function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function derecha(e) {
	if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2)){
		return false;
	}	else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2)){
		return false;
	}
}
	document.onmousedown=derecha
var detect = navigator.userAgent.toLowerCase();
var OS,browser,version,total,thestring;
if (checkIt('konqueror')){
	browser = "Konqueror";
	OS = "Linux";}
else if (checkIt('chrome')) browser = "Chrome"
else if (checkIt('safari')) browser = "Safari"
else if (checkIt('firefox')) browser = "Firefox"
else if (checkIt('omniweb')) browser = "OmniWeb"
else if (checkIt('opera')) browser = "Opera"
else if (checkIt('webtv')) browser = "WebTV";
else if (checkIt('icab')) browser = "iCab"
else if (checkIt('msie 4')) browser = "Internet Explorer 4"
else if (checkIt('msie 5')) browser = "Internet Explorer 5"
else if (checkIt('msie 6.0')) browser = "Internet Explorer 6"
else if (checkIt('msie 7.0')) browser = "Internet Explorer 7"
else if (checkIt('msie 8.0')) browser = "Internet Explorer 8"
else if (checkIt('msie')) browser = "Internet Explorer"
else if (!checkIt('compatible')){
	browser = "Netscape Navigator"
	version = detect.charAt(8);}
else browser = "An unknown browser";
if (!version) version = detect.charAt(place + thestring.length);
if (!OS){
	if (checkIt('linux')) OS = "Linux";
	else if (checkIt('x11')) OS = "Unix";
	else if (checkIt('mac')) OS = "Mac"
	else if (checkIt('win')) OS = "Windows"
	else OS = "an unknown operating system";
}
function checkIt(string){
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}
function init() {
	//alert(browser);
	//getgGMT6 ();
	//if (document.getElementById('abreDetalleAmplia')) abreDetalle ('Amplia');
	if(document.getElementById('mainHome')){
		document.getElementById('mainHome').style.overflowX = 'hidden';
		document.getElementById('mainHome').style.overflowY = 'auto';
	}
	if (browser == 'Internet Explorer 6'){
		if (document.getElementById('centro')){
			alto = document.getElementById('leftMenu').offsetHeight-100;
			document.getElementById('centro').style.height = alto+"px";
		}
		if(document.getElementById('mainHome')){
			document.getElementById('mainHome').style.height = "380px";
		}
		document.getElementById('centroAtencion').style.width = "325px";
		document.getElementById('cotizaFooter').style.marginLeft = "110px";
		document.getElementById('cotizaFooter').style.width = "250px";
		if(document.getElementById('lightwindow_galleries_list')){
			document.getElementById('lightwindow_galleries_list').style.filter =  "alpha(opacity=70)"
		}
		if(document.getElementById('cotizaForm')){
			alto = document.getElementById('leftMenu').offsetHeight-200;
			document.getElementById('cotizaForm').style.height = alto+"px";
		}
	}
	if ((browser == 'Internet Explorer 5') ||(browser == 'Internet Explorer 4')){
		if (document.getElementById('centro')){
			alto = document.getElementById('leftMenu').offsetHeight-110;
			document.getElementById('centro').style.height = alto+"px";
		}
		if(document.getElementById('formaDPago')){
			document.getElementById('formaDPago').style.width = "320px";
		}
		if(document.getElementById('mainHome')){
			document.getElementById('mainHome').style.height = "380px";
		}
		if(document.getElementById('accesoCentral')){
			document.getElementById('accesoCentral').style.textAlign = "center";
		}
		document.getElementById('container').style.width = "980px";
		if (document.getElementById('cotizaForm')){
			alto = document.getElementById('leftMenu').offsetHeight-200;
			document.getElementById('cotizaForm').style.marginLeft = "100px"
			document.getElementById('cotizaForm').style.height = alto+"px";
		}
		if (document.getElementById('lightwindow_galleries_list')){
			document.getElementById('lightwindow_galleries_list').style.filter =  "alpha(opacity=70)";
		}
	}
	if (browser == 'Safari') {
		document.getElementById('terminos').style.paddingBottom = "4px";
		document.getElementById('terminos').style.paddingTop = "3px";
	}
	if ((browser == 'Opera') && (OS == 'Mac')){
		document.getElementById('terminos').style.paddingTop = "4px";
		document.getElementById('terminos').style.paddingBottom = "3px";
	}
	/*if (browser == 'Opera') {
		document.getElementById('main').style.marginLeft = "30px";
		document.getElementById('horaMex').style.marginTop = "1px";
	}*/
	if (browser == 'Opera'){
		document.getElementById('lineaTiempo').style.paddingTop = "3px";
	}

}
function redimensiona (){
	if ((browser == 'Internet Explorer 6') || (browser == 'Internet Explorer 5') ||(browser == 'Internet Explorer 4')){
		alto = document.getElementById('leftMenu').offsetHeight;
		if (document.getElementById('cotizaForm')){
			document.getElementById('cotizaForm').style.height = alto+"px";
		}
		if (document.getElementById('contenido')){
			if (!document.getElementById('acordeonCompara')){
				document.getElementById('contenido').style.height = alto+"px";
			} /*else {
				alert('aqui esta el div del acordeon en Compara');
				document.getElementById('contenido').style.height = alto+"px";
			}*/
		}
		if (document.getElementById('centro')){
			document.getElementById('centro').style.height = alto+"px";
		}
	}
}
 function initWindow (){
	if ((browser == 'Internet Explorer 5') ||(browser == 'Internet Explorer 4')){
		document.getElementById('mainContacto').style.width = "600px";
		document.getElementById('centroAtencionContacto').style.width = "280px";
		document.getElementById('cotizaContacto').style.width = "280px";
		document.getElementById('centroAtencionContacto').style.marginBottom = "15px";
		document.getElementById('cotizaContacto').style.marginBottom = "15px";
	}
}

