﻿function hover_menu(id) {
    if (document.getElementById(id)) {
        document.getElementById(id).className = 'ops_selected';
    }
}

function customer_selected(id) {
    if (document.getElementById(id)) {
        document.getElementById(id).className = 'selected_menu_admin';
        
    }
}
/*Funcion para seleccionar boton por defecto en los formularios*/
function tabular(id){
    var b = document.getElementById(id);
	if (b && typeof(b.click) == 'undefined') b.click = function() {
	    var result = true; 
	    if (b.onclick) result = b.onclick(); 
	    if (typeof(result) == 'undefined' || result) { 
	        eval(b.getAttribute('href'));  
	    } 
	}
}
		
/* Funcion para solamente ingresar números */
function AcceptNum(evt) {
    var nav4 = window.Event ? true : false;

    var key = nav4 ? evt.which : evt.keyCode;
    

    
    return (key <= 13 || (key >= 48 && key <= 57) || key == 44 || key==46);
    
}




//**********FUNCTIONS DAY VALIDATOR*********************
//--------------DROPDOWNLIST-------------------------


//id: dia, id2: mes, id3: anio

function validarFecha(id1,id2,id3) {
    var dia = document.getElementById(id1);
    var mes = document.getElementById(id2);
    var anio = document.getElementById(id3);

    var elMes = parseInt(mes.value);

    if(elMes>12){
    return 1;
    }
    // MES FEBRERO
    if(elMes == 2){
        
        if(esBisiesto(anio.value)){
            
            if(parseInt(dia.value) > 29){
            
            dia.value="29";
            }
            
        }
        else {
            if(parseInt(dia.value) > 28){
            dia.value="28";
            }
            
        }
    }
    //RESTO DE MESES
    
    if(elMes== 4 || elMes==6 || elMes==9 || elMes==11){
        if(parseInt(dia.value) > 30){
            dia.value="30";
        }
       
    }
}


function esBisiesto(anio)
{
var BISIESTO;
    if(parseInt(anio)%4==0){
        if(parseInt(anio)%100==0){
            if(parseInt(anio)%400==0){
                BISIESTO=true;
            }
            else{
                BISIESTO=false;
            }
        }
        else{
            BISIESTO=true;
        }
        }
    else{
        BISIESTO=false;
        
    }
     return BISIESTO;
}
//***************************************************************



 
/* funcion para validar campos en sendSms.ascx*/
function validateTB() {

var arr_dest = new Array();
var arr_phone = new Array();
var sigue="";

for (i=1; i<4; i++){
    arr_dest[i] = document.getElementById("ctl00_ContentPlaceHolder1_ctlSendSms_smsDest" + i + "_tbCountryCode");
    
}
for (i=1; i<4; i++){
    arr_phone[i]=document.getElementById("ctl00_ContentPlaceHolder1_ctlSendSms_smsDest"+i+"_tbPhoneNumber");
}

for (i = 1; i < 4; i++) {
    if(arr_dest[i].value != "" && arr_phone[i].value != ""){
        sigue=1;
    }
}
document.getElementById("ctl00_ContentPlaceHolder1_ctlSendSms_HiddenField1").value = sigue;
}
/*fin de la funcion*/


/* funcion para resaltar las imagenes cuandos e haga click en ellas, aplica para BuyCredit*/
image = new Array();
for (i = 1; i < 5; i++) { image[i] = new Image(); }
for (i = 1; i < 5; i++) { image[i].src = "Images/crd_" + i + ".gif"; }

function cambiar(id) {
    for (i = 1; i < 5; i++) {
        obj = document.getElementById('checkbox_' + i);
        if (i == id) { obj.src = "Images/crd_" + i + "_2.gif"; }
        else { obj.src = image[i].src; }
    }
}
/*fin de la funcion*/