window.onLoad = function(){
	
	//dyngallery();
	
}


function dyngallery()
{
  var piclinks=document.getElementsByTagName('a');
  var list = "";

 for(var i=0;i<piclinks.length;i++)
  {
	
	
	
	
	fileName = piclinks[i].href;
	result = fileName.lastIndexOf(".jpg");
	
	if(result > 0){
		
		//piclinks[i].style.display='none';
		
		//piclinks[i].removeAttribute("rel");
		
		var objLightbox = piclinks[i].createElement("div").item(0);
		                objLightbox.setAttribute('ref','lightbox');
		                piclinks[i].appendChild(objLightbox);
		
		//piclinks[i].href = "none.jpg";
		
		
		//list += result + " => " + piclinks[i].getAttribute("rel") + "<br>";
	}
	
	
		
	
	/*
    piclinks[i].onclick=function()
    {
      var oldp=document.getElementById(picId);
      if(oldp)
      {
       oldp.parentNode.removeChild(oldp);
      }
      var nc=document.createElement('div');
      d.parentNode.insertBefore(nc,d);
      nc.style.display='none';
      nc.id=picId;
      var newpic=document.createElement('img');
      newpic.src=this.href;
      newpic.alt=this.getElementsByTagName('img')[0].alt;
      newpic.title='Click to return to images';
      newpic.onclick=function()
      {
       this.parentNode.parentNode.removeChild(this.parentNode);
      }
      nc.appendChild(newpic);
      np=document.createElement('p');
      np.appendChild(document.createTextNode(this.getElementsByTagName('img')[0].alt))
      nc.appendChild(np);
      nc.style.display='block';
      return false;
    }
*/


  }  

	//document.write(list);  

}



function OpenAd(){
	imgBan = $('pub');
	l = Lightbox;
	l.prototype.start(imgBan);
}

function openReview(element){

	var rev = element.parentNode.parentNode.childNodes[3];
	if(!rev){
		var rev = element.parentNode.parentNode.childNodes[1];	
	}
	
	
	
	
	
	
	if(rev.style.display == "block"){

		new Effect.BlindUp(rev, { // the id of the <DIV> containing the photos 
	      duration: 1, 
	      fps: 50, 
	      afterFinish: function() { 
	        rev.style.display = 'none'; 
	      } 
	    })
		
		
	}else{
		
		new Effect.BlindDown(rev, { // the id of the <DIV> containing the photos 
	      duration: 1, 
	      fps: 50, 
	      afterFinish: function() { 
	        rev.style.display = 'block'; 
	      } 
	    })
	}
	
}

function block(elm){
	elm.style.display = "block";
}

//openReview(this);

function getShow(elm) { 
    new Effect.BlindDown(elm, { // the id of the <DIV> containing the photos 
      duration: 4, 
      fps: 10, 
      afterFinish: function() { 
        elm.style.display = 'block'; 
      } 
    }) 
  }

function getXmlHttpRequest() {
	if (window.XMLHttpRequest) {
		return new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		return new ActiveXObject("Microsoft.XMLHTTP");
	}
}

function hideDiv(clip){
  clipx = document.getElementById(clip);
  //clipx.style.display='none';
	
	new Effect.BlindUp(clipx, { // the id of the <DIV> containing the photos 
      duration: 1, 
      fps: 50, 
      afterFinish: function() { 
        rev.style.display = 'none'; 
      } 
    })


}

function AjaxRequestDir(method,params){
	
	var url ="core/who_ajax.php";
	var post_data ="&func="+method;
	post_data+="&param="+params;		

	for(i in params){
		document.write(i) + "\n\r";
	}
	var cmsajaxhttp = getXmlHttpRequest(); //785
	cmsajaxhttp.open("POST", url+'?'+post_data, true);
	
	if(cmsajaxhttp){
		
		
		cmsajaxhttp.onreadystatechange = function(){
			
				if (cmsajaxhttp.readyState==4){
					
					var resultado = eval('('+cmsajaxhttp.responseText+')');
					
					for(i in resultado){
						
						k = unescape(resultado[i].nomept);
						
						alert(k);
					}
				
					
					
				}
			
			
		}
		
		
		
		
	}
	
	cmsajaxhttp.send(null);
	
}


function AjaxRequest(method,params){
	
	var url ="core/who_ajax.php";
	var post_data ="&func="+method;
	post_data+="&param="+params;		

	alert(post_data);
	exit;
	
	var cmsajaxhttp = getXmlHttpRequest(); //785
	cmsajaxhttp.open("POST", url+'?'+post_data, true);
	
	if(cmsajaxhttp){
		
		
		cmsajaxhttp.onreadystatechange = function(){
			
				if (cmsajaxhttp.readyState==4){
					
					var resultado = eval('('+cmsajaxhttp.responseText+')');
					
					for(i in resultado){
						
						k = unescape(resultado[i].nomept);
						
						alert(k);
					}
				
					
					
				}
			
			
		}
		
		
		
		
	}
	
	cmsajaxhttp.send(null);
	
}



