
function ReSize(divID)
{
	objFullContent = document.getElementById(divID);
	h = objFullContent.offsetHeight + "px";
	if(objFullContent.offsetHeight == 0)
	{
		h = document.documentElement.offsetHeight + "px";
	}
	window.parent.SetIframeHeight(h);
}

function ReSize1(divID)
{
	objFullContent = document.getElementById(divID);
	h = objFullContent.offsetHeight + "px";
	if(objFullContent.offsetHeight == 0)
	{
		h = document.documentElement.offsetHeight + "px";
	}
}


function MostrarOcultarMenu(div)
{
	//alert(div.id);
	//debugger;
	//CerrarDivs();
	//var id = div.id.split("_")[0];//id div padre
	var id = div.split("_")[0];//id div padre
	var menu = document.getElementById("divMenu");//obtiene el div que contiene los div del menu
	var elementosmenu = menu.getElementsByTagName('div');// obtiene todos los divs que forman el menu
	for(i = 0; i < elementosmenu.length;i++)
	{
		var iddiv = elementosmenu[i].id;//obtiene el div en la posicion i
		var idsMenu = iddiv.split("_");//obtiene el div padre (posicion 0), y el div hijo (posicion  1)
		if(idsMenu.length == 2 && id == idsMenu[1])
		{
			var div1 = document.getElementById(idsMenu.join("_"));						
			if(div1.style.display == "block")
			{
				div1.style.display = "none";
			}
			else
			if(div1.style.display == "none")
			{
				div1.style.display = "block";
			}
		}
	}
	menu = MenuClaro.GuardarMenu(menu.innerHTML).value;
}
function CerrarDivs()
{
	debugger;
	var menu = document.getElementById("divMenu");//obtiene el div que contiene los div del menu
	var elementosmenu = menu.getElementsByTagName('div');// obtiene todos los divs que forman el menu
	var divs="";
	for(i = 0; i < elementosmenu.length;i++)
	{
		var iddiv = elementosmenu[i].id;
		var idsMenu = iddiv.split("_");
		if(idsMenu[1] != "-1")
		{
			elementosmenu[i].style.display = "none";
			divs +=iddiv +" ";
		}
	}
	alert(divs);
}
function CambiarEstiloMenu(div,estilomenu)
{
	//debugger;
	div.className = estilomenu;
}
/**
//escribe en la pagina html un falsh sin borde 
*/
function WriteSwfID(img,wsize,hsize,id)
{
	document.write("<OBJECT classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0\" WIDTH=\""+wsize+"\" HEIGHT=\""+hsize+"\" ID=\""+id+"\">");
	document.write("<PARAM NAME=\"MOVIE\" VALUE=\""+img+"\">");
	document.write("<PARAM NAME=\"PLAY\" VALUE=\"TRUE\">");
	document.write("<PARAM NAME=\"LOOP\" VALUE=\"TRUE\">");
	document.write("<PARAM NAME=\"WMODE\" VALUE=\"transparent\">");
	document.write("<PARAM NAME=\"QUALITY\" VALUE=\"HIGH\">");
	document.write("<PARAM NAME=\"SCALE\" VALUE=\"showall\">");
	document.write("<EMBED NAME=\""+id+"\" swLiveConnect=\"true\" SRC=\""+img+"\" SCALE=\"showall\" PLAY=\"true\" LOOP=\"true\" WMODE=\"transparent\" QUALITY=\"high\" WIDTH=\""+wsize+"\" HEIGHT=\""+hsize+"\" TYPE=\"application/x-shockwave-flash\" PLUGINSPAGE=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\"></EMBED>");
	document.write("</OBJECT>");	
}

