function mailpage(){
	mail_str = "mailto:?subject=Bla bla bla";
	mail_str += "&body=" + document.title + " : ";
	mail_str += location.href;
	location.href = mail_str;
}

function bookmarkpage(){
	var url = location.href;
	var title = document.title;
	
	if (window.sidebar) // firefox
		window.sidebar.addPanel(title, url, "");
	else if(window.opera && window.print){ // opera
		var elem = document.createElement('a');
		elem.setAttribute('href',url);
		elem.setAttribute('title',title);
		elem.setAttribute('rel','sidebar');
		elem.click();
	}else if(document.all){// ie
		window.external.AddFavorite(url, title);
	}
}

function slide(){
	var className = 'SlidingPanelsContent';		 //change the className that is on all your content panels..
	var panelCount = sp1.getContentPanelsCount();//get panel length
	var current = sp1.getCurrentPanel();		 //get current panel
	var group = sp1.getContentGroup();			 //get our group
	var panelNumber = 0;
	if(group.hasChildNodes()){
		var j = 0;
		for(var i = 0, l = group.childNodes.length; i < l; i ++){
			if(group.childNodes[i].className && group.childNodes[i].className.search(new RegExp("\\b" + className + "\\b")) != -1){ // if it has SlidingPanelsContent class we found the correct node.
				if(group.childNodes[i] == current) // if it matches our current panel, we have a number
				panelNumber = j;
				j++; //increase our panelcounter
			}
		}
	}
	sp1.showPanel(((panelNumber + 1 /* its currently 0 based, and the panelCount isn't so we need to increase */) != panelCount ? (panelNumber + 1) : 0));
};

function start(){
var slideShow = setInterval(slide,8000);
}

function limparpadrao(campo) {
    if (campo.value == campo.defaultValue) {
        campo.value = "";
        campo.type = passwordfield;
    }
}

function escreverpadrao(campo) {
    if (campo.value == "") {
        campo.value = campo.defaultValue;
    }
}



function valida_busca_dirigida_pt(){
	var x = 1;
	if (document.busca_dirigida.tipo.selectedIndex==0){
		alert("Selecione o tipo de sensor")
		document.busca_dirigida.tipo.focus()
		x = 0;
		return false;
	}
	if (document.busca_dirigida.corpo.selectedIndex==0){
		alert("Selecione o corpo do material do sensor")
		document.busca_dirigida.corpo.focus()
		x = 0;
		return false;
	}
}

function valida_busca_livre_pt(){
	var x = 1;
	if (document.busca_livre.item_busca.value.length==0){
		alert("Digite uma aplicação")
		document.busca_livre.item_busca.focus()
		return false;
	}
	if (document.busca_livre.tipo.selectedIndex==0){
		alert("Selecione o tipo de sensor")
		document.busca_dirigida.tipo.focus()
		x = 0;
		return false;
	}
}

function valida_busca_modelo_pt(){
	var x = 1;
	if (document.busca_modelo.modelo.value.length==0){
		alert("Digite um modelo")
		document.busca_modelo.modelo.focus()
		return false;
	}
}
