﻿document.getElementsByTagName('html')[0].className='jsOn';

im1load= new Image(68,68);
im1load.src = "/images/loader2.gif";
im2load= new Image(68,68);
im2load.src = "/images/loader.gif";
im3load= new Image();
im3load.src = "/images/onepxtransp.gif";
im4load= new Image();
im4load.src = "/images/edititem.gif";
im5load= new Image();
im5load.src = "/images/xsymbred.gif"
im6load= new Image();
im6load.src = "/images/xsymb.gif"
var popupdiv = 'effectdiv';
var popupdivIE = 'effectdivie';
var popupdiv2 = 'thirdeffectdiv';
var popupdivIE2 = 'thirdeffectdivie';
var popupdivIm = 'effectdivim';
var popupdivImIE = 'effectdivimie';
var flvplayer= '/flash/videoemst.swf';
var flashskin= '/flash/SkinUnderAllNoFullNoCaption.swf';
var popfooter = '<p class="simplest_sml"></p>';

var proceed=true;
var secondlayer=false;

function lockLayer(){
	if(secondlayer){  return false; }
	secondlayer=true;
	return true;
}

function unlockLayer(){
	if(secondlayer){ secondlayer=false; return true; }
	return false;
}



if (document.layers) { // Netscape
    document.captureEvents(Event.MOUSEMOVE);
    document.onmousemove = captureMousePosition;
} else if (document.all) { // Internet Explorer
    document.onmousemove = captureMousePosition;
} else if (document.getElementById) { // Netcsape 6
    document.onmousemove = captureMousePosition;
}

var moveit=false;
//var moveit=true;

function captureMousePosition(e) {
	if(moveit){
    	xMousePos = 0;
    	yMousePos = 0;

        if (document.all) {
            xMousePos = window.event.clientX+document.body.scrollLeft;
            yMousePos = window.event.clientY+document.body.scrollTop;
            //xMousePos = window.event.clientX+document.documentElement.scrollLeft;
            //yMousePos = window.event.clientY+document.documentElement.scrollTop;
        } else {
        	xMousePos = e.clientX+document.body.scrollLeft;
            yMousePos = e.clientY+document.body.scrollTop;
            //xMousePos = e.clientX+document.documentElement.scrollLeft;
            //yMousePos = e.clientY+document.documentElement.scrollTop;
        }
        
        hp = document.getElementById('hoverpopup');
        hp.style.top = yMousePos-10-hp.offsetHeight + 'px';
        if (xMousePos+10+hp.offsetWidth-document.body.scrollLeft<document.body.offsetWidth){
            hp.style.left = xMousePos+10 + 'px';
        }else { hp.style.left = document.body.offsetWidth + document.body.scrollLeft - hp.offsetWidth + 'px'; }
    }
}

function ShowPopup(hoveritem,titletext)
{
	moveit=true;
    pop = document.getElementById('hoverpopup');
    pop.innerHTML=titletext;
    pop.style.visibility = 'Visible';
   	if(document.all){
   		hoveritem.style.filter = 'alpha(opacity=65)';
    }else{
    	hoveritem.style.setProperty("-moz-opacity","0.65","");
    	hoveritem.style.setProperty("opacity","0.65","");

    }
}

function HidePopup(hoveritem)
{
	moveit=false;
    hp = document.getElementById('hoverpopup');
    hp.style.visibility = 'Hidden';
    hp.innerHTML='';
   	if(document.all){
   		hoveritem.style.filter = 'alpha(opacity=100)';
    }else{
    	hoveritem.style.setProperty("-moz-opacity","1","");
    	hoveritem.style.setProperty("opacity","1","");
    }
}

function inverseHoverOut(hoveritem)
{
   	if(document.all){
   		hoveritem.style.filter = 'alpha(opacity=75)';
    }else{
    	hoveritem.style.setProperty("-moz-opacity","0.75","");
    	hoveritem.style.setProperty("opacity","0.75","");
    }
}

function inverseHover(hoveritem)
{
    if(document.all){
   		hoveritem.style.filter = 'alpha(opacity=100)';
    }else{
    	hoveritem.style.setProperty("-moz-opacity","1","");
    	hoveritem.style.setProperty("opacity","1","");
    }
}

