//------------------------new section for trilogy BP ------------------
var tmp = location.hostname.split(".");
var env = tmp[0].toLowerCase();	

     if(env == "test"){
	   env = "test-5";  
	  }
	  if(env == "uat"){
	   env = "uat-5";
	  }
	  if(env == "dev"){
	   env = "uat-5";
	  }
      if(env == "www"){
	    env = "www-5";
	  }
          if(env == "53"){
            env = "test-5";
          }
          if(env == "jeep"){
             env = "www-5";
          }
          if(env == "dodge"){
             env = "www-5";
          }
          if(env == "chrysler"){
             env = "www-5";
          }  

//------------------------new section for trilogy BP ------------------


//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 ChryslerCanada Canada web site. ChryslerCanada Inc., its agents, affiliates, officers, directors, employees and insurers (ChryslerCanada)  make no warranty of any kind regarding the accuracy and use of the information on this 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
	}
}

//----- To be used for popup windows all parameters passed
function popup_all(topic,namer,tool,loc,dir,stat,menu,scroll,resize,x,y) {

 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 + '");');

}
// ---------------------------------------------------------------------------------------

function swapImage_1(name,path){
	if (imageStay != name){
        	document[name].src = path;
	}
}
//--------------------------ADDED ---------------------------------------------
		function openWindow(loc) {
		  popupWin = window.open(loc,'open_window', " width=600, height=800,scrollbars=1, left=0, top=0");
		}
	
	function openWindowWide(loc) {
		  popupWin = window.open(loc,'open_window', " width=800, height=800,scrollbars=1, left=0, top=0");
		}
		
		



function kellyWin(token) {
input_box=confirm("Vous quittez maintenant le site Web de ChryslerCanada Inc. ChryslerCanada Inc., ses agents, ses affiliés, ses dirigeants, ses cadres, ses employés et ses assureurs (ChryslerCanada) ne font aucune garantie concernant l’exactitude et l’utilisation des informations contenues dans le site du Canadian Black Book 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
        
        //topic="http://www.canadianblackbook.com/prv/auth.cfm?token=AB04DC39ZKL01";
		
		 topic = "http://tradein.canadianblackbook.com/tradein/java/entry_token_"+token+"?siteLanguage=FR_CA";
  window.open(topic,"newWindow", 'history=no,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=yes,width=600,height=480');
 } else {
        // Output when Cancel is clicked
 }
}	 
	 
	