function getRequest(ajax,action,param,update,loader,barcode,redirect){
		
		
		if(update == "none"){
			//alert("update: " + update);
		}else{
			var divmenu= document.getElementById(update);
			var preloader = document.getElementById(loader);
			//divmenu.innerHTML='';
		}
		
		
		
		if(param == "REFERENCE"){
			var divNumberError = document.getElementById('msgerrN');
			
			if(barcode.length < 6){
				divNumberError.style.display = "block";
				masterOBJ = divNumberError;
				setTimeout("hideDiv()",2000);
				return;
				exit;
			}
			
			
		}
		
		
		var url ="gest/salsaAjaxData.php";
		var post_data="&ajax="+ajax;	
		post_data+="&FUNC="+action;
		post_data+="&"+param+"="+barcode;
		//?ajax=4&FUNC=getFromBarcode&BARCODE=5602999574255
		//post_data+="&id="+id;
		
	 //alert(url+post_data);
	
		var cmsajaxhttp = getXmlHttpRequest();	//785
		cmsajaxhttp.open("POST", url+'?'+post_data, true);
		
		
		preloader.style.display = "block";
    
		cmsajaxhttp.onreadystatechange = function(){
			if (cmsajaxhttp.readyState==4){
				
				var resultado = cmsajaxhttp.responseText;
				//alert('resultado: ' + resultado);
				
				if(update == "none"){
				  	//alert('vou saltar');
					//location.href = redirect;
				}else{
				
					var linha = new Array();
					linha=resultado.split("||");
					//alert(linha);
					
					row = linha[1].split("|");
					
					//alert(row);
					var caixinha = document.getElementById(param);
					 
					if(!row[1]){
					 divmenu.style.display = "block";
					 masterOBJ = divmenu;
					 preloader.style.display = "none";
					
      		 setTimeout("hideDiv()",2000);
      		 //caixinha.focus();
          }else{
            preloader.style.display = "none";
			
			if(redirect){
				window.location=redirect;
			}else{
            	pag = "basketAdd.php?pid="+row[1];
	            caixinha.value = "";
	            caixinha.focus();
				window.open(pag,'salsapro',' width=610,height=370,toolbar=0,menubar=0,scrollbars=1,status=0,resizable=0');
	            
			}
          }
				
				}
				
			}	
			}
			
		
			
		cmsajaxhttp.send(null);
	
}





	var objMyImg = null;
	function init() {
		objMyImg = new OpacityObject('logo','/assets');
		objMyImg.setBackground();
	}

    //<![CDATA[

    function load() {
      if (GBrowserIsCompatible()) {
        



			point = new GLatLng(41.142374,-8.608115);

	        var map = new GMap2(document.getElementById("map"));
			map.addControl(new GLargeMapControl());
			map.addControl(new GMapTypeControl());
			map.enableScrollWheelZoom();
	        map.setCenter(point, 16);
			//map.setMapType(G_HYBRID_MAP);

			var icon = new GIcon();
			
			servidor = "http://www.hotfive.eu/";
		    icon.image  = servidor +"assets/marker_red.png";
		    icon.shadow = servidor + "assets/shadow.png";
			
			icon.iconSize = new GSize(20, 34);
			icon.shadowSize = new GSize(0, 0);
			icon.iconAnchor = new GPoint(6, 20);
			icon.infoWindowAnchor = new GPoint(5, 1);

			var marker = new GMarker(point, icon);

			map.addOverlay(marker);

			marker.openInfoWindowHtml("<p style='margin:0px;color:black;'><b>Hotfive, jazz & Blues,</b><br />Largo Actor Dias ,51<br />4430 Porto</p>");

			GEvent.addListener(marker, "click", function() {
				marker.openInfoWindowHtml("<p style='margin:0px;color:black;'><b>Hotfive, jazz & Blues,</b><br />Largo Actor Dias ,51<br />4430 Porto</p>");
			});

		}
	}
    
    
if(navigator.userAgent.toLowerCase().indexOf('msie')>0){ // detect for IE (could be more specific to PC and version, but this works for the test)
	is = document.getElementsByTagName('IMG'); // get all images
	for(x=0; x<is.length; x++){ // cycle through those images
		if(is[x].src.indexOf('.png')){ // only do this to png files
			is[x].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+is[x].src+"', sizingMethod='scale')"; // apply the filter stuff that makes IE do it's magic
			is[x].src = "z.gif"; // replace the image with a clear gif so that the filter can show through
		}
	}
}
