var wGXPrompt=null;
var vGXPromtpElementsRef = null;

 var vElement_dCal = null;
 var vWindow_dCal=null;
 
 var vEleCalendar = '<iframe id="EleCalendar" src="hcalfech.aspx" scrolling="no" frameborder="0" style="width:215px;height:210px;"></iframe>';
 
 var nav4 = window.Event ? true : false;

// Capturo los errores del IE 
window.onerror = errorHandler;

var cookUtil = new CookieUtil("cookie_state");

// Incorporo al documento de forma dinámica el comportamiento de Highliter.
var headID = document.getElementsByTagName("head")[0];

var cssNode = document.createElement('link');
cssNode.type = 'text/css';
cssNode.rel = 'stylesheet';
cssNode.href = './js/dp.SyntaxHighlighter/Styles/SyntaxHighlighter.css';
cssNode.media = 'screen,projection,print';
headID.appendChild(cssNode);

// Incorporo los Scripts

var newScript = document.createElement('script');
newScript.type = 'text/javascript';
newScript.src = './js/dp.SyntaxHighlighter/Scripts/shCore.js';
headID.appendChild(newScript);


var newScript = document.createElement('script');
newScript.type = 'text/javascript';
newScript.src = './js/dp.SyntaxHighlighter/Scripts/shBrushAll.js';			
headID.appendChild(newScript);
			
			
this.onload = function()
{
			dp.SyntaxHighlighter.ClipboardSwf = './js/dp.SyntaxHighlighter/Scripts/flash/clipboard.swf';
			dp.SyntaxHighlighter.HighlightAll('code');
			
}


function parentRefresh(){self.parent.location.reload(true);}


function OpenTskInf(llamador,prctskid) {
	
	// Lo elevo a qooxdoo PrcDef.js
	
	parent.qOpenTskInf(llamador,prctskid);
	
	/*
	//var vTskMnu = '<TABLE WIDTH=300 HEIGHT=300><TR><TD>Hola, <a href=\'javascript:OpenTskInf(this,0);\'>esto</a> es una prueba</TD></TR></TABLE>';
	//Tip(vTskMnu,PADDING,0,STICKY,1,WIDTH,260,BORDERWIDTH,0,OPACITY,90,DURATION,5000,OFFSETY,-130,OFFSETX,-130,FADEIN,200,FADEOUT,200,CLICKCLOSE,false);    	    		
	
        h = screen.height - 80;
        w = screen.width - 10;	
        posx = parseInt(w/2) - parseInt(700/2);
        posy = parseInt(h/2) - parseInt(500/2);
        var winconfig = 'left=' + posx + ', Top=' + posy + ', width=700, height=500, menubar=0, resizable=yes, toolbar=0, scrollbars=0, status=1, pageXoffset=0, pageYoffset=0, screenX=' + posx + ', screenY=' + posy + '';
        var LnkTskInf = parent.prcdefLnkTskInf.replace("PRCTSKID",""+prctskid+""); 
        window.open(LnkTskInf, '_DlyaCpmOPTI', winconfig);
        */
	
} 



function dMinButtFWT(controlId,selected)
{
	
	//console.time("dMinButtFWT(" + controlId + ")");	
	docElement = document.getElementById(controlId);	
	if (docElement != null)
	{		
		appendWait(docElement);
		if (selected == true)		
			docElement.outerHTML = '<TABLE cellSpacing=0 cellPadding=0 border=0><TR><TD class=\'MIN_MNU_SEL\' noWrap><TABLE border=0 backcolor=black><TR><TD></TD><TD noWrap>' + docElement.outerHTML + '</TD></TR></TABLE></TD></TR></TABLE>';			
		else
			docElement.outerHTML = '<TABLE cellSpacing=0 cellPadding=0 border=0><TR><TD class=\'MIN_MNU_UNSEL\' noWrap><TABLE border=0 backcolor=black><TR><TD></TD><TD noWrap>' + docElement.outerHTML + '</TD></TR></TABLE></TD></TR></TABLE>';								
	}
	//console.timeEnd("dMinButtFWT(" + controlId + ")");	
}


