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('divSWFLayerColores');
			hideLayer('divSWFLayerGaleria');
			var objS = getElemRefs('divSWFFooter');
			if(objS!=null) objS.className = "";
			break;
		case "HOME":
			location.href = "home.aspx";
			break;
		case "PRECIOS_PF":
		case "PF_PRECIOS":
        case "COUM":
			A_AbreVentanaLayer("_dcn/dcn_RuteaPlanfia.asp" + location.search);
			break;
		case "COLORES":
			A_ProcesaClave('LIMPIA');
			showLayer('divSWFLayerColores');
			if(objSWFCol==null) {
				objSWFCol = new SWFObject(strClaveGenActiva + "/colores.swf", "1", "950", "380", "9.0.28.0", "Transparent");
				objSWFCol.addParam("quality", "best");
				objSWFCol.addParam("scale", "exactfit");
				objSWFCol.addParam("wmode", "transparent");
				objSWFCol.write("divSWFLayerColores");
			}
			break;
		case "GALERIA":
			A_ProcesaClave('LIMPIA');
			showLayer('divSWFLayerGaleria');
			var objS = getElemRefs('divSWFLayerGaleria');
			objS.innerHTML = "";
			objSWFGal = null;
			var dteF = new Date();
			//if(objSWFGal==null) {
				objSWFGal = new SWFObject(strClaveGenActiva + "/galeria.swf?intR=" + dteF.getTime(), "1", "950", "645", "9.0.28.0", "Transparent");
				objSWFGal.addParam("quality", "best");
				objSWFGal.addParam("scale", "exactfit");
				objSWFGal.addParam("wmode", "transparent");
				objSWFGal.write("divSWFLayerGaleria");
				var objS = getElemRefs('divSWFFooter');
				objS.className = "Ospaco";
			//}
			//alert("galeria");
			break;

		case "CORP_REGCLN": 		//Clientes Chrysler
			A_RedireccionaHoja("clientes/index.htm");
			break;
		case "CORP_REGCLN_BRC":		//BRC Clientes Chrysler
			//A_RedireccionaHoja("clientes/brc/index.asp");
			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=CH", 670, 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=CH");
			break;

		case "ACC_MOPAR":
			A_AbreVentana("http://www.mopar.com.mx/accesorios/CatAccesorios.asp?Marca=CH");
			break;

	// === Minisitios === //
		case "MSIT_SEMICER": 		//Vehículos Seminuevos Certificados
			A_RedireccionaHoja("_dcn/minisite/Seminuevos/inicio.asp?marca=CH", 480);
			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);
			//A_AbreVentana("_dcn/Hemi_07", 500, 400, "atributoadicional=valor, att2=val2");
			break;
		case "MSIT_INTERSAFE": 		//Intersafe
			//A_RedireccionaHoja("http://intersafe.com.mx");
			A_AbreVentana("http://intersafe.com.mx");
			break;
		case "MSIT_UCONNECT": 		//UConnect
			//A_AbreVentanaLayer("http://www.uconnect.com.mx", 500, 400);
			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_ENVI": 		//Vehículos ENVI
			A_AbreVentana("_dcn/minisite/Vehelectricos/inicio.htm", 800, 600);
			break;
		case "MSIT_TOWN25ANI": 	//25 aniv Town
			A_AbreVentana("TOWN09/25aniv.htm", 800, 600);
			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://twitter.com/ChryslerMX");
			break;
		case "SITIO_FACEBOOK":
			A_AbreVentana("http://www.facebook.com/pages/Chrysler-Mexico/332205604060?created");
			break;

		case "ENCUESTA":
			A_AbreVentana("../_dcn/EncuestaPromos/index.asp?marca=CH", 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]);
				//alert( A_ProcesaClave.arguments[1]);
			break;
	// === Promo Quiniela Mundialista === //
		case "QUINIELA":
			A_AbreVentana("http://www.facebook.com/ChryslerMexico?v=app_4949752878");
			break;
	// === 100820 JCV - se agrega link de Revista Prestige === //
		case "REV_PRESTIGE":
			A_AbreVentana("http://www.revistaprestige.mx");
			break;
	}
}

