
$(function() {


//$("li#m2 a").hover(function(){$("ul#sec").fadeOut(500);});

$("li#m2 a").mouseenter(function(){

      if($.browser.msie){
		     $("ul#sec").show();
		  }else{
		    $("ul#sec").fadeIn(200);
		  }

      $("ul#sec").show();
      $(this).addClass("activoTmp");
})

$("#oWrapContenido, #oNav ul li:not(#m2)").mouseenter(function(){

      if($.browser.msie){
		  	$("ul#sec").hide();
		  }else{
		  	$("ul#sec").fadeOut(200);
		  }


      if( !$("li#m2 a").hasClass("activo"))
      {
      	$("li#m2 a").removeClass("activoTmp");
      }

})

}); // FIN $(function()


/******************************************
*
* Controlador de errores
*
*******************************************/
//onerror=handleErr;
var txt="";
function handleErr(msg,url,l){
	txt="There was an error on this page.\n\n";
	txt+="Error: " + msg + "\n";
	txt+="URL: " + url + "\n";
	txt+="Line: " + l + "\n\n";
	txt+="Click OK to continue.\n\n";
//alert(txt);
return true;
}


/******************************************
*
* Función fecha
*
*******************************************/
function makeArray(n){
  this.length = n;
  for (i=1;i<=n;i++){
    this[i]=0;
  }
  return this;
}

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] = "Diciembre";

  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] + " del " + year);
  return( day + " de " + this_month[month] + " de " + year);
}

/*  TIPOS */

var tipos = ["small","medium","large"];
var estandar = getCookie('tipos');
if(estandar == undefined){
	//alert("primera vez");
	estandar = 3;
	}

function tipo(cual){
	estandar = cual;
	//document.body.style.fontSize=tipos[estandar];
	deleteCookie('tipos');
	setCookie('tipos', estandar, null, null);
	deinicio();
	}




/************************************************************************************/
// Cookie API  v1.0.1
// http://www.dithered.com/javascript/cookies/index.html
// maintained by Chris Nott (chris@NOSPAMdithered.com - remove NOSPAM)


// Write a cookie value
function setCookie(name, value, expires, path, domain, secure) {
	var curCookie = name + '=' + escape(value) + ((expires) ? '; expires=' + expires.toGMTString() : '') + ((path) ? '; path=' + path : '') + ((domain) ? '; domain=' + domain : '') + ((secure) ? '; secure' : '');
	document.cookie = curCookie;
}


// Retrieve a named cookie value
function getCookie(name) {
	var dc = document.cookie;

	// find beginning of cookie value in document.cookie
	var prefix = name + "=";
	var begin = dc.indexOf("; " + prefix);
	if (begin == -1) {
		begin = dc.indexOf(prefix);
		if (begin != 0) return null;
	}
	else begin += 2;

	// find end of cookie value
	var end = document.cookie.indexOf(";", begin);
	if (end == -1) end = dc.length;

	// return cookie value
	return unescape(dc.substring(begin + prefix.length, end));
}


// Delete a named cookie value
function deleteCookie(name, path, domain) {
	var value = getCookie(name);
	if (value != null) document.cookie = name + '=' + ((path) ? '; path=' + path : '') + ((domain) ? '; domain=' + domain : '') + '; expires=Thu, 01-Jan-70 00:00:01 GMT';
	return value;
}


// Fix Netscape 2.x Date bug
function fixDate(date) {
	var workingDate = date;
	var base = new Date(0);
	var skew = base.getTime();
	if (skew > 0) workingDate.setTime(workingDate.getTime() - skew);
	return workingDate;
}


// Test for cookie support
function supportsCookies(rootPath) {
	setCookie('checking_for_cookie_support', 'testing123', '', (rootPath != null ? rootPath : ''));
	if (getCookie('checking_for_cookie_support')) return true;
	else return false;
}