	function $(id)
	{
		return document.getElementById(id);
	}
	function hide(id)
	{
		$(id).style.display = 'none';
	}
	function show(id)
	{
		$(id).style.display = 'block';
	}
	function isHidden(id)
	{
		if($(id).style.display == 'none')
			return true;
		else
			return false;
	}
	function V_switch(id)
	{
		if(isHidden(id))
			show(id);
		else
			hide(id);
	}
function facebook()
{
	show('facebook');
}		
function fbclose()
{
	hide('facebook');
}										
function processData(responseText, responseStatus)
 { 
	
	//document.getElementById('loadingbar').style.display ='none';
	if (responseStatus==200) // succes
	{
		if(responseText == 'error')
						alert('Error updating data!'+responseText);
		else
		{
			eval(responseText);
			if(formsubmitstatus )fsm_enable();
		}
	 }
	else if(responseStatus == 0)
	{
	
	}
	else 
	{ 
	   alert(responseStatus + ' -- Error Processing Request');
	}
  }
function ajaxObject(url) {
	  var that=this;      
	   this.updating = false;
		  this.abort = function() {
				that.AJAX.onreadystatechange = function () {}
			  that.updating=false;
			  that.AJAX.abort();
			  that.AJAX=null;
			
		  }
	  this.update = function(form,postMethod) { 
		if(that.updating) that.abort();
		 that.AJAX = null;                      
		 var passData = getFormValues(form,"validate");
		 
		 
				
		if (window.XMLHttpRequest) {              
		  that.AJAX=new XMLHttpRequest();              
		} else {                                  
		  that.AJAX=new ActiveXObject("Microsoft.XMLHTTP");
		}                                             
		if (that.AJAX==null) {                             
		  return false;                               
		} else {
		
			
			  that.AJAX.onreadystatechange = function() {  
				if (that.AJAX.readyState==4) {             
				  that.updating=false;                
				  that.callback(that.AJAX.responseText,that.AJAX.status);        
				  that.AJAX=null;                                         
				} 
				}
			                                                
		  that.updating = new Date();                              
		  if (/post/i.test(postMethod)) {
			var uri=urlCall+'?'+that.updating.getTime();
			that.AJAX.open("POST", uri, true);
			that.AJAX.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=UTF-8");
			that.AJAX.setRequestHeader("Content-Length", passData.length);
			that.AJAX.send(passData);
		  } else {
			var uri=urlCall+'?'+passData+'&timestamp='+(that.updating.getTime()); 
			that.AJAX.open("GET", uri, true);                             
			that.AJAX.send(null);                                         
		  }              
		  return true;                                             
		}                                                                           
	  }
	  var urlCall = url;        
	  this.callback = processData;
	  }
	  
	  var myRequest = new ajaxObject('get_album_details.php');		
function getFormValues(fobj,valFunc, url) 
			
			{ 
			
			   var str = ""; 
			
			   var valueArr = null; 
			
			   var val = ""; 
			
			   var cmd = ""; 
			
			   for(var i = 0;i < fobj.elements.length;i++) 
			
			   { 
			
				   switch(fobj.elements[i].type) 
			
				   { 
					case "checkbox":
							var myval = fobj.elements[i].checked;
							if(myval) 
								myval = 1;
							else
								myval = 0;								   
						   str += fobj.elements[i].name + 
			
							"=" + myval + "&"; 
			
							   break; 
					  case "textarea":
						 str += fobj.elements[i].name + 
			
								 "=" + escape(fobj.elements[i].value) + "&"; 
								 break; 
				   
						case "password":
							str += fobj.elements[i].name + 
			
								 "=" + escape(fobj.elements[i].value) + "&"; 

								  break; 
						case "hidden":
							str += fobj.elements[i].name + 
		
							 "=" + (fobj.elements[i].value) + "&"; 
							  break; 
					   case "text": 
			
									
							str += fobj.elements[i].name + 
			
							 "=" + escape(fobj.elements[i].value) + "&"; 
			
							 break; 
			
					   case "select-one": 
			
							str += fobj.elements[i].name + 
			
							"=" + fobj.elements[i].options[fobj.elements[i].selectedIndex].value + "&"; 
			
							break; 
			
				   } 
			
			   } 
									
						
							 
							 
			   str = str.substr(0,(str.length - 1)); 
			
			   return str; 
			
			}
			
			
/* mouseevents */

var name; var current_top; var height ; var new_top; 
var busy  = new Array(false, false, false, false, false);
var t = new Array(null, null, null, null, null);
var h = new Array(0 ,0,0,0,0);
var temp_t = null;
// busy 0 not busy : 1 busy going up; 2 : busy going down
var para = null;
var last_id = -1;

