<!--
//
// BLESS
//
// Description: global.js
//
// History:    08-2000   
//
// Copyright (c) 2000 - Bless. All rights reserved.
//

if (document.layers)  n4 = true, ie = false , n6 = false;
if (document.all)  n4 = false, ie = true , n6 = false;

layArray = new Array();

function switchLayer( layerToSwitch ) {
	for (i=0 ; i<layArray.length; i++) {
		currentLayer = layArray[i];
		if ( currentLayer == layerToSwitch) rollOverLay( currentLayer );
		else setVisible( currentLayer , false );
	}

}

function rollOverLay( nameLayer ) {
	if ( isLayVisible( nameLayer ) ) setVisible( nameLayer , false );
	else setVisible( nameLayer , true );
}

function isLayVisible( nameLayer ) {
	if ( n4 ) {
		if ( document.layers[ nameLayer ].visibility == 'show' )	return true;
		else return false;
	}
	if ( ie ) {
		if ( document.all[ nameLayer ].style.visibility == 'visible' ) return true;
		return false; 
	}
	if ( n6 ) {
		if ( document.getElementById( nameLayer ).style.visibility == 'visible' ) return true;
		else return false;
	}
}

function setVisible( name, bVisible)
{
	if ( bVisible )
	{
		//
		// Show the layer
		//
		if ( n4 ) document.layers[ name ].visibility = 'show';
		if ( ie ) document.all[ name ].style.visibility = 'visible';
		if ( n6 ) document.getElementById( name ).style.visibility = 'visible';
	} else
	{
		//
		// Hide the layer
		//
		if ( n4 ) document.layers[ name ].visibility = 'hide';
		if ( ie ) document.all[ name ].style.visibility = 'hidden';
		if ( n6 ) document.getElementById( name ).style.visibility = 'hidden';
	}
}


function redirectAfterOnChange(element){
   selectedValue = element.options[element.selectedIndex].value+"";
	if (selectedValue!=""){
		if (selectedValue.indexOf("javascript:")>-1) {
			selectedValue = selectedValue.substring("javascript:".length, selectedValue.length);
			eval(selectedValue);
		}
		else  document.location = selectedValue;
	} 
}


function resultats_bordereau(form) {
	//var oWindow = window.open('frameset.htm', 'frameset', 'toolbar,menubar,resizable,directories,status,location,width=800,height=600')
	var sLien, sAWB = form.AWB.value
	
	// vérifie si il y a au moins un saut de ligne
	if (sAWB.indexOf('\n') != -1)
		sAWB = replaceText(sAWB, '\n', ' ')
	
	sLien = "<html><head><title>Lien</title></head><body leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\">"
		  + "<form name=\"lien\">"
		  + "<center><table width=\"100%\" bgcolor=\"#CC0000\"><tr><td align=\"center\"><a href=\"form_envoi.asp?num_bordereau=" + sAWB + "\" target=\"centre\"><font face=\"Arial, Helvetica, sans-serif\"  color=\"#FFFFFF\" size=\"3\"><b>Envoyer les r&eacute;sultats au destinataire du colis</b></font</a></td></tr></table></center>"
		  + "<b><font face=\"Arial, Helvetica, sans-serif\" size=\"1\" color=\"#CC0000\"><< <a href=\"form.htm\" target=\"centre\"><font color=\"#CC0000\">"
		  + "Nouvelle recherche</font></b></a></font></form></body></html>"
	
	//while  (!oWindow.lien) {}
		
	parent.lien.document.write(sLien)
	
	form.submit()
}

function _resultats_bordereau(form) {
	var sLien;
	var sAWB = form.AWB.value
	
	// vérifie si il y a au moins un saut de ligne
	if (sAWB.indexOf('\n') != -1)
		sAWB = replaceText(sAWB, '\n', ' ')
			
	parent.lien.location("entete.htm")
	
	//form.submit()
}


