
//document.oncontextmenu=function(){return false}

function gInicio() {
	var sAux=top.location.href
	if (sAux!=this.parent.location.href) top.location.href=this.parent.location.href
	else {
		top.gT=top
		gT=top.gT
		gT.aZs=new Array(3)
		var nPos=sAux.indexOf('/',sAux.indexOf('//')+2)+1
		gT.sURL=sAux.substring(0,nPos)
		gT.sURLWeb=gT.sURL+'Web/'
		gT.sURLApp=gT.sURL+sAux.substring(nPos,sAux.indexOf('/',nPos)+1)
		gT.sURLSrvls=gT.sURLApp+'servlet/'
		gT.bZS=1
	}
}

function siCond(e,f,t) {
	eval('if (typeof '+e+'=="undefined") setTimeout("siCond(\''+e+'\',\''+f+'\','+t+')",'+t+');else{'+f+'}')
}

function esIdentificador(t) {

	return /^(\w+)$/.test(t)
}

function esNatural(t) {
	return /^(0|[1-9]\d*)$/.test(t)
}

function esImagen(t) {
	if (!(/^.*[\/\*\?"<>\|].*$/.test(t.toLowerCase())))
		return /^([a-z]:\\([^\\]+\\)*[^\\]+.(gif|jp[e]?g))$/.test(t.toLowerCase())
	return false
}

function esGIF(t) {
	/(\.gif)$/.test(t.toLowerCase())
}

function esFecha(t) {
	if (/^((0?[1-9]|[12]\d|3[01])\/(0?[1-9]|1[012])\/\d{4})$/.test(t)) {
		var asPs=t.split(/\//)
		if (asPs[2]<1752 || asPs[2]>9999) return false
		if (asPs[1]==2 && (asPs[0]>29 || (asPs[0]==29 && !(asPs[2]%4==0 && (asPs[2]%100!=0 || asPs[2]%400==0))))) return false
		if ((asPs[1]==4 || asPs[1]==6 || asPs[1]==9 || asPs[1]==11) && asPs[0]>30) return false
		return true
	}
	return false
}

function esFechaEuskera(t) {
	if (/^(\d{4}\/(0?[1-9]|1[012])\/(0?[1-9]|[12]\d|3[01]))$/.test(t)) {
	  var asPs=t.split(/\//)
	  if (asPs[0]<1752 || asPs[0]>9999) return false
	  if (asPs[1]==2 && (asPs[2]>29 || (asPs[2]==29 && !(asPs[0]%4==0 && (asPs[0]%100!=0 || asPs[0]%400==0))))) return false
	  if ((asPs[1]==4 || asPs[1]==6 || asPs[1]==9 || asPs[1]==11) && asPs[2]>30) return false
	  return true
 }
 return false
}

function nChequeados(c) {
	var nNs=0
	if (eval('typeof '+c+'!="undefined"')) {
		if (eval('typeof '+c+'.length=="undefined"')) {
			if (eval(c+'.checked')) nNs=1
		}
		else {
			var nL=eval(c+'.length')
			for (var i=0;i<nL;i++) if (eval(c+'[i].checked')) nNs++
		}
	}
	return nNs
}

String.prototype.trim=function() {
	var i=0
	var j=this.length-1
	while (i<this.length && (this.charAt(i)==' ' || this.charCodeAt(i)==10 || this.charCodeAt(i)==13)) i++
	while (j>i && (this.charAt(j)==' ' || this.charCodeAt(j)==10 || this.charCodeAt(j)==13)) j--
	if (j>=i) return this.substring(i,j+1)
	return ''
}