var strClaveGenActiva = "";
function A_ProcesaClaveGen(strClave) {
	strClaveGenActiva = strClave;
    var strLiga = "vehiculo.aspx?ClaveGen=" + strClave;
    //***  090518  HMO  Soporte a heredar las variables adicionales...
    //***  090519  HMO  El error de undefined se arreglaba usando typeof en lugar de tratar de evaluar la variable directamente...
    if(typeof(strOrg)!="undefined" && strOrg!="") strLiga += ("&strOrg=" + strOrg);
    if(typeof(intDisID)!="undefined" && intDisID!=0) strLiga += ("&disID=" + intDisID);
    if(typeof(strXml)!="undefined" && strXml!="") strLiga += ("&strXml=" + strXml);
    if(typeof(strSelSig)!="undefined" && strSelSig!="") strLiga += ("&SelSig=" + strSelSig);
    location.href = strLiga;
}

var ajxMan = null;
var objSWFCol = null, objSWFGal = null;
var intRadWindowTimeOut = 0;
function A_ProcesaClave(strClave) {
    if(intRadWindowTimeOut!=0) clearTimeout(intRadWindowTimeOut);
	switch (strClave) {
		case "LIMPIA":
			//alert("Limpia");
            hideLayer("divInfoPlanfia");
			break;
		case "HOME":
			location.href = "home.aspx";
			break;
		case "COUM":
			A_AbreVentanaLayer("_dcn/dcn_RuteaPlanfia.asp" + location.search);
			break;
		case "COLORES":
			//alert("colores");
			break;
		case "GALERIA":
			//alert("galeria");
			break;

		case "CORP_REGCLN": 		//Clientes Chrysler
			A_RedireccionaHoja("clientes/index.htm");
			break;
		case "CORP_REGCLN_BRC":	//BRC Clientes Chrysler
			location.href = "brc/index.asp";
			break;
		case "CORP_SRVCLN": 	//Servicio PostVenta
			A_RedireccionaHoja("ServicioPostVenta/index.htm");
			break;

		case "CORP_LEALTAD": 	//Programa de Lealtad
			A_AbreVentana("_dcn/Lealtad_Sep10/index.asp?marca=JP", 667, 500);
			break;

		case "CORP_COBPRE": 	//Cobertura PRENSA del Plan de Negocios
			A_AbreVentana("http://www.dcnet.com.mx/boletines/prensa/091112_Cobertura Nuevo Plan de Negocios 2010 a 2014.pdf");
			break;

		case "CORP_COBTV": 	//Cobertura TV del Plan de Negocios
			A_AbreVentana("http://www.dcnet.com.mx/videos/videoNoticieros.htm", 320, 270);
			break;

		case "CORP_PRBMANEJO": 	//Prueba de manejo
			A_AbreVentana("_dcn/PruebaManejo/Guadalajara/index.asp", 724, 550);
			break;

		case "CORP_PUBLIC": 	//Publicidad
			A_RedireccionaHoja("publicidad/index.htm");
			break;

		case "CORP_BOLETI": 	//Boletines
			A_RedireccionaHoja("boletines/index.htm");
			break;

		case "CORP_FINAN": 		//Pantalla Financiamiento
			A_AbreVentana("https://www.chryslerfinancial.com.mx/autos/CotWeb/CotizaWeb2006.asp?marca=JP");
			break;

		case "ACC_MOPAR":
			A_AbreVentana("http://www.mopar.com.mx/accesorios/CatAccesorios.asp?Marca=JP");
			break;

	// === Minisitios === //
		case "MSIT_SEMICER": 	//Vehículos Seminuevos Certificados
			A_RedireccionaHoja("_dcn/minisite/Seminuevos/inicio.asp?marca=JP");
			break;

		case "MSIT_GARANTIATM": 	//Garantía Tren Motriz
			A_AbreVentana("_dcn/garantia/inicio.htm", 650, 400);
			break;
		case "MSIT_HEMI": 		//Motor HEMI
			A_AbreVentana("_dcn/Hemi_07/index.htm", 780, 425);
			break;
		case "MSIT_INTERSAFE": 		//Intersafe
			//A_RedireccionaHoja("http://intersafe.com.mx");
			A_AbreVentana("http://intersafe.com.mx");
			break;
		case "MSIT_UCONNECT": 		//UConnect
			A_AbreVentana("http://www.uconnect.com.mx", 770, 442);
			break;
		case "MSIT_MYGIG": 		//MyGIG
			A_AbreVentana("_dcn/minisite/mygig/inicio.htm", 770, 490);
			break;

		case "MSIT_CHERBLINDADA": 	//Cherokee Blindada
			A_AbreVentana("minisite/cherokeeBlindada/inicio.htm", 770, 470);
			break;
		case "MSIT_TRAILRATED": 	//trail rated
			A_AbreVentana("minisite/trail/inicio.htm", 650, 470);
			break;

		case "MSIT_GCHER2011": 	//Grand Cherokee 2011
			TerminaTeaser('GCHE11');
			A_AbreVentana("minisite/gcherokee2011/inicio.asp", 950, 580);
			break;

		case "MOP_CAMACEITE":
			A_AbreVentana("http://www.mopar.com.mx/");
			break;
		case "MOP_QUIMICOS":
			A_AbreVentana("http://www.mopar.com.mx/servicio/PaqQuimicos.asp");
			break;
	// === Sitios Grupo Chrysler === //
		case "SITIO_DODGE":
			A_AbreVentana("http://www.dodge.com.mx");
			break;
        case "SITIO_CHRYSLER":
		    //*** 090429  HMO  Temporal ...en productivo, debe haber un código que detecta la marca en la que está  en base a eso no hacer nada o mandar al Home...
			A_AbreVentana("http://www.chrysler.com.mx");
			break;
		case "SITIO_JEEP":
			//A_AbreVentana("http://www.jeep.com.mx");
			break;
		case "SITIO_RAM":
			A_AbreVentana("http://www.camionesram.com.mx");
			break;
		case "SITIO_MOPAR":
			A_AbreVentana("http://www.mopar.com.mx");
			break;
		case "SITIO_FINANCIAL":
			A_AbreVentana("http://www.chryslerfinancial.com.mx");
			break;
		case "SITIO_TWITTER":
			A_AbreVentana("http://www.twitter.com/jeepmx");
			break;
		case "SITIO_FACEBOOK":
			A_AbreVentana("http://www.facebook.com/pages/Jeep-MX/327724667911?created");
			break;
			
		case "ENCUESTA":
			A_AbreVentana("../_dcn/EncuestaPromos/index.asp?marca=JP", 500, 400);
			break;
			
	// === Legales - Bolsa de Trabajo === //
		case "CORP_BOLTRA":
			A_AbreVentana("http://my.occ.com.mx/privadas/htmls/chrysler.html");
			break;
		case "CORP_LEGALE":
			A_AbreVentana("_dcn/legales.htm", 550, 450);
			break;
		case "CORP_LEGMES":
			A_AbreVentana("legalmes.htm", 650, 450);
			break;


	// === Distribuidores === //
		case "CORP_REDDIST":		//Red Chrysler
			A_AbreVentana("http://www.redchrysler.com.mx");
			break;
		case "CORP_COTIZA": 		//*** Solicitar Cotización ***//
			if(typeof(intDisID)!="undefined" && intDisID!=0)
				location.href = strURLDisCot;
			else
				A_AbreVentanaLayer("_dcn/ServsDist/dcnCot.aspx?ClaveGen=" + strClaveGenActiva);
			break;
		case "CORP_PRBMAN": 		//Solicitar Prueba de Manejo
			if(typeof(intDisID)!="undefined" && intDisID!=0)
				location.href = strURLDisPM;
			else
				A_AbreVentanaLayer("_dcn/ServsDist/dcnPM.aspx?ClaveGen=" + strClaveGenActiva);
			break;
		case "CORP_SERVIC": 		//Citas de Servicio
			A_AbreVentanaLayer("_dcn/ServsDist/dcnServ.aspx", 900, 560);
			break;
		case "DIST_PLAAGE":
			if(typeof(intDisID)!="undefined" && intDisID!=0 && typeof(strURLDisFA)!="undefined")
				location.href = strURLDisFA.replace("@UID@", A_ProcesaClave.arguments[1]);
			break;

	// === Promo Quiniela Mundialista === //
		case "QUINIELA":
			A_AbreVentana("http://www.facebook.com/JeepMexico?v=app_4949752878");
			break;

	// === 100820 JCV - se agrega link de Revista Prestige === //
		case "REV_PRESTIGE":
			A_AbreVentana("http://www.revistaprestige.mx");
			break;
	// === 100825 JCV - se agrega link de CAMP JEEP === //
		case "JAMBOREE":
			A_AbreVentana("CampJeep/inicio.htm", 550, 600);
			break;
	}
}

