//<!-- Function Checkbox (alternate selection)-->

	function MM_openBrWindow(theURL,winName,features) { //v2.0
		  window.open(theURL,winName,features);
}


//<!-- Function Max Chars (limits)-->

	function LimitaTexto(CampoTexto,MaxChars,iIdioma){
	
	if(CampoTexto.value.length>MaxChars){
		
	    CampoTexto.value=CampoTexto.value.substring(0,MaxChars);
	    if(iIdioma==0)alert('Este campo pode conter até '+MaxChars+' caracteres.');
	    else if(iIdioma==1)alert('Maximum capacity is '+MaxChars+' characters.');
	    else if(iIdioma==2)alert('Este campo puede contener hasta '+MaxChars+' caracteres.');
	    else if(iIdioma==3)alert('Este campo pode conter até '+MaxChars+' caracteres.');
	    CampoTexto.focus();
    
    }
}

//<!-- Function Popup FULL SCREEN -->
function popup(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
window.open(href, windowname, ',type=fullWindow,fullscreen,scrollbars=yes');
return false;
}
//--> 


//<!-- Function Popup -->

	function NewWindow(mypage, myname, w, h, scroll) {
	
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
	
	win = window.open(mypage, myname, winprops)
	
	if (parseInt(navigator.appVersion) >= 4) {
		win.window.focus(); 
	}
}

//<!-- Function Popup 2 -->


function newWindow2(a_str_windowURL, a_str_windowName, a_int_windowWidth, a_int_windowHeight, a_bool_scrollbars, a_bool_resizable, a_bool_menubar, a_bool_toolbar, a_bool_addressbar, a_bool_statusbar, a_bool_fullscreen) {
  var int_windowLeft = (screen.width - a_int_windowWidth) / 2;
  var int_windowTop = (screen.height - a_int_windowHeight) / 2;
  var str_windowProperties = 'height=' + a_int_windowHeight + ',width=' + a_int_windowWidth + ',top=' + int_windowTop + ',left=' + int_windowLeft + ',scrollbars=' + a_bool_scrollbars + ',resizable=' + a_bool_resizable + ',menubar=' + a_bool_menubar + ',toolbar=' + a_bool_toolbar + ',location=' + a_bool_addressbar + ',statusbar=' + a_bool_statusbar + ',fullscreen=' + a_bool_fullscreen + '';
  var obj_window = window.open(a_str_windowURL, a_str_windowName, str_windowProperties)
    if (parseInt(navigator.appVersion) >= 4) {
      obj_window.window.focus();
    }
}
//  End -->


//<!-- Function Price Format (Reais) -->

	function FormatPrecoReais(num){
	
	num=num.toString().replace(/\$|\,/g,'');
	if(isNaN(num))num="0";
	sign=(num==(num=Math.abs(num)));
	num=Math.floor(num*100+0.50000000001);
	cents=num%100;
	num=Math.floor(num/100).toString();
	if(cents<10)cents="0"+cents;
	for(var i=0;i<Math.floor((num.length-(1+i))/3);i++)num=num.substring(0,num.length-(4*i+3))+'.'+num.substring(num.length-(4*i+3));
	return ((sign)?'':'-')+'R$&nbsp;'+num+','+cents;
}
//  End -->




//<!-- Function Pulldown Menu -->

	function pulldown_menu() {
	
	// Create a variable url to contain the value of the
	// selected option from the the form named pulldown and variable selectname
	var url = document.pulldown.selectname.options[document.pulldown.selectname.selectedIndex].value
	
	// Re-direct the browser to the url value
	window.location.href = url
}
// END -->



//<!-- Function Popup imagens -->

	function CaricaFoto(img){
	  foto1= new Image();
	  foto1.src=(img);
	  Control(img);
	}
	function Control(img){
	  if((foto1.width!=0)&&(foto1.height!=0)){
	    viewFoto(img);
	  }
	  else{
	    funzione="Control('"+img+"')";
	    interval=setTimeout(funzione,20);
	  }
	}
	function viewFoto(img){
	  larg=foto1.width+20;
	  alt=foto1.height+30;
	  string="width="+larg+",height="+alt;
	  finestra=window.open(img,"",string);
	}
//  End -->

	



//<!-- Function Forms: Check Fields -->

	function checkFields() {                       // field validation -
	if ( (document.emailform.nome.value=="")  ||   // checks if fields are blank.
	     (document.emailform.email.value=="") ||   // More validation scripts at
	     (document.emailform.mensagem.value=="") ) // forms.javascriptsource.com
	   {
	   alert("(*) Campos Obrigatórios / Obrigatory Fields.");
	   return false;
	   }
	
	else 
	   {
	   
	      
	      return true;
	      
	   }
}
//  End -->



//<!-- Function Dropdown menu -->

/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Konstantin Jagello | http://javascript-array.com/ */
var TimeOut         = 300;
var currentLayer    = null;
var currentitem     = null;
var currentLayerNum = 0;
var noClose         = 0;
var closeTimer      = null;

function mopen(n) {
  var l  = document.getElementById("menu"+n);
  var mm = document.getElementById("mmenu"+n);
	
  if(l) {
    mcancelclosetime();
    l.style.visibility='visible';
    if(currentLayer && (currentLayerNum != n))
      currentLayer.style.visibility='hidden';
    currentLayer = l;
    currentitem = mm;
    currentLayerNum = n;			
  } else if(currentLayer) {
    currentLayer.style.visibility='hidden';
    currentLayerNum = 0;
    currentitem = null;
    currentLayer = null;
 	}
}

function mclosetime() {
  closeTimer = window.setTimeout(mclose, TimeOut);
}

function mcancelclosetime() {
  if(closeTimer) {
    window.clearTimeout(closeTimer);
    closeTimer = null;
  }
}

function mclose() {
  if(currentLayer && noClose!=1)   {
    currentLayer.style.visibility='hidden';
    currentLayerNum = 0;
    currentLayer = null;
    currentitem = null;
  } else {
    noClose = 0;
  }
  currentLayer = null;
  currentitem = null;
}

document.onclick = mclose; 
//  End -->