// JavaScript Document

function ShowHideLayer(LayerName) {

	var targetElement;
	//Netscape 4
	if(document.layers) {
    	targetElement = document.layers(LayerName);
	}
	//IE6
	if(document.all) {
		targetElement = document.all(LayerName) ;
	}
	//Netscape 6
	if(!document.all && document.getElementById) {
		targetElement = document.getElementById(LayerName) ;
	}
	
    if (targetElement.style.display == "none") {
		targetElement.style.display = "" ;
	} else {
		targetElement.style.display = "none" ;
	}
}
//---------------------------------------------------------------------------
function ShowLayer(LayerName) {

	var targetElement;
	//Netscape 4
	if(document.layers) {
    	targetElement = document.layers(LayerName);
	}
	//IE6
	if(document.all) {
		targetElement = document.all(LayerName) ;
	}
	//Netscape 6
	if(!document.all && document.getElementById) {
		targetElement = document.getElementById(LayerName) ;
	}
	
	targetElement.style.display = "" ;
    
}
//---------------------------------------------------------------------------
function HideLayer(LayerName) {

	var targetElement;
	//Netscape 4
	if(document.layers) {
    	targetElement = document.layers(LayerName);
	}
	//IE6
	if(document.all) {
		targetElement = document.all(LayerName) ;
	}
	//Netscape 6
	if(!document.all && document.getElementById) {
		targetElement = document.getElementById(LayerName) ;
	}
	
	targetElement.style.display = "none" ;
    
}
//---------------------------------------------------------------------------
function jdgrdct(page,id_name,id_value) {
	document.location.href = '?p='+page+'&'+id_name+'='+id_value;	
}


// Correct PNG files

function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.
{
   var arVersion = navigator.appVersion.split("MSIE")
   var version = parseFloat(arVersion[1])
   if ((version >= 5.5) && (document.body.filters)) 
   {
      for(var i=0; i<document.images.length; i++)
      {
         var img = document.images[i]
         var imgName = img.src.toUpperCase()
         if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
         {
            var imgID = (img.id) ? "id='" + img.id + "' " : ""
            var imgClass = (img.className) ? "class='" + img.className + "' " : ""
            var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
            var imgStyle = "display:inline-block;" + img.style.cssText 
            if (img.align == "left") imgStyle = "float:left;" + imgStyle
            if (img.align == "right") imgStyle = "float:right;" + imgStyle
            if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
            var strNewHTML = "<span " + imgID + imgClass + imgTitle
            + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
            + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
            + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
            img.outerHTML = strNewHTML
            i = i-1
         }
      }
   }    
}


// ------------------------------------------------------------------------------------------------//
// POPUP
function fenetreCent(url,nom,largeur,hauteur,options) {
	var haut=(screen.height-hauteur)/2;
	var Gauche=(screen.width-largeur)/2;
	fencent=window.open(url,nom,"top="+haut+",left="+Gauche+",width="+largeur+",height="+hauteur+","+options);
	window.fencent.resizeTo(largeur+10,hauteur+30);
	fencent.window.focus();
}

// ------------------------------------------------------------------------------------------------//
function addclick(ref_id,url) {
	document.location.href = '?p=results'+url+'&addclick='+ref_id;	
}
// ------------------------------------------------------------------------------------------------//
function addclickHome(site_id) {
	document.location.href = '?p=home&addclick='+site_id;
}

// ------------------------------------------------------------------------------------------------//
function addclickTheme(thematique_id,site_id) {
	document.location.href = '?p=home_theme&thematique_id='+thematique_id+'&addclick='+site_id;
}

// ------------------------------------------------------------------------------------------------//
function dispSubsc(value) {
	
	switch(value) {
		
		case 'member' :
			
			break;
		
		case 'webmaster' :
			ShowHideLayer('webmaster');
			break;
		
	}
}
// ------------------------------------------------------------------------------------------------//