function clientInfo()
{
   var cliInf;
   cliInf = "<CLIINF appName='" + navigator.appName + "' userAgent='" + navigator.userAgent + "' appVersion='" + navigator.appVersion + "' appCodeName='" + navigator.appCodeName + "'></CLIINF>";
   return cliInf; 
}

function errorHandler(message, url, line)
{
    // Idea obtenida de : http://www.codeproject.com/Ajax/LogClientSideJSErrors2Srv.asp
    // message == text-based error description
    // url     == url which exhibited the script error
    // line    == the line number being executed when the error occurred

    // handle the error here
    // alert( message + '\n' + url + '\n' + line );
    
    
    //-------------------------------------------------------------------
    // Log the Error
    //-------------------------------------------------------------------
    
    var xmlHttpRequest;
    // a variable to hold our instance of an XMLHTTP object.

    var bHookTheEventHandler = false;
    // used to switch on/off the handling
    // of any response from the server.

    // Checking if IE-specific document.all collection exists 
    // to see if we are running in IE 
    if (document.all)
    { 
        xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP"); 
    } else { 
        xmlHttpRequest = new XMLHttpRequest(); 
    }
    

    //----------------------------------------------------------------        
    // Roll the error information into an xml string:
    //----------------------------------------------------------------
    var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.3.0");
    xmlDoc.async = false;
    xmlDoc.loadXML("<JSERROR line='" + line + "' url='" + url + "'>" + message + "</JSERROR>");


    //------------------------------------------------------------
    // If you want to see some sort of response to prove (on the 
    // client end) that something has happened,
    // set bHookTheEventHandler = true 
    // otherwise false is probably all we want.
    //------------------------------------------------------------
    if(bHookTheEventHandler)
    {
        xmlHttpRequest.onreadystatechange = sendSomeXml_HandlerOnReadyStateChange;
    }

    //prepare the call, http method=GET, false=asynchronous call
    xmlHttpRequest.open("post", "http://support.dlya.com.uy/dlyacpm/aerrlog.aspx", bHookTheEventHandler);

    //finally send the call
    xmlHttpRequest.send( xmlDoc );  
    
    //------------------------------------------------------------
    // Finished Logging the Error
    //------------------------------------------------------------
                    
    return true;
}

function dtNow()
{
	try{
		var mydate = new Date();
		var year= mydate.getYear();
		var day= mydate.getDate();		
		var month= mydate.getMonth() + 1;
		var hours = mydate.getHours();
		var minutes = mydate.getMinutes();		
		if (day < 10)
		    day = "0" + day;						
		if (month < 10)
		    month = "0" + month;				
		if (hours < 10)
		    hours = "0" + hours;		
		if (minutes < 10)
		    minutes = "0" + minutes;
		
		return day + "/" + month + "/" + year + " " + hours + ":" + minutes
	}
	catch(err){
		window.status = "ERRDT:" + err.message + "_" + frameId;
	}	
}

function iframeDynLoad(iframeName,iframesrc)
{            
    iframe = document.getElementById(iframeName);
    if (!iframe){
        drawIframeDynLoad(iframeName,iframesrc);}
    else {
        iframe = document.getElementById(iframeName);
                
        if(iframe.src!=iframesrc)
        {
           iframe.src = iframesrc              
        }
     }    
}

function drawIframeDynLoad(iframe,iframesrc)
{
   var iframeC = iframe.replace("_iframe","_Ciframe");
      
   iframeEle = document.getElementById(iframeC);
      
   var iframeHMTL = '<iframe id=\'' + iframe + '\' width=100% height=0 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 name=\''+ iframe + '\' scrolling=no src=\''+ iframesrc +'\' onload=\'iframeLoad("' + iframe + '","' + iframeC + '","null.html");\'' + '></iframe>';
   iframeEle.outerHTML = iframeEle.outerHTML + iframeHMTL;   
   
}


function iframeLoad(iframe,iframeC,ifnull)
{    
    iframeObj = document.getElementById(iframe);    
    if (iframeObj){
        if (iframeObj.src.indexOf('null.html') < 0)
        {        
            if (document.getElementById(iframeC))        
                setTimeout('autoIframe2(\''+iframe + '\');document.getElementById(\''+iframeC+'\').style.display=\'none\';',500);        
            else
                setTimeout('autoIframe2(\''+iframe + '\');',500);                
        }   
    }
}

