var t_timer;

function funcPosisionar(){
	if(navigator.appName == "Microsoft Internet Explorer"){
		//document.getElementById('divFaltan').style.left = parseInt( (document.body.offsetWidth/2)- 120 );
		document.getElementById('divFaltan').style.left = parseInt(0);
		//document.getElementById('divFaltan').style.top = document.body.scrollTop + parseInt(document.body.offsetHeight/2);
		document.getElementById('divFaltan').style.top = document.body.scrollTop;
	}
	else{
		//document.getElementById('divFaltan').style.left = parseInt( (window.innerWidth/2) - 120 );
		document.getElementById('divFaltan').style.left = parseInt(0);
		///document.getElementById('divFaltan').style.top = document.body.scrollTop + parseInt(window.innerHeight/2);
		document.getElementById('divFaltan').style.top = document.body.scrollTop;
	}
	//document.getElementById('divFaltan').style.top = document.body.scrollTop;// + parseInt(135);
}

function funcLoadDivPosisionar(){
	window.onscroll = funcPosisionar;
	//window.onload = funcPosisionar;
}

function displayLO(){
	rtimeLO = etimeLO-ctimeLO;
	if (rtimeLO > 60)
		mLO = parseInt(rtimeLO/60);
	else
		mLO = 0;

	sLO = parseInt( rtimeLO-mLO*60);
	if(sLO<10)
		sLO="0"+sLO
	//window.status="Time Remaining :  "+m+":"+s
	//document.getElementById("divRefreshLO").innerHTML = "Tiempo Restante: "+mLO+":"+sLO;
	if ( mLO=='0' && sLO<'10' && typeof document.getElementById('divFaltan')!="undefined"){
		document.getElementById('divFaltan').style.display = 'inline';
		document.getElementById('divFaltanInner').innerHTML = mLO+":"+sLO;
		//if (confirm('El Sistema se Cerrara.\nDesea permanecer en el Sistema?')){
			//document.getElementById('divTimeLO').innerHTML='30';
			//settimesLO();
		//}
	}
	if (typeof document.getElementById('divFaltan')=="undefined"){
		StopTimeOut();
		return false;
	}
	//window.setTimeout("checktimeLO()",1000);
	t_timer = setTimeout("checktimeLO()",1000);
	//window.setTimeout("displayLOLeft()",1000);
}

function StopTimeOut(){
	clearTimeout(t_timer);
}

function settimesLO(){
	var timeLO= new Date();
	//var rtimeLO = document.getElementById('divTimeLO').innerHTML;
	//alert(rtime);
	hoursLO= timeLO.getHours();
	minsLO= timeLO.getMinutes();
	secsLO= timeLO.getSeconds();
	etimeLO=hoursLO*3600+minsLO*60+secsLO;
	//etimeLO+=parseInt(rtimeLO);1800
	etimeLO+=13; //se envia en 30 segundos cada email
	/*
	You can change the value of 120 according to how much
	time you wish to set the timer. Where 120 is time in secs (120 = 2
	mins * 60 secs/min). Max time is 60 mins (3600secs)
	*/
	checktimeLO();
}

function checktimeLO(){
	var timeLO= new Date();
	hoursLO= timeLO.getHours();
	minsLO= timeLO.getMinutes();
	secsLO= timeLO.getSeconds();
	ctimeLO=hoursLO*3600+minsLO*60+secsLO
	if(ctimeLO>=etimeLO)
		expiredLO();
	else
		displayLO();
}

function expiredLO(){
	funcTimeRefresh();
	//settimesLO();
}

//settimesLO();
//***********//
function funcChangeClassTRUpper(E, class_name){
	var ie  = document.all;
	var mozilla = document.getElementById&&!document.all;
 
  /* ie uses parentElement to get traverse nodes; mozilla uses parentNode */
	while (E.tagName!="TR")
	{
		E = mozilla ? E.parentNode : E.parentElement;
	}
	E.className = class_name;
}

