function SendDataToFlashMovie(){
	 var flashMovie = getFlashMovieObject("contato");
	 flashMovie.Rewind();
}

function showPage(page, state){
	var obj = document.getElementById(page + '_div');
	var file = (page == 'portfolio')? 'portfolio/gallery.swf' : page + '.swf';
	
	if(state == 'show'){
		obj.style.display = 'block';
		obj.innerHTML = '<object height="100%" width="100%" id="globalnav-object" name="interface" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"><param value="transparent" name="wmode"><param value="always" name="allowScriptAccess"><param value="high" name="quality"><param value="noScale" name="scaleMode"><param value="false" name="menu"><param value="'+ file +'" name="movie"><embed height="100%" align="middle" width="100%" wmode="transparent" id="globalnav-embed" scale="noscale" allowscriptacess="always" quality="high" menu="false" flashvars="loc=en_US&amp;htmlApp=false&amp;gatewayURL=gwurl" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" src="'+ file +'"></object>';
		
	} else {
		obj.style.display = 'none';
		obj.innerHTML = '';
	}
}

function getFlashMovieObject(movieName){
  if (window.document[movieName]) {
      return window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1){
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName]; 
  } else {
    return document.getElementById(movieName);
  }
}

function clearText(field) {
if (field.defaultValue == field.value) field.value = '';
else if (field.value == '') field.value = field.defaultValue;
}

var newCaptcha = function(){
thesrc = document.getElementById("captcha").src;
thesrc = thesrc.substring(0,thesrc.lastIndexOf(".")+4);
document.getElementById("captcha").src = thesrc+"?"+Math.round(Math.random()*100000);
};

function kH(e) {
var pK = e ? e.which : window.event.keyCode;
return pK != 13;
}

function contarCaracteres(entrada, saida, texto, chars) {
var entradaObj = document.getElementById(entrada); var saidaObj = document.getElementById(saida);
var tam = chars - entradaObj.value.length;
if(tam <= 0) { tam = 0;
texto = '<span class="disable"> '+texto+' </span>';
entradaObj.value = entradaObj.value.substr(0,chars); }
saidaObj.innerHTML = texto.replace("{CHAR}",tam);
}

function zoomText(acao,el){
obj=document.getElementById(el);	
if (obj.style.fontSize=="")	obj.style.fontSize="13px";
atual=parseInt(obj.style.fontSize);
inc=2; maxVal = 19; minVal = 9;
if(acao=="reestablecer"){ obj.style.fontSize="1em" }	
if(acao=="aumentar"){ val=atual+inc; if(val <= maxVal) obj.style.fontSize=val+"px" }	
if(acao=="diminuir"){ val=atual-inc; if(val >= minVal) obj.style.fontSize=val+"px"; }
} 

function GeraSWF(arquivo,largura,altura,id,transp){
var incTransp = '';
var retorno = '';
retorno += '<object align="middle" id="globalnav-object" 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+'" id="'+id+'">';
if(transp == "yes"){ retorno += '<param name="wmode" value="transparent" />'; incTransp = 'wmode="transparent"'; }
retorno += '<param name="allowScriptAccess" value="always" />';
retorno += '<param name="quality" value="high" />';
retorno += '<param name="scaleMode" value="noScale" />';
retorno += '<param name="menu" value="false" />';
retorno += '<param name="movie" value="'+arquivo+'" />';
retorno += '<embed id="globalnav-embed" src="'+arquivo+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="loc=en_US&htmlApp=false&gatewayURL=gwurl" menu="false" align="middle" quality="high" allowscriptacess="always" scale="noscale" id="'+id+'" width="'+largura+'" height="'+altura+'" '+incTransp+'></embed>';
retorno += '</object>';

return retorno;
}

function hideLayer(obj, timeOut){ setTimeout("showHideLayers('"+obj+"','','hide')", timeOut); }

var flg1 = true; var flg2 = true; var txtorig1; var txtorig2;

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 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 MM_changeProp(objName,x,theProp,theValue) {
var obj = MM_findObj(objName);
if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
if (theValue == true || theValue == false) eval("obj."+theProp+"="+theValue);
else eval("obj."+theProp+"='"+theValue+"'");}
}

function MM_findObj(n, d) {
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 MM_jumpMenu(targ,selObj,restore){
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}

function showHideLayers() {
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;}
}