function moveTheDiv(){
	eff = document.getElementById(popupdivIE);
    eff.style.top = document.body.scrollTop + 'px';
    eff.style.left = document.body.scrollLeft + 'px';
    effim = document.getElementById(popupdivImIE);
    effim.style.top = document.body.scrollTop + 'px';
    effim.style.left = document.body.scrollLeft + 'px';
    //effim = document.getElementById(popupdivImIE2);
    //effim.style.top = document.body.scrollTop + 'px';
    //effim.style.left = document.body.scrollLeft + 'px';

}

function LightIt(hoveritem)
{
   	if(document.all){
   		hoveritem.style.filter = 'alpha(opacity=65)';
    }else{
    	hoveritem.style.setProperty("-moz-opacity","0.65","");
    	hoveritem.style.setProperty("opacity","0.65","");
    }
}

function ShadowIt(hoveritem)
{
    hp = document.getElementById('hoverpopup');
    hp.style.visibility = 'Hidden';
    if(document.all){
   		hoveritem.style.filter = 'alpha(opacity=100)';
    }else{
    	hoveritem.style.setProperty("-moz-opacity","1","");
    	hoveritem.style.setProperty("opacity","1","");
    }
}


function showQTVideo(im){
	showPopIm('<table cellspacing=0 cellpadding=0><tr><td style=\"border:1px black solid;\">' +
		'<OBJECT HEIGHT="450" WIDTH="600" CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab">' +
		'<PARAM NAME="src" VALUE="'+im+'" >' +
		'<EMBED SRC="'+im+'" bgcolor="#999999" HEIGHT="450" WIDTH="600" TYPE="video/quicktime" PLUGINSPAGE="http://www.apple.com/quicktime/download/"/>'+
		'</OBJECT></td></tr></table>',false);
}


function showFlashVideo(im){
	showPopImG('<script type="text/javascript">' +
			'function getsource(){ '+
				'return "'+im+'"; '+
			'}' +
			'function getskin(){'+ 
				'return "' + flashskin + '"; '+
			'}' +
			//'var getskin=getskin(); var getsource=getsource();'+
		'</script>' +
		'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="320" height="280" id="viedoemst" align="middle">' +
		'<param name="allowScriptAccess" value="sameDomain" />' +
		'<param name="allowFullScreen" value="false" />'+
		'<param name="movie" value="'+flvplayer+'" />' +
		'<param name="quality" value="high" />' +
		'<param name="bgcolor" value="#999999" />' +	
		'<embed src="'+flvplayer+'" quality="high" bgcolor="#999999" width="320" height="280" name="videoemst" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />' +
		'</object>',false);
}


function showTheImage(im){
	showTheImageWithoutX('/images/loader2.gif'); 
	var img = new Image();
	img.onload=function(){ _showTheImage(im); }
	img.src=im;
}

function _showTheImage(im){
	showPopIm('<img style="border:0px white solid;" class="largeimage" src="'+im+'">',false);
}

function showTheImageWithoutX(im){
	showPopIm('<img style="border:0px white solid;" class="largeimage" src="'+im+'">',true); 
}

function showThePopWithoutX(im){
	showPop('<img style="border:0px white solid;" class="largeimage" src="'+im+'">',true,''); 
}

function showTheIm(im){
	showTheImage(im);
}

function hideTheImage(){ 
	document.getElementById(popupdivImIE).style.visibility='Hidden'; 
	document.getElementById(popupdivIm).style.visibility='Hidden'; 
	document.getElementById(popupdivImIE).innerHTML='';
	document.getElementById(popupdivIm).innerHTML='';
	//_hideFrame();
	escroll();
}

function hideThePop(){ 
	document.getElementById(popupdivIE).style.visibility='Hidden'; 
	document.getElementById(popupdiv).style.visibility='Hidden'; 
	//document.getElementById(popupdivIE).innerHTML='';
	//document.getElementById(popupdiv).innerHTML='';
	//_hideFrame();
	escroll();
}

function hideThePop2(){ 
	document.getElementById(popupdivIE2).style.visibility='Hidden'; 
	document.getElementById(popupdiv2).style.visibility='Hidden'; 
	//document.getElementById(popupdivIE).innerHTML='';
	//document.getElementById(popupdiv).innerHTML='';
	//_hideFrame();
	unlockLayer();
}

