// JavaScript Document
<!--
function printMenu()
{
	window.self.print();
}

function ImageViewOpen(divId,idImagem,urlImagem,coordX){
	try{
		xmlhttp = new XMLHttpRequest();
	}catch(ee){
		try{
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e){
			try{
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}catch(E){
				xmlhttp = false;
			}
		}
	}

	window.scrollTo(0,coordX);

	if (!divId)
	{
		xmlhttp.open("GET", "loadImage.php",true);
		xmlhttp.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
	}else{
		
		//document.body.scroll="no";
		document.body.style.overflow = "hidden";
		document.getElementById(divId).style.top=document.body.scrollTop;		
		document.getElementById(divId).style.display='none';
		//document.getElementById('btFechar').style.display='none';
		//document.getElementById(idImagem).src='images/loadding.gif';

		//Abre a url
		//xmlhttp.open("GET", "loadImage.php?urlimage="+urlImagem,true);
		xmlhttp.open("POST", "loadImage.php",true);
		//xmlhttp.open("POST", "images/posts/"+urlImagem,true);
		xmlhttp.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
	}
	
	 xmlhttp.onreadystatechange=function() {
		//alert(xmlhttp.readyState);
		if (xmlhttp.readyState==4)
		{		
			document.getElementById(idImagem).src=urlImagem;
			window.scrollTo(0,coordX);
			document.body.style.overflow = "hidden";
			document.getElementById(divId).style.top=document.body.scrollTop;
			document.getElementById(divId).style.display='';
			//document.getElementById('btFechar').style.display='';
		}
	 }
//	xmlhttp.send(null)
	xmlhttp.send("urlimage="+urlImagem);
}


function openEventDetails(divId,idCoordEvent){
	try{
		xmlhttpE = new XMLHttpRequest();
	}catch(ee){
		try{
			xmlhttpE = new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e){
			try{
				xmlhttpE = new ActiveXObject("Microsoft.XMLHTTP");
			}catch(E){
				xmlhttpE = false;
			}
		}
	}

	//Abre a url
	xmlhttpE.open("GET", "panelEventDetails.php?idEvent="+idCoordEvent,true);
	xmlhttpE.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");

	
	 xmlhttpE.onreadystatechange=function() {
		if (xmlhttpE.readyState==4)
		{
			var texto=xmlhttpE.responseText;
			document.getElementById(divId).style.display = '';
			document.getElementById(divId).innerHTML = texto;
			texto = "";
		}
	 }
	xmlhttpE.send(null)
}


function openEventGallery(divId,idCoordEvent,page){
	try{
		xmlhttp = new XMLHttpRequest();
	}catch(ee){
		try{
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e){
			try{
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}catch(E){
				xmlhttp = false;
			}
		}
	}

	//Abre a url
	xmlhttp.open("GET", "panelGallery.php?pageNumber="+page+"&idEvent="+idCoordEvent,true);
	xmlhttp.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");

	
	 xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4)
		{
			var texto=xmlhttp.responseText;
			document.getElementById(divId).style.display = '';
			document.getElementById(divId).innerHTML = texto;
			texto = "";
		}
	 }
	xmlhttp.send(null)
}

function openVenueGallery(divId,idCoordEvent,page){
	try{
		xmlhttp = new XMLHttpRequest();
	}catch(ee){
		try{
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e){
			try{
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}catch(E){
				xmlhttp = false;
			}
		}
	}

	//Abre a url
	xmlhttp.open("GET", "panelGalleryVenue.php?pageNumber="+page+"&idEvent="+idCoordEvent,true);
	xmlhttp.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");

	
	 xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4)
		{
			var texto=xmlhttp.responseText;
			document.getElementById(divId).style.display = '';
			document.getElementById(divId).innerHTML = texto;
			texto = "";
		}
	 }
	xmlhttp.send(null)
}

function ImageViewClose(divId,idImagem){
//	document.body.scroll="yes";
//	document.body.style.overflow = "auto";
	document.getElementById(divId).style.display='none';
	document.getElementById(idImagem).src='images/transp.gif';
}

