// ---------------------------------------------------------------------------------------

// browser sniffer, defines variables for the rest of the functions below to use.


ns4 = (document.layers)? true:false

ie4 = (document.all)? true:false

   

// ---------------------------------------------------------------------------------------

// resizes page to its proper dimension


function resizeFix() {

	if(widthCheck != window.innerWidth || heightCheck != window.innerHeight) {

		window.location.reload();

   }

}


// ---------------------------------------------------------------------------------------

// handles netscape resizing problem by forcing to reload when window is resized


if(ns4) {

	widthCheck = window.innerWidth;

    heightCheck = window.innerHeight;

    window.onresize = resizeFix();

}



// --------------------------------------------------------------------------------------- 

//     Load initial images for feature navs


    function imageLoad(curFeature) {


//     Turn current feature image back on

       imgOn = eval(curFeature + "on.src");

       document [curFeature + "img"].src = imgOn;


//     Turn text on

        if (ns4) document.layers[curFeature].visibility = "show"

        else if (ie4) document.all[curFeature].style.visibility = "visible"

        

    }



// --------------------------------------------------------------------------------------- 

// 


function launchWindow(url,windowName) {

	window.open( url, windowName, "history=no,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=no,width=800,height=400'");

}

  


// --------------------------------------------------------------------------------------- 

// 


function popUpDisclaimer() {

	window.open("/CA/03/EN/LEGAL/1,,CA-03-EN-LEGAL,.html", "Disclaimer", 'history=no,toolbar=0,location=0,directories=0,status=0,menubar=1,scrollbars=yes,resizable=no,width=640,height=500');

}


// ---------------------------------------------------------------------------------------

//To be used for popup windows with scroll bars


function popup(topic,x,y) {

eval('window.open(topic, "glossaryWin", "history=no,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=no,width=' +  y  + ',height=' +  x + '");');

}



// ----------------------------------------

// Get a Quote


function gaqWin(){

  topic = "http://www.c1hrapps.com/locator/CA/?presentationId=dlen_CAsdd1&brand=D";

  window.open(topic,"GAQ", 'history=no,toolbar=1,location=0,directories=0,status=0,menubar=1,scrollbars=yes,resizable=yes,width=600,height=380');

}



// ---------------------------------------------------------------------------------------

// Promo Mouseover and MouseOut


function promo_on(imgName) {

    imgOn = "/CA/02/EN/FIVE_STAR/PROMOS/promobutton_on.gif";

    document [imgName].src = imgOn;

}


function promo_off(imgName) {

    imgOff = "/CA/02/EN/FIVE_STAR/PROMOS/promobutton_off.gif";

    document [imgName].src = imgOff;

}


// --------------------------------------------------------------------------------------- 

// 


function launchView(url,windowName) {

	window.open( url, windowName, "history=no,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=no,width=455,height=700'");

}


// ---------------------------------------------------------------------------------------

// For Site Viewing Recos


   function recommendations() {

  window.open("/CA/02/EN/RECOMMENDATIONS/1,,CA-02-EN-RECOMMENDATIONS,.html", "discWin", "history=no,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=no,width=463,height=315");

}

// ---------------------------------------------------------------------------------------

//   For Assistance Emailer

// 

  

function popUpRetailer() {

  window.open("http://www.c1hrapps.com/locator/CA/?presentationId=dlen_CAfia1&brand=A", "Retailer", 'history=no,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=no,width=640,height=460');

}


// ---------------------------------------------------------------------------------------

//To be used for popup windows all parameters passed


//----- To be used for popup windows all parameters passed

function popup_all(topic,namer,tool,loc,dir,stat,menu,scroll,resize,x,y) {


var tmp = location.hostname.split(".");

	var env = tmp[0].toLowerCase();	 


		



if(namer == "contact_us"){


  	  if(env == "test"){

	  urlmod = "http://test-5.chrysler.ca/wccs-ca/index_fr.jsp";

	  }

	  if(env == "dev"){

	  urlmod = "http://uat-5.chrysler.ca/wccs-ca/index_fr.jsp"; 

	  }
	  if(env == "uat"){

	  urlmod = "http://uat-5.chrysler.ca/wccs-ca/index_fr.jsp"; 

	  }

	  if(env == "www"){

	   urlmod = "http://www-5.chrysler.ca/wccs-ca/index_fr.jsp"; 

	  }


eval('window.open(urlmod, namer, "history=no,toolbar='+tool+',location='+loc+',directories='+dir+',status='+stat+',menubar='+menu+ ',scrollbars='+scroll+',resizable='+resize+',width=' +  y  + ',height=' +  x + '");');


}


else{


eval('window.open(topic, namer, "history=no,toolbar='+tool+',location='+loc+',directories='+dir+',status='+stat+',menubar='+menu+ ',scrollbars='+scroll+',resizable='+resize+',width=' +  y  + ',height=' +  x + '");');


}


}// ---------------------------------------------------------------------------------------

//To be used for popup windows all parameters passed and if user is leaving site presented with a dialog box


function popup_leaving(topic,namer,tool,loc,dir,stat,menu,scroll,resize,x,y) {


input_box=confirm("Vous quittez maintenant le site Web de DaimlerChrysler Canada Inc. DaimlerChrysler Canada Inc., ses agents, ses affiliés, ses dirigeants, ses cadres, ses employés et ses assureurs (DaimlerChrysler Canada) ne font aucune garantie concernant l’exactitude et l’utilisation des informations contenues dans le site du Centre de documentation et ne peuvent être tenus responsables des dommages pouvant découler de l’accès à ce site ou de son utilisation. Vous accédez à ce site et y naviguez à vos propres risques. Voulez-vous continuer? ");

	if (input_box==true)    { 

		// Output when OK is clicked

        eval('window.open(topic, namer, "history=no,toolbar='+tool+',location='+loc+',directories='+dir+',status='+stat+',menubar='+menu+ ',scrollbars='+scroll+',resizable='+resize+',width=' +  y  + ',height=' +  x + '");');

	} else {

        // Output when Cancel is clicked

	}

}

//-------------------------------------------------------------------------------------------

// Needed for Rollover generator


function swapRollImage(name, path, state){

if (state == "on") document.images[name].src=path+name+"_on.gif";

else if (state == "off") document.images[name].src=path+name+"_off.gif";

}


// ---------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------

// Needed for Rollover generator


function swapRollImage2(name, path, state){

if (state == "on") document.images[name].src=path+name+"_on.jpg";

else if (state == "off") document.images[name].src=path+name+"_off.jpg";

}


// ---------------------------------------------------------------------------------------


