// JavaScript Document

function openpop(pag) {
	window.open(pag, 'janela','scrollbars=yes,resizable=yes,width=850,height=720');
}

$(document).ready(function() {
						   
	// fix for target="_blank"
	$("a[rel='external']").click(function(){
		window.open($(this).attr("href"), 'janela','scrollbars=yes,resizable=yes,width=880,height=720');
		return false;
	});
	
	function limpaform(){
		var arg="#"+idform + " :input";
		$(arg).each(function() { // Pega os campos do form
			if(this.type=='text' || this.type=='hidden' || this.type=='password')
				this.value='';
		});
	}
	
	// fix for target="_blank" de form
	$("form").submit(function(){
		idform = $(this).attr('id');
		otarg = $(this).attr('target');
		if(otarg!='') {
			window.open('', 'janela','scrollbars=yes,resizable=yes,width=850,height=720');
			setTimeout(limpaform, 2000);
		}
		return true;
	});
	
	//focus no primeiro campo
	$("#f_contato :input:visible:enabled:first").focus();
	
	if($("#tabela").length > 0) {
		var Wwid = $(window).width();
		var Whei = $(window).height();
		if(Wwid<1000) {
			$("#tabela").css({'display':'block','position':'static'});
			$("#celula").css({'display':'block','position':'static','verticalAlign':'top'});
			$("#index_corpo").css("top","10px");
		}
	}


});
