<!--
function switch_Panels( id1, id2 ) { //v1.0 by caridy
  var obj1 = findObj ( id1 );
  var obj2 = findObj ( id2 );
  if (obj1)
    obj1.style.display = 'none';
  if (obj1)
    obj2.style.display = 'block';
  return false;
}
function display_Advanced_Search() { //v1.0 by caridy
  document.forms['PredefinedSearchForm'].style.display = 'none';
  document.forms['AdvSearchForm'].style.display 	   = 'block';
  return false;
}
function display_Predefined_Search() { //v1.0 by caridy
  document.forms['PredefinedSearchForm'].style.display = 'block';
  document.forms['AdvSearchForm'].style.display 	   = 'none';
  return false;
}
function view_photo(obj){ //v1.0 by caridy
  w = 720;
  h = 580;
  /// detect a special case of "web browser"
  is_ie = (navigator.userAgent.toLowerCase().indexOf("msie") != -1);
  if (!is_ie)
    h = h + 95;
  window.open(obj.href,'','scrollbars=yes,width='+w+',height='+h);
  return false;
}
function display_forums(obj){ //v1.0 by caridy
  w = 680;
  h = 580;
  /// detect a special case of "web browser"
  is_ie = (navigator.userAgent.toLowerCase().indexOf("msie") != -1);
  if (!is_ie)
    h = h + 95;
  window.open(obj.href,'forums','scrollbars=yes,width='+w+',height='+h);
  return false;
}
function display_chat(obj){ //v1.0 by caridy
  w = 800;
  h = 600;
  /// detect a special case of "web browser"
  is_ie = (navigator.userAgent.toLowerCase().indexOf("msie") != -1);
  if (!is_ie)
    h = h + 95;
  window.open(obj.href,'','scrollbars=yes,width='+w+',height='+h);
  return false;
}
function external_navigate(url){ //v1.0 by caridy
  if (url != '')
    window.open(url,'','');
  return false;
}
function recommend ( url ) {
  var page = base64encode(utf16to8(document.URL)); // url = utf8to16(base64decode(page));
  var title = document.title;
  if ( url.indexOf ('?') == -1 )
    location.href = url + '?_title=' + title  + '&_url=' + page;
  else  
    location.href = url + '&_title=' + title  + '&_url=' + page;
}
function add_to_favorites ( msg ) {
  var page = document.url;
  var title = document.title;
  // window.external.AddFavorite( page, title );
  if (msg != null)
    alert ( msg );
  return false;  
}
function navegate( url ) {
  if (url != '')
    location.href = url;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function makeArray(n){
  this.length = n;
  for (i=1;i<=n;i++){
    this[i]=0;
  }
  return this;
}

// standard date display function with y2k compatibility
function displayDate() {
  var this_month = new makeArray(12);
  this_month[0]  = "Enero";
  this_month[1]  = "Febrero";
  this_month[2]  = "Marzo";
  this_month[3]  = "Abril";
  this_month[4]  = "Mayo";
  this_month[5]  = "Junio";
  this_month[6]  = "Julio";
  this_month[7]  = "Agosto";
  this_month[8]  = "Septiembre";
  this_month[9]  = "Octubre";
  this_month[10] = "Noviembre";
  this_month[11] = "Deciembre";

  var this_day_e = new makeArray(7);
  this_day_e[0]  = "Domingo";
  this_day_e[1]  = "Lunes";
  this_day_e[2]  = "Martes";
  this_day_e[3]  = "Miércoles";
  this_day_e[4]  = "Jueves";
  this_day_e[5]  = "Viernes";
  this_day_e[6]  = "Sábado";

  var today = new Date();
  var day   = today.getDate();
  var month = today.getMonth();
  var year  = today.getYear();
  var dia = today.getDay();
    if (year < 1000) {
       year += 1900; }
  return( " " + this_day_e[dia] + ", " + day + " de " + this_month[month] + " " + year);
}

function email_onblur(correo)
{ 
  aux = new String(correo);
  var aux1=aux.indexOf("@",1);
  if (aux1 == -1)
    return true;
  if (aux.indexOf(".",aux1) == -1)
    return true;
  return false; // check passed
}

function validaphone(phone)
{	
    var regEx = /[0-9]{6}/;
    if(regEx.test(phone))
    {    
    return false;
    }
    else
    {    
    return true;
    }	   
}
function close_window () {
  window.close ();
}
function check_email( correo )
{ 
  aux = new String(correo);
  var aux1=aux.indexOf("@",1);
  if (aux1 == -1)
    return true;
  if (aux.indexOf(".",aux1) == -1)
    return true;
  return false; // check passed
}
function check_passport( pass, confirmpass )
{	
  if(pass != confirmpass)
    return false;
  else
    return true;
}
function findObj(theObj, theDoc)
{
  var p, i, foundObj;

  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++)
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++)
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);

  return foundObj;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' debe contener una dirección de E-mail.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' debe contener un número.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' debe contener un número entre '+min+' y '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' es requerido.\n'; }
  } if (errors) alert('Ha ocurrido un error(s):\n'+errors);
  document.MM_returnValue = (errors == '');
}
function validate_field() { //v4.1 by caridy (sources: validateForm from macromedia MX 2004)
  var i,p,q,nm,test,num,min,max,errors='',args=validate_field.arguments;
  for (i=0; i<(args.length-2); i+=4) { 
    test=args[i+2]; 
    msg=args[i+3]; 
	val=MM_findObj(args[i]);
    if (val) { 
	  nm=val.name; 
	  if ((val=val.value)!="") {
        if (test.indexOf('isEmail')!=-1) { 
		  p=val.indexOf('@');
          if (p<1 || p==(val.length-1)) 
		    errors+='- '+msg+'\n';
        } 
		else if (test!='R') { 
		  num = parseFloat(val);
          if (isNaN(val)) 
		    errors+='- '+msg+'\n';
          if (test.indexOf('inRange') != -1) { 
		    p=test.indexOf(':');
            min=test.substring(8,p); max=test.substring(p+1);
            if (num<min || max<num) 
		      errors+='- '+msg+'\n';
          }
		} 
	  } 
	  else if (test.charAt(0) == 'R') 
	    errors+='- '+msg+'\n';
	}
  } 
  document.MM_returnValue = (errors == '');
  return errors;
}
function validate_check( obj, msg ) {
  errors='';
  val=MM_findObj(obj);
  if ((val) && (val.checked != true))
    errors+='- '+msg+'\n';
  document.MM_returnValue = (errors == '');
  return errors;
}

