﻿/*
Copyright (c) 2008 ATXOOM.  Tous Droits Réservés.

1 - PROPRIETE INTELLECTUELLE
Ce Logiciel est la propriété de ATXOOM ou de ses fournisseurs.
Ce Logiciel est protégé par la loi relative au droit d'auteur et
par les conventions internationales. En conséquence, vous devez
considérer ce Logiciel comme n'importe quel autre matériel protégé
par un droit d'auteur (par exemple, un livre ou un enregistrement
sonore). Cependant, l'autorisation vous est accordée d'effectuer
une copie du Logiciel à seule fin de constituer une sauvegarde ou
une archive. Vous n'êtes pas autorisé à reproduire la documentation
fournie avec le Logiciel, sauf pour un usage personnel autorisé.

Toute personne ne respectant pas ces dispositions se rendra
coupable du délit de contrefaçon et sera passible des sanctions
pénales prévues par la loi.

2 - ACCORD DE LICENSE
Le droit d'utilisation qui vous est concédé permet l'installation et
l'utilisation du Logiciel sur un et seul ordinateur.

3 - CESSION
Le droit d'utilisation qui vous est concédé est incessible et non
transférable.


Copyright (c) 2008 ATXOOM.  All Rights Reserved.

1 - COPYRIGHT
The Software is owned by ATXOOM or its suppliers and is protected
by copyright laws and international treaty provisions. Therefore,
you must treat the Software like any other copyrighted material
(e.g., a book or musical recording) except that you may make one
copy of the Software solely for back up or archival purposes.
You may not copy the user documentation provided with the Software, except
for your own authorized use. 

2 - GRANT OF LICENSE
This Software License Agreement ("License") permits you to install
and use one copy solely of the Software on one computer solely.

3 - NOT FOR RESALE SOFTWARE
The software is labeled “Not For Resale” or “NFR”, then, notwithstanding
other sections of this license, your use of the software is limited to
use for demonstration, test, or evaluation purposes and you may
not resell, or otherwise transfer for value, the software.
*/

var AvailableHeight = null;
var CachedWebRoot = null;
var CachedBanner = null;
var win = null;

function AutoStart(withBanner) {

	PaintControls();

	if (UseScreenSize == true) {
		if (screen.width <= 800) {
			if (document.styleSheets[0].href.indexOf('_big') >= 0) {
				if (document.location.search == '') {
					document.location = document.location + "?atx=800";
				}
				else if (document.location.search.indexOf('?atx=') < 0 && document.location.search.indexOf('&' + 'atx=') < 0) {
					document.location = document.location + "&' + 'atx=800";
				}
				else {
					document.location = document.location.toString().replace(/atx=1024/, 'atx=800');
				}
			}
		}
		else {
			if (document.styleSheets[0].href.indexOf('_big') < 0) {
				if (document.location.search == '') {
					document.location = document.location + "?atx=1024";
				}
				else if (document.location.search.indexOf('?atx=') < 0 && document.location.search.indexOf('&' + 'atx=') < 0) {
					document.location = document.location + "&' + 'atx=1024";
				}
				else {
					document.location = document.location.toString().replace(/atx=800/, 'atx=1024');
				}
			}
		}
	}

	AutoSize(withBanner);
}

function AutoSize(withBanner) {
	if (withBanner != null) {
	 CachedBanner = withBanner;
	}
	try {
		var menu = document.getElementById('ContainerTopLeft');
		var div = document.getElementById('ContentHolder');
		if (CachedBanner == true) {
			menu.style.minHeight = (div.scrollHeight + 286).toString() + 'px';
		}
		else {
			menu.style.minHeight = div.scrollHeight.toString() + 'px';
		}
	}
	catch (e) {
		//alert(e.message);
	}
}

function PaintControls() {

	var strBtnPattern = 'actions/btn';
	if (typeof(strLangId) != "undefined") {
		strBtnPattern = 'actions/' + strLangId + '/btn';
	}
	try {
		var objButton = document.getElementsByTagName('img');
		if (objButton.length <= 1) {
		}
		else {
			for (var i = 0; i < objButton.length; i++) {
				if (objButton[i].src.indexOf(strBtnPattern) >= 0) {
					objButton[i].onmouseover = function () { atx_OnButton(this) };
					objButton[i].onmouseout = function () { atx_OffButton(this) };
				}
			}
		}
	}
	catch (e) {}

	try {
		var objButton = document.getElementsByTagName('input');
		if (objButton.length <= 1) {
		}
		else {
			for (var i = 0; i < objButton.length; i++) {
				if (objButton[i].src) {
					if (objButton[i].src.indexOf(strBtnPattern) >= 0) {
						objButton[i].onmouseover = function () { atx_OnButton(this) };
						objButton[i].onmouseout = function () { atx_OffButton(this) };
					}
				}
			}
		}
	}
	catch (e) {}
}

function showVideo(videoCode, videoSizeX, videoSizeY, videoTitle, videoText, videoSummary) {
	lockFlashLeft = true;
	var so = new SWFObject('_ressources/_flash/player.swf', 'FlashVideo1', '412', '420', '8.0');
	so.addParam("wmode", "transparent");
	so.addVariable('MediaName', videoCode + '-' + videoSizeX + '-' + videoSizeY);
	so.addVariable('MediaWidth', videoSizeX);
	so.addVariable('MediaHeight', videoSizeY);
	so.addVariable('UrlToGo', '" + ResolveUrl("~/") + "');
	so.write('FlashVideo');
	try {
		//document.getElementById('VideoDivTitle').innerHTML = videoTitle;
		//document.getElementById('VideoDivText').innerHTML = videoText;
		//document.getElementById('FlashLeftTitle').innerHTML = videoSummary;
	} catch (e) {/*alert(e.message);*/}
}

