function Image_renderFlash( path, width, height, vars, quality, className ) {

    function escapeValue( value ) {
        if( typeof( value ) != "string" ) {
            return value;
        }
        var str = value.replace( /"/g, "&quot;" );
        str = str.replace( /</g, "&lt;" );

        return str;
    }



	
    function renderAttribute( name, value ) {
        if( ! value ) {
            return;
        }
        document.write( " " );
        document.write( name );
        document.write( "=\"" );
        document.write( escapeValue( value ) );
        document.write( "\"" );
    }

    function renderParam( name, value ) {
        if( ! value ) {
            return;
        }
        document.write( "<param" );
        renderAttribute( "name", name );
        renderAttribute( "value", value );
        document.write( "/>" );
    }

    document.write( "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"" );
    renderAttribute( "width", width );
    renderAttribute( "height", height );
    renderAttribute( "class", className );
    document.write( " codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\">" );

    renderParam( "MOVIE", path );
    renderParam( "QUALITY", quality );
    document.write( "<param name=\"wmode\" value=\"transparent\"/>" );
    renderParam( "FlashVars", vars );

    document.write( "<embed type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\"" );
    renderAttribute( "src", path );
    renderAttribute( "quality", quality );
	document.write( "wmode=\"transparent\" bgcolor=\"#ffffff\"" );
	renderAttribute( "flashvars", vars );
    renderAttribute( "width", width );
    renderAttribute( "height", height );
    document.write( ">" );

    document.write( "</embed>" );

    document.write( "</object>" );
}


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_showHideLayers() { 
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=9) 
  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 expandit(objname,image){
    var folder='';
    curobj = objname + 'info';
    imgobj = objname + 'img';
    folder = getObjectRef(curobj).style;
	if (folder.display=="none") {
        folder.display="";
        getObjectRef(imgobj).src = "/images/spacerr.gif";
    } else {
        folder.display="none"
        getObjectRef(imgobj).src = "/images/spacerr.gif";
    }
}
function getObjectRef(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=getObjectRef(n,d.layers[i].document);
	
  if(!x && d.getElementById) 
  	x=d.getElementById(n); 
	
  return x;
}
    function print_page(url) {
      if(navigator.userAgent.indexOf("MSIE") == -1) {
        newwindow = window.open(url,'examples','toolbar=1,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=620,height=350');
        newwindow.focus();
      } else {
        window.open(url,'examples','toolbar=1,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=620,height=350');
      }
    }
	
	
function Dados(valor) {
      //verifica se o browser tem suporte a ajax
	  try {
         ajax = new ActiveXObject("Microsoft.XMLHTTP");
      } 
      catch(e) {
         try {
            ajax = new ActiveXObject("Msxml2.XMLHTTP");
         }
	     catch(ex) {
            try {
               ajax = new XMLHttpRequest();
            }
	        catch(exc) {
               alert("Esse browser não tem recursos para uso do Ajax");
               ajax = null;
            }
         }
      }
	  //se tiver suporte ajax
	  if(ajax) {
	     //deixa apenas o elemento 1 no option, os outros são excluídos
		 document.forms[0].listCidades.options.length = 1;
	     
		 idOpcao  = document.getElementById("opcoes");
		 
	     ajax.open("POST", "cidades.php", true);
		 ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		 
		 ajax.onreadystatechange = function() {
            //enquanto estiver processando...emite a msg de carregando
			if(ajax.readyState == 1) {
			   idOpcao.innerHTML = "Carregando...!";   
	        }
			//após ser processado - chama função processXML que vai varrer os dados
            if(ajax.readyState == 4 ) {
			   if(ajax.responseXML) {
			      processXML(ajax.responseXML);
			   }
			   else {
			       //caso não seja um arquivo XML emite a mensagem abaixo
				   idOpcao.innerHTML = "Selecione Estado>>";
			   }
            }
         }
		 //passa o código do estado escolhido
	     var params = "estado="+valor;
         ajax.send(params);
      }
   }
   
   function processXML(obj){
      //pega a tag cidade
      var dataArray   = obj.getElementsByTagName("cidade");
      
	  //total de elementos contidos na tag cidade
	  if(dataArray.length > 0) {
	     //percorre o arquivo XML paara extrair os dados
         for(var i = 0 ; i < dataArray.length ; i++) {
            var item = dataArray[i];
			//contéudo dos campos no arquivo XML
			var codigo    =  item.getElementsByTagName("codigo")[0].firstChild.nodeValue;
			var descricao =  item.getElementsByTagName("descricao")[0].firstChild.nodeValue;
			
	        idOpcao.innerHTML = "Selecione Cidade";
			
			//cria um novo option dinamicamente  
			var novo = document.createElement("option");
			    //atribui um ID a esse elemento
			    novo.setAttribute("id", "opcoes");
				//atribui um valor
			    novo.value = codigo;
				//atribui um texto
			    novo.text  = descricao;
				//finalmente adiciona o novo elemento
				document.forms[0].listCidades.options.add(novo);
		 }
	  }
	  else {
	    //caso o XML volte vazio, printa a mensagem abaixo
		idOpcao.innerHTML = "Selecione Estado>>";
	  }	  
   }
  
function ddados(valor) {

	  try {
         ajax2 = new ActiveXObject("Microsoft.XMLHTTP");
      } 
      catch(e) {
         try {
            ajax2 = new ActiveXObject("Msxml2.XMLHTTP");
         }
	     catch(ex) {
            try {
               ajax2 = new XMLHttpRequest();
            }
	        catch(exc) {
               alert("Esse browser não tem recursos para uso do ajax2");
               ajax2 = null;
            }
         }
      }
	  
	  if(ajax2) {

	     ajax2.open("POST", "descricaocidade.php", true);
		 ajax2.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		 ajax2.onreadystatechange = function() {

			if(ajax2.readyState == 1) {
			   idOpcao.innerHTML = "Carregando...!";   
	        }

            if(ajax2.readyState == 4) {
				{				
				document.getElementById("txtHint").innerHTML=ajax2.responseText 
 				}
			   if(ajax2.responseXML) {
			      processXMLL(ajax2.responseXML);
			   }
			   else {
			      idOpcao.innerHTML = "Primeiro selecione Estado";
			   }
            }
         }
		 
var params2 = "cidade="+valor;
ajax2.send(params2);
      }
   }
   

function processXMLL(obj){

      var dataArray   = obj.getElementsByTagName("cid");
      

	  if(dataArray.length > 0) {
	    
         for(var i = 0 ; i < dataArray.length ; i++) {
            var item = dataArray[i];
			
//			var cod    =  item.getElementsByTagName("cod")[0].firstChild.nodeValue;
			var desc =  item.getElementsByTagName("desc")[0].firstChild.nodeValue;
			
	        idOpcao.innerHTML = "Selecione Cidade";
			
	 }
	  }
	  else {
	   		idOpcao.innerHTML = "Selecione Estado";
	  }	  
   }
   
function load() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map"));
        map.setCenter(new GLatLng(-23.534500, -46.71955), 13);
      }
    }


