function muda_administrador(id,menu){
window.location="index2.php?permissao=3&user="+id+"&menu="+menu+"";
}

function actualiza(url){
document.forms["permissoes"].submit();

}



//muda idioma homepage 
 function muda_lang(id){
	 
	 var url=window.location.href;
	 
	 
	  if ( url.indexOf("?") > -1 ){

	  window.location=url+"&lang="+id+"";
	  }
	  else{
	   window.location=url+"?lang="+id+"";
	  }
	 
}
//select homepage
 function muda_produtor(id){
	  window.location="index.php?option=com_dprodutores&Itemid=46&task=detalhe&id="+id+"";
}

//select homepage
 function muda_produto(id){
	  window.location="index.php?option=com_dprodutos&Itemid=46&task=detalhe&id="+id+"";
}


function muda_servico(pagina){

	   window.location=pagina;

}

function pagina(pagina){
	
	//alert(pagina);
	
	
	if(pagina=='produzir'){
	   window.location="index.php?option=com_content&task=blogsection&id=3&Itemid=133";
	}
   //  window.location="index.php";
}

//bolsa //imagem homepage

function bolsa(){
window.location="index.php?option=com_oferta&Itemid=150";
}

//muda fundo menu

function fixa_menu(id){


if(id=='114'){
		document.getElementById('m1').className='m1_1';
}
if(id==10 || id==11 || id==12 || id==13 || id==15 || id==14 || id==85 || id==16 || id==138){
		document.getElementById('m2').className='m2_1';
}
if(id==133){
		document.getElementById('m3').className='m3_1';
}
if(id==121){
		document.getElementById('m4').className='m4_1';
}
if(id==46){
		document.getElementById('m5').className='m5_1';
}
if(id==58){
		document.getElementById('m6').className='m6_1';
}
if(id==67 || id==68 || id==69 || id==70 || id==71){
		document.getElementById('m7').className='m7_1';
}
if(id==72 || id==153){
		document.getElementById('m8').className='m8_1';
}
if(id==128){
		document.getElementById('m9').className='m9_1';
}
if(id==73){
		document.getElementById('m10').className='m10_1';
}
if(id==78){
		document.getElementById('m11').className='m11_1';
}


}


 function muda(id){
			
 window.location=id;
			 
}



/************************************************************************************************************
(C) www.dhtmlgoodies.com, February 2006

This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website.	

Terms of use:
You are free to use this script as long as the copyright message is kept intact. However, you may not
redistribute, sell or repost it without our permission.

Thank you!

www.dhtmlgoodies.com
Alf Magne Kalleland

************************************************************************************************************/	
	
	
// Patterns
var formValidationMasks = new Array();
formValidationMasks['email'] = /\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/gi;	// Email
formValidationMasks['numeric'] = /^[0-9]+$/gi;	// Numeric
formValidationMasks['zip'] = /^[0-9]{5}\-[0-9]{4}$/gi;	// Numeric

var formElementArray = new Array();

function validateInput(e,inputObj)
{
	if(!inputObj)inputObj = this;		
	var inputValidates = true;
	
	if(formElementArray[inputObj.name]['required'] && inputObj.tagName=='INPUT' && inputObj.value.length==0)inputValidates = false;
	if(formElementArray[inputObj.name]['required'] && inputObj.tagName=='SELECT' && inputObj.selectedIndex==0){
		inputValidates = false;
	}
	if(formElementArray[inputObj.name]['mask'] && !inputObj.value.match(formValidationMasks[formElementArray[inputObj.name]['mask']]))inputValidates = false;

	if(formElementArray[inputObj.name]['freemask']){
		var tmpMask = formElementArray[inputObj.name]['freemask'];
		tmpMask = tmpMask.replace(/-/g,'\\-');
		tmpMask = tmpMask.replace(/S/g,'[A-Z]');
		tmpMask = tmpMask.replace(/N/g,'[0-9]');
		tmpMask = eval("/^" + tmpMask + "$/gi");
		if(!inputObj.value.match(tmpMask))inputValidates = false
	}	
	
	if(formElementArray[inputObj.name]['regexpPattern']){
		var tmpMask = eval(formElementArray[inputObj.name]['regexpPattern']);
		if(!inputObj.value.match(tmpMask))inputValidates = false
	}
	if(!formElementArray[inputObj.name]['required'] && inputObj.value.length==0 && inputObj.tagName=='INPUT')inputValidates = true;
	
	
	if(inputValidates){
		inputObj.parentNode.className='validInput';
	}else{
		inputObj.parentNode.className='invalidInput'
	}
}

function isFormValid()
{
	var divs = document.getElementsByTagName('DIV');
	for(var no=0;no<divs.length;no++){
		if(divs[no].className=='invalidInput')return false;
	}
	return true;	
}