function showMenuItem(menu){
	try{
		xmlhttp = new XMLHttpRequest();
	}catch(ee){
		try{
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e){
			try{
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}catch(E){
				xmlhttp = false;
			}
		}
	}

	document.getElementById('itemMenu').innerHTML="loading ...";
//layerOpen('menu');	
//	document.getElementById('menu').style.display='none';
	//Abre a url
	xmlhttp.open("GET", "menuData.php?menu="+menu,true);
	xmlhttp.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
	
	 xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4)
		{
			var texto=xmlhttp.responseText;
			document.getElementById('itemMenu').innerHTML="";
			document.getElementById('itemMenu').innerHTML=texto;
			document.getElementById('itemMenu').style.display='';
			document.getElementById('menu').style.display='';
			texto="";
		}
	 }
	xmlhttp.send(null)
}

function showCompleteMenu(){
	try{
		xmlhttpCM = new XMLHttpRequest();
	}catch(ee){
		try{
			xmlhttpCM = new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e){
			try{
				xmlhttpCM = new ActiveXObject("Microsoft.XMLHTTP");
			}catch(E){
				xmlhttpCM = false;
			}
		}
	}

	//Abre a url
	xmlhttpCM.open("GET", "completeMenuData.php",true);
	xmlhttpCM.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
	
	 xmlhttpCM.onreadystatechange=function() {
		if (xmlhttpCM.readyState==4)
		{
			var texto=xmlhttpCM.responseText;
			document.getElementById('completeMenu').innerHTML="";
			document.getElementById('completeMenu').innerHTML=texto;
			texto="";
		}
	 }
	xmlhttpCM.send(null)
}


function showGallery(idEvent,page){
	try{
		xmlhttp = new XMLHttpRequest();
	}catch(ee){
		try{
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e){
			try{
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}catch(E){
				xmlhttp = false;
			}
		}
	}

	document.getElementById('eventGallery').innerHTML="loading ...";
	//Abre a url
	xmlhttp.open("GET", "evGallery.php?pageNumber="+page+"&event_id="+idEvent,true);
	xmlhttp.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
	
	 xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4)
		{
			var texto=xmlhttp.responseText;
			document.getElementById('eventGallery').innerHTML="";
			document.getElementById('eventGallery').innerHTML=texto;
			document.getElementById('eventGallery').style.display='';
			texto="";
		}
	 }
	xmlhttp.send(null)
}

function showVenueGallery(){
	try{
		xmlhttpV = new XMLHttpRequest();
	}catch(ee){
		try{
			xmlhttpV = new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e){
			try{
				xmlhttpV = new ActiveXObject("Microsoft.XMLHTTP");
			}catch(E){
				xmlhttpV = false;
			}
		}
	}

	document.getElementById('vgallery').innerHTML="loading ...";
	//Abre a url
	xmlhttpV.open("GET", "venueGallery.php",true);
	xmlhttpV.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
	
	 xmlhttpV.onreadystatechange=function() {
		if (xmlhttpV.readyState==4)
		{
			var textoV=xmlhttpV.responseText;
			document.getElementById('vgallery').innerHTML="";
			document.getElementById('vgallery').innerHTML=textoV;
			document.getElementById('vgallery').style.display='';
			textoV="";
		}
	 }
	xmlhttpV.send(null)
}


function showCalendar(month,year){
	try{
		xmlhttp = new XMLHttpRequest();
	}catch(ee){
		try{
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e){
			try{
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}catch(E){
				xmlhttp = false;
			}
		}
	}

	document.getElementById('calendar').innerHTML="loading calendar ...";
//layerOpen('menu');	
//	document.getElementById('menu').style.display='none';
	//Abre a url
	xmlhttp.open("GET", "calendar.php?month="+month+"&year="+year,true);
	xmlhttp.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
	
	 xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4)
		{
			var texto=xmlhttp.responseText;
			document.getElementById('calendar').innerHTML="";
			document.getElementById('calendar').innerHTML=texto;
			document.getElementById('calendar').style.display='';
			texto="";
		}
	 }
	xmlhttp.send(null)
}