//JCV 100817 se agrega funcion para certificado premiere night
function A_ImprimeCertPremierNight(){
	var strLiga= "_dcn/CertPremiereNight/index.asp?marca=JP"
	window.open(strLiga,"certpremierenight","menubar=0,toolbar=0,location=0,status=0,resizable=0,titlebar=0,width=667,height=500,scrollbars=no")
}

//JCV 100825 se agrega funcion para certificado premiere night
function A_ImprimeCertGala(){
	var strLiga= "_dcn/CertGala/index.asp?marca=JP"
	window.open(strLiga,"certgala","menubar=0,toolbar=0,location=0,status=0,resizable=0,titlebar=0,width=687,height=500,scrollbars=no")
}


// JCV 100715 Se modifica funcion para procesar COMPARATIVOS === //
function A_AbreComparativo(intModID, strNomMod){
	var strLigaBase = "http://200.57.136.114/Carspecs3/ComparadorCarspecs/ComparadorCarspecs.html?vehicleId=";
	var strMarca = "Jeep";
	var strLigaFinal = strLigaBase + intModID + "&make=" + strMarca + "&model=" + strNomMod;
	//alert(strLigaFinal);
	var intVent = window.open(strLigaFinal,"comparativo","menubar=0,toolbar=0,location=0,status=0,resizable=0,titlebar=0,scrollbars=yes, width=1024, height=768");
	intVent.focus();
	//A_AbreVentana(strLigaFinal, 1024, 768, "menubar=0,toolbar=0,location=0,status=0,resizable=0,titlebar=0,scrollbars=yes");
}

