/* 
	CEE - Chamada Geral de Javascript
	25/11/2010 - A2 Comunicação
*/

$(function(){

	//Fale Conosco
	$(function(){ $('label').inFieldLabels(); });

	//Hover das listas
	$("#lista-normas li.norma").hover(function(){
		$(this).addClass("hover")
	},function(){
		$(this).removeClass("hover")
	});

	//Tabela
	$("table tr:nth-child(odd)").addClass("odd");

	//Galeria de fotos
	var galleries = $('.ad-gallery').adGallery();
	$('#switch-effect').change(
	  function() {
		galleries[0].settings.effect = $(this).val();
		return false;
	  }
	);
	$('#toggle-slideshow').click(
	  function() {
		galleries[0].slideshow.toggle();
		return false;
	  }
	);
	$('#toggle-description').click(
	  function() {
		if(!galleries[0].settings.description_wrapper) {
		  galleries[0].settings.description_wrapper = $('#descriptions');
		} else {
		  galleries[0].settings.description_wrapper = false;
		}
		return false;
	});

	//Looped slider
	$('.loopedSlider').loopedSlider();

	//subnav
	$(".subnav").hide();
	$("#nav-main li").mouseover(function(){
		$("#nav-main li .subnav").hide();
		$(this).children(".subnav").show();
	});
	$(".subnav").mouseout(function(){
		$(this).hide();
	});		
	$("#container, #menu-topo ul li a").mouseover(function(){
		$("#nav-main li .subnav").hide();
	});

	//alerts
/*	$("#menu-topo .item07 a, #news_bt, #social a, #form-normas-cee #input-botao, li.norma .antetitulo a").click(function(){
		alert("Funcionalidade não disponível na versão estática.")
	});*/
	
	//foco e blur
	$('input[type="text"]').focus(function() {
		if (this.value == this.defaultValue){ 
			this.value = '';
		}
		if(this.value != this.defaultValue){
			this.select();
		}
		$(this).addClass("input-focus");
	});
	$('input[type="text"]').blur(function() {
		if ($.trim(this.value) == ''){
			this.value = (this.defaultValue ? this.defaultValue : '');
		}
		$(this).removeClass("input-focus");
	});

	
	//lightbox
	$('.zoom').lightBox({
			overlayBgColor : '#FFFFFF',
			overlayOpacity : '0.5',
			imageLoading  : '/lib/content/themes/ceesp/js/lightbox/images/lightbox-ico-loading.gif',
			imageBtnClose : '/lib/content/themes/ceesp/js/lightbox/images/lightbox-btn-close.gif',
			containerResizeSpeed  : '200',
			txtImage  : '',
			txtOf  : 'de'
		});

	//links externos
	$("#instituicoes_distancia #content table td a, #instituicoes_superior .content-section ul li a, #interesse .content-section ul li a").not("a[href=#inst_obs]").attr("target","_blank");
	
	//drop downs
	$(document).ready(function() {
		$('#drop1_submit').click(function(){
			ob = this.form.drop1;
			window.open(ob.options[ob.selectedIndex].value, '_blank'); 
			return false;
		});
		$('#drop2_submit').click(function(){
			ob = this.form.drop2;
			window.open(ob.options[ob.selectedIndex].value, '_blank'); 
			return false;
		});		
		$('#drop3_submit').click(function(){
			ob = this.form.drop3;
			window.open(ob.options[ob.selectedIndex].value, '_blank'); 
			return false;
		});		
		$('#drop4_submit').click(function(){
			ob = this.form.drop4;
			window.open(ob.options[ob.selectedIndex].value, '_blank'); 
			return false;
		});		
		$('#drop5_submit').click(function(){
			ob = this.form.drop5;
			window.open(ob.options[ob.selectedIndex].value, '_blank'); 
			return false;
		});	
		
		
		
		
					
	 });	
	 
	 




});

