var flg1 = true;
var flg2 = true;
var flg3 = true;
var flg4 = true;
var txtorig1; 
var txtorig2;
var txtorig3;
var txtorig4;

function inn(txt,i) {
	 if (eval('flg'+i)){
		  eval('txtorig'+i+'=txt.value;');
		  eval('flg'+i+'=false;');
	 }
	
	 if (txt.value == eval('txtorig'+i)) txt.value = '';
}

function out(txt,i) {
	if (txt.value == '') txt.value = eval('txtorig'+i);
}


//========================================================================


function GeraSWF($arquivo,$altura,$largura,$id,$transparent){
	incTransp = '';
	if($transparent == "yes") incTransp = 'wmode="transparent"';
	
	 if (navigator.appName.indexOf("Microsoft Internet")==-1){
		 
		 document.writeln('        <embed src="' + $arquivo + '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" swliveconnect="true" flashvars="loc=en_US&htmlApp=false&gatewayURL=gwurl" menu="false" align="middle" quality="high" scale="noscale" id="' + $id + '" name="'+ $id +'" width="' + $largura + '" height="' + $altura + '" '+incTransp+'></embed>'); 
		
	 } else {
		 
		document.writeln('    <object align="middle" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="' + $largura + '" height="' + $altura + '" id="' + $id + '" name="' + $id + '">');
		if($transparent == "yes") document.writeln('        <param name="wmode" value="transparent" />');
		document.writeln('        <param name="allowScriptAccess" value="sameDomain" />');
		document.writeln('        <param name="quality" value="high" />');
		document.writeln('        <param name="scale" value="noScale" />');
		document.writeln('        <param name="menu" value="false" />');
		document.writeln('        <param name="movie" value="' + $arquivo + '" />');
		document.writeln('        <param name="FlashVars" value="loc=en_US&htmlApp=false&gatewayURL=gwurl" />');
		document.writeln('    </object>');
		
	 }
}


//========================================================================


var isNN = (navigator.appName.indexOf("Netscape")!=-1);

function autoTab(input, len, e) {
	var keyCode = (isNN) ? e.which : e.keyCode; 
	var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
	
	if(input.value.length >= len && !containsElement(filter,keyCode)) {
		input.value = input.value.slice(0, len);
		input.form[(getIndex(input)+1) % input.form.length].focus();
	}

	function containsElement(arr, ele) {
		var found = false, index = 0;
		
		while(!found && index < arr.length)
			if(arr[index] == ele)
				found = true;
			else
				index++;
				
		return found;
	}
	
	function getIndex(input) {
		var index = -1, i = 0, found = false;
		
		while (i < input.form.length && index == -1)
			if (input.form[i] == input)index = i;
			else i++;
		return index;
	}

return true;

}


//========================================================================


//Created by Arthur Paredes
function hideLayer(obj, timeOut){
	setTimeout("showHideLayers('" + obj + "','','hide')", timeOut);
}


//========================================================================


function newWindow(mypage, 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+',status=yes, resizable'
	win = window.open(mypage, '', winprops)
	
	if (parseInt(navigator.appVersion) >= 4) { 
		win.window.focus(); 
	}
}


//========================================================================


function flashGoTo(frame) {
	
        var IE = navigator.appName.indexOf("Microsoft") != -1;
        var filme = IE ? window.mainMovie : window.document.mainMovie;
        filme.GotoFrame(frame - 1);
}


//========================================================================


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 showHideLayers() { //v6.0
  var i,p,v,obj,args=showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  	if ((obj=MM_findObj(args[i]))!=null) { 
		v=args[i+2];
    	if (obj.style) { 
			obj=obj.style;
			v=(v=='show')?'visible':(v=='hide')?'hidden':v;
		}
    	obj.visibility=v; 
	}
}

//============================================================================


function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}