function creaEmbed(pelicula,ancho,alto) {
	cadena='<embed src="' + pelicula + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + ancho + '" height="' + alto + '" wmode="transparent"></embed>'
	document.write(cadena)
}

function miBorde(){
	theObjects = document.getElementsByTagName("object");
	for (var i = 0; i < theObjects.length; i++) {
		theObjects[i].outerHTML = theObjects[i].outerHTML;
	}
}
function muestraVentana(pagina, ancho, alto, titulo)   {
	if ((browser == 'Internet Explorer 5') ||(browser == 'Internet Explorer 4')){
		window.open( pagina, titulo ,'width='+ancho+',height='+alto+',toolbar=0, menuBar=1,scrollBars=0 resizable=0');
	} else {
		myLightWindow.activateWindow({href: pagina, params: 'lightwindow_type=external,lightwindow_width='+ancho+',lightwindow_height='+alto, title: titulo});
	}
}
function muestraFormaPago (){
	formaPag = document.getElementById('formaDePago');
	for (i=1; i<formaPag.options.length; i++) {
		borrar = formaPag.options[i].value;
		document.getElementById(borrar).style.display = 'none';
	}
	document.getElementById(formaPag.value).style.display = 'block';
}
function muestraCargando(titulo) {
    var pagina = "http://localhost/sComMx_site/html/precargador.html";
    var ancho = 500;
    var alto = 500;
    if ((browser == 'Internet Explorer 5') || (browser == 'Internet Explorer 4')) {
        window.open(pagina, titulo, 'width=' + ancho + ',height=' + alto + ',toolbar=0, menuBar=1,scrollBars=0 resizable=0');
    } else {
    myLightWindow.activateWindow({ href: pagina, params: 'lightwindow_type=external,lightwindow_loading_animation=false,lightwindow_width=' + ancho + ',lightwindow_height=' + alto, title: titulo });
    }
}