function newsletterSend(name,email){
	try{
		xmlhttp = new XMLHttpRequest();
	}catch(ee){
		try{
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e){
			try{
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}catch(E){
				xmlhttp = false;
			}
		}
	}

	document.getElementById('dropdownNewsletter').innerHTML="<table width=\"280\" height=\"125\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"texto\"><tr><td height=\"125\" align=\"center\"  style=\"font-size:10px;\">sending ...</td></tr></table>";

	//Abre a url
	xmlhttp.open("GET", "cadnewsletter.php?name="+name+"&email="+email,true);
	xmlhttp.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
	
	 xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4)
		{
			var texto=xmlhttp.responseText;
			document.getElementById('dropdownNewsletter').innerHTML="";
			document.getElementById('dropdownNewsletter').innerHTML=texto;
			texto="";
		}
	 }
	xmlhttp.send(null);
}

function eventSend(name,email,idEvent){
	try{
		xmlhttp = new XMLHttpRequest();
	}catch(ee){
		try{
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e){
			try{
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}catch(E){
				xmlhttp = false;
			}
		}
	}

	document.getElementById('sendfriend'+idEvent).innerHTML="<table width=\"280\" height=\"55\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"texto\"><tr><td height=\"55\" align=\"center\"  style=\"font-size:10px;\">sending email ...</td></tr></table>";

	//Abre a url
	xmlhttp.open("GET", "sendEvent.php?idEvent="+idEvent+"&uname="+name+"&femail="+email,true);
	xmlhttp.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
	
	 xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4)
		{
			var texto=xmlhttp.responseText;
			document.getElementById('sendfriend'+idEvent).innerHTML="";
			document.getElementById('sendfriend'+idEvent).innerHTML=texto;
			texto="";
		}
	 }
	xmlhttp.send(null);
}

function galleryPhotoSend(name,email,idEvent,photo){
	try{
		xmlhttp = new XMLHttpRequest();
	}catch(ee){
		try{
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e){
			try{
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}catch(E){
				xmlhttp = false;
			}
		}
	}

	document.getElementById('sendfriend').innerHTML="<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"384\" height=\"70\" valign=\"top\" background=\"images/panelEventSend.png\" style=\"background-repeat:no-repeat\"><table width=\"340\" height=\"55\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"texto\"><tr><td height=\"55\" align=\"center\"  style=\"font-size:10px;\">sending email ...</td></tr></table></td></tr></table>";

	//Abre a url
	xmlhttp.open("GET", "sendPhoto.php?idEvent="+idEvent+"&uname="+name+"&femail="+email+"&fphoto="+photo,true);
	xmlhttp.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
	
	 xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4)
		{
			var texto=xmlhttp.responseText;
			document.getElementById('sendfriend').innerHTML="";
			document.getElementById('sendfriend').innerHTML=texto;
			texto="";
		}
	 }
	xmlhttp.send(null);
}

