// JavaScript Document
/*-----------------------Para abrir ventanas---------------------------------*/
function abrir(valor) {
  window.open(valor,'','width=500,height=400,menubar,resizable,toolbar,titlebar,status,directories,location,scrollbars=yes');
}
/*---------------------------------------------------------------------------*/

var button_state=0;
var over_win=false;
function Init()
{

/*--------------------  Boton para desplegar el tiempo --------------------- */

var obj = getObj('button');
var obj_win= getObj('window');
var obj_container= getObj('container_total');
obj_win.style.visibility="hidden";// Hide when onload
      obj.onmouseover=function() { over_win=true;   }
	   obj.onmouseout=function() { over_win=false;   }
      obj.onclick=function() {   
	        Window_W ();    
	       }//onclick function	
	 obj_container.onclick=function() {  				
          if (over_win==false )	{				  
				     obj_win.style.visibility="hidden";
					 obj.src=path + "img/btn_open.gif";
					 obj1.style.visibility="visible"; // listbox
				     button_state = 0; 
					}	
	       }//onclick function	
		   
function Window_W (){
 if (button_state==0 ) {					
				    obj_win.style.visibility="visible"; //win tiempo
					if (getObj('skin_box')) obj1.style.visibility="hidden"; // listbox
					obj.src=path + "img/btn_close.gif";
				    button_state = 1; 
					} else 	{				  
				     obj_win.style.visibility="hidden";
					 obj.src=path + "img/btn_open.gif";
					if (getObj('skin_box')) obj1.style.visibility="visible"; // listbox
				    button_state = 0; 
					}	
					
	 }       
/* --------------------Para el box de los temas -------------------  */
var obj1;
if (getObj('skin_box')){
	   obj1 = getObj('skin_box');
         obj1.onchange=function() {  document.temas.submit(); } 
             }
	           		  
 }//End Init
 /*-------------------PAra el mapa del sitio--------------------------*/
 var button_state1=0;
var over_win1=false;

 function Init1()
{

/*--------------------  Boton para desplegar el tiempo --------------------- */

var obj = getObj('button');
var obj_win1= getObj('window');
var obj_container= getObj('container_total');
obj_win1.style.visibility="hidden";// Hide when onload
      obj.onmouseover=function() { over_win=true;   }
	   obj.onmouseout=function() { over_win=false;   }
      obj.onclick=function() {   
	        Window_W1 ();    
	       }//onclick function	
	 obj_container.onclick=function() {  				
          if (over_win==false )	{				  
				     obj_win1.style.visibility="hidden";
					 obj.src=path + "img/btn_open.gif";
					 //obj1.style.visibility="visible"; // listbox
				     button_state1 = 0; 
					}	
	       }//onclick function	
		   
function Window_W1 (){
 if (button_state1==0 ) {
				    obj_win1.style.visibility="visible"; //win tiempo
					//if (getObj('skin_box')) obj1.style.visibility="hidden"; // listbox
					obj.src=path + "img/btn_close.gif";
				    button_state1 = 1; 
					} else 	{				  
				     obj_win1.style.visibility="hidden";
					 obj.src=path + "img/btn_open.gif";
					//if (getObj('skin_box')) obj1.style.visibility="visible"; // listbox
				    button_state1 = 0; 
					}	
					
	 }       
/* --------------------Para el box de los temas -------------------  */
/*var obj1;
if (getObj('skin_box')){
	   obj1 = getObj('skin_box');
         obj1.onchange=function() {  document.temas.submit(); } 
             }*/
	           		  
 }//End Init1

/* --------------------------------------------------------------------*/
/*Get object */
function getObj(objID)
	{
	if (document.getElementById) {return document.getElementById(objID);}
	else if (document.all) {return document.all[objID];}
	else if (document.layers) {return document.layers[objID];}
	}
	
	
	// DEFINE VARIABLES

// whitespace characters
var whitespace = " \t\n\r";
var defaultEmptyOK = false

var intLimit = 15

function isEmpty(s){
// Check whether string s is empty.
	 return ((s == null) || (s.length == 0))
}

// Returns true if string s is empty or 
// whitespace characters only.

function isWhitespace(s)

{	 var i;

		// Is s empty?
		if (isEmpty(s)) return true;

		for (i = 0; i < s.length; i++)
		{	 
		// Check that current character isn't whitespace.
		var c = s.charAt(i);

		if (whitespace.indexOf(c) == -1) return false;
		}

		// All characters are whitespace.
		return true;
}

// E-mail Validation
function isEmail (s)
{	 if (isEmpty(s)) 
			 if (isEmail.arguments.length == 1) return defaultEmptyOK;
			 else return (isEmail.arguments[1] == true);
	 
		// is s whitespace?
		if (isWhitespace(s)) return false;
		
		// there must be >= 1 character before @, so we
		// start looking at character position 1 
		// (i.e. second character)
		var i = 1;
		var sLength = s.length;

		// look for @
		while ((i < sLength) && (s.charAt(i) != "@"))
		{ i++
		}

		if ((i >= sLength) || (s.charAt(i) != "@")) return false;
		else i += 2;

		// look for .
		while ((i < sLength) && (s.charAt(i) != "."))
		{ i++
		}

		// there must be at least one character after the .
		if ((i >= sLength - 1) || (s.charAt(i) != ".")) return false;
		else return true;
}	


/* Efemerides*/

function UpdateMonths()
{
document.form_efemerides.submit(); 
}