function A_ProcesaComparativos(strClave, strVer){
	switch (strClave) {
		case "COMP10":
			/*
			v1=Compass 2.4L SPORT 4X2 MANUAL 2010
			v2=Compass 2.4L SPORT FWD CVT 2010
			v3=Compass 2.4L LIMITED PREMIUM FWD CVT 2010
			*/
			strNom = "Compass";
			intId1 = 737140720100108;
			intId2 = 737140820100108;
			intId3 = 756842320100108;
			switch(strVer){
				case "v1": A_AbreComparativo(intId1, strNom); break;
				case "v2": A_AbreComparativo(intId2, strNom); break;
				case "v3": A_AbreComparativo(intId3, strNom); break;
			}
		break;
		case "PATR10":
			/*
			v1=Patriot 2.4L BASE FWD MTX 2010
			v2=Patriot 2.4L BASE FWD CVT 2010
			v3=Patriot 2.4L SPORT FWD MTX 2010
			v4=Patriot 2.4L SPORT FWD CVT 2010
			v5=Patriot 2.4L LIMITED FWD CVT 2010
			v6=Patriot 2.4L LIMITED 4WD CVT 2010
			*/
			strNom = "Patriot";
			intId1 = 742187220100108;
			intId2 = 765734720100108;
			intId3 = 756841920100108;
			intId4 = 756842020100108;
			intId5 = 756842120100108;
			intId6 = 756842220100108;
			switch(strVer){
				case "v1": A_AbreComparativo(intId1, strNom); break;
				case "v2": A_AbreComparativo(intId2, strNom); break;
				case "v3": A_AbreComparativo(intId3, strNom); break;
				case "v4": A_AbreComparativo(intId4, strNom); break;
				case "v5": A_AbreComparativo(intId5, strNom); break;
				case "v6": A_AbreComparativo(intId6, strNom); break;
			}
		break;
		case "WRAN210":
			/*
			v1=Wrangler 3.8L X 4X4 MANUAL 2010
			v2=Wrangler 3.8L X 4X4 MANUAL CON TOLDO DURO Y AC 2010
			v3=Wrangler 3.8L SAHARA 4X4 AUTO 2010
			v4=Wrangler 3.8L RUBICON 4X4 AUTO 2010
			v5=Wrangler 3.8L ISLANDER 4X4 MANUAL 2010
			v6=Wrangler 3.8L ISLANDER 4X4 AUTOMATICO 2010
			*/
			strNom = "Wrangler";
			intId1 = 62592320100108;
			intId2 = 765734620100108;
			intId3 = 737147520100108;
			intId4 = 62598420100108;
			intId5 = 790734420100409;
			intId6 = 790734520100409;
			switch(strVer){
				case "v1": A_AbreComparativo(intId1, strNom); break;
				case "v2": A_AbreComparativo(intId2, strNom); break;
				case "v3": A_AbreComparativo(intId3, strNom); break;
				case "v4": A_AbreComparativo(intId4, strNom); break;
				case "v5": A_AbreComparativo(intId5, strNom); break;
				case "v6": A_AbreComparativo(intId6, strNom); break;
			}
		break;
		case "WRAN410":
			/*
			v1=Wrangler 3.8L UNLIMITED X 4X2 AUTO 2010
			v2=Wrangler 3.8L UNLIMITED SAHARA 4X4 AUTO TELA 2010
			v3=Wrangler 3.8L UNLIMITED SAHARA 4X4 AUTO 2010
			v4=Wrangler 3.8L UNLIMITED RUBICON 4X4 AT 2010
			v5=Wrangler 3.8L UNLIMITED MOUNTAIN 4X4 AUTO 2010
			*/
			strNom = "Wrangler";
			intId1 = 737154920100108;
			intId2 = 790732820100218;
			intId3 = 737155020100218;
			intId4 = 757760320100108;
			intId5 = 790735120100514;
			switch(strVer){
				case "v1": A_AbreComparativo(intId1, strNom); break;
				case "v2": A_AbreComparativo(intId2, strNom); break;
				case "v3": A_AbreComparativo(intId3, strNom); break;
				case "v4": A_AbreComparativo(intId4, strNom); break;
				case "v5": A_AbreComparativo(intId5, strNom); break;
			}
		break;
		case "LIBE10":
			/*
			v1=Liberty 3.7L SPORT 4X2 2010
			v2=Liberty 3.7L SPORT 4X4 2010
			v3=Liberty 3.7L LIMITED 4X2 2010
			v4=Liberty 3.7L LIMITED 4X4 2010
			v5=Liberty 3.7L RENEGADE 4X4 2010
			*/
			strNom = "Liberty";
			intId1 = 48915320100304;
			intId2 = 48915420100304;
			intId3 = 65412320100304;
			intId4 = 68651920100304;
			intId5 = 790735020100428;
			switch(strVer){
				case "v1": A_AbreComparativo(intId1, strNom); break;
				case "v2": A_AbreComparativo(intId2, strNom); break;
				case "v3": A_AbreComparativo(intId3, strNom); break;
				case "v4": A_AbreComparativo(intId4, strNom); break;
				case "v5": A_AbreComparativo(intId5, strNom); break;
			}
		break;
		case "CHER10":
			/*
			v1=Grand Cherokee 3.7L LAREDO 4X2 V6 POWER TECH 2010
			v2=Grand Cherokee 3.7L LIMITED 4X2 V6 POWER TECH 2010
			v3=Grand Cherokee 5.7L LIMITED PREMIUM 4X2 HEMI V8 MDS 2010
			v4=Grand Cherokee 5.7L LIMITED PREMIUM 4X4 HEMI V8 MDS 2010
			v5=Grand Cherokee 6.1L SRT-8 4X4 2010
			*/
			strNom = "Grand Cherokee";
			intId1 = 62034520100304;
			intId2 = 788290420100304;
			intId3 = 729965820100304;
			intId4 = 788290320100304;
			intId5 = 729965720100304;
			switch(strVer){
				case "v1": A_AbreComparativo(intId1, strNom); break;
				case "v2": A_AbreComparativo(intId2, strNom); break;
				case "v3": A_AbreComparativo(intId3, strNom); break;
				case "v4": A_AbreComparativo(intId4, strNom); break;
				case "v5": A_AbreComparativo(intId5, strNom); break;
			}
		break;
		case "COMM10":
			/*v1=Commander 5.7L V8 MDS HEMI LIMITED PREMIUM 4X2 2010*/
			strNom = "Commander";
			intId = 729961020100203;
			A_AbreComparativo(intId, strNom);
		break;
	}
}