function backInnerHtml(idLayer,idEvent){
	if(idLayer=='dropdownNewsletter'){
		htmlText = "<table width=\"280\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"texto\"><tr><td height=\"57\" valign=\"top\" style=\"font-size:10px;\">Join our mailing list today to receive the Santo Weekly Newsletter. Exclusive Santo Member offers and invitations. Always stay up-to-date on upcoming events and special deals on a dining experience at Santo.</td></tr><tr valign=\"top\"><td height=\"47\" align=\"center\"><table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"44\" height=\"20\"><img src=\"images/lblName.png\" width=\"35\" height=\"9\" /></td><td align=\"left\" colspan=\"2\"><input name=\"name\" type=\"text\" class=\"borda\" id=\"fieldname\" style=\"width:200px;\"></td></tr><tr><td width=\"44\"><img src=\"images/lblEmail.png\" width=\"34\" height=\"9\" /></td><td width=\"160\" align=\"left\"><input name=\"email\" type=\"text\" class=\"borda\" id=\"fieldemail\" style=\"width:160px;\"></td><td width=\"40\" align=\"right\"><input name=\"button\" type=\"button\" class=\"button\" id=\"button\" value=\"Send\" onclick=\"if((document.getElementById('fieldname').value!='') && (document.getElementById('fieldemail').value!='')){newsletterSend(document.getElementById('fieldname').value,document.getElementById('fieldemail').value);}\"></td></tr></table></td></tr><tr valign=\"bottom\"><td height=\"23\"><table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr valign=\"top\"><td width=\"35\" height=\"15\" align=\"left\">&nbsp;</td><td width=\"73\" height=\"15\" align=\"left\"><a href=\"javascript:layerClose('dropdownNewsletter');layerClose('dropdown');layerOpen('tab');\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('btNewsletter02','','images/btNewsletter02.png',1)\"><img src=\"images/btNewsletter02.png\" name=\"btNewsletter02\" width=\"58\" height=\"7\" border=\"0\" /></a></td><td width=\"36\" height=\"15\" align=\"right\"><a href=\"javascript:layerClose('dropdownNewsletter');layerOpen('dropdownLegal');\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('btLegal2','','images/btLegal02.png',1)\"><img src=\"images/btLegal01.png\" name=\"btLegal2\" width=\"29\" height=\"7\" border=\"0\" /></a></td></tr></table></td></tr></table>";
	}
	if(idLayer=='sendfriend'+idEvent){
		htmlText = "<table width=\"280\" border=\"0\" cellpadding=\"1\" cellspacing=\"0\" class=\"texto\"><tr><td></td><td align=\"left\"></td><td height=\"10\" align=\"left\" colspan=\"2\"></td></tr><tr><td align=\"right\"><img src=\"images/inputFriendsEmail.png\" width=\"77\" height=\"9\"></td><td align=\"left\">&nbsp;</td><td align=\"left\" colspan=\"2\"><input name=\"femail\" type=\"text\" class=\"borda\" id=\"femail\" style=\"width:191px;\"></td></tr><tr><td align=\"right\"><img src=\"images/inputYourName.png\" width=\"64\" height=\"9\"></td><td align=\"left\">&nbsp;</td><td align=\"left\"><input name=\"uname\" type=\"text\" class=\"borda\" id=\"uname\" style=\"width:149px;\"></td><td align=\"left\"><input name=\"button\" type=\"submit\" class=\"button\" id=\"button\" value=\"Send\" onclick=\"if(document.getElementById('uname').value!='' && document.getElementById('femail').value!=''){eventSend(document.getElementById('fieldname').value,document.getElementById('fieldemail').value,'');}\"></td></tr></table>";
	}
	if(idLayer=='sendfriend'){
		htmlText = "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"384\" height=\"70\" valign=\"top\" background=\"images/panelEventSend.png\" style=\"background-repeat:no-repeat\"><table border=\"0\" cellpadding=\"1\" cellspacing=\"0\" class=\"texto\"><tr><td width=\"25\"></td><td></td><td align=\"left\"></td><td height=\"10\" align=\"left\" colspan=\"2\"></td></tr><tr><td width=\"25\" align=\"right\">&nbsp;</td><td align=\"right\"><img src=\"images/inputFriendsEmail.png\" width=\"77\" height=\"9\"></td><td align=\"left\">&nbsp;</td><td align=\"left\" colspan=\"2\"><input name=\"fphoto\" type=\"hidden\" id=\"fphoto\" value=\"'.$bigPhoto.'\"><input name=\"femail\" type=\"text\" class=\"borda\" id=\"femail\" style=\"width:191px;\"></td></tr><tr><td width=\"25\" align=\"right\">&nbsp;</td><td align=\"right\"><img src=\"images/inputYourName.png\" width=\"64\" height=\"9\"></td><td align=\"left\">&nbsp;</td><td align=\"left\"><input name=\"uname\" type=\"text\" class=\"borda\" id=\"uname\" style=\"width:149px;\"></td><td align=\"left\"><input name=\"button\" type=\"button\" class=\"button\" id=\"button\" value=\"Send\" onclick=\"if(document.getElementById('uname').value!='' && document.getElementById('femail').value!=''){galleryPhotoSend(document.getElementById('uname').value,document.getElementById('femail').value,'"+idEvent+"');}\"></td></tr></table></td></tr></table>";
	}

	
	document.getElementById(idLayer).innerHTML = "";
	document.getElementById(idLayer).innerHTML = htmlText;
}


//MYSPACE function
function GetThis(T, C, U, L) {
	var targetUrl = 'http://www.myspace.com/Modules/PostTo/Pages/?' + 't=' + 	encodeURIComponent(T) + '&c=' + encodeURIComponent(C) + '&u=' + encodeURIComponent(U) + '&l=' + L; window.open(targetUrl);
}






    function goLastMonth(month,year) 
    { 
        if(month == 1) 
			{ 
			--year; 
			month = 13; 
			}        
		showCalendar(month-1,year);
    } 
    
    function goNextMonth(month,year) 
    { 
        if(month == 12) 
			{ 
			++year; 
			month = 0; 
			} 
		showCalendar(month+1,year); 
    } 
    
    function sendToForm(val,field,form) 
    { 
        eval("opener.document." + form + "." + field + ".value='" + val + "'"); 
        window.close(); 
    } 



