//Default browsercheck, added to all scripts!
function checkBrowser(){
	this.ver=navigator.appVersion
	this.dom=document.getElementById?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
	this.ie4=(document.all && !this.dom)?1:0;
	this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
	return this
}
bw=new checkBrowser()

//Reusable background color change function
function changeBc(obj,color){
  div=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?document.layers[obj]:0;	
	if(bw.dom || bw.ie4) div.backgroundColor=color;
	else if(bw.ns4) div.bgColor=color;
}

function showHideData(id) {
	if (document.getElementById(id).style.display == '') 
		document.getElementById(id).style.display = 'none'
	else
	   document.getElementById(id).style.display = '';
}

function showData(id) {
	document.getElementById(id).style.display = '';
}

function hideData(id) {
	document.getElementById(id).style.display = 'none';
}


function getElemRefs(id) {
	var el = (document.getElementById)? document.getElementById(id): (document.all)? document.all[id]: (document.layers)? document.layers[id]: null;
	if (el) el.css = (el.style)? el.style: el;
	return el;
}

function getElement(id) {
	var control = (document.getElementById)? document.getElementById(id): (document.all)? document.all[id]: (document.layers)? document.layers[id]: null;
	return control;
}


function confirma(mensaje,destino) {
	if ( confirm(mensaje) ) { 
		self.location =destino;
	}
}

function openWinClean(fichero,nombre,tam) {
	ventana=window.open(fichero,nombre,tam+",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes");	
}
function openWinScroll(fichero,nombre,tam) {
	ventana=window.open(fichero,nombre,tam+",toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,copyhistory=yes");	
}

function openWin(fichero,nombre,tam) {
	ventana=window.open(fichero,nombre,tam+",toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=yes");	
}

function irA(destino) {
	self.location =destino;
}

function initScrollLayer() {
	if (document.getElementById("ventana_scroll")) {
		var wndo = new dw_scrollObj('ventana_scroll', 'capa_scroll', 'tabla_scroll');
		wndo.setUpScrollbar("dragBar", "track", "h", 1, 1);
	}

}

function toggleAviso(){

	if (document.getElementById("eventoAviso").checked == true) {
		document.getElementById("date_day").disabled = false;
		document.getElementById("date_month").disabled = false;
		document.getElementById("date_year").disabled = false;
	} else {
		document.getElementById("date_day").disabled = true;
		document.getElementById("date_month").disabled = true;
		document.getElementById("date_year").disabled = true;
	}
}