/**
abre el popup de 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('/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=580,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 Tag35gclaro(){
	
	var strurl= document.location.href;
	
	var obj = strurl.split('http://www.claro.com.pa/');	
	
	//alert(obj[0]);

	//urchinTracker(obj[0]);
	
}


function TagBanners(banner){
	
	var strurl= document.location.href;
	
	var obj = strurl.split('http://www.claro.com.pa/');	
	
	//alert(banner+"-"+obj[1]);

	//urchinTracker(banner+"-"+obj[1]);
	
}

function SoloNumeros(evt)
{
	var nav4 = window.Event ? true : false;
	// NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57
	var key = nav4 ? evt.which : evt.keyCode;

	if (esIE8())
	    key = evt.keyCode;
	
	return (key <= 13 || (key >= 48 && key <= 57));
}

function SoloLetras(evt)
{
	var nav4 = window.Event ? true : false;
	// NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57
	var key = nav4 ? evt.which : evt.keyCode;

	if (esIE8())
	    key = evt.keyCode;
	
	return (key <= 13 || (key >= 65 && key <= 90) || (key >= 97 && key <= 122) || key==32 || key==225 || key==233 || key==237 || key==243 || key==250 || key==241);
}



//
//Examinar
addEvent = function(obj, type, fn) {
    if (obj.addEventListener)
        obj.addEventListener(type, fn, false);
    else if (obj.attachEvent) {
        obj["e" + type + fn] = fn;
        obj[type + fn] = function() { obj["e" + type + fn](window.event); };
        obj.attachEvent("on" + type, obj[type + fn]);
    }
}
bc_newElement = function(tag) {
    return document.createElement(tag);
}
bc_getElement = function(id) {
    return document.getElementById(id);
}

var field_count = 1;
var optionvald = 1;
bc_init = function(fileId, displayId) {
    try {
        field = bc_getElement(fileId);
        field.display = bc_getElement(displayId)  ;

        if (!field || !field.type || field.type != 'file' || !field.display) return;

        addEvent(field, 'change', bc_addField);
    } catch (ex) { bc_handleError(ex); }
}

bc_load = function(fileId, displayId, optio) {
    //alert('');
    optionvald = optio;
    addEvent(window, 'load', new Function("bc_init('" + fileId + "', '" + displayId + "');"));
}
bc_addField = function() {
    var obj = $(this.id);
    if (optionvald == 1) {
        var namefile = obj.value.toString();
        if (!validateimgs(namefile)) {
            alert("Solo se permiten archivos tipo imagen (jpg o pdf).");
            return;
        }
    }
    else {
        if (!validatefiles(obj.value)) {
            alert("No se permiten archivos ejecutables.");
            return;
        }
    }

    if(NUM_CARGADOS>=5)
    {
		alert("No puedes cargar más de 5 archivos");
		return;
    }
    
    if (this.id.indexOf('ifEx') == -1) {
        try {
            new_field = bc_newElement('INPUT');
            new_field.type = 'file';
            new_field.id = new_field.name = this.id.replace(/-@bc-.*$/g, "") + '-@bc-' + field_count++;
            new_field.className = 'file';
            new_field.display = this.display;
            addEvent(new_field, 'change', bc_addField);

            this.parentNode.insertBefore(new_field, this);

            li = bc_newElement('LI');

            a = bc_newElement('A');
            a.href = "#";
            a.appendChild(document.createTextNode('Quitar'));
            a.field_id = this.id;
            addEvent(a, 'click', bc_removeField);

            li.appendChild(a);
            li.appendChild(document.createTextNode('  ' + this.value.substring(this.value.search(/[^\/\\]+$/))));
            this.display.appendChild(li);

            this.style.position = 'absolute';
            this.style.left = '-1000px';
            NUM_CARGADOS++;
        } catch (ex) { bc_handleError(ex); }
    }
    else {
        document.getElementById('txtExaminar').value = this.value;
    }
}
bc_removeField = function(event) {
    try {
        (del = bc_getElement(this.field_id)).parentNode.removeChild(del);

        this.parentNode.parentNode.removeChild(this.parentNode);
        NUM_CARGADOS--;
        if (event && event.preventDefault)
            event.preventDefault();
        return false;
    } catch (ex) { bc_handleError(ex); }
}
//bc_handleError = function(ex) { alert(ex); }

/*function dur() {
    var ids = document.getElementsByTagName('LI');
    alert(ids.length)
}*/

var NUM_CARGADOS = 0;

//Fin Examin



function validateimgs(value) {
    var b = value.split('.');
    var valid = /^(jpg|pdf)$/.test(b[b.length - 1].toLowerCase());
    return valid;
}
function validatefiles(value) {
    var b = value.split('.');
    var valid = /^(exe|dll)$/.test(b[b.length - 1].toLowerCase());
    return !valid;    
}

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;
}