function mo_index(id)
{
	if( id != last_id)
	{
		if(para != null)
		{
			para.stop();	
		}
		para = null;
		para = new Parallel();
	}
	else
		return;
	for( var i = 1; i <= 5; i++)
	{
		if(i == id) continue;
		
		if( busy[i-1] == 2 ) {  continue; }

		busy[i-1] = 2;
		
		name = "layer"+i;
		 current_top = parseInt($( name ).style.top);
		 height =  $( name ).offsetHeight;
		 new_top = h[i-1] - 39 ;
		 
		 time = 0.75;
		 
		 // time correction
		 var distance = new_top-current_top;
		 time = time*distance/100;
		 
		t[i] = new Tween($( name ).style,'top',Tween.regularEaseOut,  current_top ,new_top, time ,'px');
		//t[i].onMotionFinished = function(){ busy[ eval( i-1)]  = false; alert(eval( i-1)); };
		var temp = i;
		setTimeout( 'busy['+temp+'-1] = 0;', time*100 );
		para.addChild(t[i]);
		
			
	}
	
	// if busy and wrong side, go for it anyway
	if( busy[id-1] == 1 ) {  return; }
	
	busy[id-1] = 1;
	
	 name = "layer"+id;
	 current_top = parseInt($( name ).style.top);
	
	 height =  $( name ).offsetHeight;
	 new_top = h[id-1] - height ;
	
	t[id-1] = null;
	temp_t = new Tween($( name ).style,'top',Tween.regularEaseOut,  current_top ,new_top,0.75,'px');
	temp_t.onMotionFinished = function(){ busy[id-1]  = 0; };
	para.addChild( temp_t);
	
	para.start();
	last_id = id;	
}
function reservation()
{
	myRequest.update( $('rform'), 'POST' ) ;
}
function gotoUrl(url)
{
	
	window.location=  "http://www.inticura.be/"+url;	
}
function gt()
{
	window.location = "http://www.inticura.be/";
}	

/* mouseevents */
/// MYRGB  FUNCTIONS ///
function addListener(element, type, expression)
{
if(window.addEventListener)	
{
 // Standard
 element.addEventListener(type, expression, false);
 return true;
 }
  else if(window.attachEvent)
   { // IE	
	element.attachEvent('on' + type, expression);	
	return true;	
}
 else return false;
}
function addClassName(objElement, strClass, blnMayAlreadyExist){
   if ( objElement.className ){
      var arrList = objElement.className.split(' ');
      if ( blnMayAlreadyExist ){
         var strClassUpper = strClass.toUpperCase();
         for ( var i = 0; i < arrList.length; i++ ){
            if ( arrList[i].toUpperCase() == strClassUpper ){
               arrList.splice(i, 1);
               i--;
             }
           }
      }
      arrList[arrList.length] = strClass;
      objElement.className = arrList.join(' ');
   }
   else{  
      objElement.className = strClass;
      }
}

//http://www.bigbold.com/snippets/posts/show/2630
function removeClassName(objElement, strClass){
   if ( objElement.className ){
      var arrList = objElement.className.split(' ');
      var strClassUpper = strClass.toUpperCase();
      for ( var i = 0; i < arrList.length; i++ ){
         if ( arrList[i].toUpperCase() == strClassUpper ){
            arrList.splice(i, 1);
            i--;
         }
      }
      objElement.className = arrList.join(' ');
   }
}

function mover(id)
{
	mout_action();
	//$('fader').style.top = '0px';
	//var opacityTween = new OpacityTween($('fader'),Tween.regularEaseIn,0,70,0.0);
	//opacityTween.start();
	//show('fader');
	
	//var ctween = new ColorTween($('navmenu_1').style,'color', Tween.regularEaseIn,"999999","EB3A25",0.0);
	//ctween.start();
	addClassName( $('navmenu_'+id), 'selected');
	
	show('submenu'+id);
	
	
}
function standard()
{
	mout_action();
}
function mout_action()
{
	//$('fader').style.top = '-19px';
	
	//var opacityTween = new OpacityTween($('fader'),Tween.regularEaseIn,70,0,0.0);
	//opacityTween.start();
	//hide('fader');
	
	//var ctween = new ColorTween($('navmenu_1').style,'color',Tween.regularEaseIn,"EB3A25","999999",0.0);
	//ctween.start();
	for(var i = 1; i<=3;i++)
		removeClassName( $('navmenu_'+i), 'selected');
	
	for(var i = 1; i<=3;i++)
		hide('submenu'+i);
		
		
}

addListener(document, "keyup", function (e) { if (!e) { e = event; } if (e.keyCode == 27) { document.location.href = "http://www.myrgb.be"; } } );
/// MYRGB  FUNCTIONS ///
