function ShowCorpo() 
{
 document.getElementById("msg").style.display = "none";
 document.getElementById("content").style.display = "block";
}
function showhideLayers(obj,img, image) 
{ //v1.0
	var v,obj;	
	if ( image != ''){
		image=MM_findObj(image);
	}	
	
	if ((obj=MM_findObj(obj))!=null) 
	{
        v=obj.style.display;
        if (v == 'none' ) 
		{
                disp = 'block';
				//img = path + '/retract.gif';
        }
        else 
		{
                disp = 'none';
				//img = path + '/expand.gif';
        }
        obj.style.display = disp;
		if ( image != ''){
			image.src = img;
		}	
 }
}
function MM_findObj(n, d)
{ //v4.01
        var p,i,x; if(!d) d=document;
        if((p=n.indexOf("?"))>0&&parent.frames.length)
        {
                d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
        }
        if(!(x=d[n])&&d.all)
                x=d.all[n];
        for (i=0;!x&&i<d.forms.length;i++)
                x=d.forms[i][n];
                for(i=0;!x&&d.layers&&i<d.layers.length;i++)
                        x=MM_findObj(n,d.layers[i].document);
                if(!x && d.getElementById)
                        x=d.getElementById(n);
        return x;
}
function openWindow ( url )
{
	var d = new Date();
	var winId = d.getDate() + d.getHours() + d.getMinutes() + d.getSeconds();
	
	newWindow = window.open(url, winId , 'scrollbars=yes,top=20,left=230,width=480,height=520,hotkeys=0,menubar=0');
	newWindow.focus();
	return;
}

function toPrint ( url ){
	var d = new Date();
	var winId = d.getDate() + d.getHours() + d.getMinutes() + d.getSeconds();
	
	//newWindow = window.open(url, winId , 'scrollbars=yes, top=20, left=230, width=565, height=520');
	newWindow = window.open(url, winId , '');
	newWindow.focus();
	return;
}
function goCountry(Obj,region,destiny)
{    
    window.document.location='index.php?' + Obj.options[Obj.selectedIndex].value + '&' + destiny;
}
function goRegion(Obj)
{
    window.document.location='index.php?' + Obj.options[Obj.selectedIndex].value;
}
function goState(Obj,region,country,destiny)
{
   if(destiny)
   { 
        window.document.location='index.php?'  + 'region=' + region + '&country=' + country + Obj.options[Obj.selectedIndex].value + '&' + destiny;
   }else {
             window.document.location='index.php?'  + 'region=' + region + '&country=' + country + Obj.options[Obj.selectedIndex].value;
   }
}
function search(from)
{
    document.formSearch.from.value = from; 
    document.formSearch.submit(); 
}
function winOpen(destination) 
{
    window.open(destination, "_blank", "width=550,scrollbars=yes");
}
function insertDefaultOperator(obj){
	var s = obj;
	var str = s.value.toLowerCase();

	var quotedExpressions = str.match(/("[^"]*")/g);

	// Substitui expressões dentro de aspas por %~~%
	if (quotedExpressions)
	{
		for (var i = 0; i < quotedExpressions.length; i++)
		{
			var qexp = quotedExpressions[i];
			var pos = str.indexOf(qexp);
			
			str = str.slice(0, pos) + "\%~~\%" + str.slice(pos + qexp.length);
		}	
	}
	
	var patterns = [ /^\s+/, /\s+$/, /\s+/g, / AND (AND|OR|NOT) AND /ig, /^NOT AND /i, / NOT AND /ig, / AND /g, / OR /g, /^NOT /, / NOT /g ];
	var replacements = [ "", "", " and ", " $1 ", "not ", " not ", " and ", " or ", "not ", " not " ];

/* sugestao do shintani 

	var patterns = [ /^\s+/, /\s+$/, /\s+/g, / (AND|OR) (AND|OR|NOT) (AND|OR) /ig, /^NOT (AND|OR) /i, / NOT (AND|OR) /ig, / AND /g, / OR /g, /^NOT /, / NOT /g ];
	var replacements = [ "", "", " " + operator + " ", " $2 ", "not ", " not ", " and ", " or ", "not ", " not " ];
*/
	
	for (var i = 0; i < patterns.length; i++)
	{
		str = str.replace(patterns[i], replacements[i]);
	}	
	
	// Insere de volta a expressão dentro de aspas
	if (quotedExpressions)
	{
		for (var i = 0; i < quotedExpressions.length; i++)
		{
			str = str.replace(/%~~%/, quotedExpressions[i]);
		}	
	}
	//alert("str: " + str);
	s.value = str;
}