function showTiles(){

	this.tileID = 1;
	this.currentID = this.tileID;
	this.nextID = 0;
	this.tilesArr = $$('#showTrailsPanel div');
	this.loading = false;

	
	this.init = function(){
		var t = this;
		if ($('tile-next')){
			$('tile-next').observe("click", function(ele){
				Event.stop(ele)
				if(!loading){
					currentID = tileID;
					if (tileID >=tilesArr.length){
						tileID = 1;
					}else{
						tileID++;
					}
					nextID = tileID;
					t.showImage(currentID, nextID);
				}
			});
			$('tile-prev').observe("click", function(ele){
				Event.stop(ele);
				if(!loading){
					currentID = tileID;
					if (tileID == 1){
						tileID = tilesArr.length;
					}else{
						tileID--;
					}
					nextID = tileID;
					t.showImage(currentID, nextID);
				}
			});
		}

	}
	this.init();

	this.next = function(){
	}
	this.prev = function(){
	}

	this.showImage = function(cid, nid){
		//alert(cid + ' :: ' + nid);
		//alert(tileID)
		//var t = this;
		loading = true
		new Effect.Fade(tilesArr[cid-1], { 
				duration : 0.1,
				from : .7,
				to : 0.0,
				queue: { position: 'front', scope: 'imageTile', limit: 2 } 
			}); 
		new Effect.Appear(tilesArr[nid-1], { 
				duration : 0.3,
				from : 0.3,
				to : 1,
				queue: { position: 'end', scope: 'imageTile', limit: 2 },
				afterFinish : function(){
					loading = false;
				}
			}); 
		//tilesArr.invoke("hide")[id-1].appear();
	}
}

Event.observe(window, "load", function(){
	if ($('showTrailsPanel')){
		showTiles();
	}
//alert($$('h3.exhitorPanel').length);
	$$('h3.exhitorPanel').each(function(ele){
		//alert(ele);
		ele.down('a').observe('click', function(ele2){
			Event.stop(ele2)
			var el = Event.element(ele2).up().next().toggle();
		})
		
	})
})

var Popup = {
  open: function(options)
  {
    this.options = {
      url: '#',
      width: 300,
      height: 300
    }
    Object.extend(this.options, options || {});
    window.open(this.options.url, '', 'width='+this.options.width+',height='+this.options.height);
  }
}
function addBookmark(title, url) {
        if (window.sidebar) { // firefox
              window.sidebar.addPanel(title, url,"");
        } else if( document.all ) { // MSIE
                window.external.AddFavorite( url, title);
        } else {
               alert("Sorry, your browser doesn't support this");
        }
}


menuLi = function() {
	var sfEls = document.getElementById("nav2010").getElementsByTagName("li");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" menuLiOver";
		}         
		sfEls[i].onmouseout=function() {  
			this.className=this.className.replace(new RegExp("menuLiOver\\b"), "");         
		}     
	} 
} 
//if (window.attachEvent) window.attachEvent("onload", menuLi);

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

addLoadEvent(menuLi)

function submitForm(name){
	var f;
	if (name)
		f=document.forms[name];
	else
		f=document.forms[0];

	if(f){
		if(submitForm.arguments.length>1)
			if(submitForm.arguments[1])
				f.method=submitForm.arguments[1];
		if(submitForm.arguments.length>2)
			if(submitForm.arguments[2])
				f.action=submitForm.arguments[2];
		if(f.onsubmit)
			f.onsubmit();
		f.submit();
	}
	else
		alert('Form not found.');
}