function getUriArrayParam( tmpString ) {
	param = tmpString.substring(1,tmpString.length);
	return param.split("&");
}

function getUriParam() {
	param =new Array();
	tmpString = "?";

	param = getUriArrayParam( parent.document.location.search );
	for( i=0 ; i < param.length ; i++) {
		tmpString += param[i]+"&";  
	}
	return tmpString;
}

function getLastPartOfUrl( url ) {
	tmpArray = new Array();
	tmpArray = url.split("/");
	
	return tmpArray[tmpArray.length-1];
}


function getParamValue( url , paramNameToSearch){
	param =new Array();
	
	param = getUriArrayParam( parent.document.location.search );
	for( i=0 ; i < param.length ; i++) {
		if (param[i].indexOf(paramNameToSearch) > -1) {
			return param[i].substring( param[i].indexOf("=")+1 , param[i].length );  		
		}
	}

}
//This function is customized for form_envoi.asp only
function changeLinkLocation( whichHrefLink ) {
	tmpHref = "?num_bordereau=";
	
	tmpHref += getParamValue(parent.document.location.search , "AWB");
 
	for (i=0 ; i < document.links.length; i++) {  		
		if ( getLastPartOfUrl( document.links[i].href ) == whichHrefLink ) {
			document.links[i].href += tmpHref;
		}
	}
}

function transferParamThrowFrames( path) {
	parent.mainFrame.location = path + getUriParam();
}													  	

//
//function openWindow olderVersion
//
function pop(url,h,w)
{
window.open(url+".html","pop","dependent=1,directories=0,height="+h+",width="+w+",innerheight="+h+",innerwidth="+w+",hotkeys=no,top=0,left=0,location=0,menubar=0,resizable=0,scrollbars=no,status=0,toolbar=0");
}

//
//function openWindow
//
function openWindow(url , name , width , height , showChrome , canResize , canScroll , top , left) {
	
addScrolls = "no";
if (canScroll == true ) addScrolls = "auto";

	var options = 'status='+showChrome+', resizable='+canResize+', menubar='+showChrome+', toolbar='+showChrome+',location='+showChrome+',width='+width+',height='+height+',scrollbars='+canScroll;
	if ( top != "" ) {
		options+= ',top='+top;
	}
	if ( left != "" ){
		options+= ',left='+left;
	}
	newWindow = window.open( url, name, options);
    newWindow.focus()
}


function jumpMenu(targ,selObj, specialPath){
   comboIndex = selObj.selectedIndex;
   comboText = selObj.options[comboIndex].text;
   comboValue = selObj.options[comboIndex].value;

	path = selObj.options[selObj.selectedIndex].value;
	
	if (jumpMenu.arguments.length == "3" )
		path = specialPath+path;
		
	//alert(path);
   
   if ( selObj.selectedIndex > 0 && comboText.indexOf("--") < 0 ) {				
	  eval(targ+".location='"+path+"'");
   }
}

//
// function goToNewsLetterInscription
//

function goToNewsLetterInscription() {
	mail = self.document.newsLetter.mail.value;
	url = "/pages_html/mailing_list/inscription.htm?mail="+mail;
	openWindow(url , "newsLetter" , 440 , 550 , true , true , true);
}

//
// function goToNewsLetterInscriptionForEspaceNewsLetter
//

function goToNewsLetterInscriptionForEspaceNewsLetter() {
	openWindow(url , "newsLetter" , 440 , 550 , true , true , true);
}

//
// function getUrlParam
//
function getUrlParam() {
   	tmpPath = top.document ;

	listOfParam = new Array();
	
	if ( tmpPath.location.search.length > 0 ) {
		mail = "";
		
		param = tmpPath.location.search.substring(1,tmpPath.location.search.length);
		
		if (param.indexOf("&") > -1)
			listOfParam = param.split("&");
		else
			listOfParam[0] = param;

	} 
		return listOfParam;
}