var dom = (!document.all && document.getElementById);
var gallery_index = 0;
var description_index = 0;

function ajaxManager()
	{
	var args = ajaxManager.arguments;
	switch (args[0])
		{
		case "array_setup":
			galleryArray = new Array();
			galleryArray[0] = "image1.html";
			galleryArray[1] = "image2.html";
			galleryArray[2] = "image3.html";
			galleryArray[3] = "image4.html";
			galleryArray[4] = "image5.html";
			galleryArray[5] = "image6.html";

			descriptionArray = new Array();
			descriptionArray[0] = "description1.xml";
			descriptionArray[1] = "description2.xml";
			descriptionArray[2] = "description3.xml";
			descriptionArray[3] = "description4.xml";
			descriptionArray[4] = "description5.xml";
			descriptionArray[5] = "description6.xml";
			break;
		case "load_page":
			var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
			pageWidth = (dom) ? innerWidth : document.body.clientWidth;
			preload = document.getElementById("preloadLYR");
			gallery = document.getElementById("galleryLYR");
			if (x)
				{
				x.onreadystatechange = function()
					{
					if (x.readyState == 0)
						{
						preload.innerHTML = "iniciando...";
						}
					else if (x.readyState == 1)
						{
						preload.innerHTML = "processando...";
						}
					else if (x.readyState == 2)
						{
						preload.innerHTML = "processando descricao...";
						}
					else if (x.readyState == 3)
						{
						preload.innerHTML = "carregando..";
						setOpacity(0, 'galleryLYR');
						setOpacity(0, 'captionLYR');
						}
					else if (x.readyState == 4 && x.status == 200)
						{

						el = document.getElementById(args[2]);
						el.innerHTML = x.responseText;
						preload.innerHTML = "";
						getImageSize = document.getElementsByTagName("img")[0].getAttribute("width");
						gallery.style.left = (pageWidth - getImageSize) / 2+"px";
						preload.style.left = (pageWidth - getImageSize) / 2+"px";
						document.getElementById('captionLYR').style.left = (pageWidth -	getImageSize) / 2+"px";
						document.getElementById('accessLYR').style.visibility = "hidden";
						setTimeout("fadeIn('galleryLYR', 0, '99.99')", 1200);
						setTimeout("fadeIn('captionLYR', 0, '99.99')", 1300);
						}
					}
				x.open("GET", args[1], true);
				x.send(null);
				}
			break;
			


		case "cycle_gallery":
			if (args[1] == 'forw' && gallery_index != galleryArray.length - 1)
				{
				gallery_index++;
				description_index++;
				ajaxManager('load_page', galleryArray[gallery_index], 'galleryLYR');
				ajaxManager('load_page', descriptionArray[description_index], 'captionLYR');
				
				}
			else if (args[1] == 'rev' && gallery_index != 0)
				{
				gallery_index--;
				description_index--;
				ajaxManager('load_page', galleryArray[gallery_index], 'galleryLYR');
				ajaxManager('load_page', descriptionArray[description_index], 'captionLYR');
				}
			break;
		case "hide_access":
			document.getElementById('accessLYR').style.visibility = "hidden";
			break;
			

					
		case "start_up":
			ajaxManager('hide_access');
			ajaxManager('array_setup');
			ajaxManager('load_page', galleryArray[gallery_index], 'galleryLYR');
			ajaxManager('load_page', descriptionArray[description_index], 'captionLYR');
			break;
		}
	}
	

