function jtabla(conten){
	return '<table border="0" cellpading="0" cellspacing="0"><tr><td>'+conten+'</td></tr></table>';
}
$(document).ready(function(){ 
	//para navegacion
	$("#unavegacion").hover(function() {
		$("#navegacion ul li.current").addClass("current2"); 
		$("#navegacion ul li.current").removeClass("current"); 
		//$("#user > span").addClass("estilo2");  
	}, function() {
		$("#navegacion ul li.current2").addClass("current"); 
		$("#navegacion ul li.current2").removeClass("current2");
	});
	if ( $.browser.msie ) {
  		if( $.browser.version =='6.0'){
			//alert('IE6');
			$("#navegacion ul li").hover(function() {
				$(this).addClass("currentx"); 
			}, function() {
				$(this).removeClass("currentx");
			});
			$("#idioma").hover(function() {
				$(this).addClass("currentx");
			}, function() {
				$(this).removeClass("currentx");
			});
		}
	};
	//etiquetas de input
	$('body').prepend('<div id="xtip"><div id="xtip_tx"></div><div id="xtip_marco"><div id="xtip_tex">Dummy Text</div>		<div id="xtip_bor"></div></div></div>');
	
	$("input:text, textarea, input:password").each(function(){
        if(this.value == '')
            this.value = this.title;
    });
    $("input:text, textarea, input:password").focus(function(){
        if(this.value == this.title)
            this.value = '';
		if(this.title!=''){
			$('#xtip_tx').html(this.title);
			$('#xtip_tex').html(this.title);
			$('#xtip').css('display','block');
			var coor=$(this).offset();
			$('#xtip').css('top',coor.top-29);
			$('#xtip').css('left',coor.left-2);
		}
    });
    $("input:text, textarea, input:password").blur(function(){
        if(this.value == '')
            this.value = this.title;
		if(this.title!=''){
			$('#xtip').css('display','none');
		}
    });	
	$("select").focus(function(){
		if(this.title!=''){
			$('#xtip_tx').html(this.title);
			$('#xtip_tex').html(this.title);
			$('#xtip').css('display','block');
			var coor=$(this).offset();
			$('#xtip').css('top',coor.top-29);
			$('#xtip').css('left',coor.left-2);
		}
    });
    $("select").blur(function(){
		if(this.title!=''){
			$('#xtip').css('display','none');
		}
    });	
	//para slider de home
	$("#slider1").easySlider({//id de contenedor
	    prevId: 'prevBtn1', //id de botones
	    nextId: 'nextBtn1',//es todo lo demas es css
		auto:true,
		continuous:	true,
		speed:500,
		pause:3000,
		pausaBoton:true,
		pausaIniciar:false,
		pausaId: 'pausaBtn1',
		pausaText:''
	});
	$('#pausaBtn1').css('display','none');
	$('#pausaBtn1 a').css('opacity','0.6');
	$('#slider1').hover(
		function(){
			$('#pausaBtn1').css('display','block');
		},
		function(){
			$('#pausaBtn1').css('display','none');
		}
	);
	$('#pausaBtn1').hover(
		function(){
			$('#pausaBtn1 a').css('opacity','0.8');
			$('#pausaBtn1').css('display','block');
		},
		function(){
			$('#pausaBtn1 a').css('opacity','0.6');
			$('#pausaBtn1').css('display','block');
		}
	);
	//slider de destacados
	$("#textobloques").easySlider2({//id de contenedor
	    prevId: 'prevBtn2',
	    nextId: 'nextBtn2'
	});
	//para popus
	$("a[rel=fbox]").fancybox({
		'titleShow'		: true,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'overlayColor'	: '#000',
		'overlayOpacity': 0.6
	});	
	//para popus url
	$("a.pop").fancybox({
		'width'				: 382,
		'height'			: 430,
		'autoScale'			: false,
		'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe',
		'overlayColor'	: '#000',
		'overlayOpacity': 0.6
	});
	//para formulario de contacto
	$('#isubject').css('display','none');
	$('#cbsource').change(function(){
		if(this.value=='Others'){
			$('#isubject').css('display','block');
		}
		else {
			$('#isubject').css('display','none');
		}
	});
	//slider de modulos de la parte inferior
	$("#modinf").easySlider({//id de contenedor
		prevId: 'prevBtn3',
		nextId: 'nextBtn3'
	});
	//calendarios
	cYear=new Date();
	$('.fechacx').dynDateTime({
		ifFormat: "%d/%m/%Y",
		range: [cYear.getFullYear(), 2020],
		FechaHoy:true
	});
	$('.fechacy').dynDateTime({
		ifFormat: "%d/%m/%Y",
		range: [1900, cYear.getFullYear()],
		FechaHoy:false
	});

	//ie6 & 7 fix
	if ( $.browser.msie ) {
  		if( $.browser.version =='6.0' || $.browser.version =='7.0'){
			$('#slider1 .enlacesTxt').each(function(){
				var Txt = $(this).html();
				$(this).html(jtabla(Txt));
			});
			$('#slider1 .enlaces').each(function(){
				var Txt = $(this).html();
				$(this).html(jtabla(Txt));
			});
			$('.aviso').each(function(){
				var Txt = $(this).html();
				$(this).html(jtabla(Txt));
			});
			$('.aviso2').each(function(){
				var Txt = $(this).html();
				$(this).html(jtabla(Txt));
			});
			$('.stud_texto').each(function(){
				var Txt = $(this).html();
				$(this).html(jtabla(Txt));
			});
		}
	}

	$('#aHablemos').click(function(){
		if($('#menu_hablemos').css('display')=='none'){
			$('#menu_hablemos').css('display','block');
		}
	});
	$('#menu_hablemos').hover(
		function(){
		},
		function(){
			$('#menu_hablemos').css('display','none');
		}
	);
	/*marquesina*/
	var marquesina1 ='<marquee behavior="scroll" direction="down" scrolldelay="90" scrollamount="2" height="90"><span style="height:426px"><span style="padding-left:80px"><img src="img/ban_videos.png" alt="fotos" /></span></span></marquee>';
	$('#marquesina1').append(marquesina1);
});
