function checkMessageSent( msg ){
   if ( msg != "" ) alert(msg);
}

function changeMenuItem( menuChosenItem ){
   document.menuForm.menuChosenHidden.value = menuChosenItem;
   document.menuForm.submit();
}


function changeLanguage( menuChosenItem ){
   document.languageForm.chosenLanguage.value = menuChosenItem;
   document.languageForm.submit();
}

function doAction( value ){
   document.mainForm.action.value = value;
   document.mainForm.submit();
}

function doActionCustomers( value ){
   document.customersForm.action.value = value;
   document.customersForm.submit();
}

function removeAtividade( action, id ){
   document.mainForm.action.value = action;
   document.mainForm.selectedActivity.value = id;
   document.mainForm.submit();
}

function loadControls( selectedElement ){
   if ( selectedElement == 'en' ){ 
      var divElement = document.getElementById( 'flag2' );
   }
   else if ( selectedElement == 'es' ){ 
      var divElement = document.getElementById( 'flag3' );
   }
   else if ( selectedElement == 'pt_BR' ){ 
      var divElement = document.getElementById( 'flag1' );
   }
   divElement.style.backgroundColor = "#aacdbb";
   divElement.style.border = "1px solid #006600";
   
}


function openImageOnPopup( URL, altura, largura ){
        w = screen.width;
	h = screen.height;
	
	//divide a resolução por 2, obtendo o centro do monitor
	meio_w = w/2;
	meio_h = h/2;
	
	//diminui o valor da metade da resolução pelo tamanho da janela, fazendo com q ela fique centralizada
	altura2 = altura/2;
	largura2 = largura/2;
	meio1 = meio_h-altura2;
	meio2 = meio_w-largura2;
	
	//abre a nova janela, já com a sua devida posição
	window.open(URL,"","height=" + altura + ", width=" + largura + ", top="+meio1+", left="+meio2+", scrollbars=yes, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=yes, fullscreen=no");
}



<!--
//Global Constants

var startX=200;
var startY=100;
verticalpos="frombottom";

//Global Variables
var ns = (navigator.appName.indexOf("Netscape") != -1);
var d = document;
var languagecode=navigator.language? navigator.language : navigator.userLanguage;
var selectedLanguage=languagecode.substring(0,2,languagecode);
var actualSect='home';
var actualProd=1;
var prodSect=1;
var timer=false;

//Common Functions

function getLang(){
	return selectedLanguage;
}

//Flash Integration

//Browser Integration


//AJAX section

function floatMovies(width,height){
	movieHold=document.getElementById('moviesHolder');
	//var pY = ns ? pageYOffset + innerHeight : document.body.scrollTop + 600; //document.body.clientHeight;
	
	var pY = document.body.scrollTop + 600;
	movieHold.y+=(pY - startY - height - movieHold.y)/8;
	movieHold.style.top=movieHold.y+"px";
	movieHold.style.left=0; //(document.body.clientWidth / 2 - (width +15)/2)+"px";
	timer=setTimeout("floatMovies("+width+","+height+")", 10);
}

function floatMovies2(width,height){
	movieHold=document.getElementById('moviesHolder');
	movieHold.y+=50; //(pY - startY - height - movieHold.y)/8;
	movieHold.style.top=movieHold.y+"px";
	movieHold.style.left=0;//(document.body.clientWidth / 2 - (width +15)/2)+"px";
}

function showMovie(movieurl,width,height,caption){
	movieHold=document.getElementById('moviesHolder');
	movieHoldContent=document.getElementById('moviesHolderContent');
	movieCaption=document.getElementById('moviesCaption');
	movieObjStr=	'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+width+'" height="'+height+'" id="tutorial">'+
								'<param name="movie" value="'+movieurl+'" />'+
								'<param name="menu" value="false" /><param name="quality" value="high" /><param name="scale" value="noscale" /><param name="wmode" value="transparent" />'+
								'<embed src="'+movieurl+'" menu="false" quality="high" scale="noscale" wmode="transparent" width="'+width+'" height="'+height+'" name="flashProdMkt" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'+
								'</object>';
	if(navigator.userAgent.indexOf("MSIE")>=0){
		movieHold.style.width=width+15;
		movieHoldContent.style.height=height;
	}
	/*movieHold.style.width=width+15;
	movieHold.style.height=height+29;*/
	movieHoldContent.innerHTML=movieObjStr;
	var startX=0; // (document.body.clientWidth / 2 - (width +15)/2);
	var startY=0; //((document.body.scrollTop + document.body.clientHeight) - (height+70));
	movieHold.style.left=startX+"px";
	movieHold.style.top=startY+"px";
	movieHold.x=startX;
	movieHold.y=startY;
	movieCaption.innerHTML=caption;
	movieHold.style.display='inline';
	floatMovies(width,height);
	//timer=setTimeout("floatMovies2("+width+","+height+")", 10);
}