//
// function setMailToMailField
//
	 function setParamToField( paramName , fieldToFill ) {
	 
	 
		 listOfParam = new Array();

		listOfParam = getUrlParam();
		paramValue="";

		for ( i=0 ; i < listOfParam.length ; i++ ) {
			if ( listOfParam[i].indexOf( paramName ) != -1 ) {
				paramValue = listOfParam[i].substring( listOfParam[i].indexOf("=")+1 , listOfParam[i].length);
			}
		}

		fieldToFill.value = paramValue;

}

function openEuro() {
	if (!isCookieContainValue( 'popupEuro','DoNotOpen' ) ) {	
		url = "/pages_html/client/popup_euro.htm";
		openWindow(url , "Euro" , 625 , 423 , 0 , 0 , 0);
	}
}


//
// Test cookie
//

function isCookieContainValue( name , value)
	{		
		if ( GetCookie ( name ) == value ) 
		{ 
			return true;
		}
		else
		return false;
	}
	
function openShowStartPage() {
	if ( ( getCookie( 'showStartHome' ) != "false" ) && ie) {  
	//est ce que le cookie existe? s'il n'existe pas j'execute les lignes suivantes 	
		url = "D:/CC_Mesdocs/dominique flon/PRODUCTION/SITE/www/page popup et closebutton/pages_html/popup_homePage/homeStart.htm";
		openWindow(url , "homeStart" , 319 , 200 , 0 , 0 , 0);
	}
}



function openShowQuestionPage()
{
url = "/pages_html/popup_homePage/homeQuestion.htm";
window.open(url,'PopUp','toolbar=0,location=0,directories=0,status=0,scrollbars=1,resizable=1,copyhistory=0,menuBar=0,width=607,height=500');
}

function openShowPopUpPub() {
		openWindow("/pages_html/popup_homePage/popupPub.asp" , "popupPub" , 500 , 405 , 0 , 0 , 0, 120, 200);
}

function openShowPopUpPub3() {
		openWindow("/pages_html/popup_homePage/popupPub3.asp" , "popupPub" , 500 , 405 , 0 , 0 , 0, 120, 200);
}

function openShowPopUpPrivileges() {
		openWindow("/pages_html/DhlPrivileges/popupdelais.htm" , "PopUpDelais" , 452 , 277 , 0 , 0 , 0, 120, 200);
}


function openShowPopUpPubWebShip() {
	if ( ( getCookie( 'showWebShipPopup' ) != "false" ) ) {	
		url = "/pages_html/Webship/popuppub.asp";
		openWindow(url , "popupWebShipInscriptionPub" , 450 , 227 , 0 , 0 , 0);
	}
}

function openShowPopUpInscriptionWebShip	() {
	if ( ( getCookie( 'showWebShipPopup' ) != "false" ) ) {	
		url = "/pages_html/Webship/popupInscription.asp";
		openWindow(url , "popupWebShipInscription" , 450 , 460 , 0 , 0 , 0);
	}
}




function openShowPopUpVoeux	() {
url = top.document.location;

if (getParamValue( url , "flash") == "0")
	{
	urltmp = "/pages_html/popup_homePage/voeuxGif.htm";
	}
else 
	{
	 urltmp = "/pages_html/popup_homePage/voeux.htm";
	}
urlForVoeux = urltmp;


if ( ( getCookie( 'showVoeuxPopup' ) != "false" ) ) {	
		openWindow(urlForVoeux , "popup_Voeux" , 350 , 470 , 0 , 0 , 0);
	}
}


function openShowPopUpVoeux2	() {
url = top.document.location;

if (getParamValue( url , "flash") == "0")
	{
	urltmp = "/pages_html/popup_homePage/voeuxGif.htm";
	}
else 
	{
	 urltmp = "/pages_html/popup_homePage/voeux.htm";
	}
urlForVoeux = urltmp;


openWindow(urlForVoeux , "popup_Voeux" , 350 , 470 , 0 , 0 , 0);

}


//-->