jQuery.noConflict();

jQuery(document).ready(
	function(){
		displayDate();
		displayDateEng();
		jQuery('ul#banner').innerfade({
			speed: 1000,
			timeout: 3000,
			type: 'sequence',
			containerheight: '263px'
		});
		jQuery.uicornerfix('6px');
		
		jQuery('#opciones li').click(function()
		{
			var valor=this.value;
			cargarContenido(valor);
			jQuery(this).addClass("servicio_activo");
			
			jQuery('#opciones li').each(function()
			{
				if(this.value != valor)
				{
					jQuery(this).removeClass("servicio_activo");
				}
			});
			
		});

		
	});
	
function cargarContenido(id)
{
		switch(id)
	{
		case 1:
		
		var id="#cont"+jQuery('#last').val();
		jQuery('#last').val(1);
		jQuery(id).fadeOut('normal',function(){jQuery("#cont1").fadeIn('normal');});
		break;
		
		case 2:
		var id="#cont"+jQuery('#last').val();
		jQuery('#last').val(2);
		jQuery(id).fadeOut('normal',function(){jQuery("#cont2").fadeIn('normal');});
		break;
		
		case 3:
		var id="#cont"+jQuery('#last').val();
		jQuery('#last').val(3);
		jQuery(id).fadeOut('normal',function(){jQuery("#cont3").fadeIn('normal');});
		break;
		
		case 4:
		var id="#cont"+jQuery('#last').val();
		jQuery('#last').val(4);
		jQuery(id).fadeOut('normal',function(){jQuery("#cont4").fadeIn('normal');});
		break;
		
		case 5:
		var id="#cont"+jQuery('#last').val();
		jQuery('#last').val(5);
		jQuery(id).fadeOut('normal',function(){jQuery("#cont5").fadeIn('normal');});
		break;
		
		case 6:
		var id="#cont"+jQuery('#last').val();
		jQuery('#last').val(6);
		jQuery(id).fadeOut('normal',function(){jQuery("#cont6").fadeIn('normal');});
		break;

	}
}

function toogleContenido(id)
{
	jQuery(id).slideToggle();
}

var pong;
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; }
  jQuery("#fecha").html(" ("+day + " de " + this_month[month] + " " + year+") ");
}

function displayDateEng() {
  var this_month = new makeArray(12);
  this_month[0]  = "January";
  this_month[1]  = "February";
  this_month[2]  = "March";
  this_month[3]  = "April";
  this_month[4]  = "My";
  this_month[5]  = "June";
  this_month[6]  = "July";
  this_month[7]  = "August";
  this_month[8]  = "September";
  this_month[9]  = "Octubre";
  this_month[10] = "November";
  this_month[11] = "December";

  var this_day_e = new makeArray(7);
  this_day_e[0]  = "Sunday";
  this_day_e[1]  = "Monday";
  this_day_e[2]  = "Tuesday";
  this_day_e[3]  = "Wednesday";
  this_day_e[4]  = "Thursday";
  this_day_e[5]  = "Friday";
  this_day_e[6]  = "Saturday";

  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; }
  jQuery("#fecha_eng").html(" ("+this_month[month] + " " +day+", "+year+") ");
}

function login()
{
 var parametros=jQuery("#form").serialize();
 jQuery.post("client/login.php",parametros, function(data){
  if(data=="ok")
  {
  	window.location.href="client/report.php?lang=es";
  }else
  {
  	jQuery("#msg").html("Verifique el usuario y la contraseña");
	jQuery("#msg").show();
  }
});
}

function loginint()
{
 var parametros=jQuery("#form").serialize();
 jQuery.post("../client/login.php",parametros, function(data){
  if(data=="ok")
  {
  	window.location.href="../client/report.php?lang=es";
  }else
  {
  	jQuery("#msg").html("Verifique el usuario y la contraseña");
	jQuery("#msg").show();
  }
});
}

function loginint_fr()
{
 var parametros=jQuery("#form").serialize();
 jQuery.post("../client/login.php",parametros, function(data){
  if(data=="ok")
  {
  	window.location.href="../client/report.php?lang=fr";
  }else
  {
  	jQuery("#msg").html("Verifique el usuario y la contraseña en francés");
	jQuery("#msg").show();
  }
});
}

function loginint_en()
{
 var parametros=jQuery("#form").serialize();
 jQuery.post("../client/login.php",parametros, function(data){
  if(data=="ok")
  {
  	window.location.href="../client/report.php?lang=eng";
  }else
  {
  	jQuery("#msg").html("Incorrect user and / or password");
	jQuery("#msg").show();
  }
});
}



function submitEnter(myfield,e,op)
{
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
else return true;

if (keycode == 13)
   {
	 switch(op){  
  		case 1:login();break;
		case 2:loginint();break;
  		case 3:loginint_en();break;
		case 4:loginint_fr();break;

	 }
   return false;
   }
else
   return true;
}