// Universal Popup function
function universal(name,vehicle) {
// Defining default values
h = 480;
w = 490;
scrolling = "yes";
windowname = "open_me";
input_box = true;
popup = true;
currentwin=false;


// Associating the name of the link with the url
switch (name) {

    case "getaquote": url = "http://" + env + ".chrysler.ca/vehsuite/GetQuote.jsp?vehicle="+ vehicle +"&lang=fr-ca";h=600;w=774;break;
    case "retailer": url = "http://www.chrysler.ca/retailer/index.php?brand=chrysler&language=fr";windowname=name;h=565;w=992;break;
   // case "getaquote": url = "http://www.daimlerchrysler.ca/CA/04/EN/CHRYSLER/1,,CA-04-EN-CHRYSLER-QUOTE,.html";h=580;w=620;break;
   // case "retailer": url = "http://www.c1hrapps.com/locator/CA/?presentationId=dlen_CAsdc1&brand=C";windowname=name;h=420;w=620;break;
    case "inventory": url = "http://www.c1hrapps.com/locator/CA/?presentationId=dlen_CAinc1&brand=C";windowname=name;h=420;w=620;break;    
    // case "specialoffers": url = "http://www.daimlerchryslerhotdeals.ca/en";h=600;w=700;break; 
    case "specialoffers": url = "http://www.chryslercanada.ca/fr/specialoffers/index.php?brand=chrysler";popup = false; currentwin=true; break;
    //case "specialoffers": url = "/EN/CHRYSLER/1,,EN-CHRYSLER-PLUS,.html";h=610;w=650;break;
    //case "blackbook": url = "http://www.daimlerchrysler.ca/cgi-bin/getcbb.cgi?en"; input_box=confirm("You are now leaving the ChryslerCanada web site. ChryslerCanada Inc., its agents, affiliates, officers, directors, employees and insurers (ChryslerCanada)  make no warranty of any kind regarding the accuracy and use of the information on the Canadian Black 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? ");break;
    case "blackbook": url = "http://www.canadianblackbook.com/prv/auth.cfm?token=AB04DC39ZKL01"; input_box=confirm("You are now leaving the ChryslerCanada web site. ChryslerCanada Inc., its agents, affiliates, officers, directors, employees and insurers (ChryslerCanada)  make no warranty of any kind regarding the accuracy and use of the information on the Canadian Black 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? ");break;

    case "buildyourown": url = "http://www.daimlerchrysler.ca/CA/04/FR/CHRYSLER/1,,CA-04-FR-CHRYSLER-BUILD_AND_PRICE,.html";popup=false;currentwin=true;break;
    case "getabrochure": url = "http://www.chryslercanada.ca/fr/crm/index.php?brand=chrysler&form=gab";w=1024;break;
    case "efamily": url = "http://www.chryslercanada.ca/fr/crm/index.php?brand=chrysler&form=efamily";w=1024;break;	
    case "update" : url = "http://www-5.chrysler.ca/crmforms/GetForm.jam?PageName=personal_info&SalesMarket=C&CountryCode=CA&LanguageCode=FR&Brand=Chrysler&FormName=updateyourinformation&MediaCode=WS20&MediumCode=CGAB04&PromoCode=0000000";w=600;break;
    case "compare": url = "http://www.daimlerchrysler.ca/CA/04/FR/CHRYSLER/1,,CA-04-FR-CHRYSLER-COMPARE,.html";w=610;h=610;self.name="Configurator";break;
    case "accessories": w=800;h=540;windowname=name;break;
    case "recommendations": url = "http://www.daimlerchrysler.ca/FR/RECOMMENDATIONS/1,,FR-RECOMMENDATIONS,.html";h=315;w=463;windowname=name;break;
    case "fleet": url = "http://www.fleet.daimlerchrysler.ca/CA/04/FR/FLEET/1,,CA-04-FR-FLEET,.html";windowname=name;popup=false;break;	
    case "financial": url = "http://www.daimlerchryslerfinancial.ca/en/index.jsp";windowname=name;popup=false;break;
    case "owners": url = "http://www.daimlerchrysler.ca/CA/03/EN/OWNERS/1,,CA-03-EN-OWNERS,.html?Chrysler";windowname=name;popup=false;break;
    case "worldwide": url="http://www.international.chryslercorp.com";h=520;w=840;break;
    case "disclaimer": url = "http://www.daimlerchrysler.ca/CA/04/FR/LEGAL/1,,CA-04-FR-LEGAL,.html";h=450;w=790;break;
    case "recommender": url = "http://www-5.chrysler.ca/vehicleRecommender/RecommenderController?action=vehicleRecommender&language=EN&sales_market=C&brand=Chrysler";w=775;h=605;break;
    case "store": url = "http://www.chryslergiftgallery.ca";windowname=name;h=470;w=860;break;
    default:
}
	eval(window.open(url,windowname,"history=no,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars="+scrolling+",resizable=yes,width="+w+",height="+h));

}
// ---------------------------------------------------------------------------------------


function swapImage(name,path){
 document[name].src = path;
}

function buzzRO(img,state) {
 if (state == 'on') { document.images[img].src = eval(img + "_on.src"); }
 else { document.images[img].src = eval(img + ".src"); }
}


function preload(imgObj) {
	if (document.images) {
		eval(imgObj+' = new Image()');
		imgSrc = ('img/' + imgObj + '.gif');			
		eval(imgObj+'.src = "'+imgSrc+'"');
		eval(imgObj+'_on = new Image()');
		imgSrc = ('img/' + imgObj + '_on.gif');			
		eval(imgObj+'_on.src = "'+imgSrc+'"');		
	}
}

preload('dod_footer');
preload('chr_footer');
preload('jeep_footer');
preload('dodram_footer');