function ylib_Browser(){
	d=document;
	this.agt=navigator.userAgent.toLowerCase();
	this.major = parseInt(navigator.appVersion);
	this.dom=(d.getElementById)?1:0;
	this.ns=(d.layers);
	this.ns4up=(this.ns && this.major >=4);
	this.ns6=(this.dom&&navigator.appName=="Netscape");
	this.op=(window.opera? 1:0);
	this.ie=(d.all);
	this.ie4=(d.all&&!this.dom)?1:0;
	this.ie4up=(this.ie && this.major >= 4);
	this.ie5=(d.all&&this.dom);
	this.win=((this.agt.indexOf("win")!=-1) || (this.agt.indexOf("16bit")!=-1));
	this.mac=(this.agt.indexOf("mac")!=-1);
};

var oBw = new ylib_Browser();

function funcLink(url){
	window.location = url;
}

function funcLinkDecisionCanjePremio(url){
	if (confirm( "Esta Seguro de Canjear este Premio?" ))
		window.location = url;
//	else		
}

function funcLinkDecisionAumentarAnioo(url){
	if (confirm( "Esta Seguro de Aumentar el Anio para la Galeria?" ))
		window.location = url;
//	else		
}
/*function funcRedondearInput(num, decimal) {
	alert (num);
	var valor = Math.round(num * Math.pow(10, decimal)) / Math.pow(10, decimal);
	if (num != ''){
		if (isNaN(valor))
			num = '';
		else
			num = valor;
	}
	alert (num);
}*/
function DisplayElement ( elt, displayValue )
{
	//if (ComposeVals.ExpandoToCcBcc){
		if ( typeof elt == "string" )
			elt = document.getElementById( elt );
			if ( elt == null ) return;
			if ( oBw && oBw.ns6 ) {
				// OTW table formatting will be lost:
				if ( displayValue == "block" && elt.tagName == "TR" )
					displayValue = "table-row";
				else if ( displayValue == "inline" && elt.tagName == "TR" )
					displayValue = "table-cell";
		}
		elt.style.display = displayValue;
		//alert(elt.style.display);
	//}
}

function TrimLeft( str ) {
	var resultStr = "";
	var i = len = 0;

	// Return immediately if an invalid value was passed in
	if (str+"" == "undefined" || str == null)	
		return null;

	// Make sure the argument is a string
	str += "";

	if (str.length == 0) 
		resultStr = "";
	else {	
  		// Loop through string starting at the beginning as long as there
  		// are spaces.
//	  	len = str.length - 1;
		len = str.length;
		
  		while ((i <= len) && (str.charAt(i) == " "))
			i++;

   	// When the loop is done, we're sitting at the first non-space char,
 		// so return that char plus the remaining chars of the string.
  		resultStr = str.substring(i, len);
  	}

  	return resultStr;
}

function TrimRight( str ) {
	var resultStr = "";
	var i = 0;

	// Return immediately if an invalid value was passed in
	if (str+"" == "undefined" || str == null)	
		return null;

	// Make sure the argument is a string
	str += "";
	
	if (str.length == 0) 
		resultStr = "";
	else {
  		// Loop through string starting at the end as long as there
  		// are spaces.
  		i = str.length - 1;
  		while ((i >= 0) && (str.charAt(i) == " "))
 			i--;
 			
 		// When the loop is done, we're sitting at the last non-space char,
 		// so return that char plus all previous chars of the string.
  		resultStr = str.substring(0, i + 1);
  	}
  	
  	return resultStr;  	
}

function Trim( str ) {
	var resultStr = "";
	
	resultStr = TrimLeft(str);
	resultStr = TrimRight(resultStr);
	
	return resultStr;
}

function TrimObject( object ) {
	var resultStr = "";
	
	resultStr = TrimLeft(object.value);
	resultStr = TrimRight(resultStr);
	
	object.value = resultStr;
}

function TrimCadena( cadena ) {
	var resultStr = "";
	
	resultStr = TrimLeft(cadena);
	resultStr = TrimRight(resultStr);
	
	return resultStr;
}