function fadeIn(id, startfade, endfade)
	{
	timer = 0;
	if (startfade < endfade)
		{
		for (i = startfade; i <= endfade; i++)
			{
			setTimeout("setOpacity(" + i + ",'" + id + "')", (timer * 20));
			timer++;
			}
		}
	}

function setOpacity(opacity, id)
	{
	var el = document.getElementById(id).style;
	el.opacity = (opacity / 100);
	el.MozOpacity = (opacity / 100);
	el.KhtmlOpacity = (opacity / 100);
	el.filter = "alpha(opacity=" + opacity + ")";
	}

function cycle_galleryy() {
				gallery_index++;
				description_index++;
				ajaxManager('load_page', galleryArray[gallery_index], 'galleryLYR');
				ajaxManager('load_page', descriptionArray[description_index], 'captionLYR');	
				timeee();
				
}

function timeee() {
		timerr = 12000;
		setTimeout("cycle_galleryy()", (timerr));
		timerr++;
}







var bustcachevar=1 
var loadedobjects=""
var rootdomain="http://"+window.location.hostname
var bustcacheparameter=""

function ajaxpage(url, containerid){
var page_request = false
if (window.XMLHttpRequest) 
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ 
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
} 
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.onreadystatechange=function(){
loadpage(page_request, containerid)
}
if (bustcachevar) 
bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
page_request.open('GET', url+bustcacheparameter, true)
page_request.send(null)
}

function loadpage(page_request, containerid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
document.getElementById(containerid).innerHTML=page_request.responseText
}

function loadobjs(){
if (!document.getElementById)
return
for (i=0; i<arguments.length; i++){
var file=arguments[i]
var fileref=""
if (loadedobjects.indexOf(file)==-1){ 
if (file.indexOf(".js")!=-1){ 
fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript");
fileref.setAttribute("src", file);
}
else if (file.indexOf(".css")!=-1){ 
fileref=document.createElement("link")
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", file);
}
}
if (fileref!=""){
document.getElementsByTagName("head").item(0).appendChild(fileref)
loadedobjects+=file+" " 
}
}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

	