function muestraAMIIPCI (){
	muestraVentana('https://www.sellosdeconfianza.org.mx/MuestraCertificado.php?NUMERO_SERIE=0688','520','616','Certificado');
}
function muestraVerisign () {
	muestraVentana('https://seal.verisign.com/splash?form_file=fdf/splash.fdf&dn=WWW.S.COM.MX&lang=en','540','500', 'Certificados');
}
function conductorAdd(siNo) {
	if (siNo) {
		document.getElementById('fechNacCA').style.display = "none";
	} else {
		document.getElementById('fechNacCA').style.display = "block";
	}
}
function muestraKpa (kpa) {
	document.getElementById(kpa).style.visibility = "visible";
}
function ocultaKpa (kpa) {
	document.getElementById(kpa).style.visibility = "hidden";
}
function muestraOpinion (capa, sh) {
	if (sh==1) {
		document.getElementById(capa).style.display = "none";
	} else {
		document.getElementById(capa).style.display = "block";
	}
}
function muestraPreg(preg, siNo){
	if (siNo==1) {
		document.getElementById(preg).style.display = "none";
	} else {
		document.getElementById(preg).style.display = "block";
	}
}
function abreDetalle (cobertura) {
	var divsCobertura = new Array()
	divsCobertura[0] = 'detalleAmplia'
	divsCobertura[1] = 'cierraDetalleAmplia'
	divsCobertura[2] = 'detalleAmpliaPlus'
	divsCobertura[3] = 'cierraDetalleAmpliaPlus'
	divsCobertura[4] = 'detalleLimitada'
	divsCobertura[5] = 'cierraDetalleLimitada'
	divsCobertura[6] = 'detalleRC'
	divsCobertura[7] = 'cierraDetalleRC'
	var btnVer = new Array ()
	btnVer[0] = 'abreDetalleAmplia' 
	btnVer[1] = 'abreDetalleAmpliaPlus' 
	btnVer[2] = 'abreDetalleLimitada' 
	btnVer[3] = 'abreDetalleRC' 

	for (i=0; i<divsCobertura.length; i++){
	    if(document.getElementById(divsCobertura[i]))
		    document.getElementById(divsCobertura[i]).style.display = 'none';
	}
	for (j=0; j<btnVer.length; j++){
	    if(document.getElementById(btnVer[j]))
		    document.getElementById(btnVer[j]).style.display = 'block';
	}
	document.getElementById('abreDetalle'+cobertura).style.display = 'none';
	document.getElementById('detalle'+cobertura).style.display = 'block';
	document.getElementById('cierraDetalle'+cobertura).style.display = 'block';
}
function smallFont(){
    document.getElementById('main').style.fontSize = 9+"px";
}
function bigFont(){
    document.getElementById('main').style.fontSize = 13+"px";
}
function normalFont(){
    document.getElementById('main').style.fontSize = 11+"px";
}
function imprimeContainer(){
    var imprimeContenido = document.getElementById('main');
    var HTMLs = "<html><header><style>body { font-family: Arial, Helvetica, sans-serif; font-size: 11pt;color: #000;} #usability { display: none;}</style></header><body>";
    var ventanaImpresion = window.open(' ', 'popUpImpresion');
    ventanaImpresion.document.write (HTMLs);
    ventanaImpresion.document.write (imprimeContenido.innerHTML);
    ventanaImpresion.document.write ('</body></html>');
    ventanaImpresion.document.close();
    ventanaImpresion.print();
    ventanaImpresion.close();
}
function muestraMenuPress( menu) {
	document.getElementById('menuGaleria').style.display = "none";
	document.getElementById('menuAcerca').style.display = "none";
	document.getElementById(menu).style.display = "block";
}
function disableEnterKey(e)
{
     var key;     
     if(window.event)
          key = window.event.keyCode; //IE
     else
          key = e.which; //firefox     
     return (key != 13);
}