function initFormValidation()
{
	var inputFields = document.getElementsByTagName('INPUT');
	//var selectBoxes = document.getElementsByTagName('SELECT');
	
	var inputs = new Array();
	
	
	for(var no=0;no<inputFields.length;no++){
		inputs[inputs.length] = inputFields[no];
		
	}	
	for(var no=0;no<selectBoxes.length;no++){
		inputs[inputs.length] = selectBoxes[no];
		
	}
	
	for(var no=0;no<inputs.length;no++){
		var required = inputs[no].getAttribute('required');
		if(!required)required = inputs[no].required;		
		
		var mask = inputs[no].getAttribute('mask');
		if(!mask)mask = inputs[no].mask;
		
		var freemask = inputs[no].getAttribute('freemask');
		if(!freemask)freemask = inputs[no].freemask;
		
		var regexpPattern = inputs[no].getAttribute('regexpPattern');
		if(!regexpPattern)regexpPattern = inputs[no].regexpPattern;
		
		var div = document.createElement('DIV');
		div.className = 'invalidInput';
		inputs[no].parentNode.insertBefore(div,inputs[no]);
		div.appendChild(inputs[no]);
		div.style.width = inputs[no].offsetWidth + 'px';
		
		inputs[no].onblur = validateInput;
		inputs[no].onchange = validateInput;
		inputs[no].onpaste = validateInput;
		inputs[no].onkeyup = validateInput;
		
		
		formElementArray[inputs[no].name] = new Array();
		formElementArray[inputs[no].name]['mask'] = mask;
		formElementArray[inputs[no].name]['freemask'] = freemask;
		formElementArray[inputs[no].name]['required'] = required;
		formElementArray[inputs[no].name]['regexpPattern'] = regexpPattern;

		validateInput(false,inputs[no]);

			
	}	
}


function getURLParam(strParamName){
  var strReturn = "";
  var strHref = window.location.href;
  if ( strHref.indexOf("?") > -1 ){
    var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
    var aQueryString = strQueryString.split("&");
    for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
      if (
aQueryString[iParam].indexOf(strParamName + "=") > -1 ){
        var aParam = aQueryString[iParam].split("=");
        strReturn = aParam[1];
        break;
      }
    }
  }
  return strReturn;
}


function fixColumns(){
		var h1 = document.getElementById("col1").offsetHeight;
		var h2 = document.getElementById("col2").offsetHeight;
		var h3 = document.getElementById("col3").offsetHeight;
		var max = h1;
		if(h2 > max) max = h2;
		if(h3 > max) max = h3;
		document.getElementById("col1").style.height = max + "px";
		document.getElementById("col2").style.height = max + "px";
		document.getElementById("col3").style.height = max + "px";
		

	}


function data(){

var now = new Date();
var hours = now.getHours();
var minutes = now.getMinutes();
var timeValue = "" + ((hours >12) ? hours -12 :hours)
timeValue += ((minutes < 10) ? ":0" : ":") + minutes
timeValue += (hours >= 12) ? " PM" : " AM"
timerRunning = true;

mydate = new Date();
myday = mydate.getDay();
mymonth = mydate.getMonth();
myweekday= mydate.getDate();
weekday= myweekday;
myyear= mydate.getFullYear();
mes = mydate.getMonth()+1;
year = myyear

if(myday == 0)
day = " Domingo "

else if(myday == 1)
day = " Segunda-feira "

else if(myday == 2)
day = " Terça-feira "

else if(myday == 3)
day = " Quarta-feira "

else if(myday == 4)
day = " Quinta-feira "

else if(myday == 5)
day = " Sexta-feira "

else if(myday == 6)
day = " Sábado "

if(mymonth == 0)
month = " de Janeiro de "

else if(mymonth ==1)
month = " de Fevereiro de "

else if(mymonth ==2)
month = " de Março de "

else if(mymonth ==3)
month = " de April de "

else if(mymonth ==4)
month = " de Maio de "

else if(mymonth ==5)
month = " de Junho de "

else if(mymonth ==6)
month = " de Julho de "

else if(mymonth ==7)
month = " de Agosto de "

else if(mymonth ==8 ) 
month = " de Setembro de "

else if(mymonth ==9)
month = " de Outubro de "

else if(mymonth ==10)
month = " de Novembro de "

else if(mymonth ==11)
month = " de Dezembro de "

document.write( myweekday+"/"+mes+"/"+year+ " "+day );

	
}




function closeAd1() {
document.getElementById("recomendar").style.display="none"; 
}
function mostra_recomendacao() {
document.getElementById("recomendar").style.display=""; 
}





function displayWindow(theURL,winName,width,height,features) { //v3.1
    var window_width = width;
    var window_height = height;
    var newfeatures= features;
    var window_top = (screen.height-window_height)/2;
    var window_left = (screen.width-window_width)/2;
    newWindow = window.open(''+ theURL + '',''+ winName + '','width=' + window_width + ',height=' + window_height + ',top=' + window_top + ',left=' + window_left + ',' + newfeatures + '');
	newWindow.focus();
}