function dscroll(){
	if(document.all){
		document.getElementsByTagName("body")[0].style.overflow= "hidden";
	}else{
		document.getElementsByTagName("body")[0].style.setProperty("overflow","hidden","");
	}
}

function escroll(){
	if(document.all){
		document.getElementsByTagName("body")[0].style.overflow="auto";
	}else{
		document.getElementsByTagName("body")[0].style.setProperty("overflow","auto","");
	}
}

function hideTheIm(){
	hideTheImage();
}


var ascript=new Array();
function removeScripts(){
	if(ascript){ 
		for(var i=0; i<ascript.length; i++){
			document.getElementsByTagName("head")[0].removeChild(ascript[i]);
		}
	}
	ascript.length=0;
}

function insertJscript(txt){
	if(!secondlayer){
		removeScripts();
		var text = ""+txt;
		var cont=true;
		while(cont){
			cont=false;
			var start = new String(text).search(/<script>/) + 8;
			if(start==7){ start = new String(text).search(/<script type=[\"\']{1}text\/javascript[\"\']{1}>/) + 31; }
			if(start>7){
				var end= new String(text).search(/<\/script>/);
				var script= new String(text).substring(start,end);
				if( (end>start)&&(script.search(/</)==-1)&&(script.search(/>/)==-1) ){
					var oScript=document.createElement("script");
					oScript.text=script;
					document.getElementsByTagName("head")[0].appendChild(oScript);
					//eval(script);
					cont=true;
					ascript.push(oScript);
					text=text.substring(end+8,text.length-1);
				}
				else
				{
					//alert(text.length);
					if(text.length > 15){
						text=text.substring(start,text.length-1);
						cont=true;
					}
				}
			}
		}
	}
}

function _showPop(text,noX,img,func,title){
	__showPop(text,noX,img,func,'popupwindowtable','popupwindowinnertable',title);
}

function __showPop(text,noX,img,func,class1,class2,title){
	if(!title){ title=' '; }
	dscroll();
	insertJscript(text);
	var thediv='<div style="background:black; filter:alpha(opacity=60); -moz-opacity:0.6;opacity:0.6; width:100%; height:100%;"></div>';
    var style='style="background:black; filter:alpha(opacity=60); -moz-opacity:0.6;opacity:0.6"';
    var pos;
    if (document.all){ pos = 'absolute'; }
  	else { pos = 'fixed'; }
    var htm='<div style="height:100%; overflow:auto; width:100%; position:'+pos+'; top:0px; z-index:5; background:black; filter:alpha(opacity=60); -moz-opacity:0.6;opacity:0.6"></div>' +
    	'<div style="height:100%; width:100%; position:'+pos+'; top:0px; z-index:6;">' +
    		'<table width="100%" height="100%" cellspacing=0 cellpadding=0>'+
    			'<tr valign="middle"><td align="center">';
    if (!noX){
    		htm+='<table class="'+class1+'" cellspacing=0 cellpadding=0 style="width:100px;">';
    		var im1='/images/xsymb.gif';
    		var im2='/images/xsymbred.gif';
    		htm+='<tr style="height:20px;"><td style="padding-right:10px; padding-top:10px; padding-left:10px;">' +
    				'<table cellspacing="0" cellpadding="0" width=100%><tr><td class="popupwindowtitle '+class2+'" width="100%">'+title+'</td><td style="text-align:right; padding-left:10px;">'+
    				'<table cellspacing="0" cellpadding="0" class="'+class1+'" height="100%"><tr><td style="padding:1px;">' +
    				'<img onMouseOver="this.src=\''+im2+'\'" onMouseOut="this.src=\''+im1+'\'" onClick="'+func+'" src="'+im1+'" height="10px">' +
    				'</td></tr></table>' +
    				'</td></tr></table></td></tr>'; 
    		htm+='<tr><td style="padding-top:10px; padding-left:10px; padding-bottom:10px; padding-right:10px"><table class="'+class2+'" cellspacing="0" cellpadding="0" width="100%"><tr><td>'+text+'</td></tr></table></td></tr>';
    		//htm+='<tr><td style="padding-right:10px; padding-left:10px; padding-bottom:10px;"><table cellspacing=0 cellpadding=0 width=100% class="popupwindowtitle '+class2+'"><tr><td>'+popfooter+'</td></tr></table></td></tr></table>';
    		htm+='<tr><td style="padding-right:10px; text-align:right; padding-left:10px; padding-bottom:10px;">'+popfooter+'</td></tr></table>';
    }
    else{	htm+='<table width="100%" class="popupwindowtablesimple" cellspacing="0" cellpadding="0"><tr><td>'+text+'</td></tr></table>'; }
	htm+=    		'</td></tr>' +	
    		'</table>' +
    	'</div>';
    img.innerHTML=htm; 
    img.style.visibility='Visible';
    try{
	    window.document.roomflash.focus();
	}
	catch(Exception){}
    //_showFrame(im);
}

function showPopImG(text,noX){
	var img;
    if (document.all){ img = document.getElementById(popupdivImIE); }
  	else { img = document.getElementById(popupdivIm); }
	__showPop(text,noX,img,'hideTheImage()','popupwindowtable2','popupwindowinnertable2','');
}


function showPopIm(text,noX){
	var img;
    if (document.all){ img = document.getElementById(popupdivImIE); }
  	else { img = document.getElementById(popupdivIm); }
	_showPop(text,noX,img,'hideTheImage()','');
}

function showPop(text,noX,title){
	var img;
	if(secondlayer){
		if (document.all){ img = document.getElementById(popupdivIE2); }
	  	else { img = document.getElementById(popupdiv2); }
	  	_showPop(text,noX,img,'hideThePop2()',title);
	}else{
	    if (document.all){ img = document.getElementById(popupdivIE); }
	  	else { img = document.getElementById(popupdiv); }
		_showPop(text,noX,img,'hideThePop()',title);
	}
}

function sleeper(naptime){
  naptime = naptime;
  var sleeping = true;
  var now = new Date();
  var alarm;
  var startingMSeconds = now.getTime();
  //alert("starting nap at timestamp: " + startingMSeconds + "\nWill sleep for: " + naptime + " ms");
  while(sleeping){
     alarm = new Date();
     alarmMSeconds = alarm.getTime();
     if(alarmMSeconds - startingMSeconds > naptime){ sleeping = false; }
  }      
  //alert("Wakeup!");
}



function _writeOnDiv(text,divid){
 	//opacity(divid, 100, 0, 300);
 	//sleeper(400);
 	_doTheRest(divid,text);
	//opacity(divid, 1, 100, 300);
}


function _doTheRest(div,tex){
	insertJscript(tex);
	img = document.getElementById(div);
	img.innerHTML=tex;
    if ( (new String(tex)).search(/myscrollbar/)!=-1 ){ 
	    if ( (new String(tex)).search(/myscrollbar2/)!=-1 ){ 
	    	zxcVerticalScroll('myscrollbar2','textcontent2','mousedown',10);
	    }
	    zxcVerticalScroll('myscrollbar','textcontent','mousedown',10);
	}
}


function writeOnDiv(text){
 	_writeOnDiv(text,'secondeffdiv');
}

function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;

    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
} 

//change the opacity for different browsers
function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}

function initXMLHTTP(){
	var xmlhttp=false;
	try {
		xmlhttp = new ActiveXObject('Msxml2.XMLHTTP');
	} catch (e) {
		try {
    	    xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
	    } catch (E) {
            xmlhttp = false;
        }
    }
    if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
		try {
		    xmlhttp = new XMLHttpRequest();
	    } catch (e) {
	        xmlhttp=false;
	    }
    }
    if (!xmlhttp && window.createRequest) {
		try {
		    xmlhttp = window.createRequest();
	    } catch (e) {
	        xmlhttp=false;
	    }
    }
    return xmlhttp;
}

