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
			A_RedireccionaHoja("clientes/index.htm");
			break;
		case "CORP_REGCLN_BRC":	//BRC Clientes
			location.href = "brc/index.asp?marca=DG";
			break;
		case "CORP_SRVCLN": 	//Servicio PostVenta
			A_RedireccionaHoja("ServicioPostVenta/index.htm");
			break;

		case "CORP_LEALTAD": 	//Programa de Lealtad
			A_AbreVentana("_dcn/Lealtad_Feb10/index.asp?marca=DG", 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=DG");
			break;

	// === Minisitios === //
		case "MSIT_SEMICER": 	//Vehículos Seminuevos Certificados
			A_RedireccionaHoja("_dcn/minisite/Seminuevos/inicio.asp?marca=DG");
			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;

	// === 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/DodgeMX");
			break;
		case "SITIO_FACEBOOK":
			A_AbreVentana("http://www.facebook.com/pages/Dodge-Mexico/358548171022?created");
			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;
	// === Teaser modelos 2009 === //
		case "ULMOD09":
			showLayer('divSWFTeaserMod2009');
			break;
	}
}

// JCV 091221 Se agrega funcion para procesar COMPARATIVOS === //
function A_ProcesaComparativos(strClave, strVer){
	switch (strClave) {
		case "ATOS10":
		/*
		v1=Atos 1.1L BASICO 2010
		v2=Atos 1.1L BASICO AC 2010
		v3=Atos 1.1L LUJO 2010
		*/
			switch (strVer) {
				case "v1":
					A_AbreVentana("http://200.57.136.114/Carspecs3/ComparadorCarspecs/ComparadorCarspecs.html?vehicleId=62551620100108&make=Dodge&model=Atos", 1024, 768, "menubar=0,toolbar=0,location=0,status=0,resizable=0,titlebar=0,scrollbars=yes");
				break;
				case "v2":
					A_AbreVentana("http://200.57.136.114/Carspecs3/ComparadorCarspecs/ComparadorCarspecs.html?vehicleId=756840720100108&make=Dodge&model=Atos", 1024, 768, "menubar=0,toolbar=0,location=0,status=0,resizable=0,titlebar=0,scrollbars=yes");
				break;
				case "v3":
					A_AbreVentana("http://200.57.136.114/Carspecs3/ComparadorCarspecs/ComparadorCarspecs.html?vehicleId=62551520100108&make=Dodge&model=Atos", 1024, 768, "menubar=0,toolbar=0,location=0,status=0,resizable=0,titlebar=0,scrollbars=yes");
				break;

			}
		break;
		case "ATTI10":
		/*
		v1=Attitude 1.4L GL 4DRS MT 2010
		v2=Attitude 1.6L GL 4DRS AT 2010
		v3=Attitude 1.6L GLS 4DRS TM 2010
		v4=Attitude 1.6L GLS 4DRS AT 2010
		*/
			switch (strVer) {
				case "v1":
					A_AbreVentana("http://200.57.136.114/Carspecs3/ComparadorCarspecs/ComparadorCarspecs.html?vehicleId=729966120100108&make=Dodge&model=Attitude", 1024, 768, "menubar=0,toolbar=0,location=0,status=0,resizable=0,titlebar=0,scrollbars=yes");
				break;
				case "v2":
					A_AbreVentana("http://200.57.136.114/Carspecs3/ComparadorCarspecs/ComparadorCarspecs.html?vehicleId=729966220100108&make=Dodge&model=Attitude", 1024, 768, "menubar=0,toolbar=0,location=0,status=0,resizable=0,titlebar=0,scrollbars=yes");
				break;
				case "v3":
					A_AbreVentana("http://200.57.136.114/Carspecs3/ComparadorCarspecs/ComparadorCarspecs.html?vehicleId=790060120100108&make=Dodge&model=Attitude", 1024, 768, "menubar=0,toolbar=0,location=0,status=0,resizable=0,titlebar=0,scrollbars=yes");
				break;
				case "v4":
					A_AbreVentana("http://200.57.136.114/Carspecs3/ComparadorCarspecs/ComparadorCarspecs.html?vehicleId=729966320100108&make=Dodge&model=Attitude", 1024, 768, "menubar=0,toolbar=0,location=0,status=0,resizable=0,titlebar=0,scrollbars=yes");
				break;
			}
		break;
		case "AVEN10":
		/*
		v1=Avenger 2.0L SE MTX 2010
		v2=Avenger 2.4L SE ATX 2010
		v3=Avenger 2.4L SXT ATX 2010
		v4=Avenger 2.4L SXT ATX SPORT 2010
		*/
			switch (strVer) {
				case "v1":
					A_AbreVentana("http://200.57.136.114/Carspecs3/ComparadorCarspecs/ComparadorCarspecs.html?vehicleId=742184520100108&make=Dodge&model=Avenger", 1024, 768, "menubar=0,toolbar=0,location=0,status=0,resizable=0,titlebar=0,scrollbars=yes");
				break;
				case "v2":
					A_AbreVentana("http://200.57.136.114/Carspecs3/ComparadorCarspecs/ComparadorCarspecs.html?vehicleId=742184620100108&make=Dodge&model=Avenger", 1024, 768, "menubar=0,toolbar=0,location=0,status=0,resizable=0,titlebar=0,scrollbars=yes");
				break;
				case "v3":
					A_AbreVentana("http://200.57.136.114/Carspecs3/ComparadorCarspecs/ComparadorCarspecs.html?vehicleId=742184720100108&make=Dodge&model=Avenger", 1024, 768, "menubar=0,toolbar=0,location=0,status=0,resizable=0,titlebar=0,scrollbars=yes");
				break;
				case "v4":
					A_AbreVentana("http://200.57.136.114/Carspecs3/ComparadorCarspecs/ComparadorCarspecs.html?vehicleId=742061820100108&make=Dodge&model=Avenger", 1024, 768, "menubar=0,toolbar=0,location=0,status=0,resizable=0,titlebar=0,scrollbars=yes");
				break;
			}
		break;
		case "CHAL10":
		/*
		v1=Challenger 5.7L RT 2010
		v2=Challenger 6.1L SRT-8 2010
		*/
			switch (strVer) {
				case "v1":
					A_AbreVentana("http://200.57.136.114/Carspecs3/ComparadorCarspecs/ComparadorCarspecs.html?vehicleId=742068320100108&make=Dodge&model=Challenger", 1024, 768, "menubar=0,toolbar=0,location=0,status=0,resizable=0,titlebar=0,scrollbars=yes");
				break;
				case "v2":
					A_AbreVentana("http://200.57.136.114/Carspecs3/ComparadorCarspecs/ComparadorCarspecs.html?vehicleId=756913920100108&make=Dodge&model=Challenger", 1024, 768, "menubar=0,toolbar=0,location=0,status=0,resizable=0,titlebar=0,scrollbars=yes");
				break;
			}
		break;
		case "CHAR10":
		/*
		v1=Charger 3.5L SXT 2010
		v2=Charger 5.7L R/T 2010
		v3=Charger 6.1L SRT-8 2010
		*/
			switch (strVer) {
				case "v1":
					A_AbreVentana("http://200.57.136.114/Carspecs3/ComparadorCarspecs/ComparadorCarspecs.html?vehicleId=729960620100108&make=Dodge&model=Charger", 1024, 768, "menubar=0,toolbar=0,location=0,status=0,resizable=0,titlebar=0,scrollbars=yes");
				break;
				case "v2":
					A_AbreVentana("http://200.57.136.114/Carspecs3/ComparadorCarspecs/ComparadorCarspecs.html?vehicleId=729960720100108&make=Dodge&model=Charger", 1024, 768, "menubar=0,toolbar=0,location=0,status=0,resizable=0,titlebar=0,scrollbars=yes");
				break;
				case "v3":
					A_AbreVentana("http://200.57.136.114/Carspecs3/ComparadorCarspecs/ComparadorCarspecs.html?vehicleId=737155120100108&make=Dodge&model=Charger", 1024, 768, "menubar=0,toolbar=0,location=0,status=0,resizable=0,titlebar=0,scrollbars=yes");
				break;
			}
		break;
		case "JOUR10":
		/*
		v1=Journey 2.4L SE 2010
		v2=Journey 2.4L SXT 5 PASAJEROS 2010
		v3=Journey 2.4L SXT 7 PASAJEROS 2010
		v4=Journey 3.5L RT 2010
		v5=Journey 3.5L SXT PREMIUM 2010
		*/
			switch (strVer) {
				case "v1":
					A_AbreVentana("http://200.57.136.114/Carspecs3/ComparadorCarspecs/ComparadorCarspecs.html?vehicleId=756849120100108&make=Dodge&model=Journey", 1024, 768, "menubar=0,toolbar=0,location=0,status=0,resizable=0,titlebar=0,scrollbars=yes");
				break;
				case "v2":
					A_AbreVentana("http://200.57.136.114/Carspecs3/ComparadorCarspecs/ComparadorCarspecs.html?vehicleId=742067520100108&make=Dodge&model=Journey", 1024, 768, "menubar=0,toolbar=0,location=0,status=0,resizable=0,titlebar=0,scrollbars=yes");
				break;
				case "v3":
					A_AbreVentana("http://200.57.136.114/Carspecs3/ComparadorCarspecs/ComparadorCarspecs.html?vehicleId=742067620100108&make=Dodge&model=Journey", 1024, 768, "menubar=0,toolbar=0,location=0,status=0,resizable=0,titlebar=0,scrollbars=yes");
				break;
				case "v4":
					A_AbreVentana("http://200.57.136.114/Carspecs3/ComparadorCarspecs/ComparadorCarspecs.html?vehicleId=756849320100108&make=Dodge&model=Journey", 1024, 768, "menubar=0,toolbar=0,location=0,status=0,resizable=0,titlebar=0,scrollbars=yes");
				break;
				case "v5":
					A_AbreVentana("http://200.57.136.114/Carspecs3/ComparadorCarspecs/ComparadorCarspecs.html?vehicleId=756849220100108&make=Dodge&model=Journey", 1024, 768, "menubar=0,toolbar=0,location=0,status=0,resizable=0,titlebar=0,scrollbars=yes");
				break;
			}
		break;
		case "NITRO10":
		/*
		v1=Nitro 3.7L ATX 4X2 2010
		v2=Nitro 3.7L SXT PREMIUM AT 4X2 2010
		*/
			switch (strVer) {
				case "v1":
					A_AbreVentana("http://200.57.136.114/Carspecs3/ComparadorCarspecs/ComparadorCarspecs.html?vehicleId=737146920100108&make=Dodge&model=Nitro", 1024, 768, "menubar=0,toolbar=0,location=0,status=0,resizable=0,titlebar=0,scrollbars=yes");
				break;
				case "v2":
					A_AbreVentana("http://200.57.136.114/Carspecs3/ComparadorCarspecs/ComparadorCarspecs.html?vehicleId=742186820100108&make=Dodge&model=Nitro", 1024, 768, "menubar=0,toolbar=0,location=0,status=0,resizable=0,titlebar=0,scrollbars=yes");
				break;
			}
		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 090918 - Se agrega función para ocultar teaser
function TerminaTeaser(strUbi){
	switch(strUbi){
		case "HOME":
			hideLayer('contFlashVideo');
		break;
		case "H100":
			hideLayer('contFlhVideoH100');
		break;
		case "MOD09":
			hideLayer('contFlashTeaser');
		break;
		case "RENOV":
			hideLayer('contFlashVideo');
		break;

	}
}

// JCV 091026 - Se agrega función para descargar wallpapers
function A_DescargaWallpaper(strClaveGen, strNumWP){
	//alert("DescargaWallpaper, ClaveGen="+strClaveGen+" | NumWP="+strNumWP);
	A_AbreVentana("wallpapers.asp?ClaveGen="+strClaveGen+"&NumWP="+strNumWP, 800, 690);
}


// ====================================================================================
// 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;
	}
}

function A_ProcesaClavePlan(clave, uid) {
	alert("uid = "+uid);
}
