// JavaScript Document

<!--
//Disable right mouse click Script
//By Maximus (maximus@nsimail.com) w/ mods by DynamicDrive
//For full source code, visit http://www.dynamicdrive.com
///////////////////////////////////

var utime = window.setTimeout("",500);

function clickIE4()
{
	if (event.button==2)
	{
		return false;
	}
}

function clickNS4(e)
{
	if (document.layers||document.getElementById&&!document.all)
	{
		if (e.which==2||e.which==3)
		{
			return false;
		}
	}
}

if (document.layers)
{
	document.captureEvents(Event.MOUSEDOWN);
	document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById)
{
	document.onmousedown=clickIE4;
}

document.oncontextmenu=new Function("return false")
// --> 


function OcultarMostrarMenu(idMenuMostrar, idInfoMostrar)
{
	var mainDiv = document.getElementById("contentServicios").getElementsByTagName("div");
	var mainDivInfoServicios = document.getElementById("contentInfoServicios").getElementsByTagName("div");
	for(i=0; i < mainDiv.length; i++)
	{
		if(mainDiv[i].id == idMenuMostrar)
			mainDiv[i].className = "simple_tab selected";	
		else
			mainDiv[i].className = "simple_tab";	
	}
	for(i=0; i < mainDivInfoServicios.length; i++)
	{
		if(mainDivInfoServicios[i].id != "")
		{
			if(mainDivInfoServicios[i].id == idInfoMostrar)
				mainDivInfoServicios[i].className = "content_space display_block";	
			else
				mainDivInfoServicios[i].className = "content_space display_none";	
		}
	}
}

function OcultarMostrarEquiposCategoria(idMostrar,idLi)
{
	var i = 1;
	var classe;
	while(document.getElementById("divEq"+i))
	{
		document.getElementById("divEq"+i).className = "puntal_oculto"; 
		classe = document.getElementById("li"+i).className; 
		fragmentoClass = classe.split(' ');
		document.getElementById("li"+i).className = fragmentoClass[0]; 
		i++;
	}
	document.getElementById(idMostrar).className = "puntal_visible"; 
	classe = document.getElementById(idLi).className; 
	fragmentoClass = classe.split(' ');
	document.getElementById(idLi).className = fragmentoClass[0]+" selected"; 
	
}

function openlayer(width,heigh,path)
{
	yWithScroll = 0;
    xWithScroll = 0;
    if (window.innerHeight && window.scrollMaxY) {// Firefox
        yWithScroll = window.innerHeight + window.scrollMaxY;
        xWithScroll = window.innerWidth + window.scrollMaxX;
    } else if (document.body.scrollHeight > document.body.offsetHeight) { // all but Explorer Mac
        yWithScroll = document.body.scrollHeight;
        xWithScroll = document.body.scrollWidth;
    } else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
        yWithScroll = document.body.offsetHeight;
        xWithScroll = document.body.offsetWidth;
    }

	document.getElementById("divlayer").style.height = yWithScroll+"px";
	document.getElementById("divlayer").style.width = xWithScroll+"px";
	document.getElementById("ifrmlayer").height = heigh;
	document.getElementById("ifrmlayer").width = width;
	document.getElementById("ifrmlayer").src = path;
	document.getElementById("divlayer").style.display = 'block';
	document.getElementById("divframe").style.display = 'block';
	//alert('');
}

/*function replacestr(str)
{
	str=str.replace(/á/gi,"a");
	str=str.replace(/é/gi,"e");
	str=str.replace(/í/gi,"i");
	str=str.replace(/ó/gi,"o");
	str=str.replace(/ú/gi,"u");

	str=str.replace(/ñ/gi,"n");
}*/

function textCounter(field, field2, countfield, maxlimit) 
{
  if ((field.value.length + field2.value.length) > maxlimit)
    field.value = field.value.substring(0, maxlimit - field2.value.length);
  else 
    countfield.value = maxlimit - (field.value.length + field2.value.length);
}

function redirec()
{
	if(document.getElementById("_ctl0_Buscador1_txtCriterio").value.length<3)
		alert("El Criterio de Búsqueda debe tener por lo menos 3 caracteres");
}

function clearText(idControl)
{
	if(idControl)
	{
		if(idControl.value == "Buscar en comcel.com")
			idControl.value = "";
		else if(idControl.value == "")
			idControl.value = "Buscar en comcel.com";
	}
}

/*function redirecBusqueda()
{
	if(document.getElementById("_ctl0_Buscador1_txtCriterio"))
	{
		alert( document.getElementById("_ctl0_Buscador1_txtCriterio").value)		
		if((document.getElementById("_ctl0_Buscador1_txtCriterio").value.length<3) || document.getElementById("_ctl0_Buscador1_txtCriterio").value == "Buscar en comcel.com")
			alert("El Criterio de Búsqueda debe tener por lo menos 3 caracteres");
	}
	else
	{
		alert( document.getElementById("_ctl0:Buscador1:txtCriterio").value)
		if((document.getElementById("_ctl0:Buscador1:txtCriterio").value.length<3))
			alert("El Criterio de Búsqueda debe tener por lo menos 3 caracteres");	
	}
}*/