// Fromulario de combio de fecha... (add by caridy)

// JS Calendar
var calendar = null; // remember the calendar object so that we reuse
// it and avoid creating another

// This function gets called when an end-user clicks on some date
function updateCalendar(cal, date) {
	cal.sel.value = date; // just update the value of the input field
}

// And this gets called when the end-user clicks on the _selected_ date,
// or clicks the "Close" (X) button.  It just hides the calendar without
// destroying it.
function closeHandler(cal) {
	cal.hide();			// hide the calendar

	// don't check mousedown on document anymore (used to be able to hide the
	// calendar when someone clicks outside it, see the     s function).
	Calendar.removeEvent(document, "mousedown", checkCalendar);
}

// This gets called when the user presses a mouse button anywhere in the
// document, if the calendar is shown.  If the click was outside the open
// calendar this function closes it.
function checkCalendar(ev) {
	var el = Calendar.is_ie ? Calendar.getElement(ev) : Calendar.getTargetElement(ev);
	for (; el != null; el = el.parentNode)
	// FIXME: allow end-user to click some link without closing the
	// calendar.  Good to see real-time stylesheet change :)
	if (el == calendar.element || el.tagName == "A") break;
	if (el == null) {
		// calls closeHandler which should hide the calendar.
		calendar.callCloseHandler(); Calendar.stopEvent(ev);
	}
}

// This function shows the calendar under the element having the given id.
// It takes care of catching "mousedown" signals on document and hiding the
// calendar if the click was outside.
function showCalendar(id) {
	var el = document.getElementById(id);
	if (calendar != null) {
		// we already have one created, so just update it.
		calendar.hide();		// hide the existing calendar
		calendar.parseDate(el.value); // set it to a new date
	} else {
		// first-time call, create the calendar
		var cal = new Calendar(true, null, updateCalendar, closeHandler);
		calendar = cal;		// remember the calendar in the global
		cal.setRange(1900, 2070);	// min/max year allowed
		calendar.create();		// create a popup calendar
	}
	calendar.sel = el;		// inform it about the input field in use
	calendar.showAtElement(el);	// show the calendar next to the input field

	// catch mousedown on the document
	Calendar.addEvent(document, "mousedown", checkCalendar);
	return false;
}

// -->