// JCV 091029 - Se agrega función para ocultar teaser
function TerminaTeaser(strClave){
	switch (strClave) {
		case "VIDEO":
			hideLayer('contFlashVideo');
		break;
		case "GCHE11":
			hideLayer('divSWFLayerTeaser2');
			showLayer('divSWFLayerTeaser1');
		break;
		case "DESC":
			hideLayer('divSWFLayerTeaser1');
		break;
	}
}

function A_RedireccionaHoja(strLiga, intH) {
    var bolNoUsarTop =false;
    if(strLiga.indexOf("?")<0) strLiga += "?";
    if(typeof(strOrg)!="undefined" && strOrg!="") strLiga += ("&strOrg=" + strOrg);
    if(typeof(intDisID)!="undefined" && intDisID!=0) strLiga += ("&disID=" + intDisID);
    if(typeof(strXml)!="undefined" && strXml!="") strLiga += ("&strXml=" + strXml);
    strLiga = "hoja.aspx?strHoja=" + escape(strLiga);
    if (intH != undefined) strLiga += ("&intH=" + intH);
    //
    if(typeof(strOrg)!="undefined" && strOrg!="") { strLiga += ("&strOrg=" + strOrg); bolNoUsarTop = true;}
    if(typeof(intDisID)!="undefined" && intDisID!=0) strLiga += ("&disID=" + intDisID);
    if(typeof(strXml)!="undefined" && strXml!="") strLiga += ("&strXml=" + strXml);
    ///
    (bolNoUsarTop?this:top).location.href = strLiga;
}