/**
 *
 * @access public
 * @return void
 **/
function closeMovie(){
	movieHold=document.getElementById('moviesHolder');
	movieHoldContent=document.getElementById('moviesHolderContent');
	movieHoldContent.innerHTML='';
	movieHold.style.display='none';
	if(timer){
		top.clearTimeout(timer);
	}
}

function makePostStr(form){
	postStr='';
	for(x=0;x<form.elements.length;x++){
		switch(x){
			case 0:
				postStr=form.elements.item(x).getAttribute('name')+"="+encodeURI(document.getElementById(form.elements.item(x).getAttribute('id')).value);
				break;
			default:
				postStr=postStr+"&"+form.elements.item(x).getAttribute('name')+"="+encodeURI(document.getElementById(form.elements.item(x).getAttribute('id')).value);
		}
	}
	return postStr;
}

function GetXmlHttpObject(handler){
	var objXmlHttp=null;

	if (navigator.userAgent.indexOf("Opera")>=0){
		/*alert('This example doesn\'t work in Opera')
		return*/
		objXmlHttp=(window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP"): new XMLHttpRequest();
	}
	if (navigator.userAgent.indexOf("MSIE")>=0){
		var strName="Msxml2.XMLHTTP"
		if (navigator.appVersion.indexOf("MSIE 5.5")>=0){
		strName="Microsoft.XMLHTTP"
		}
		try{
			objXmlHttp=new ActiveXObject(strName)
			objXmlHttp.onreadystatechange=handler
			return objXmlHttp
		}
		catch(e){
			alert("Error. Scripting for ActiveX might be disabled")
			return
		}
	}
	if (navigator.userAgent.indexOf("Mozilla")>=0){
		objXmlHttp=new XMLHttpRequest()
		objXmlHttp.onload=handler
		objXmlHttp.onerror=handler
		return objXmlHttp
	}
}

function loadOBJ(hlder){
	hlder.innerHTML='<img src="styles/default/images/body/loadings.gif" style="margin:20px;" border="0" width="16" height="16" />';
}

function ajaxManager(){
	var args = ajaxManager.arguments;
	var httpObj = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP"): new XMLHttpRequest();
	//top.blur();
	switch (args[0]){
		case "getDefaultVars":
			httpObj.onreadystatechange = function(s){
				if (httpObj.readyState == 4 && httpObj.status == 200){
					response=httpObj.responseXML;
					var lang=response.getElementsByTagName('lang');
					var selectedLanguage=lang.item(0).childNodes[0].nodeValue;
					var sect=response.getElementsByTagName('sect');
					var actualSect=sect.item(0).childNodes[0].nodeValue;
					var prod=response.getElementsByTagName('prod');
					var actualProd=prod.item(0).childNodes[0].nodeValue;
				}
			}
//			alert(args[1]);
			httpObj.open("GET", './index.php?sect=getDefaultVars&detlang='+args[1], true);
			httpObj.send(null);
			break;
		case "startup":
			ajaxManager('loadLangs');
			//ajaxManager('getDefaultVars',languagecode.substring(0,2,languagecode));
			if(args[1]!=undefined){
				ajaxManager('switchLang',args[1]);
			}else{
				ajaxManager('switchLang',selectedLanguage);
				//ajaxManager('setMainMenu');
				//ajaxManager('setProdMenu',selectedLanguage);
				//ajaxManager('setProdFlash',actualProd);
				//ajaxManager('loadSect',actualSect,selectedLanguage);
			}
			break;
		case "setMainMenu":
			httpObj.onreadystatechange = function(s){
				if (httpObj.readyState == 4 && httpObj.status == 200){
					var placeholder=document.getElementById('menu');
					placeholder.innerHTML=httpObj.responseText;
				}
			}
			httpObj.open("GET", './index.php?sect=loadMenu&lang='+selectedLanguage, true);
			httpObj.send(null);
			break;
		case "loadSect":
	    //var x = document.getElementById('prodtit').y ? document.getElementById('prodtit').y : document.getElementById('prodtit').offsetTop;

			httpObj.onreadystatechange = function(s){
				if (httpObj.readyState == 4 && httpObj.status == 200){
					document.getElementById('content').innerHTML=httpObj.responseText;
					if(!ns){
						var y = document.getElementById('prodtit').offsetParent.offsetParent.offsetTop;
						window.scrollTo(0,y);
					} else {
						Element.scrollTo(document.getElementById('prodtit'));
					}
				}
			}
			//loadOBJ(document.getElementById('content'));
			actualSect=args[1];
			httpObj.open("GET", './index.php?sect='+args[1], true);
			httpObj.send(null);
			break;
		case "loadProd":
			httpObj.onreadystatechange = function(s){
				if (httpObj.readyState == 4 && httpObj.status == 200){
					document.getElementById('content').innerHTML=httpObj.responseText;
					if(!ns){
						var y = document.getElementById('prodtit').offsetParent.offsetParent.offsetTop;
						window.scrollTo(0,y);
					} else {
						Element.scrollTo(document.getElementById('prodtit'));
					}
				}
			}
			//loadOBJ(document.getElementById('content'));
			actualSect='produtos';
			actualProd=args[1];
			prodSect=args[2];
			ajaxManager('setProdFlash',actualProd);
			httpObj.open("GET", './index.php?sect=loadProd&id='+actualProd+'&lang='+selectedLanguage+'&prodSect='+prodSect+'&file='+args[3], true);
			httpObj.send(null);
			//alert('./index.php?sect=loadProd&id='+actualProd+'&lang='+selectedLanguage+'&prodSect='+prodSect);
			break;
		case "switchLang":
			//ajusta o padrão para a lingua a ser usada
			httpObj.onreadystatechange = function(s){
				if (httpObj.readyState == 4 && httpObj.status == 200){
					var response=httpObj.responseXML;
					selectedLanguage=args[1];
					ajaxManager('setMainMenu');
					ajaxManager('setProdMenu',selectedLanguage);
					if(actualSect=='home' || actualSect=='empresa' || actualSect=='contato' || actualSect=='distribuidores'){
						ajaxManager('loadSect',actualSect);
						ajaxManager('setProdFlash',actualProd);
					}else{
						ajaxManager('loadProd',actualProd,prodSect);
					}
					while(document.getElementById('flagSet')!=null){
						document.getElementById('flagSet').setAttribute('id','flag');
					}
					var placeHolder=document.getElementById('langplaceholder');
					for(x=0;x<placeHolder.childNodes.length;x++){
						if(placeHolder.childNodes[x].getAttribute('lang')==selectedLanguage){
							placeHolder.childNodes[x].setAttribute('id','flagSet');
						}
					}
				}
			}
			httpObj.open("GET", './index.php?sect=setDefLang&lang='+args[1], true);
			httpObj.send(null);
			break;
		case "load_js":
			httpObj.onreadystatechange = function(){
				if (httpObj.readyState == 4 && httpObj.status == 200){
					var getheadTag = document.getElementsByTagName('head')[0];
					setjs = document.createElement('script');
					setjs.setAttribute('type', 'text/javascript');
					getheadTag.appendChild(setjs);
					setjs.text = httpObj.responseText;
				}
			}
			httpObj.open("GET", args[1], true);
			httpObj.send(null);
			break;
		case "loadLangs":
			httpObj.onreadystatechange = function(s){
				if (httpObj.readyState == 4 && httpObj.status == 200){
					var response=httpObj.responseXML;
					var langs=response.getElementsByTagName('lang');
					var placeHolder=document.getElementById('langplaceholder');
					placeHolder.innerHTML='';
					for(x=0;x<langs.length;x++){
						var uid=langs.item(x).childNodes[0].firstChild.nodeValue;
						var lcode=langs.item(x).childNodes[1].firstChild.nodeValue;
						var lname=langs.item(x).childNodes[2].firstChild.nodeValue;
						if(lcode==selectedLanguage){
							cla="flagSet";
						} else {
							cla="flag";
						}
						placeHolder.innerHTML=placeHolder.innerHTML+'<div id="'+cla+'" lang="'+lcode+'"><a class="flagLink" href="Javascript:ajaxManager(\'switchLang\',\''+lcode+'\',this)">'+'<img src="imga.php?type=flag&id='+uid+'" alt="'+lname+'" title="'+lname+'" border="0" /></a></div>';
					}
				}
			}
			loadOBJ(document.getElementById('langplaceholder'));
			httpObj.open("GET", './index.php?sect=loadLangs', true);
			httpObj.send(null);
			break;
		case "setProdFlash":
			httpObj.onreadystatechange = function(s){
				if (httpObj.readyState == 4 && httpObj.status == 200){
					var placehold=document.getElementById('rightplaceholder');
					placehold.innerHTML=httpObj.responseText;
				}
			}
			loadOBJ(document.getElementById('rightplaceholder'));
			httpObj.open("GET", './index.php?sect=getProdFlash&lang='+selectedLanguage+'&id='+actualProd, true);
			httpObj.send(null);
			break;
		case "setProdMenu":
			httpObj.onreadystatechange = function(s){
				if (httpObj.readyState == 4 && httpObj.status == 200){
					response=httpObj.responseXML;
					//document.getElementById('leftplaceholder').innerHTML=httpObj.responseText;
					var prodtit=response.getElementsByTagName('secttext');
					var prodhold=document.getElementById('leftplaceholder');
					prodhold.innerHTML='';
					document.getElementById('prodtit').innerHTML="<b>"+prodtit.item(0).childNodes[2].firstChild.nodeValue+"</b>";
					var prods=response.getElementsByTagName('prod');
					var list=document.createElement('ul');
					list.setAttribute('id','prod_nav');
					prodhold.appendChild(list);
					for(x=0;x<prods.length;x++){
						var uid=prods.item(x).childNodes[0].firstChild.nodeValue;
						var prodname=prods.item(x).childNodes[1].firstChild.nodeValue+"\u00AE";
						var litem=document.createElement('li');
						var plink=document.createElement('a');
						var plinktxt=document.createTextNode(prodname);
						plink.setAttribute('href','javascript:ajaxManager(\'loadProd\','+uid+',1);');
						plink.appendChild(plinktxt);
						litem.appendChild(plink);
						list.appendChild(litem);
					}
				}
			}
			loadOBJ(document.getElementById('leftplaceholder'));
			httpObj.open("GET", './index.php?sect=loadProds&lang='+selectedLanguage,true);
			httpObj.send(null);
			break;
		case "loadNews":
			httpObj.onreadystatechange = function(s){
				if (httpObj.readyState == 4 && httpObj.status == 200){
					document.getElementById('content').innerHTML=httpObj.responseText;
				}
			}
			//loadOBJ(document.getElementById('content'));
			httpObj.open("GET", './index.php?sect=loadNews&id='+args[1], true);
			httpObj.send(null);
			break;
		case "downloadForm":
			switch(args[1]){
				case "send":
					break;
				default:
					httpObj.onreadystatechange = function(s){
						if (httpObj.readyState == 4 && httpObj.status == 200){
						}
					}
				httpObj.open("GET", './index.php?sect=downloadForm',true);
				httpObj.send(null);
			}
			break;
		case "sendForm":
			httpObj.onreadystatechange = function(s){
				if (httpObj.readyState == 4 && httpObj.status == 200){
					var response=httpObj.responseXML;
					var status=response.getElementsByTagName('status');
					switch(status.item(0).firstChild.nodeValue){
						case "success":
							document.getElementById('contactSuccess').style.display='block';
							break;
						case "failure":
							document.getElementById('contactFailure').style.display='block';
							break;
					}
				}
			}
			document.getElementById('contactSuccess').style.display='none';
			document.getElementById('contactFailure').style.display='none';
			parameters=makePostStr(document.getElementById(args[2]));
			httpObj.open("POST", './index.php?sect=sendForm&form='+args[1], true);
			httpObj.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      httpObj.setRequestHeader("Content-length", parameters.length);
      httpObj.setRequestHeader("Connection", "close");
			httpObj.send(parameters);
			break;
		case "sendFormAndDownload":
			httpObj.onreadystatechange = function(s){
				if (httpObj.readyState == 4 && httpObj.status == 200){
					var response=httpObj.responseXML;
				}
			}
			parameters=makePostStr(document.getElementById(args[2]));
			httpObj.open("POST", './index.php?sect=sendForm&form='+args[1], true);
			httpObj.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      httpObj.setRequestHeader("Content-length", parameters.length);
      httpObj.setRequestHeader("Connection", "close");
			httpObj.send(parameters);
			break;
	}
}

//-->