var gxmlhttp=false;
var prevdiv=null;     

function showXMLHTTPOnDiv(remotepage,ispopup){
	_showXMLHTTPOnDiv(remotepage,ispopup,'secondeffdiv','');
}

function showXMLHTTPOnDivWithTitle(remotepage,ispopup,title){
	_showXMLHTTPOnDiv(remotepage,ispopup,'secondeffdiv',title);
}

      
function _showXMLHTTPOnDiv(remotepage,ispopup,divid,title){
	__showXMLHTTPOnDiv(remotepage,ispopup,divid,false,title)
}


function __showXMLHTTPOnDiv(remotepage,ispopup,divid,reload,title){
	var xmlhttp=false;
	if((prevdiv==divid)&&gxmlhttp){ xmlhttp=gxmlhttp; }
	else{ 
		xmlhttp=initXMLHTTP(); 
	}
	___showXMLHTTPOnDiv(remotepage,ispopup,divid,reload,xmlhttp,title);
	gxmlhttp=xmlhttp;
	prevdiv=divid;
}
                
function ___showXMLHTTPOnDiv(remotepage,ispopup,divid,reload,xmlhttp,title){
	if (ispopup){ showThePopWithoutX('/images/loader2.gif'); }
	else { _writeOnDiv('<table class="whileloading" width="100%" height="100%" cellspacing=0 cellpadding=0 style="border:1px #dddddd solid;">' + 
		'<tr valign="middle"><td align="center">' +
		'<img border=0 src="/images/loader.gif">' +
		'</td></tr></table>',divid); 
	}
	if(reload){
		var date = new String(''+(new Date().getTime()));
		date = date.substring(date.length-7,date.length-1);
		var params = 'silly=' + date;
		
	    var s= (new String(remotepage)).replace(/silly=[0-9]{6}/g,params);
	    if (s==remotepage){ 
	    	if ( (new String(remotepage)).search(/\?/)==-1 ){ remotepage+='?'+params; }
	    	else { remotepage+='&'+params; } 
	    }
	    else {remotepage=s; }
    }
    
	var divpar = 'divid=' + divid;
	var st= (new String(remotepage)).replace(/divid=[a-zA-Z0-9]+/g,divpar);
	if (new String(remotepage).search(/divid=[a-zA-Z0-9]+/)==-1){ 
	  	if ( (new String(remotepage)).search(/\?/)==-1 ){ remotepage+='?'+divpar; }
	   	else { remotepage+='&'+divpar; } 
	}
	else {remotepage=st; }
    xmlhttp.open('GET', remotepage, true);
    xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4) {
    	    if (ispopup){ showPop(xmlhttp.responseText,false,title); }
    	    else { _writeOnDiv(xmlhttp.responseText,divid); }
    	}
	}
    xmlhttp.send(null);
}


