			
			foto = new Image();
			
			function confirma(url)
				{
				document.getElementById('grande').style.display = 'none';
				if (confirm("A cópia do arquivo está autorizada para uso não comercial, desde que mantida a marca d'água e respeitada a autoria"))
					{					
					location.href = url;;
					}
				}
				
				
			function divfoto(thfoto,caminho,orient)
				{
				document.getElementById('grande').style.cursor = 'wait';
				path = caminho + "/" + thfoto.title;
				path = caminho + "/" + thfoto.id;
				//path = "img/" + caminho + "/" + thfoto.title;
				
				foto.src = path;
				if (orient==1)
					{
					document.getElementById('grande').style.width=400;
					document.getElementById('grande').style.height=600;
					document.getElementById('no').style.paddingTop = '610px';
					w=410;
					h=615;
					}
				else
					{
					document.getElementById('grande').style.width=600;
					document.getElementById('grande').style.height=400;
					document.getElementById('no').style.paddingTop = '410px';
					w=610;
					h=415;
					}
				contentL = document.getElementById('content').offsetLeft;
				contentT = document.getElementById('content').offsetHeight;
				styleL = Math.min(thfoto.offsetLeft+contentL,contentL - w + 800);
				styleT = Math.min(thfoto.offsetTop, contentT - h);
				if (styleT < 0) styleT = 0;
				document.getElementById('grande').style.left = styleL;
				document.getElementById('grande').style.top = styleT;
				//document.getElementById('grande').style.top = document.body.scrollTop;
				document.getElementById('grande').style.backgroundImage = "url('" + path + "')";
				document.getElementById('grande').style.display='block';
				//document.body.scrollTop = styleT;
				document.getElementById('grande').style.cursor='default';
				document.getElementById('down').setAttribute('onclick', 'javascript:confirma("' + path + '&dl=1")');
			 
				}
				
// AJAX SELEÇÃO DIRETORIO

	function GetXmlHttpObject() 
					 {
  					 try 
					 	{
    				    // Firefox, Opera 8.0+, Safari
    				    xmlHttp=new XMLHttpRequest();
    				    }
  					 catch (e) {
    				    // Internet Explorer
    					try 
						   {
     					   xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      					   }
    					   catch (e) {
      					   try 
						      {
        				      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        					  }
      						  catch (e)
							     {
        					     alert("O seu browser não suporta AJAX! Atualize-o");
        						 }
      						  }
    				    }
 						return xmlHttp;
 						}
					 
			function dirStateChanged() 
					 {
       				 if(xmlHttp.readyState==4) 
					 	    {
							if (xmlHttp.status==200) 
							   {								  
							   document.getElementById('content').innerHTML = xmlHttp.responseText; 
							   }
							}
       				 }
						
				function enviadir(dir)
			   		 { 						 xmlHttp=GetXmlHttpObject();
						 
						 if (xmlHttp==null)
					 		{
					   	alert ("O seu browser não suporta AJAX! Atualize-o");
							return;
							} 
						dados = (dir) ? "dir=" + dir : "";
					 	xmlHttp.onreadystatechange=dirStateChanged;
					 	xmlHttp.open("POST","content.php",true);
					 	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");	// Setando Content-type					 xmlHttp.send(dados);
					 	xmlHttp.send(dados);
						}
			
			//SIDE
			function sideStateChanged() 
					 {
       				 if(xmlHttp.readyState==4) 
					 	    {
							if (xmlHttp.status==200) 
							   {	
							   //document.getElementById('divside').innerHTML = xmlHttp.responseText; 
							   }
							}
       				 }
       				 
       		function veriside()
			   		 { 		
			   		 xmlHttp=GetXmlHttpObject();						 
					 if (xmlHttp==null)
					 	{
					  	alert ("O seu browser não suporta AJAX! Atualize-o");
						return;
						} 
					dadoside = (screen.width < 600) ? "mob=1" : "mob=0";
					xmlHttp.onreadystatechange=sideStateChanged;
					xmlHttp.open("POST","mobile.php",true);
					xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");	// Setando Content-type					 xmlHttp.send(dados);
					xmlHttp.send(dadoside);			 	
					}
			veriside();
			
       		//FIM SIDE

// FIM SELEÇÃO DIRETÓRIO

	function menu(item,root)
		{
		divmenu = document.getElementById('menu')
		for (i=0; i<divmenu.getElementsByTagName('span').length; i++)
			{
			link = document.getElementsByTagName('span')[i].getElementsByTagName('a')[0].getAttribute('href');
			document.getElementsByTagName('span')[i].getElementsByTagName('a')[0].setAttribute('href',  link)
			if (divmenu.getElementsByTagName('span')[i].id == item) divmenu.getElementsByTagName('span')[i].setAttribute('class','ativo');
			else divmenu.getElementsByTagName('span')[i].setAttribute('class','');
			}
		}
	
	
	
