var popUp; 
function OpenCalendar(idname, postBack)
{
	popUp = window.open('/MunLima/Controles/Calendar.aspx?formname=' + document.forms[0].name + 
		'&id=' + idname + '&selected=' + document.forms[0].elements[idname].value + '&postBack=' + postBack, 
		'popupcal', 
		'width=165,height=208,left=429.5,top=280');
}

function PopupAlojamiento(URL)
       { popUp = window.open(URL ,'Detalles',
        'width=650, height=340, left=402, top=259, scrollbars=no,menubar=no, location=no, help=no ,resizable=no');
       }


function SetDate(formName, id, newDate, postBack)
{
	eval('var theform = document.' + formName + ';');
	popUp.close();
	theform.elements[id].value = newDate;
	if (postBack)
		__doPostBack(id,'');
}		
function Print()
{
	window.print();
}

function SetDate(formName, id, newDate, postBack)
{
	eval('var theform = document.' + formName + ';');
	popUp.close();
	theform.elements[id].value = newDate;
	if (postBack)
		__doPostBack(id,'');
}	

function SetPostbackNoClose(id)
{
	__doPostBack(id,'');
}	

function SetPostback(id)
{
       popUp.close();
	__doPostBack(id,'');
}


 // Inicio buscador
 function SubmitOnEnter(myfield, e)  
 {  
     var keycode;  
     if (window.event)  
         keycode = window.event.keyCode;  
     else if (e)  
         keycode = e.which;  
     else  
         return true;  
     if (keycode == 13)  
     {  
         SearchSite();  
         return false;  
     }  
     else  
         return true;  
 }
   
 function SearchSite()  
 {  
 //document.location.href='http://200.60.130.182/MunLima/Buscar/Resultados.aspx?cx=000281850906638204004:k26vlk-rocy&cof=FORID:11&ie=UTF-8&q=' + document.getElementById('q').value + '&sa=Buscar';  
 //Cambiar la URL de dominio para publicar
 document.location.href='http://www.munlima.gob.pe/Buscar/Resultados.aspx?cx=000281850906638204004:k26vlk-rocy&cof=FORID:11&ie=UTF-8&q=' + document.getElementById('q').value + '&sa=Buscar';  

 } 
 //fin buscador
 
 
 // Camino hacia los Estándares de la web - Lucar Capristano
/* 
 Onload 
*/ 
window.onload = initCSS; 
// initCSS: If there's a "mystyle" cookie, set the active stylesheet when the page loads 
function initCSS() { 
 var style = readCookie("mystyle"); 
 if (style) { 
 activeCSS(style); 
 } 
} 
/* 
 Switcher functions 
*/ 
// activeCSS: Set the active stylesheet 
function activarCSS(title) { 
 var i, oneLink; 
 for (i = 0; (oneLink = document.getElementsByTagName("link")[i]); i++) { 
 if (oneLink.getAttribute("title") && findWord("stylesheet", oneLink.getAttribute("rel"))) { 
 oneLink.disabled = true; 
 if (oneLink.getAttribute("title") == title) { 
 oneLink.disabled = false; 
 } 
 } 
 } 
 setCookie("mystyle", title, 365); 
} 
// findWord: Used to find a full word (needle) in a string (haystack) 
function findWord(needle, haystack) { 
 var init = needle + "\\b"; 
 return haystack.match(needle + "\\b"); 
} 
/* 
 Cookie functions 
*/ 
// Set the cookie 
function setCookie(name,value,days) { 
 if (days) { 
 var date = new Date(); 
 date.setTime(date.getTime()+(days*24*60*60*1000)); 
 var expires = ";expires="+date.toGMTString(); 
 } else { 
 expires = ""; 
 } 
 document.cookie = name+"="+value+expires+";"; 
} 
// Read the cookie 
function readCookie(name) { 
 var needle = name + "="; 
 var cookieArray = document.cookie.split(';'); 
 for(var i=0;i < cookieArray.length;i++) { 
 var pair = cookieArray[i]; 
 while (pair.charAt(0)==' ') { 
 pair = pair.substring(1, pair.length); 
 } 
 if (pair.indexOf(needle) == 0) { 
 return pair.substring(needle.length, pair.length); 
 } 
 } 
 return null; 
} 

//para Home
 function activeCSS(title) { 
  var links = document.getElementsByTagName("link"); 
  for (var i=0; i<links.length; i++) { 
if (links[i].getAttribute("title") == title) { 
  links[i].disabled = false; 
} else { 
  links[i].disabled = true; 
} 
  } 
}


function AbrirVentana(vPagina,vToolbar,vLocation,vDirectorio,vEstado,vMenubar,vScrollbars,vRedimensionable,vAncho,vAlto) {
    
   vContadorVentanas++;
   
   //Se procede a obtener solo los valores en numeros del ancho y alto establecidos de la ventana
    var vSoloNumeroAncho = vAncho.slice(0,vAncho.length-2);
    var vSoloNumeroAlto  = vAlto.slice(0,vAlto.length-2);
    var vRutaPagina='http://apl.munlima.gob.pe/consultasislic/';
    
   //Se procede a obtener los valores del ancho y alto de la pantalla (768*1024,600*800,etc) 
    alto=screen.height;
    ancho=screen.width;
    
    //Se procede a obtener el calculo del eje X e Y
    yposi=(alto-vSoloNumeroAlto)/2;
    xposi=(ancho-vSoloNumeroAncho)/2;
    
    eval("ventana" + vContadorVentanas + "=window.open('" + vRutaPagina + vPagina + "','','toolbar=" + vToolbar + ",location=" + vLocation + ",directories=" + vDirectorio + ",status=" + vEstado + ",menubar=" + vMenubar + ",scrollbars=" + vScrollbars + ",resizable=" + vRedimensionable + ",width=" + vAncho + ",height=" + vAlto + ",top=" + yposi + ",left=" + xposi + "')");
    
   //window.showModalDialog(vPagina,'modal','dialogTop='+yposi+';dialogLeft='+xposi+';dialogWidth='+vAncho+';dialogHeight='+vAlto + ";center=yes;help=no;font-family:Arial;status='"+vEstado+"';scroll="+"yes");
}





	