// JCV 091029 - Se agrega función para ocultar teaser
function TerminaTeaser(strClave){
	switch (strClave) {
		case "VIDEO":
			hideLayer('contFlashVideo');
		break;
		case "MOD09":
			hideLayer('contFlashTeaser');
		break;
		case "DESC":
			hideLayer('contFlashVideo');
		break;

	}
}

// 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 = "Chrysler";
	var strLigaFinal = strLigaBase + intModID + "&make=" + strMarca + "&model=" + strNomMod;
	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 "300C10":
			/*
			v1=3.5 V6 
			v2=C 5.7 C LUJO
			*/
			strNom1 = "300";
			strNom2 = "300C";
			intId1 = 68680420100108;
			intId2 = 756840820100108;
			switch(strVer){
				case "v1": A_AbreComparativo(intId1, strNom1); break;
				case "v2": A_AbreComparativo(intId2, strNom2); break;
			}
		break;
		case "CIRR10":
			/*
			v1=2.4L TOURING SEDAN
			v2=2.4 SEDAN LIMITED 
			v3=3.5 SEDAN LIMITED 
			*/
			strNom = "Cirrus";
			intId1 = 742188720100108;
			intId2 = 742067720100108;
			intId3 = 742181020100108;
			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 "CONV10": /*v1=3.5L CONVERTIBLE LIMITED*/
			strNom = "Cirrus";
			intId = 749910120100108;
			A_AbreComparativo(intId, strNom);
		break;
		case "PTCR10":
			/*v1=2.4 CLASSIC*/
			/*v2=2.4 COUTURE EDITION*/
			strNom = "PT Cruiser";
			intId1 = 790060420100108;
			intId2 = 790734920100607;
			switch(strVer){
				case "v1": A_AbreComparativo(intId1, strNom); break;
				case "v2": A_AbreComparativo(intId2, strNom); break;
			}
		break;
		case "TOWN10":
			/*
			v1=4.0L LX
			v2=4.0L TOURING
			v4=4.0L SIGNATURE SERIES
			v3=4.0L LIMITED
			*/
			strNom = "Town and Country";
			intId1 = 62596820100203;
			intId2 = 756841620100203;
			intId3 = 790733920100329;
			intId4 = 62025120100203;
			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;
			}
		break;
	}
}


// JCV 100602 Se agrega funcion para procesar ACCESORIOS MOPAR === //
function A_ProcesaAccMopar(strClaveGen){
	//strLigaBase = "http://www.mopar.com.mx/accesorios/CatAccesorios.asp?Marca=CH&Vehiculo=";
	strLigaBase = "http://exa3/mopar/accesorios/CatAccesorios.asp?Marca=CH&Vehiculo=";
	strLigaFinal = strLigaBase + strClaveGen;
	//alert("Liga final = "+strLigaFinal);
	A_AbreVentana(strLigaFinal);

}

// JCV 100723 Se agrega funcion para procesar FICHA TÉCNICA EN HTML === //
function A_MuestraFichaTec(strClaveGen){
	//alert("voy a mostrar la ficha tecnica del "+ strClaveGen);
	showLayer('divFichaTecnica');
}

function A_CierraFichaTec(){
	//alert("voy a cerrar la ficha tecnica");
	hideLayer('divFichaTecnica')
}


// JCV 100726 Se agrega funcion para procesar PRECIOS EN HTML === //
function A_MuestraPrecios(strClaveGen){
	//alert("voy a mostrar los precios del "+ strClaveGen);
	showLayer('divPrecios');
}

function A_CierraPrecios(){
	//alert("voy a cerrar los precios");
	hideLayer('divPrecios')
}

//JCV 100817 se agrega funcion para certificado premiere night
function A_ImprimeCertPremierNight(){
	var strLiga= "_dcn/CertPremiereNight/index.asp?marca=CH"
	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=CH"
	window.open(strLiga,"certgala","menubar=0,toolbar=0,location=0,status=0,resizable=0,titlebar=0,width=687,height=500,scrollbars=no")
}



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;
	}
}