function dateTime(selector,text1){
	var now;
	var the_timer;
	var hora;
	var minutos;
	var segundos;
	var strDate='';
	var mes=new Array('Janeiro','Fevereiro','Março','Abril','Maio','Junho','Julho','Agosto','Setembro','Outubro','Novembro','Dezembro');
	var f_time=function(){
		now = new Date();
		the_timer = new Date(now.getTime());
		hora = the_timer.getHours();
		minutos = the_timer.getMinutes();
		segundos = the_timer.getSeconds();
		if ( minutos <= 9 ) minutos = "0" + minutos;
		if ( segundos <= 9 ) segundos = "0" + segundos;
		
		//strDate=the_timer.getDate()+' de '+mes[the_timer.getMonth()]+' de '+the_timer.getYear()+' ás ';
		strDate=''+text1;
		strDate+=hora + ":" + minutos + ":" + segundos;
		$(selector).html(strDate);
	};
	f_time(); setInterval(function(){f_time();},1000);
}

function printOpen(){
	var w = 750; var h = 550;
	var l = screen.width/2 - w/2; l=parseInt(l);
	var t = screen.height/2 - h/2; t=parseInt(t);
	var winPrint = window.open(siteUrl+'/print.asp','print','width='+w+',height='+h+',top='+t+',left='+l+',scrollbars=1,status=no,menubar=1');
	if (window.focus){winPrint.focus();}
}
function sendMail(){
	var w = 700; var h = 390;
	var l = screen.width/2 - w/2; l=parseInt(l);
	var t = screen.height/2 - h/2; t=parseInt(t);
	var winSendMail = window.open(siteUrl+'/sendMail.asp','print','width='+w+',height='+h+',top='+t+',left='+l+',scrollbars=1,status=no,menubar=0');
	if (window.focus){winSendMail.focus();}
}
function formsFocus(formSelector){$(formSelector).find("input,textarea,select").not(".ok").focus(function(){ $(formSelector).find("input,textarea,select").removeClass('focus'); $(this).addClass('focus') }).blur(function(){ $(formSelector).find("input,textarea,select").removeClass('focus');});}
function maxlenght(selector){//valida os campos textarea de acordo com a propriedade maxlength
	$(selector).bind('blur keypress',function(){
		var limite=$(this).attr('maxlength');
		if(limite!=undefined && isNaN(limite)==false){
			limite=parseFloat(limite);
			if(limite>0 && $(this).val().length>limite){$(this).val( $(this).val().substring(0,limite) );return false;}//obj.value=obj.value.substring(0,limite);
		}
	});
}
function replacex(text,sfind,sreplace){var r=text; for(var i=0;i<text.length;i++){r = r.replace( sfind, sreplace);} return r; }//replace geral
function exec(param){if(param.substring(0,7)=='http://' || param.substring(0,1)=='#'){window.location=param;}else if(param.substring(0,11)=='javascript:'){ eval(param); }}//executa o comando passando em param
function paginClass(selector){
	//************** controle de paginação ************* 
	var o=$(selector+' li');
	o.click(function(){ 
		if($(this).attr('class')==''){
		o.find('a').removeClass('over');
		$(this).find('a').addClass('over');
		};
		return false;
	});
}

function init(){
	//topo em flash
	$('.site > .swf > div').flash(
        { src: siteUrl+'/topo.swf', width: 952, height: 222,  wmode: 'transparent', menu: false },
        { version: 8 }
    );

	//ajusta a altura das laterais do conteúdo
	setInterval(function(){
		var o=$('.site > .center');
		var h=$('.cc').height();
		o.find('> .c4,> .c5').css('height',h+'px');
	},1000);
	
	//somente para ie 
	if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){//test for MSIE x.x;
		var ieversion=new Number(RegExp.$1); // capture x.x portion and store as a number
		if (ieversion<=8){
			$('.corner1').corner('10px');//curva dos boxs
			$('.button').each(function(){var w=$(this).width();$(this).corner('6px').css('width',w+'px');});//curva dos botoes
		}
	};
	
	//hora
	dateTime('.date > .time',' ás ');
	$('.bt-print').click(function(){printOpen();return false;});
	$('.bt-mail').click(function(){sendMail();return false;});

	//barra de status para os links
	$('a').bind('mousemove',function(){window.status=$(this).attr('title');}).bind('click',function(){if($(this).attr('href')=='#'){return false;}});

	/*stats online*/
	var statsCalc=function(){
		//prompt('',siteUrl+'/load.asp?pag=statsOnline&sx='+screen.width)
		$.ajax({
			type: "GET",
			url: siteUrl+'/load.asp',
			data: 'pag=statsOnline&sx='+screen.width,
			success: function(r){setTimeout(function(){statsCalc();},1000*60*2);}
		});
	};
	statsCalc();

}
