//Poup UP
function popup(page,width,heigth){
		window.open(page,"quiz0","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width="+width+", height="+heigth);
	}
function opensb(page,width,heigth){
window.open(page,"quiz","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width="+width+", height="+heigth);
	}
function certificacao(){

	window.open("certificado.htm","certificado","scrollbars=0,status=0,location=0,toolbar=0,menubar=0,width=800, height=567");
}

//Enquete
function enquete_posta(id){
	quant=document.enquete_post.r.length
	for (a=0;a<quant;a++){
		if (document.enquete_post.r[a].checked) {
			document.enquete_post.resposta.value=a
			document.enquete_post.submit()
		}
	}
}

//Busca
function buscar(palavra){
	if (palavra!=""&&palavra!=" "){
		document.busca.submit()
	}
}
//Valida Email
function valida_email(email){
	if(!email.match('@')){
		return true
	} else {
		return false
	}
	
}
function validaemail(){
		f=document.news
		if (valida_email(f.email.value)) {alert('O campo e-mail deve ser preenchido corretamente.');return false}
	return true
}
function validaincompany(){
		f=document.ficha
		if(!f.maxpro.checked && !f.wipro.checked && !f.wiprosecure.checked) {alert('Selecione pelo menos um curso.');return false}
		if (valida_email(f.email.value)) {alert('O campo e-mail deve ser preenchido corretamente.');return false}

	return true
}
//Login
function login(senha){
	if (senha!=""&&senha!=" "){
		document.login.submit.value(remover)
		document.login.submit()
	} else { alert('Nehum campo deve ficar em branco') }
}


//HighLight
var hiliteClass = "inschilight";
var normalClass = "insc";
var hilitedElem = "";
var regExp = /INPUT|OPTION|SELECT|TEXTAREA/;

var ns6=document.getElementById && !document.all

var hiliteClass = 'inschilight';
var normalClass = 'insc';
var hilitedElem = '';
var regExp = /INPUT|OPTION|SELECT|TEXTAREA/;

var ns6=document.getElementById && !document.all

//Function to highlight form element
function hilite(evt){
	evt = evt ? evt : window.event;
	var currentElem = evt.srcElement ? evt.srcElement : evt.target || evt.currentTarget;
	if(currentElem.className && regExp.test(currentElem.tagName)){
		//if (ns6&&eventobj.nodeType==3)eventobj=eventobj.parentNode.parentNode
		if(hilitedElem)hilitedElem.className = normalClass;
		currentElem.className = hiliteClass;
		hilitedElem = currentElem;
	}
}
function removeHilite(evt){
	evt = evt ? evt : window.event;
	var currentElem = evt.srcElement ? evt.srcElement : evt.target || evt.currentTarget;
	if(currentElem.className && regExp.test(currentElem.tagName)){
		currentElem.className = normalClass;
	}
}

function writeFlash(id) {
    document.getElementById(id).innerHTML = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='780' height='199' id='topo' align='middle'><param name='allowScriptAccess' value='sameDomain' /><param name='movie' value='layout/topo.swf' /><param name='quality' value='high' /><param name='bgcolor' value='#ffffff' /><embed src='layout/topo.swf' quality='high' bgcolor='#ffffff' width='780' height='199' name='topo' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /></object>";
}


var req;
function loadXMLDoc(url){
 req = null;

if (window.XMLHttpRequest) {
 req = new XMLHttpRequest();
 req.onreadystatechange = processReqChange;
 req.open("GET", url, true); 
 req.send(null);

} else if (window.ActiveXObject) {
try {
req = new ActiveXObject("Msxml2.XMLHTTP.4.0");
} catch(e) {
try {
req = new ActiveXObject("Msxml2.XMLHTTP.3.0");
} catch(e) {
try {
req = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
try {
req = new ActiveXObject("Microsoft.XMLHTTP");
} catch(e) {
req = false;
}
}
}
}
if (req) {
 req.onreadystatechange = processReqChange;
 req.open("GET", url, true);
 req.send();
}
}
}


function processReqChange(){

if (req.readyState == 4) {
if (req.status == 200) {

document.getElementById("atualiza").innerHTML = req.responseText;
} else {
alert("Houve um problema ao obter os dados:\n" + req.statusText);
}
}
}
function atualiza(valor){
loadXMLDoc("carrega_datas.php?ID="+valor);
}
function indique(nome,emailamigo,nomeamigo,id){
loadXMLDocindique("indique.php?nome="+nome+"&emailamigo="+emailamigo+"&nomeamigo="+nomeamigo+"&id="+id);
}
var req;
function loadXMLDocindique(url){
 req = null;

if (window.XMLHttpRequest) {
 req = new XMLHttpRequest();
 req.onreadystatechange = processReqChangeindique;
 req.open("GET", url, true); 
 req.send(null);

} else if (window.ActiveXObject) {
try {
req = new ActiveXObject("Msxml2.XMLHTTP.4.0");
} catch(e) {
try {
req = new ActiveXObject("Msxml2.XMLHTTP.3.0");
} catch(e) {
try {
req = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
try {
req = new ActiveXObject("Microsoft.XMLHTTP");
} catch(e) {
req = false;
}
}
}
}
if (req) {
 req.onreadystatechange = processReqChangeindique;
 req.open("GET", url, true);
 req.send();
}
}
}
function processReqChangeindique(){

if (req.readyState == 4) {
if (req.status == 200) {

document.getElementById("indique").innerHTML = req.responseText;
} else {
alert("Houve um problema ao obter os dados:\n" + req.statusText);
}
}
}
function checkBrowser(){
	this.ver=navigator.appVersion
	this.dom=document.getElementById?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
	this.ie4=(document.all && !this.dom)?1:0;
	this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
	return this
}
bw=new checkBrowser()
//Hides the div
function hideIt(div){
	if(bw.bw){
		div="divLoadCont"
		obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?document[div]:0; 
		obj.visibility='hidden'
	}
}
onload=hideIt;