//my sid
var auth = "";
var treinamento = "";



var checkmail=0;
function ClearInput(value, id){ 
	var input = document.getElementById(id); 
	if(value == input.value){ 
		input.value = '';
		input.style.color = "#000";
		checkmail = 0;
	}else{ // Else the value is not equal to the current input field value.
		if(input.value == '')
		{
			input.value = value; // Leave it the same.
			input.style.color = "#8C8C8C";
			checkmain = 1;
		}
	}
} // Close Function.

function frmnews()
{
	var filtro=/^.+@.+\..{2,3}$/;
	if (filtro.test(document.getElementById("email").value) == false){
		alert("O email informado não é válido");
	} else
	{
		enviaForm('frmnews', 'newsletter.php', 'newsletter');
	}
}
function contato()
{
	enviaForm('contato', 'contato.php', 'contato');
}
function contato2()
{
	document.getElementById("contatoresult").innerHTML = texto;
	f = document.getElementById("contato");
    for (i=0;i<f.elements.length;i++){
	    f.elements[i].value = "";
    }
}
function sendloginauth($)
{
	var dataString = 'logon=1&usuario='+ $('input#login').val() + '&senha=' + $('input#senha').val();
	$.ajax({
    	type: "GET",
	    url: "auth.php",
    	data: dataString,
    	success: function(e) {
      		tmp = e.split("@|@");
			code = tmp[0];
			txt = tmp[1];
			switch(code)
			{
				case "1": document.getElementById('centralerro').innerHTML = txt; break;
				case "2":
					tmp = txt.split("@!@");
					auth = tmp[0];
					document.getElementById("meiotxt").innerHTML = tmp[1];
					$('#mask').hide();
					$('.window').hide();
			}
      	}
    });
}
function changepass()
{
	if(document.getElementById("senha1").value == "")
		alert("Nao e possivel deixar senha em branco!");
	else
	if(document.getElementById("senha1").value == document.getElementById("senha2").value)
	{
		carrega("changepass.php?"+auth+"&sended=1&password="+document.getElementById("senha1").value, "sendtext");
	} else {
		alert("Senha nao confere!");
	}
}
function financeiro()
{
	ano = document.getElementById("selectano").options[document.getElementById("selectano").selectedIndex].value;
	carrega("paineluser.php?"+auth+"&cmd=financeiro&financeiro="+ano, "sendtext");
}
function changelog(id)
{
	carrega("paineluser.php?"+auth+"&cmd=changelog&changelog="+id, "sendtext");
}
function boleto(ano, mes)
{
	window.open("boleto/boleto_santander_banespa.php?"+auth+"&ano="+ano+"&mes="+mes, "boleto", "");
}
function stopUpload(txt){
    document.getElementById('f1_upload_process').style.visibility = 'hidden';
	document.getElementById('contatoresult').innerHTML = txt;
    return true;
}
function startUpload(){
	document.getElementById('f1_upload_process').style.visibility = 'visible';
	document.forms['trabalheconosco'].submit();
}
function treinainsc(id){
	treinamento=id;
	showtreinainsc($);
}
function showtreinainsc($)
{
	document.getElementById('treinainscerro').innerHTML = "";
	$('input#nome').val('');
	$('input#empresa').val('');
	$('input#telefone').val('');
	$('input#treinaemail').val('');
	var id = '#treinainsc';
	$('#treinainsctitle2').html(document.getElementById("title-"+treinamento).innerHTML + " - " + document.getElementById("treinadata-"+treinamento).innerHTML);
	var maskHeight = $(document).height();
	var maskWidth = $(window).width();
	$('#mask').css({'width':maskWidth,'height':maskHeight});
	$('#mask').fadeIn(1000);	
	$('#mask').fadeTo("slow",0.8);	
	var winH = Math.round(GetWindowSize()/4);
	var winW = $(window).width();
	$(id).css('top',  winH-$(id).height());
	$(id).css('left', winW/2-$(id).width()/2-50);
	$(id).fadeIn(2000); 
	scroll(0,0);
}
function treinadetalhe(id){
	var dataString = 'detalhe='+id;
	$.ajax({
    	type: "GET",
	    url: "treinamento.php",
    	data: dataString,
    	success: function(e) {
      		document.getElementById('treinadetalhetxt').innerHTML = e;
      	}
    });
	showtreinadetalhe($);
}
function showtreinadetalhe($)
{
	var id = '#treinadetalhe';
	var maskHeight = $(document).height();
	var maskWidth = $(window).width();
	$('#mask').css({'width':maskWidth,'height':maskHeight});
	$('#mask').fadeIn(1000);	
	$('#mask').fadeTo("slow",0.8);	
	var winH = Math.round(GetWindowSize()/4);
	var winW = $(window).width();
	$(id).css('top',  winH-$(id).height());
	$(id).css('left', (winW/2)-($(id).width()/2)-100);
	$(id).fadeIn(2000); 
	scroll(0,0);
}