/* ================================================= */

function atx_OnButton(objButton) {
	try {
		objButton.src = objButton.src.replace('-off.', '-on.');
	}
	catch (e) {}
}

function atx_OffButton(objButton) {
	try {
		objButton.src = objButton.src.replace('-on.', '-off.');
	}
	catch (e) {}
}

function atx_LinkOver(strStatusText) {
	window.status = strStatusText;
	return (navigator.appName != 'Opera');
}

function atx_LinkOut(strStatusText) {
	window.status = strStatusText;
}

/* ================================================= */
// Ajax behaviors 
/* ================================================= */

function OnResponseStart() {
	DisableControls();
}

function OnResponseEnd() {
	EnableControls();
	PaintControls();
	correctPNG(null);
	AutoSize(null);
}

function DisableControls() {
    for (var i=0; i<document.forms[0].elements.length; i++) {
        var obj = document.forms[0].elements[i];
        obj.WasDisabled = obj.disabled;
        obj.disabled = true;
    }
}
function EnableControls() {
    for (var i=0; i<document.forms[0].elements.length; i++) {
        var obj = document.forms[0].elements[i];
        if (obj.WasDisabled == false) {
			obj.disabled = false;
        }
    }
}

/* ================================================= */
//
// Display the target image for this thumbnail
//
function displayThumb(src, width, height, title) {
   var winWidth = parseInt(width) + 50;
   var winHeight = parseInt(height) + 70;
   if (win != null) {
    win.close();
   }
   eval("win = window.open('','Thumb', 'toolbar=0,scrollbars=1,location=0,status=0,resizable=1,menubar=0,width="+winWidth+",height="+winHeight+"');");
   // clear the content of the document
   win.document.open();
   win.document.writeln('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
   win.document.writeln('<html>');
   if(null != title && title != "") {
       win.document.writeln('<head><title>' + title + '</title></head>');
   }
   else {
       win.document.writeln('<head><title>Thumbnail Image</title></head>');
   }
   win.document.writeln('<body>');
   win.document.writeln('<center><table border="0">');
   if (width == 0) {
      win.document.writeln('<tr><td align="center"><img src="'+src+'"></td></tr>');
   }
   else if (height == 0) {
      win.document.writeln('<tr><td align="center"><img width="'+width+'" src="'+src+'" /></td></tr>');   
   } 
   else {
      win.document.writeln('<tr><td align="center"><img alt="'+title+'" width="'+width+'" height="'+height+'" src="'+src+'" /></td></tr>');   
   } 
   if(null != title && title != "") {
       win.document.writeln('<tr><td align="center">'+title+'</td></tr>');
   }
   win.document.writeln('</table></center>');
   win.document.writeln('</body></html>');
   win.document.close();
}

function atx_LinkToMe(link,seed) {
var ky = "yJzdeB4CcDnmEFbZtvuHlI1hA8SiLo9MwfN3O6Y5QaRqKTjUpxVk2WgXrP7Gs0";
if(document.all) { 
	link = document.all[link];
}
else {
	link = document.getElementById(link);
}

var storeText = link.innerHTML;
var baseNum = parseInt(seed);
var atSym = link.href.indexOf("@");

if(atSym == -1) atSym = 0;
var dotidx = link.href.indexOf(".",atSym);
if (dotidx==-1) dotidx = link.href.length;
var scramble = link.href.substring(7, dotidx);
var unscramble = "";
var su = true;
for (i = 0; i < scramble.length; i++) {
	var ch = scramble.substring(i,i+1);
	var idx=ky.indexOf(ch);
	if(idx< 0) {
		unscramble = unscramble + ch;
		continue;
	}
	idx -= (su ? -baseNum : baseNum);
	baseNum -= (su ? -i : i);
	while (idx < 0) idx+=ky.length;idx%=ky.length;

	unscramble = unscramble + ky.substring(idx, idx + 1);
	su = !su;
}

var emAdd = unscramble + link.href.substring(dotidx, link.href.length + 1);
link.href = "mailto:" + emAdd;
var findEm = storeText.indexOf(scramble);
while (findEm > -1) {
	storeText = storeText.substring(0, findEm) + emAdd + storeText.substring(findEm + emAdd.length, storeText.length);
	findEm = storeText.indexOf(scramble);
}

link.innerHTML = storeText;
}

/* ================================================= */

function correctPNG(WebRoot) {
	if (WebRoot != null) {
	 CachedWebRoot = WebRoot;
	}
	if (CachedWebRoot != null) {
		 is = document.getElementsByTagName('IMG');
		 for(x=0; x<is.length; x++){
		 if(is[x].src.toLowerCase().indexOf('.png')>=0){
		 is[x].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+is[x].src+"', sizingMethod='scale')";
		 is[x].src = CachedWebRoot+'images/_protected/spacer.gif';
		 }
		 }
		 is = document.getElementsByTagName('INPUT');
		 for(x=0; x<is.length; x++){
		 if(is[x].src.toLowerCase().indexOf('.png')>=0){
		 is[x].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+is[x].src+"', sizingMethod='scale')";
		 is[x].src = CachedWebRoot+'images/_protected/spacer.gif';
		 }
		 }
	 }
}