function autoIframe2(frameId){
	try{	        
                
		iframe = document.getElementById(frameId);						
		//objResize = (frame.style) ? frame.style : frame;		
		
		if (iframe.contentDocument && iframe.contentDocument.body.offsetHeight)
		{  		        
			iframe.height = Math.min(iframe.contentDocument.body.offsetHeight, 10000);  // netscape/firefox			
			iframe.style.display='block' // Fix para que lo muestre
		}
				
		if (iframe.Document && iframe.Document.body.scrollHeight)
		{   
			iframe.height = Math.min(iframe.Document.body.scrollHeight, 10000) + 2;   // internet explorer		
		}
		
		
	}
	catch(err){		
		window.status = "ERR1:" + err.message + "_" + frameId;
	}
}


function Help(u)
{	
	window.open(u, '_DlyaCpmHelp', 'toolbar=0,status=yes,menubar=0,scrollbars=yes,resizable=1,width=720,height=' + Math.round(window.screen.availHeight*2/3));
	
	event.cancelBubble = true;
	return false;
}

function Help2(u)
{	
	window.open(u, '_DlyaCpmHelp2', 'toolbar=0,status=yes,menubar=0,scrollbars=yes,resizable=1,width=720,height=' + Math.round(window.screen.availHeight*2/3));
	
}

function SetParameters(elements)
{	
	vGXPromtpElementsRef = elements;
}