function A_AbreVentana(strLiga, intAncho, intAlto, strAttrs) {
    var strAtributos = "";
    if (intAncho != undefined) strAtributos += ("width=" + intAncho + ", height=" + intAlto);
    if (strAttrs != undefined) strAtributos += strAttrs;
    var intWndID = window.open(strLiga, "", strAtributos);
    if(intWndID!=null) intWndID.focus();
}

function A_AbreVentanaLayer(strLiga, intAncho, intAlto) {
    if(intRadWindowTimeOut!=0) clearTimeout(intRadWindowTimeOut);
	A_ProcesaClave('LIMPIA');
    if(typeof(intAncho)=="undefined") intAncho = 0;
    if(typeof(intAlto)=="undefined") intAlto = 0;
	if(typeof(window.radopen)!="undefined")
	{
		try { 
			var winV = window.radopen(strLiga, "winCoum");
			if(winV!=null) {
				if(intAncho>0) winV.set_width(intAncho);
				if(intAlto>0) winV.set_height(intAlto);
				if(intAncho>0 || intAlto>0) winV.center();
			}
		}
		catch(e) { intRadWindowTimeOut = setTimeout("A_AbreVentanaLayer('" + strLiga +"', " + intAncho + ", " + intAlto + ");", 200); }
	}
    else
        A_AbreVentana(strLiga, intAncho, intAlto);
}