function showDivNHide(object,remotepage,ispopup){
	HidePopup(object);
	showXMLHTTPOnDiv(remotepage,ispopup);
}
      


var g_PopupIFrame;

function IsIE()
{
	return ( navigator.appName=="Microsoft Internet Explorer" );
}

function _hideFrame()
{
    /*if (IsIE())
	{
	    document.body.removeChild(g_PopupIFrame);
        g_PopupIFrame=null;
    }*/
}

function _showFrame(divID)
{
	var divPopup=divID;
	//var divPopup=document.getElementById(divID);
	if (!IsIE()){ return; }
	//Increase default zIndex of div by 1, so that DIV appears before IFrame
    //divPopup.style.zIndex=divPopup.style.zIndex+1;

    var iFrame = document.createElement("IFRAME");
    iFrame.setAttribute("src", "/otherpages/blank.html");

	//Match IFrame position with divPopup
    iFrame.style.position="absolute";
    iFrame.style.left =divPopup.offsetLeft + 'px';
    iFrame.style.top =divPopup.offsetTop + 'px';
    iFrame.style.width =divPopup.offsetWidth + 'px';
    iFrame.style.height =divPopup.offsetHeight + 'px';

    document.body.appendChild(iFrame);

    //Store iFrame in global variable, so it can get removed when divPopup is hidden g_PopupIFrame=iFrame;
    //divPopup.style.visibility ="visible";
}   
                

function gup(){
 	var str=window.location.toString();
  	if( str.search(/gr/i) > -1 ) 
  		return "gosearch_gr.png";  	
  	else if ( str.search(/en/i) > -1 ) 
 		return "gosearch_en.png";  	
  	else if ( str.search(/fr/i) > -1 )
  		return "gosearch_fr.png"; 
  	else
  		return "gosearch.png";
}

function get_request_param( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}


                
                