function doVerificarCaracteresProhibidosToFolder( cadena ){
	var temp_cadena = "\/:*?\"'<>|";

	for (i=0;i<temp_cadena.length;i++){
		for (j=0;j<cadena.length;j++){
			if (temp_cadena.charAt(i) == cadena.charAt(j))
				return true;
		}
	}
	return false;
}

function doVerificarCaracteresPermitidosTemplate( cadena, temp_cadena ){
	var flag = 0;
	for (i=0;i<cadena.length;i++){
		for (j=0;j<temp_cadena.length;j++){
			if (cadena.charAt(i) == temp_cadena.charAt(j)){
				flag = 0;
				break;
			}
			else
				flag = 1;
		}
		if (flag==1)
			return false;
	}
	return true;
}

function funcGetIframe0(objiframe, temp_iframe){
	var nombre = navigator.appName
	var frmTemp = objiframe;
	
	if (nombre == "Microsoft Internet Explorer")
		frmTemp = document.frames(temp_iframe).document;
	else
		frmTemp = document.getElementById(temp_iframe).contentDocument;
	
	return frmTemp;
}

function funcGetIframe(objiframe, temp_iframe){
	var nombre = navigator.appName
	var frmTemp = objiframe;
	
	if (nombre == "Microsoft Internet Explorer")
		frmTemp = parent.document.frames(temp_iframe).document;
	else
		frmTemp = parent.document.getElementById(temp_iframe).contentDocument;
	
	return frmTemp;
}

function funcGetIframe2(objiframe, temp_iframe){
	var nombre = navigator.appName
	var frmTemp = objiframe;
	//alert(temp_iframe2);
	//alert(temp_iframe);
	if (nombre == "Microsoft Internet Explorer")
		frmTemp = parent.document.frames(temp_iframe).document;
	else
		frmTemp = parent.document.getElementById(temp_iframe).contentDocument;
	//alert(parent.document.getElementById(temp_iframe).src);
	//alert(frmTemp.getElementById('bdyContenido').innerHTML);return false;
	return frmTemp;
}

function funcGetIframe3(objiframe, temp_iframe){
	var nombre = navigator.appName
	var frmTemp = objiframe;
	//alert(temp_iframe2);
	//alert(temp_iframe);
	if (nombre == "Microsoft Internet Explorer")
		frmTemp = parent.document.all(temp_iframe);
	else
		frmTemp = parent.document.getElementById(temp_iframe);
	//alert(parent.document.getElementById(temp_iframe).height);
	//alert(frmTemp.getElementById('bdyContenido').innerHTML);return false;
	return frmTemp;
}

function funcGetIframe4(objiframe, temp_iframe, temp_iframe2){
	var nombre = navigator.appName
	var frmTemp = objiframe;
	var frmTemp2;
	
	if (nombre == "Microsoft Internet Explorer")
		frmTemp = parent.document.frames(temp_iframe).document;
	else
		frmTemp = parent.document.getElementById(temp_iframe).contentDocument;

	if (nombre == "Microsoft Internet Explorer")
		frmTemp2 = frmTemp.frames(temp_iframe2).document;
	else
		frmTemp2 = frmTemp.getElementById(temp_iframe2).contentDocument;

	return frmTemp2;
}

function funcGetIframe5(objiframe, temp_iframe, temp_iframe2){
	var nombre = navigator.appName
	var frmTemp = objiframe;
	var frmTemp2;
	
	if (nombre == "Microsoft Internet Explorer")
		frmTemp = parent.document.frames(temp_iframe).document;
	else
		frmTemp = parent.document.getElementById(temp_iframe).contentDocument;

	if (nombre == "Microsoft Internet Explorer")
		frmTemp2 = frmTemp.all(temp_iframe2);
	else
		frmTemp2 = frmTemp.getElementById(temp_iframe2);

	return frmTemp2;
}

function funcGetIframe6(objiframe, temp_iframe){
	var nombre = navigator.appName
	var frmTemp = objiframe;
	//alert(temp_iframe2);
	//alert(temp_iframe);
	if (nombre == "Microsoft Internet Explorer")
		frmTemp = parent.parent.document.frames(temp_iframe).document;
	else
		frmTemp = parent.parent.document.getElementById(temp_iframe).contentDocument;
	//alert(parent.parent.document.getElementById(temp_iframe).src);
	//alert(frmTemp.getElementById('bdyContenido').innerHTML);return false;
	return frmTemp;
}