// ====================================================================================
// JCV 090428 - Se agergan funciones para mostrar y ocultar layers


/*************************************************************************
This code is from Dynamic Web Coding at http://www.dyn-web.com/
Copyright 2001-3 by Sharon Paine
See Terms of Use at http://www.dyn-web.com/bus/terms.html
regarding conditions under which you may use this code.
This notice must be retained in the code as is!
*************************************************************************/

// resize fix for ns4
var origWidth, origHeight;
if (document.layers) {
	origWidth = window.innerWidth; origHeight = window.innerHeight;
	window.onresize = function() {
		if (window.innerWidth != origWidth || window.innerHeight != origHeight)
			history.go(0);
	}
}

var cur_lyr;	// holds id of currently visible layer
function swapLayers(id) {
	if (cur_lyr) hideLayer(cur_lyr);
	showLayer(id);
	cur_lyr = id;
}

function showLayer(id) {
	var lyr = getElemRefs(id);
	if (lyr && lyr.css) {
		lyr.css.visibility = "visible";
		lyr.css.display = "block"; /*Soporte para Mozilla Firefox - JCV 070924*/
	}
}

function hideLayer(id) {
	var lyr = getElemRefs(id);
	if (lyr && lyr.css) {
		lyr.css.visibility = "hidden";
		lyr.css.display = "none"; /*Soporte para Mozilla Firefox - JCV 070924*/
	}
}

function getElemRefs(id) {
	var el = (document.getElementById)? document.getElementById(id): (document.all)? document.all[id]: (document.layers)? getLyrRef(id,document): null;
	if (el) el.css = (el.style)? el.style: el;
	return el;
}

// get reference to nested layer for ns4
// from old dhtmllib.js by Mike Hall of www.brainjar.com
function getLyrRef(lyr,doc) {
	if (document.layers) {
		var theLyr;
		for (var i=0; i<doc.layers.length; i++) {
			theLyr = doc.layers[i];
			if (theLyr.name == lyr) return theLyr;
			else if (theLyr.document.layers.length > 0)
			if ((theLyr = getLyrRef(lyr,theLyr.document)) != null)
				return theLyr;
		}
		return null;
	}
}



//===================
function A_ProcesaBoletin(numBol) {
	switch (numBol) {
		case 1:
			A_AbreVentana("http://www.dcnet.com.mx/boletines/prensa/090430_BolPres_AlianzaChrysler-Fiat.pdf");
		break;
		case 2:
			A_AbreVentana("http://www.dcnet.com.mx/boletines/prensa/090519_BolPres_EstamosContruyendoNuevaCompañia.pdf");
		break;
		case 3:
			A_AbreVentana("http://www.dcnet.com.mx/boletines/prensa/090527_BolPres_CESVIpremiaAutos.pdf");
		break;
		case 4:
			A_AbreVentana("http://www.dcnet.com.mx/boletines/prensa/090602_BolPres_ContinuaPromocionGPS.pdf");
		break;
		case 5:
			A_AbreVentana("http://www.dcnet.com.mx/boletines/prensa/090609_BolPres_ChryslerPresenteEnLaXXIIIDelConcursoElegancia2009.pdf");
		break;
	}
}