function showContent(){
	document.getElementById('mainWindow').style.display="";
	document.getElementById('slideshow').style.display="";
}
function abre(pagina,nome,caracter)  {window.open (pagina,nome,caracter)}
<!-- ImageView Abre/Fecha -->
function layerClose(method){
	document.getElementById(method).style.display='none';
}

function layerOpen(method){
	document.getElementById(method).style.display='';
}



//AC_FL_RunContent = 0;
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

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 MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}



function applyPrototype(obj, el) {
	for (f in obj.prototype) {
		if (typeof(el[f]) == 'undefined') {
			el[f] = obj.prototype[f];
		}
	}
}

var $ = function(id) {
	return document.getElementById(id);
};

function $new(eltype, attributes, content) {
    var newElement = document.createElement(eltype);

    if (typeof(attributes != 'undefined')) { 
        if (typeof(attributes) == 'object') {
            for (name in attributes) {
               if (typeof(attributes[name]) == 'string')
                   newElement.setAttribute(name, attributes[name]);
            }

            if (typeof(content) != 'undefined') 
               newElement.innerHTML = content;
        } else if (typeof(attributes) != 'undefined') {
            newElement.innerHTML = attributes;
        }
    } 
	
	applyPrototype(newElement, DomElement);
    return newElement;
}

function DomElement() {};

DomElement.prototype.addEvent = function(evtType, func) {
   if (this.addEventListener) { //gecko
      this.addEventListener(evtType, func, true);
   } else if (this.attachEvent) { //ie
      this.attachEvent('on' + evtType, func);
   } else { //all the others
      this['on' + evtType] = func;
   }
}

DomElement.prototype.hasClass = function(className) {
   var pattern = new RegExp('(^|\\s)' + className + '(\\s|$)'); //use this regexp
   return pattern.test(this.className); //to check for the class
}
 
DomElement.prototype.addClass = function(className) {
   if (!this.hasClass(className)) { //if the class isn't there already
      this.className += (' ' + className); //append it to the end of the class list
   }
}
 
DomElement.prototype.removeClass = function(className) {
   var pattern = new RegExp('(^|\\s)' + className + '(\\s|$)'); //use this regexp
   this.className = this.className.replace(pattern, ' '); //to make a search and replace by a blank space
}

DomElement.prototype.getElementsByClass = function (className, tag) {
   var returnArray = [];
   tag = tag || '*'; //if tag is defined, use that for a more specific search, otherwise search in all tags
 
   var els = this.getElementsByTagName(tag); //get the elements
 
   for (var i = 0; i < els.length; i++) { //run the elements
      if (els[i].hasClass(className)) { //if a element implements that class
         returnArray.push(els[i]); //append it to the return array
      }
   }
 
   return returnArray;
}

DomElement.prototype.appendAfter = function(newElement) {
   //call insertBefore method on parent node to insert the new element before the element next to this
   this.parentNode.insertBefore(newElement, this.nextSibling);
}
 
DomElement.prototype.appendBefore = function(newElement) {
   //call insertBefore method on parent node to insert the new element before this
   this.parentNode.insertBefore(newElement, this);
}

DomElement.prototype.removeElement = function(oldElement) {
   var childElements = oldElement.getElementsByTagName('*');
 
   for (var i = 0; i < childElements.length; i++) { //purge all elements contained in the element to remove
      purge(childElements[i]);
   }
 
   purge(oldElement); //purge the element to remove
   this.removeChild(oldElement); //remove it
 
   //function that came from Douglas Crockford site, that removes all the event handlers from de elements
   function purge(d) {
      var a = d.attributes, i, l, n;
      if (a) {
          l = a.length;
          for (i = 0; i < l; i += 1) {
              n = a[i].name;
              if (typeof d[n] === 'function') {
                  d[n] = null;
              }
          }
      }
      a = d.childNodes;
      if (a) {
          l = a.length;
          for (i = 0; i < l; i += 1) {
              purge(d.childNodes[i]);
          }
      }
   }
}

