
function validarRut(rut,rut_d){
	var M=0,S=1;
	T=rut;
	for(;T;T=Math.floor(T/10))
		S=(S+T%10*(9-M++%6))%11;
	digito= S?S-1:'K';
	if(rut_d.toUpperCase()==digito)
		return true;
	else{
		alert('Rut Inválido');
		return false;
	}
}

function navActivacion(id, nav)
{
  $('.'+nav).removeClass("activo");
  $('#'+id).addClass("activo");
}

function screenAdjust(id){

  var ancho_pantalla =screen.height;
  var alto_pantalla=screen.height;

  var div = document.getElementById(id);
  var ancho_div=div.offsetWidth; //obtener alto de un div
  var alto_div=div.offsetHeight; //obtener alto de un div
 //  document.writeln((alto)/2);

  div.style.marginLeft =  ((ancho_pantalla-(ancho_div/2))/4)+"px";
  div.style.marginTop = ((alto_pantalla - (alto_div*1.6))/4) +"px";

}

function action_enter_login(e){
    var key;

    if(window.event || !e.which){// IE
    key = e.keyCode; // para IE
    }
    else if(e){ // netscape
        key = e.which;
        }
        else{
        return true;
    }

    if(key==13){ //Enter
        validar_ingreso_cliente();
    }
}

function cargar_url_enter(e,url){
    var key;

    if(window.event || !e.which){// IE
    key = e.keyCode; // para IE
    }
    else if(e){ // netscape
        key = e.which;
        }
        else{
        return true;
    }

    if(key==13){ //Enter
        window.location.href=url;
    }
}

function newWindow(theURL,winName,features)
{
  window.open(theURL,winName,features);
}
function abrirPopup(pagina)
{
        newWindow(pagina,'','width=630,height=400,menubar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0,left=100,top=100');
}