function funcGetIframe7(objiframe, temp_iframe){
	var nombre = navigator.appName
	var frmTemp = objiframe;
	//alert(temp_iframe2);
	//alert(temp_iframe);
	if (nombre == "Microsoft Internet Explorer")
		frmTemp = parent.parent.document.all(temp_iframe);
	else
		frmTemp = parent.parent.document.getElementById(temp_iframe);
	//alert(parent.parent.document.getElementById(temp_iframe).src);
	//alert(frmTemp.getElementById('bdyContenido').innerHTML);return false;
	return frmTemp;
}

function funcGetIframe8(objiframe, temp_iframe){
	var nombre = navigator.appName
	var frmTemp = objiframe;
	//alert(temp_iframe2);
	//alert(temp_iframe);
	if (nombre == "Microsoft Internet Explorer")
		frmTemp = parent.parent.parent.document.frames(temp_iframe).document;
	else
		frmTemp = parent.parent.parent.document.getElementById(temp_iframe).contentDocument;
	//alert(parent.parent.document.getElementById(temp_iframe).src);
	//alert(frmTemp.getElementById('bdyContenido').innerHTML);return false;
	return frmTemp;
}

function funcGetIframe9(objiframe, temp_iframe){
	var nombre = navigator.appName
	var frmTemp = objiframe;
	//alert(temp_iframe2);
	//alert(temp_iframe);
	if (nombre == "Microsoft Internet Explorer")
		frmTemp = parent.parent.parent.document.all(temp_iframe);
	else
		frmTemp = parent.parent.parent.document.getElementById(temp_iframe);
	//alert(parent.parent.document.getElementById(temp_iframe).src);
	//alert(frmTemp.getElementById('bdyContenido').innerHTML);return false;
	return frmTemp;
}

function funcGetIframe10(objiframe, temp_iframe){
	var nombre = navigator.appName
	var frmTemp = objiframe;
	//alert(temp_iframe2);
	//alert(temp_iframe);
	if (nombre == "Microsoft Internet Explorer")
		frmTemp = parent.parent.parent.document.frames(temp_iframe).document;
	else
		frmTemp = parent.parent.parent.document.getElementById(temp_iframe).contentDocument;
	//alert(parent.parent.document.getElementById(temp_iframe).src);
	//alert(frmTemp.getElementById('bdyContenido').innerHTML);return false;
	return frmTemp;
}

function funcGetIframe11(objiframe, temp_iframe){
	var nombre = navigator.appName
	var frmTemp = objiframe;
	//alert(temp_iframe2);
	//alert(temp_iframe);
	if (nombre == "Microsoft Internet Explorer")
		frmTemp = parent.parent.parent.parent.document.all(temp_iframe);
	else
		frmTemp = parent.parent.parent.parent.document.getElementById(temp_iframe);
	//alert(parent.parent.document.getElementById(temp_iframe).src);
	//alert(frmTemp.getElementById('bdyContenido').innerHTML);return false;
	return frmTemp;
}

function funcEmptyDiv(iddiv){
	document.getElementById(iddiv).innerHTML = '';
}

function hL(E, cstyle){
	var ie  = document.all;
	var mozilla = document.getElementById&&!document.all;
 
	while (E.tagName!="TD")
		E = mozilla ? E.parentNode : E.parentElement;
	E.className=cstyle;
}

function dL(E, cstyle){
	var ie  = document.all;
	var mozilla = document.getElementById&&!document.all;

  /* ie uses parentElement to get traverse nodes; mozilla uses parentNode */
	while (E.tagName!="TD")
		E = mozilla ? E.parentNode : E.parentElement;
	E.className=cstyle;
}

function ONE(CB,cstyle1,cstyle2,noHL){
	if (!noHL){
		if (CB.checked)
			hL(CB, cstyle1);
		else
			dL(CB, cstyle2);
	}
}