var d, dom, ns4, ie, ie4, ie5x, moz, mac, win, lin, old, ie5mac, ie5xwin, op;

d = document;
n = navigator;
na = n.appVersion;
nua = n.userAgent;
win = (na.indexOf('Win') != -1);
mac = (na.indexOf('Mac') != -1);
ns4 = d.layers
var calunits=document.layers? "" : "px"

if (!d.layers){
dom = (d.getElementById);
op = (nua.indexOf('Opera') != -1);
konq = (nua.indexOf('Konqueror') != -1);
saf = (nua.indexOf('Safari') != -1);
moz = (nua.indexOf('Gecko') != -1);
ie = (d.all && !op);
ie4 = (ie && !dom);
ie5x = (d.all && dom);
ie5mac = (mac && ie5x);
ie5xwin = (win && ie5x);
}

var vis="hide"; var vispais="hide";
function showImageH(){document.write('<img src="/media/headers/'+theImagesH[whichImage]+'">');}
//----------------------------------------------------------------
function validar(field) {
var valid = "abcdefghijklmnñopqrstuvwxyz ABCDEFGHIJKLMNÑOPQRSTUVWXYZ 0123456789 ().*&^%$#@!+-_][}{ áéíóúü"; var ok = "si"; var temp;
for (var i=0; i<field.value.length; i++) {temp = "" + field.value.substring(i, i+1);
if (valid.indexOf(temp) == "-1") ok = "no";}
if (ok == "no") {alert("El nombre de usuario que ingresó\ncontiene caracteres inválidos!");
field.focus();
field.select();}}
//----------------------------------------------------------------
function showHideLayers() { //v6.0
var i,p,v,d,obj,args=showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if ((obj=findObj(args[i]))!=null) { v=args[i+2];
if (obj.style) { v=(v=='show')?'visible':(v=='hide')?'hidden':v; if(v=='visible'){d="block"}else{d="none"};}
obj.style.visibility=v;  obj.style.display=d;}
}
function findObj(n, d) { //v4.01
var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function hide(id){
if (ns4) document.layers[id].visibility = "hide"
else if (ie4) document.all[id].style.display = "none"
}

//----------------------------------------------------------------
function validaEmail(emails,al){
emails.value = emails.value.toLowerCase();
email=new String(emails.value.toLowerCase())
if(email== "" || email.indexOf("@", 0) == -1 || email.indexOf(".", 0) == -1 || email.length <= 9){
	alert(al);
	emails.focus();
	return false;
} else {
	ok=1
	var validos="abcdefghijklmnopqrstuvwxyz0123456789-_@.";
	for (i=0;i<email.length;i++){
		if (validos.indexOf(email.charAt(i)) == "-1") ok = 0;	
	}
	if (ok==0) {
		alert(al);
		emails.focus();
		return false;
	}
}
return true
}

//----------------------------------------------------------------
function validaTelefonos(valor,texto,minimo){
numero=new String(valor.value)
ok=1
var validos="0123456789()-/";
for (i=0;i<numero.length;i++){
	if (validos.indexOf(numero.charAt(i)) == "-1") ok = 0;	
}
if (ok==0) {
	if (texto!="") alert(texto)
	valor.focus(); return false
}
if (numero.length<6){
	alert(minimo);
	valor.focus(); return false
}
return true
}
//----------------------------------------------------------------
function validaNumeros(valor,texto,minimo, minimotexto){
numero=new String(valor.value);ok=1;var validos="0123456789";
for (i=0;i<numero.length;i++){if (validos.indexOf(numero.charAt(i)) == "-1") ok = 0;}
if (ok==0) {alert(texto);valor.focus(); return false}
if (numero.length<minimo){alert(minimotexto);valor.focus(); return false}
return true
}
//----------------------------------------------------------------
function estaVacio(s,texto){var len=s.value.length;var i;
for (i=0;i<len;++i){if (s.value.charAt(i)!=" ") {return false;}}alert(texto);s.focus();return true
}
//----------------------------------------------------------------
function validaFecha(fechad){
fecha=fechad.value;
dia=new Number(fecha.substr(0,2))
mes=new Number(fecha.substr(3,2))
ano=new Number(fecha.substr(6,4))
var hoy = new Date();
if (dia<1 || dia>31 || isNaN(dia)){dia=hoy.getDate();}
if (mes<1 || mes>12 || isNaN(mes)){mes=hoy.getMonth()+1}
if (ano<hoy.getFullYear()-99 || isNaN(ano)){ano=hoy.getFullYear()}
if (parseInt(mes)==2 && parseInt(dia)>28) dia="28";
if ((parseInt(mes)==4 || parseInt(mes)==6 || parseInt(mes)==9 || parseInt(mes)==11) && parseInt(dia)==31) dia="30";
diad=new String(dia)
mesd=new String(mes)
if (diad.length!=2) dia="0"+dia
if (mesd.length!=2) mes="0"+mes
fechad.value=dia+"/"+mes+"/"+ano
if (ano>hoy.getFullYear()-13) {return false}
return true
return
}
//-----------------------------
function initbox(){
if (!dom&&!ie&&!ns4)
return
crossobj=(dom)?document.getElementById("dropin").style : ie? document.all.dropin : document.dropin
scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
crossobj.top=scroll_top-250+calunits
crossobj.visibility=(dom||ie)? "visible" : "show"
dropstart=setInterval("dropin()",50)
}

function dropin(){scroll_top=(ie)? truebody().scrollTop : window.pageYOffset;
if (parseInt(crossobj.top)<100+scroll_top)crossobj.top=parseInt(crossobj.top)+40+calunits;
else{clearInterval(dropstart);bouncestart=setInterval("bouncein()",50)
}
}

function bouncein(){
crossobj.top=parseInt(crossobj.top)-bouncelimit+calunits;if (bouncelimit<0)bouncelimit+=8;bouncelimit=bouncelimit*-1;
if (bouncelimit==0){clearInterval(bouncestart)}
}

function dismissbox(){if (window.bouncestart) clearInterval(bouncestart);crossobj.visibility="hidden";}

function redo(){bouncelimit=32;direction="up";initbox()}

function truebody(){return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body}

function popPage(l, n, w, h, o) { posTop = screen.availHeight / 2 - (h / 2) - 30; posLeft = screen.availWidth / 2 - (w / 2); opts = "status=no, width=" + w + ", height=" + h + ",  top=" + posTop + ", left=" + posLeft + "," + o; window.open(l,n,opts); }

function OpenW(img,txt) {
document.getElementById("popImg").style.left = (document.body.offsetWidth - 500) / 2;
document.getElementById("popImg").style.visibility = 'visible';
document.getElementById("popImg").style.display = 'block';
document.getElementById("text_big").innerHTML = txt;
setBackgroundImage ('image_big', 'http://www.minaclavero.gov.ar/' + img)
}
function CloseW() {
document.getElementById("popImg").style.visibility = 'hidden';
document.getElementById("popImg").style.display = 'none';
setBackgroundImage ('image_big', 'none');
}
function setBackgroundImage (id, imageURL) {
if (document.layers)document[id].background.src = imageURL == 'none' ? null : imageURL;
else if (document.all)document.all[id].style.backgroundImage = imageURL == 'none' ? 'none' : 'url(' + imageURL + ')';
else if (document.getElementById)document.getElementById(id).style.backgroundImage = imageURL == 'none' ? 'none' : 'url(' + imageURL + ')';
document.getElementById(id).style.visibility = 'visible';
return true;
}
function getElems(id) { if (window.parent.document.getElementById) { return document.getElementById(id); } else if (window.parent.document.all) { return document.all(id); } else if (window.parent.document.layers) { return document.layers(id); } }
//----------------------------------------------------------------
function SH(act,id) { var obj = getElems(id); if(obj) { if(act == "") { if(obj.style.visibility == "hidden" || obj.style.visibility == "") { obj.style.visibility = "visible"; if(obj.tagName != "TR") { obj.style.display = "block"; } else { obj.style.display = ""; } } else { obj.style.visibility = "hidden"; obj.style.display = "none"; } } else if(act.toUpperCase() == "S") { obj.style.visibility = "visible"; if(obj.tagName != "TR") { obj.style.display = "block"; } else { obj.style.display = ""; } } else if(act.toUpperCase() == "H") { obj.style.visibility = "hidden"; obj.style.display = "none"; } } }

function showdeadcenterdiv(Xwidth,Yheight,divid) { 
var scrolledX, scrolledY; 
if( self.pageYOffset ) { scrolledX = self.pageXOffset; scrolledY = self.pageYOffset; 
} else if( document.documentElement && document.documentElement.scrollTop ) { 
scrolledX = document.documentElement.scrollLeft; scrolledY = document.documentElement.scrollTop; 
} else if( document.body ) { scrolledX = document.body.scrollLeft; scrolledY = document.body.scrollTop; } 
var centerX, centerY; 
if( self.innerHeight ) { centerX = self.innerWidth; centerY = self.innerHeight; 
} else if( document.documentElement && document.documentElement.clientHeight ) { 
centerX = document.documentElement.clientWidth; centerY = document.documentElement.clientHeight; 
} else if( document.body ) { centerX = document.body.clientWidth; centerY = document.body.clientHeight; 
} 
var leftOffset = scrolledX + (centerX - Xwidth) / 2; 
var topOffset = scrolledY + (centerY - Yheight) / 2; 
var o=document.getElementById(divid); 
var r=o.style; 
r.position='absolute'; 
r.top = topOffset + 'px'; 
r.left = leftOffset + 'px'; 
r.display = "block"; 
} 