function OpenPopup(equ_id)
{
	var x = (screen.width / 2) - 250;
	var y = (screen.height / 2) - 280;
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open('/administradores/popequipo.aspx?equ_id=" + equ_id + "' , 'helpwindow', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,left = " + x + ",top = " + y + ",width=568,height=355');");	
}



function mostrar(idDiv) {	
	var i = 0;
	while(document.getElementById("div"+i))
	{
		ocultar("div"+i);
		i++;
	}
	target = document.getElementById( idDiv );
	if(target != null)
	{		
		target.style.display = "";			
	}	
}

function ocultar(idDiv) {	
	target = document.getElementById( idDiv );			
	if(target != null)		
		target.style.display = "none";	
}

function ocultar1() {	
utime = window.setTimeout ("oculta()", 50);
}

function oculta()
{
	var i = 0;
	while(document.getElementById("div"+i))
	{
		document.getElementById('div'+i+'').style.display='none';
		i++;
	}
}

function mostrar2() {
	//alert("si");	
	var u=window.clearTimeout(utime);	
}

function Roll(id)
{
	document.getElementById('papa'+id).className = "MenuPrincipal";	
	document.getElementById('td'+id).className = "";	
}

function Over(id)
{
	document.getElementById('papa'+id).className = "MenuPrincipalRoll";	
	document.getElementById('td'+id).className = "tdcolor";	
}

function WriteSwf(repImage,repWidth,repHeight){
	
	document.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\""+repWidth+"\" height=\""+repHeight+"\">");
    document.write("<param name=\"movie\" value=\""+repImage+"\">");
    document.write("<param name=\"quality\" value=\"high\">");
    document.write("<param name=wmode value=transparent>");
    document.write("<embed src=\""+repImage+"\" wmode=\"transparent\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\""+repWidth+"\" height=\""+repHeight+"\"></embed>");
   document.write("</object>");
}

function showTime(){
	//alert(document.getElementById)
//if (!document.all || !document.getElementById)
//return
if(!esIE6())
	{	
		var Digital=new Date()
		var hours=Digital.getHours()
		var minutes=Digital.getMinutes()
		var seconds=Digital.getSeconds()
		var dn="am" 
		if (hours>12){
		dn="pm"
		hours=hours-12
		}
		if (hours==0)
		hours=12
		if (minutes<=9)
		minutes="0"+minutes
		if (seconds<=9)
		seconds="0"+seconds
		var ctime=hours+":"+minutes+":"+seconds+""+dn
		//document.getElementById("tick2").innerHTML="<b class='hora'> "+ctime+"</b>";
		//tick2.innerHTML="<b class='hora'> "+ctime+"</b>"
		setTimeout("showTime()",1000)
		dows = new Array("Domingo","Lunes","Martes","Mi\xe9rcoles","Jueves","Viernes","S\xe1bado");
		months = new Array("Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic");
		now = new Date();
		dow = now.getDay();
		d = now.getDate();
		m = now.getMonth();
		h = now.getTime();
		y = now.getUTCFullYear();
		document.getElementById("tick1").innerHTML = dows[dow] + " " + d + " " + months[m] + " " + y + " " + ctime;
		//tick1.innerHTML="<b class='hora'>"+dows[dow]+" "+d+" "+months[m]+" "+y;
	}
}

function esInternetExplorer() {

    var explo = navigator.appName == "Microsoft Internet Explorer";
    return explo;
}

function esIE8() {
    
    if (esInternetExplorer()) {
        var useragent = navigator.appVersion;
        var version = useragent.split(';')[1];
        return version.indexOf("MSIE 8.0") == 1;
    }
    return false;
}

function esIE6() {
    
    if (esInternetExplorer()) {
        var useragent = navigator.appVersion;
        var version = useragent.split(';')[1];
        return version.indexOf("MSIE 6") == 1;
    }
    return false;
}

function esIE7() {
    
    if (esInternetExplorer()) {
        var useragent = navigator.appVersion;
        var version = useragent.split(';')[1];
        return version.indexOf("MSIE 7.0") == 1;
    }
    return false;
}

// Javascript Abrir Equipos

  function OpenPopup(equ_id) { var x = (screen.width / 2) - 230; 
  var y = (screen.height / 2) - 270; 
  day = new Date(); id = day.getTime(); 
  eval("page" + id + " = window.open('http://www.comcel.com/administradores/popequipo.aspx?equ_id=" + equ_id + "' , 'helpwindow', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,left = " + x + ",top = " + y + ",width=570,height=360');");	 
  }
  
  
 
function openPop(delUrl,Width,Height)
  {	
	    window.open(delUrl,'mywindow','width='+ Width + ',height=' + Height,'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0');
  }	
  function __goBanner2(surl,bnewwindow)
	{
	if(bnewwindow)
		{
		childWindow = window.open('/Administradores/showBanner.aspx?gourl='+surl,'IdeasBanner');
		childWindow.opener = blank;
		}
	else
		{
		document.location.href = document.location.href + '?gourl=' + surl;
		}
	}
	

function openPopup(URL,barrascroll, ancho, alto, nombre)
{
	var opciones =  "scrollbars=" + barrascroll + 
					",width=" + ancho +
	                ",height=" + alto; 
	
  var ventana = window.open(URL,nombre,opciones); 
}

	function abrirSuramericanos() 
	{
		window.open("/administradores/suramericanos/home.htm", "popup","width=775px; height=545px,toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,left=0,top=0,");
	}
	
	
		function abrirCruzRoja() 
	{
		window.open("http://www.comcel.com/home/popUpCruz/CruzRoja.htm", "popup","width=440px; height=610px,toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,left=0,top=0,");
	}
	