DomElement.prototype.getAbsolutePosition = function() {
	var curleft = curtop = 0;
	var el = this;
	
	if (el.offsetParent) {
		curleft = el.offsetLeft
		curtop = el.offsetTop
		
		while (el = el.offsetParent) {
			curleft += el.offsetLeft
			curtop += el.offsetTop
		}
	}
	
	return {x: curleft, y: curtop};
}

DomElement.prototype.getRelativePosition = function(node) {
	var pos = this.getAbsolutePosition();
	var nodePos = node.getAbsolutePosition();
	
	return {x: pos.x - nodePos.x, y: pos.y - nodePos.y};
}

Array.prototype.map = function(f) {
  for (i = 0; i < this.length; i++)
    f(this[i]);
}

window.addEvent = DomElement.prototype.addEvent;
window.loadEvents = [];
window.addEvent('load', function() {
	for (var i = 0; i < this.loadEvents.length; i++) {
		this.loadEvents[i]();
	}
});


window.addOnLoad = function(fnFunction) {
	window.loadEvents.push(fnFunction);
}
 
addOnLoad(function() {
	document.getElementsByClass = DomElement.prototype.getElementsByClass;
	document.body.getElementsByClass = DomElement.prototype.getElementsByClass;
	
	var allNodes = document.getElementsByTagName('*');
	
	for (var i = 0; i < allNodes.length; i++) {
		applyPrototype(DomElement, allNodes[i]);
	}
});







function SlideShow(slideel, faddingSpeed, stopTime, stopOnMouseOver) {
	var slideshow = this;
	slideel.mouseover = false;
	
	if (stopOnMouseOver) {		
		slideel.addEvent('mouseover', function() {
			this.mouseover = true;
		});

		slideel.addEvent('mouseout', function() {
			this.mouseover = false;
			slideshow.next(true);
		});
	}
	
	var sttoped = false;
		
	this.next = function(triggeredByEvent) {
		if (!sttoped && triggeredByEvent)
			return;
			
		sttoped = true;
		
		if (slideel.mouseover)
			return;
		
		sttoped = false;
		
		this.current.fadeOut();
		this.current = this.current.nextSlide;
		this.current.fadeIn();
	}
	
	function createSlides() {
		var imgs = slideel.getElementsByTagName('img');
		var slides = [];
		
		for (var i = 0; i < imgs.length; i++) {		
			slides[i] = new SlideShowImage(imgs[i]);
		}
		
		for (var i = 0; i < slides.length; i++) {
			if (i == slides.length - 1)
				slides[i].nextSlide = slides[0];
			else
				slides[i].nextSlide = slides[i + 1];
		}
		
		slideshow.current = 	slides[0];
		slides[0].fadeIn();
		
		function SlideShowImage(img) {			
			var currOpacity = 0;
			applyCurrOpacity();
	
			this.fadeIn = function() {
				var i = 0;
				while (++i <= 50) {
					t1 = window.setTimeout(function() {
						addFade(0.10);
					}, i * faddingSpeed);
				}
				
				t2 = window.setTimeout(function() {
					slideshow.next();
				}, 50 * faddingSpeed + stopTime);
			}
	
			this.fadeOut = function() {
				var i = 0;
				while (++i <= 50) {
					t1 = window.setTimeout(function() {
						addFade(-0.10);
					}, i * faddingSpeed);
				}
			}
			
			function applyCurrOpacity() {
				if ((navigator.appVersion.indexOf("MSIE")!= -1) && !window.opera)
					img.style.filter = "alpha(opacity=" + (currOpacity * 100) + ")";
				else
					img.style.opacity = currOpacity;
			}
			
			function addFade(value) {
				currOpacity += value;				
				applyCurrOpacity();	
			}
		}
	}
	
	createSlides(slideel);
}

addOnLoad(function() {
	new SlideShow($('slideshow'), 50, 5000, true);
});


	function openAd(image, url){
	var obj=document.getElementById('addetails');

	var wnd_left = (screen.width - 415)/2;
	var wnd_top = (screen.height - 623)/2; wnd_top=wnd_top-100;

	document.getElementById('adimage').src=image;
	document.getElementById('adhref').href=url;

	obj.style.top=wnd_top+'px';
	obj.style.left=wnd_left+'px';
	obj.className='visible';

	}


//-->