function CallPrompt(program)
{
	
	if (wGXPrompt== null || wGXPrompt.closed)
	{		
		wGXPrompt=open(program, '', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no');
	}
	wGXPrompt.focus();
	
}

function ReturnPrompt(values)
{
	var changed=false;
	if (opener != null)
	{
		if (opener.vGXPromtpElementsRef!= null) 
		{
			
			var x=0;
			var len = opener.vGXPromtpElementsRef.length;
			
			for (x=0; x<len; x++) 
			{ 
				if (opener.vGXPromtpElementsRef[x].type != 'hidden')
				{
					opener.vGXPromtpElementsRef[x].value = values[x]; changed = true;
				}
				if (changed && opener.GXISGET)
				{
					opener.document.MAINFORM._EventName.value = 'GET';opener.document.MAINFORM.submit();
				}
				else
				{
					if ((opener.vGXPromtpElementsRef[x].type != 'hidden') && (opener.vGXPromtpElementsRef[x].style.disabled=false))
					{
						opener.vGXPromtpElementsRef[x].focus();
					}
				}			
			} 			

		}
		self.close();
	}
}
	


function setFocus(frameElement)
{
	alert('ok3');
	
 // Se setea el foco en el primer campo editable en caso que éste exista y que el paso esté visible
 //if (frameElement.style.visibility == "visible")
 //{
  alert('ok2');
  elements = frameElement.all; //document.forms[0].elements;
  
  for (i = 0; i < elements.length; i++)
  {
     alert(elements[i].id);
   if ((elements[i].type != 'hidden') && (!elements[i].disabled) && (elements[i].type == 'text'))
   {
    alert('ok');
    elements[i].focus();
    break;
   }
  }
 //}
}

function showMyMsg()
{
   alert('hola mundo');
}

var over="";
function showLogIframe(show){
	try{
		// En este sitio tendría que incorporar al documento los
		// elementos para cargar el login si no existe en la página
		// En caso que exista, se oculta y se muestra dado el parámetro.
		login = document.getElementById("LogContent");
		if (show==true){
			logout = document.getElementById("iflogout")		
			logout.src = 'aClsSes.aspx';		
			login.style.visibility = "visible";
			over = document.body.style.overflow;
			document.body.style.overflow ="hidden";
			syslog = document.getElementById("milogiframe");
			if (syslog.src.search('null.html') != -1)
			     syslog.src = 'hsyslog.aspx';			
			
		}
		else
		{
			login.style.visibility = "hidden";   
			document.body.style.overflow=over;
		}
	}
	catch(err){
		window.status = "ERR2:" + err.message;
	}
	document.body.scrollTop=0;
}


//******

function CookieUtil(name, duration, path, domain, secure)
{
   this.affix = "";
   
   if( duration )
   {   	  
      var date = new Date();
	  var curTime = new Date().getTime();

	  date.setTime(curTime + (1000 * 60 * duration));
	  this.affix = "; expires=" + date.toGMTString();
   }
   
   if( path )
      this.affix += "; path=" + path;   
   if( domain )   
      this.affix += "; domain=" + domain;
   if( secure )
      this.affix += "; secure=" + secure;
         
   function getValue(){
      var m = document.cookie.match(new RegExp("(" + name + "=[^;]*)(;|$)"));
      return m ? m[1] : null;   
   }
   
   this.cookieExists = function()
   {
      return getValue() ? true : false;
   }
      
   this.expire = function()
   {
      var date = new Date();
	  date.setFullYear(date.getYear() - 1);
	  document.cookie=name + "=noop; expires=" + date.toGMTString(); 
   }
        
   this.setSubValue = function(key, value)
   {
      var ck = getValue();

      if( /[;, ]/.test(value) )
      {
         //Mac IE doesn't support encodeURI
		 value = window.encodeURI ? encodeURI(value) : escape(value);
      }

      if( value )
      {
         var attrPair = "@" + key + value;
         if( ck )
         {
             if( new RegExp("@" + key).test(ck) )
	         {
		        document.cookie =
				   ck.replace(new RegExp("@" + key + "[^@;]*"), attrPair) + this.affix;
	         }
	         else
	         {
		        document.cookie =
				   ck.replace(new RegExp("(" + name + "=[^;]*)(;|$)"), "$1" + attrPair) + this.affix;
	         }
         }
         else
         {
	        document.cookie = name + "=" + attrPair + this.affix;
         }
      }
      else
      {      
	     if( new RegExp("@" + key).test(ck) )
	     {
	        document.cookie = ck.replace(new RegExp("@" + key + "[^@;]*"), "") + this.affix;
	     }
      }
   }

      
   this.getSubValue = function(key)
   {
      var ck = getValue();
      if( ck )
      {
         var m = ck.match(new RegExp("@" + key + "([^@;]*)"));
	     if( m )
	     {
	        var value = m[1];
	        if( value )
	        { 
	           //Mac IE doesn't support decodeURI
			   return window.decodeURI ? decodeURI(value) : unescape(value);
	        }
	     }
      }
   }
}

//******

// Esta función no funciona.
function addMediaScreen()
{


/*
		var elements = document.getElementsByTagName('link');

		for (var i=0; i<elements.length; i++) {
			
			if (elements[i].href && (elements[i].href.indexOf("style.css") != -1)) {
				
				elements[i].title='GX Style';				
				elements[i].media='screen';				
				break;
			}
		}

	//changeStyle('GX Style',);
	*/
}

function getAllSheets() {
  if( !window.ScriptEngine && navigator.__ice_version ) { return document.styleSheets; }
  if( document.getElementsByTagName ) { var Lt = document.getElementsByTagName('link'), St = document.getElementsByTagName('style');
  } else if( document.styleSheets && document.all ) { var Lt = document.all.tags('LINK'), St = document.all.tags('STYLE');
  } else { return []; } for( var x = 0, os = []; Lt[x]; x++ ) {
    var rel = Lt[x].rel ? Lt[x].rel : Lt[x].getAttribute ? Lt[x].getAttribute('rel') : '';
    if( typeof( rel ) == 'string' && rel.toLowerCase().indexOf('style') + 1 ) { os[os.length] = Lt[x]; }
  } for( var x = 0; St[x]; x++ ) { os[os.length] = St[x]; } return os;
}
function changeStyle() {
  for( var x = 0, ss = getAllSheets(); ss[x]; x++ ) {
    if( ss[x].title ) { ss[x].disabled = true; }
    for( var y = 0; y < arguments.length; y++ ) {
     if( ss[x].title == arguments[y] ) { ss[x].disabled = false; }
} } }

function disText(controlId)
{
	
	docElement = document.getElementById(controlId);	
	if (docElement != null)
	{		           	
            	docElement.style.border='none';            	
            	docElement.readOnly = true;        
            	docElement.style.background='transparent';
	}
		
}

 function cCale(P0)
 {
 
     GXPARAMETERS[0] = P0;
 }
 
 
 function dCale(controlId)
 {	
 	docElement = document.getElementById(controlId);
 	if (docElement != null)
 	{			        
               docElement.outerHTML = '<span onmousemove="cCale(document.forms[0].'+docElement.name+');" onmouseover="Tip(vEleCalendar,PADDING,0,OFFSETY,-5,OFFSETX,-5,STICKY,1,WIDTH,215,BORDERWIDTH,0,OPACITY,90);">' + docElement.outerHTML + '</span>';					
               
 	}		
 }

function confirmBtn(text) 
{
   var ret = false;
   if (confirm(text))
        ret = true;   
   else
      removeWaitMessage();   
   
   return ret;
}

function dButt(controlId)
{
	
	docElement = document.getElementById(controlId);	
	if (docElement != null)
	{		
		appendWait(docElement);
		docElement.outerHTML = '<TABLE cellSpacing=2 cellPadding=0 border=0 ><TR><TD class=\'UPL_BTN_MO\' onmouseover="javascript:this.className=\'UPL_BTN_MT\';" onmouseout="javascript:this.className=\'UPL_BTN_MO\';" noWrap>' + docElement.outerHTML + '</TD></TR></TABLE>';			
	}
		
}

function dButtFWT(controlId)
{
	
	docElement = document.getElementById(controlId);	
	if (docElement != null)
	{		
		appendWait(docElement);
		docElement.outerHTML = '<TABLE cellSpacing=0 cellPadding=0 border=0 width=100% ><TR><TD align=center class=\'UPL_BTN_MO\' onmouseover="javascript:this.className=\'UPL_BTN_MT\';" onmouseout="javascript:this.className=\'UPL_BTN_MO\';" noWrap>' + docElement.outerHTML + '</TD></TR></TABLE>';			
	}
		
}

function dButtFWTIcon(controlId,image)
{
	
	docElement = document.getElementById(controlId);	
	if (docElement != null)
	{		
		appendWait(docElement);
		docElement.outerHTML = '<TABLE cellSpacing=0 cellPadding=0 border=0 width=100% ><TR><TD align=center class=\'UPL_BTN_MO\' onmouseover="javascript:this.className=\'UPL_BTN_MT\';" onmouseout="javascript:this.className=\'UPL_BTN_MO\';" noWrap><TABLE width=100% border=0 backcolor=black><TR><TD><img src="' + image + '" border=0></TD><TD width=100% noWrap>' + docElement.outerHTML + '</TD></TR></TABLE></TD></TR></TABLE>';			
	}
		
}

function dButtTip(controlId,vTip)
{
	
	docElement = document.getElementById(controlId);	
	if (docElement != null)
	{		
		docElement.outerHTML = '<TABLE cellSpacing=0 cellPadding=0 border=0 ><TR><TD align=center class=\'UPL_BTN_MO\' onmouseover="javascript:Tip(\''+vTip+'\');this.className=\'UPL_BTN_MT\';" onmouseout="javascript:this.className=\'UPL_BTN_MO\';" noWrap><TABLE width=100% border=0 backcolor=black><TR><TD width=100% noWrap>' + docElement.outerHTML + '</TD></TR></TABLE></TD></TR></TABLE>';			
	}
		
}

function dTblForm(controlId)
{
	
		/*
	docElements = document.getElementsByTagName('TABLE');	
		
	
	if (docElements.length != 0)
	{			
		
		for(i=0;i<docElements.length;i++) 
		{	
			if (docElements[i].id == controlId)
			{
				//alert('ok');
				//docElements[i].outerHTML = 'HOLA!!' + docElements[i].outerHTML + 'MUNDO!!!';
			}
		}
	}
		*/
}


function dButtTab(controlId,selected)
{
	
	docElement = document.getElementById(controlId);	
	if (docElement != null)
	{		
		appendWait(docElement);
		if (selected == true)		
			docElement.outerHTML = '<TABLE cellSpacing=0 cellPadding=0 border=0><TR><TD class=\'TAB_SEL\' noWrap>' + docElement.outerHTML + '</TD></TR></TABLE>';			
		else
			docElement.outerHTML = '<TABLE cellSpacing=0 cellPadding=0 border=0><TR><TD class=\'TAB_UNSEL\' noWrap>' + docElement.outerHTML + '</TD></TR></TABLE>';			
		
	}
		
}

function dButtMnu(controlId,selected)
{
	
	docElement = document.getElementById(controlId);	
	if (docElement != null)
	{		
		appendWait(docElement);
		if (selected == true)		
			docElement.outerHTML = '<TABLE width=100% cellSpacing=0 cellPadding=0 border=0><TR><TD class=\'MNU_SEL\' noWrap>' + docElement.outerHTML + '</TD></TR></TABLE>';			
		else
			docElement.outerHTML = '<TABLE width=100% cellSpacing=0 cellPadding=0 border=0><TR><TD class=\'MNU_UNSEL\' noWrap>' + docElement.outerHTML + '</TD></TR></TABLE>';			
		
	}
		
}

function appendWait(docElement)
{
	var childNode = docElement.childNodes[0];	
	if (childNode != null)
	{
		if (childNode.nodeType == 1)
		{	
			var href = String(childNode.getAttribute('href'));			
			var onclick = String(childNode.getAttribute('onclick'));
			if (!((href.indexOf('.submit()') == -1) && (onclick.indexOf('.submit()') == -1)))
			{	
				childNode.setAttribute('onclick','preClick();' + onclick);	
			}
		}	
	} else
	{ 
	   // No hago nada
	}
}

function dHTMLEdit(controls)
{
	try {		
		
			tinyMCE.init({mode : "exact",
			        entities : "",
			        cleanup : "false",			
				theme : "advanced",        	
				language : "es",	
				theme_advanced_disable : "formatselect,styleselect",								
				width : "540",
				height : "240",
				browsers : "msie,gecko,opera",
				elements : controls,
                                plugins : "advlink, spellchecker, paste, fullscreen,table,contextmenu,searchreplace,visualchars,layer,media,preview,codehighlighting",								
                                theme_advanced_buttons1_add : "searchreplace,fontselect,fontsizeselect,forecolor,backcolor",
				theme_advanced_buttons2_add : "visualchars,spellchecker,fullscreen,preview,pastetext,pasteword,selectall",	
				theme_advanced_buttons3_add : "tablecontrols,layer,media,codehighlighting",
				theme_advanced_statusbar_location : "bottom",
				theme_advanced_resize_horizontal : false,
				theme_advanced_resizing : true,				
				fullscreen_new_window : false,                                				
				paste_create_paragraphs : true,
				paste_create_linebreaks : false,			
				paste_use_dialog : false,
				paste_auto_cleanup_on_paste : true,
				paste_convert_middot_lists : false,	
				paste_convert_headers_to_strong : true,
				spellchecker_languages : "Ingles=en-US,+Espanol=es-ES",
				valid_elements : "*[*]",				
				extended_valid_elements : "*[*]",				
				remove_linebreaks : false,				
				advlink_styles : "Link=link"
				});
				
				//extended_valid_elements : "pre[name|class|cols|rows],script[src|type],a[class|name|href|target|title|onclick|rel]",				
	}
	catch(err)
	{
	   // No es compatible con TinyMCE
	}

	// Me fijo si ya fue instanciado el Init de tinyMCE
	//if (tinyMCE.settings == null)
	//{
	
	//   tinyMCE.init({
	//      mode : "exact",
  	//    	theme : "advanced2",
  	//    	language : "es",
  	//    	theme_advanced2_buttons1_add : "fontselect,fontsizeselect",
  	//    	elements : controls
  	//	});
  	//}
  	//else
  	//{
  		// En el caso en que ya posea elementos, se incorporan los nuevos.
  	//	tinyMCE.settings['elements'] += ',' + controls;  		
  	//}
}

function showContent(winname){
	eleIdContent = winname + 'CONTENT';
	eleIdPrevH = winname + 'PREVH';
	eleIdHead  = winname + 'head';
	eleIdPlus  = winname + 'plus';
	element = document.getElementById(eleIdContent);
	elementH = document.getElementById(eleIdPrevH);
	document.getElementById(eleIdHead).style.visibility='visible';
	element.style.visibility='visible';
	
	if(element.style.display=='none'){
	     element.style.display='block';
	     document.getElementById(eleIdPlus).innerHTML='<img src=\'images/upsimple.png\'>';
	     //cookUtil.setSubValue(winname+'WINSTATE','S')
	     //setCookie(winname+'WINSTATE', 'S');
	}
	else{
	     element.style.display='none';
             document.getElementById(eleIdPlus).innerHTML='<img src=\'images/downsimple.png\'>';
             //cookUtil.setSubValue(winname+'WINSTATE','N')
	     //setCookie(winname+'WINSTATE', 'N');
	}
}



// ********************** Funciones para desplegar un indicador de progreso *********************

var _timer;
var _waitMessage = null;
var _waitHeight = 105;
var _waitWidth = 502;
 

// Tiempo de espera en milisegundos antes de mostrar el mensaje de procesando

var _waitTime = 100;

 

function initializeMessage()
{    
	    iframeLocker = document.createElement('<iframe style="z-index:0;position:absolute;left:0;top:0;width:100%;height:100%;opacity: 0;filter:alpha(opacity=0);-moz-opacity:0;khtml-opacity:0">');
            _waitMessage = document.createElement('<DIV style="BACKGROUND-COLOR: #ffffff; z-index: 300; visibility: hidden; position: absolute;">');

            _waitMessage.innerHTML = '<table bgcolor="#888888" cellpadding="0" cellspacing="3"><tr><td>\
                        <table bgcolor="#FFFFFF" cellSpacing="0px" cellPadding="0px">\
                                   <tr height="65">\
                                               <td width="21"></td>\
                                               <td>\
                                                           <font color="#969696" face="Verdana" size="5">Procesando, espere por favor...</font>\
                                               </td>\
                                               <td width="16">\
                                               </td>\
                                               <td valign="middle">\
                                                           <table cellSpacing="0px" cellPadding="0px">\
                                                                       <tr><td height="18px"></td></tr>\
                                                                       <tr valign="middle">\
                                                                                   <td>\
                                                                                              <img src="images/wait.gif"></img>\
                                                                                  </td>\
                                                                       </tr>\
                                                                       <tr><td height="14px"></td></tr>\
                                                           </table>\
                                               </td>\
                                               <td width="18"></td>\
                                   </tr>\
                        </table>\
            </td></tr></table>';            

            document.body.appendChild(iframeLocker);
            document.body.appendChild(_waitMessage);

}

 

function preClick()
{
            _timer = setTimeout("waitMessage()", _waitTime);                                  
            return true;
}

function preClickMenu(obj)
{
            if (obj.firstChild != null) {
                        if (obj.firstChild.nodeType != 3) {
                                   // No es nodo texto
                                   _timer = setTimeout("waitMessage()", _waitTime);                                  
                        }           
            }
            return true;
}

function waitMessage()
{
            // Si es la primera vez se crea el mensaje
            if (_waitMessage == null) {
                        initializeMessage();
            }
            t = document.body.scrollTop + (document.documentElement.scrollHeight - _waitHeight) / 2;
            l = document.body.scrollLeft + (document.documentElement.scrollWidth - _waitWidth) / 2;
 
            _waitMessage.style.left = l;
            _waitMessage.style.top = t;
 
            _waitMessage.style.visibility = 'visible';
}

 

function removeWaitMessage()
{
       if (_waitMessage != null) {
               _waitMessage.style.visibility = 'hidden';
       }
       clearTimeout(_timer);
}

// ********************* Fin Funciones para desplegar un indicador de espera ********************


function setCookie(cookieName, cookieValue, expires, path, domain, secure) {
	document.cookie =
		escape(cookieName) + '=' + escape(cookieValue)
		+ (expires ? '; expires=' + expires.toGMTString() : '')
		+ (path ? '; path=' + path : '')
		+ (domain ? '; domain=' + domain : '')
		+ (secure ? '; secure' : '');
};
// [Cookie] Gets a value from a cookie
function geCookie(cookieName) {
	var cookieValue = '';
	var posName = document.cookie.indexOf(escape(cookieName) + '=');
	if (posName != -1) {
		var posValue = posName + (escape(cookieName) + '=').length;
		var endPos = document.cookie.indexOf(';', posValue);
		if (endPos != -1) cookieValue = unescape(document.cookie.substring(posValue, endPos));
		else cookieValue = unescape(document.cookie.substring(posValue));
	}
	return (cookieValue);
};
