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

// 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_en.jsp";

	  }

	  if(env == "uat"){

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

	  }
	  if(env == "dev"){

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

	  }

	  if(env == "www"){

	   urlmod = "http://www-5.chrysler.ca/wccs-ca/index_en.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("You are now leaving the DaimlerChrysler Canada web site. DaimlerChrysler Canada Inc., its agents, affiliates, officers, directors, employees and insurers (DaimlerChrysler Canada)  make no warranty of any kind regarding the accuracy and use of the information found on the Service Bookstore Book Site and is not liable for damages of any kind arising out of your access to or use of this Site. Your use of and browsing in this site are at your own risk. Would you like to continue? ");

	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";

}


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

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

// Needed for Rollover generator support of Jpg


function swapRollImageExt(name, path, state, ext){

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

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

}


// -----

