  var Hush = new Class({

  	/**/

  	_session_id: null,

  	_session_name: null,

  	

  	/* background images array */

  	_bg_basepath: null,

  	_bg: new Array(),

  	

  	/* perodical image switching */

  	_p_last_action: false, //was there an action last cycle

  	_p_current: 1, //whats the current item

  	_p_interval: 3000,

  	

  	/* Internal variables */

	_base_url:null,

  	_column_list:null,

	_column_widths: new Array(), //section column widths

	_active_column:-1, //the current column

	

	/* Element collections */

	_ajax_columns: null, 

	_columns: null,

	_descs: null,

	_fades: null,

	_prink_menu: null,

	_whatson_links: null,

	_yourvisit_links: null,

	_doc_article_links: null,

	_main_links: null,

	_sec_links: null,

	_search:null,

	_search_links: null,

	_sub_links: null,

	_links: null,

	

	_panel_pane0:null,

	_panel_pane2:null,

	_panel_pane4:null,

	_doc_modules:null,



	

	/* Fx Definitions*/

	_fx_ajax_fade:null,

	_fx_column_slide:null,

	_fx_column_fade:null,

	_fx_link_hover:null,

	_fx_link_hide:null,

	_fx_section_desc:null,

	_fx_content_bg:null,

	_fx_loaded_content:null,

	_fx_loaded_content_p:null,

	_fx_mb:null,

	

	/* content height holders */

	_new_article_height:null,

	_old_article_height:null,

	

	/* fx command sets */

	_link_hover_commands: {},

	_columns_commands: {},

	_col_internal_commands: {},

	_doc_modules_commands: {},

	_panel_prink_commands: {},

	_doc_footer_commands: {},

	_section_hover_commands: {},

	_content_p_commands:{},

	

	/* ajax vars*/ 	

	_tmp: null,

	_internal: false,



	/*scrolling*/

	_scroll: null,

  	/**

  	* initialize the class

  	**/

  	initialize: function(base,sid,sn){

  		this._scroll = new Fx.Scroll(window, {

			wait: false,

			duration: 500,

			

			transition: Fx.Transitions.Quad.easeInOut

		});

  		//new SmoothScroll();

  		this._session_id   = sid;

  		this._session_name = sn;

  		////////////console.log("hush class initialized");

  		//alert("hush class initialized");

  		//set the base url

  		this._base_url= base;  

		//////////console.log(this._base_url);

  		

  		//assign column names

  		this._column_list = new Array('internal','about','whatson','dining','bedroom'); 

  		

  		

  		$('doc-container').setStyle("background-position","-9999px bottom");

  		//build  open widths array

  		

  		this._column_widths.push(Array(0,242,242,242,242)); //default

		this._column_widths.push(Array(457,100,82,85,113,149)); //internal

		this._column_widths.push(Array(0,557,82,85,113,149));   //kitchen

		this._column_widths.push(Array(0,100,540,84,113,149));  //living

		this._column_widths.push(Array(0,100,82,545,111,149));  //dining

		this._column_widths.push(Array(0,108,82,93,554,149));   //bedroom

		

		

		//define element collections

		

		this._doc_modules = $$('#doc-modules'); 

		this._ajax_columns = $$('.ajax-col'); 

		this._columns      = $$('.content-col')

		this._panel_menu   = $$('.mainlevel-panel');

		this._panel_prink   = $$('#prink_panels');

		

		this._col_internal   = $$('#content-col-internal');

		this._doc_footer   = $$('#doc-footer');

		this._doc_footer_links   = $$('#doc-footer a');

		

		this._prink_menu   = $$('.prink_menu');

		this._descs        = $$('.section-description');

		this._fades        = $$('.content-col-fade');

		this._links        = $$('.section-link');

		this._whatson_links  = $$('#section-description-whatson a');

		this._sub_nav_links  = $$('#section-cat-menu a');

		

		this._yourvisit_links  = $$('#section-description-yourvisit a');

		this._panel_links  = $$('.panelmenu a');

		

		this._main_menu   = $$('.mainlevel-main');

		this._main_links   = $$('#primary-navigation a');

		this._sec_links   = $$('#secondary-navigation a');

		this._search_links   = $$('#searchresults a');

		

		this._search   = $$('#mod_search_searchword');

  		this._sub_links    = $$('.sub-menu a');

		//define element animations

		this._fx_ajax_fade      = new Fx.Elements(this._ajax_columns, {wait: false, duration: 1300, transition: Fx.Transitions.linear});

		this._fx_column_slide   = new Fx.Elements(this._columns, {wait: false, duration: 300,transition: Fx.Transitions.linear});

		this._fx_column_fade    = new Fx.Elements(this._fades, {wait: false, duration: 300, transition: Fx.Transitions.linear});

		

		this._fx_doc_modules     = new Fx.Elements(this._doc_modules, {wait: false, duration: 100, transition: Fx.Transitions.linear})

		this._fx_column_hide     = new Fx.Elements(this._columns, {wait: false, duration: 100, transition: Fx.Transitions.linear});

		this._fx_col_internal_hide   = new Fx.Elements(this._col_internal, {wait: false, duration: 100, transition: Fx.Transitions.linear});

		this._fx_panel_prink    = new Fx.Elements(this._panel_prink, {wait: false, duration: 100, transition: Fx.Transitions.linear});

		this._fx_doc_footer    = new Fx.Elements(this._doc_footer, {wait: false, duration: 100, transition: Fx.Transitions.linear});

		

		this._fx_link_hover     = new Fx.Elements(this._links, {wait: false, duration: 100, transition: Fx.Transitions.linear});

		this._fx_link_hide      = new Fx.Elements(this._links, {wait: false, duration: 300, transition: Fx.Transitions.linear});

		this._fx_section_desc   = new Fx.Elements(this._descs, {wait: false, duration: 100, transition: Fx.Transitions.linear});

		this._fx_content_bg     = new Fx.Morph('content-background', {fps: 60,wait: false, duration:1300,transition: Fx.Transitions.linear});

		this._fx_white_bg       = new Fx.Morph('content-background-white', {fps: 60,wait: false, duration:1300,transition: Fx.Transitions.linear});

		

		//assign actions

		this.assignSectionLinkActions();

		

		//start slide show monitor

		this.bgSlideShow.periodical(this._p_interval,this);



		//this.showInternal();

		this.checkEnter();

		this.checkSearch();

		this.attachLinkClicks();

		

		//var ajax_urlx = this.geturl("/#\/");

		//alert(ajax_urlx);

		this.viewurl(ajax_urlx);

		

		this._main_links[0].setStyle("text-decoration","underline");

		this._main_links[0].setStyle("color","#FFFFFF");

		

		

		/*SHOW OR HIDE THE MEMBOX*/



  	},

	

	clearLinks: function () {

		// Clear Main Links

		for( t = 0; t < 13; t++ ) {

			this._main_menu[t].setStyle("text-decoration","");

			this._main_menu[t].setStyle("color","#A1A6AA");

		}

		

		this._whatson_links[0].setStyle("text-decoration","");
		this._whatson_links[0].setStyle("color","#FFFFFF");
		
		this._whatson_links[1].setStyle("text-decoration","");
		this._whatson_links[1].setStyle("color","#FFFFFF");



		for( t = 0; t < 4; t++ ) {

				this._yourvisit_links[t].setStyle("text-decoration","");

				this._yourvisit_links[t].setStyle("color","#FFFFFF");

		}

		

		

		return;

	},

	

	checkContact: function () {

	var errorMSG = '';

	var iserror=0;

	

	



   if (document.emailForm.email.value == "") {

		errorMSG += "Please enter your email address\n";

		iserror=1;

	}

	

	var email_Format = /^\w(\.?[\w-])*@\w(\.?[\w-])*\.[a-zA-Z]{2,6}(\.[a-zA-Z]{2})?$/i;

	if (document.emailForm.email.value.search(email_Format)== -1)

	{

		errorMSG += "Please specify email in the format: email@emailaddress.com\n";

		iserror=1;

	}

	if (iserror==1) {

		

		alert(errorMSG);

		return false;

	} else {

		alert("Thank you");

		return true;

	}



	

	},
	
	
	
	
	sendnewsletter: function () {
	var errorMSG = '';

	var iserror=0;
	var name = document.getElementById("contact_name").value;
	if (name.value == "") {
		errorMSG += "Please enter your Name\n";
		iserror=1;
	}
	var email = document.getElementById("contact_email").value;
	if (email.value == "") {
		errorMSG += "Please enter your email address\n";
		iserror=1;
	}
	var email_Format = /^\w(\.?[\w-])*@\w(\.?[\w-])*\.[a-zA-Z]{2,6}(\.[a-zA-Z]{2})?$/i;
	if (email.search(email_Format)== -1) {
		errorMSG += "Please specify email in the format: email@emailaddress.com\n";
		iserror=1;
	}
	
	
	
	var address = document.getElementById("contact_text").value;
	if (address.value == "") {
		errorMSG += "Please enter your Address\n";
		iserror=1;
	}
	var phone = document.getElementById("phone").value;
	if (phone.value == "") {
		errorMSG += "Please enter your Phone Number\n";
		iserror=1;
	}
	
	if (document.getElementById("privacy").value === false) {
		errorMSG += "Please accept the privacy policy\n";
		iserror=1;
	}
	
	var stayinformed = document.getElementById('informed').checked;
	if (stayinformed === true) stayinformed = 1;
	else stayinformed = 0;
	
	if (iserror==1) {
		alert(errorMSG);
	} else {
		var params = "name="+name+"&email="+email+"&address="+address+"&phone="+phone+"&stayinformed="+stayinformed;
		xmlHttp2=CreateXMLHttpRequest();
		
		xmlHttp2.open("POST","newsletter.php",true);
		xmlHttp2.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		xmlHttp2.setRequestHeader("Content-length", params.length);
		xmlHttp2.setRequestHeader("Connection", "close")
		xmlHttp2.onreadystatechange = function() {
			if (xmlHttp2.readyState == 4) {
				alert("Thank you");
			}
		}
		xmlHttp2.send(params);
	}

	},

	

	viewurl: function (ajax_url) {

		

		ajax_url = ajax_url.replace(this._base_url+"#",'');

		//#/main/events/about

		var strLen = ajax_url.length;

		var start_point = ajax_url.charAt(0);

		

		if (start_point == '/') ajax_url = ajax_url.slice(1,strLen); 

		

		

		

		var temp = new Array();

		temp = ajax_url.split('/');

		var tx = temp.length;



		if (temp[0] == 'about' || temp[0] == 'whatson' || temp[0] == 'yourvisit') var area = 'ajax';

		else var area = 'main';

		

		

		

		if (temp[0] == 'about') var active = 1;

		if (temp[0] == 'whatson') var active = 2;

		if (temp[0] == 'yourvisit') var active = 3;

		if (temp[0] == 'main') var active = 4;

		

		ajax_url = '';

		for( i = 1; i < tx; i++ ) {

			ajax_url += area+temp[i]+'/';

		}

		

		if (temp[0] == 'about') ajax_url = area+temp[0]+'/';

			

			

		

		strLen = ajax_url.length;

		var end_point = ajax_url.slice(strLen-1,strLen); 

		

		if (end_point == '/') ajax_url = ajax_url.slice(0,strLen-1); 

		

		//alert(ajax_url);

		

		ajax_url = this._base_url + ajax_url;



		if (active == 1 || active == 2 || active == 3) {



			this.setSectionPane(active);

			this.ajaxLinkFollow(ajax_url,active);

			

		} else if(active == 4){

			//alert(ajax_url);

			if (temp[1] == 'ajaxsearch') {

				ajax_url = temp[1]+"/"+temp[2];

			}

			this.ajaxPanelFollow(ajax_url,6,'main');

		}

		//if (ur == 'main') this.loadAjaxContent(ajax_url,'','main');

		//else if (ur == 'ajax') this.loadContent(ajax_url,active);



	

	},

  	

	geturl: function (key,url){

	if(arguments.length < 2) url =location.href;

	if(arguments.length > 0 && key != ""){

	//if(key == "#"){

	var regex = new RegExp("[#]([^$]*)");

	//} 

	var results = regex.exec(url);

	return (results == null )? "" : results[1];

	} else {

	url = url.split("?");

	var results = {};

	if(url.length > 1){

	url = url[1].split("#");

	if(url.length > 1) results["hash"] = url[1];

	url[0].split("&").each(function(item,index){

	item = item.split("=");

	results[item[0]] = item[1];

	});

	}

		return results;

	}

	},

	

  	/**

  	* SHOW INTERNAL

  	**/  	

  	showInternal: function(){

  		var pane = 0;

  		//////////console.log("setting up pane: " + pane);

  		//clear previous pane

  		this._new_article_height = null;

  		this._old_article_height = null;

  		

  		//reset animation commands

  		this._column_commands = {};

		this._link_commands  = {};

		this._ajax_commands  = {};

		this._fade_commands  = {};

		

		//from and to widths for the active column

		var w_from = this._columns[pane].getStyle("width").toInt();

		var w_to   = this._column_widths[pane+1][pane];

		//set params for the active pane

		this._column_commands[pane] = {width: [w_from, w_to]}

		

		//set params for the active panes link and fade

		this._link_commands[pane]  = {opacity: 0};

		this._fade_commands[pane]  = {opacity: [0,0.8], width: [w_from, w_to]};

		

		//show and color the fades

		this._fades.setStyle('display', 'block');

		this._fades.setStyle('background-color', '#000');

		

		//hide elements

		this._descs.setStyle('display','none');

		this._links[pane].setStyle('position','absolute');

		//hide all loading bars

		$$('.loading-flash').setStyle('display','none');

		//show the loading frame for this pane

		this._columns[pane].getElements('.loading-flash').setStyle('display','block');

		

		var t_el = this._columns[pane].getElements('.loading-flash')

		t_el.setStyle('width', w_to);

		//hide all ajax columns

		this._ajax_columns.setStyle('display','none');

		//set animation for non active panes

		this._links.each(function(other,j) {

			if(pane != j) {

				//effects for the unselected item

				var w = other.getStyle("width").toInt();

				if(w != this._column_widths[pane+1][j]) this._column_commands[j] = {width: [w, this._column_widths[pane+1][j]]};

				this._link_commands[j]  = {opacity: 1};

				this._fade_commands[j]  = {opacity: 0.5,width:[w,this._column_widths[pane+1][j]]};

				this._ajax_commands[j]  = {};

				this._links[j].setStyle('position','relative');

			}

			

		},this);

		

		//begin the animation

		//////////console.log(this._column_commands);

		this._fx_column_slide.start(this._column_commands);

		this._fx_link_hide.start(this._link_commands);

		this._fx_column_fade.start(this._fade_commands);

		

		

		

  	},

  	

  	/**

  	* assign actions to links

  	*/

  	assignSectionLinkActions: function(){

  		

  		this._links.each(function(link,i){

  			

  			//assign mouseout function to each link

  			//link.addEvent('mouseout', this.sectionLinksReset.bind(this));

  			//assign mouseover function

  			link.addEvent("mouseover", this.sectionLinkOver.bind(this).pass(i));

  			//assign click function

  			//link.addEvent("click", this.sectionLinkClick.pass(i,event)}.bind(this));

  			link.addEvent("click", function(event) { 

  					//stop the regular link activating

  					new Event(event).stop();	



					if (i == 1){

						this.sectionLinkClick(i); 

					} else if (i == 4) {

							this.normalLinkClick(link); 

					} else {

						// do nothing

					}

  					//execute the actions for a link click.				

  					

  				}.bind(this)

  			);

  			

  			

	  		

  		},this);

  	},

  	

  	/**

  	* Load content into a section

  	**/

  	loadContent: function(url,active){



		// erase the styles of the other windows so that they wil animate into view

		//otherEl.erase('style'); 

		

		var req = new Request({

					method: 'get',

					url: url,

					

					onSuccess: function(e){

						this.setURL(active,url);

						this.showLoadedContent(active, e);

					}.bind(this)

			

				});

		

		req.send();

		

		

		var ajax_url = url.replace(this._base_url,'');

		var strLen = ajax_url.length;

		var end_point = ajax_url.slice(strLen-1,strLen); 

		

		if (end_point == '/') ajax_url = ajax_url.slice(0,strLen-1); 





		var temp = new Array();

		temp = ajax_url.split('/');

		var tx = temp.length - 1;

		ajax_url = temp[tx].replace('ajax','modules');

		

		this.loadAjaxContent(ajax_url,'','Modules');



  		

  	},

	

	loadAjaxContent: function(url,active,type){

		

		this.showPanel();

		var req = new Request({

					method: 'get',

					url: url,

					onSuccess: function(e){

						

						if (type == 'panel')this.showLoadedPanelContent(active, e);

						else if (type == 'main') {

						this.setURL(4,url);

						this.showLoadedMainContent(e); // Shows the main content



						}	else if (type == 'Modules') { 

							this.showModules();

							this.showLoadedModulesContent(e);

						}

						

					}.bind(this),

					

					onFailure: function(){

						if (type == 'Modules') {

							this.resetModules();

							

						}

					}.bind(this)

					

			

				});

		

		req.send();

  	},

	

  	

  	setRemove: function(d){

  		

  		var rls = $$('.ajax-col .mb_remove_link');

  		rls.each(function(f,n){

  			var x = Cookie.get("membox");

  			f.removeEvents();

  			f.addEvent("click", function(e){

  					new Event(e).stop();

  					var p = f.getParent();

  					p.remove();

  			});

  		});

  	},

  	

  	 	

  	removefromquote: function(){

  	},

  	

  	showExtendedLogo: function(){

  		

  		//array of positions

  		var posis = new Array(0,490,600,700,780,880,230);

  

  		//get the current col

  		var x = posis[this._active_column+1];

  		var name = this.getCurrentContentName();

  		////console.log("MOVIGN "+ name + " TO: " + x);

  		//get the height of the current col

		var nh = $(name).getStyle("height").toInt();

  		//calculate the min width

  		////console.log(nh);

  		

  		//if the content is longer, show.

  		if(nh > 1000){

  			//set the x from array

  			//set y position ( element x + height - logo_height

  			$('doc-container').setStyle("background-position",x + "px bottom");

  		//$('doc-container').setStyle("display","");

  		}else{

  			$('doc-container').setStyle("background-position","-9999px bottom");

  		}

  		

  	},

  	

  	getCurrentContentName: function(){

  		return "ajax-col-" +this._column_list[this._active_column];

  	},

  	

  	fadeInContent: function(){

  		var name = this.getCurrentContentName();

  		this._fx_loaded_content = new Fx.Morph(name, 'opacity', {

  			duration:500

  			

  		});

  		this._fx_loaded_content.addEvent("onStart",function(){

  				$$('.loading-flash').setStyle('display','none');

  		},this).start.delay(200,this._fx_loaded_content,[0,1]);

  		$$('.loading-flash').setStyle('display','none');

  	},

  	

  	fadeOutContent: function(){

  		var name = this.getCurrentContentName();

  		this._fx_loaded_content = new Fx.Morph(name, 'opacity', {

  			duration:500

  			

  		});

  		this._fx_loaded_content.addEvent("onComplete",function(){

  			$$('.loading-flash').each(function(el,i){

  					////console.log(i +" == " +this._active_column);

  					if(i == this._active_column){

  						el.setStyle('display','block');

  					}else{

  						el.setStyle('display','none');

  					}

  				}.bind(this));

  		}.bind(this)).start.delay(0,this._fx_loaded_content,[1,0]);

  	},

  	/**

  	* show loaded content

  	**/

	setURL: function(active,url) {



	    var section = 'main';

		if (active == 1) section = 'about/';

		if (active == 2) section = 'whatson/';

		if (active == 3) section = 'yourvisit/';

		if (active == 4) section = 'main/';

		var ajax_url = url.replace(this._base_url,'');

	

		if (active == 1 ||active == 2 ||active == 3) ajax_url = ajax_url.replace(/ajax/gi,'');

		else {

			ajax_url = ajax_url.replace(/main/gi,'');	

			ajax_url = ajax_url.replace('main','');

		}

		

		if (ajax_url == section) {
			document.title = "Prinknash Bird Park | "+section;
			ajax_url = this._base_url + "#/"+section;
		
		} else {
			document.title = "Prinknash Bird Park | "+ajax_url;
			ajax_url = this._base_url + "#/"+section+ajax_url;
			
		}

		//alert(ajax_url);


		
		window.location.assign(ajax_url);



		return;

	},

	

	

	

  	showLoadedContent: function(active,new_content){

		

		var exez;

		for( i = 0; i < 3; i++ ) {

			if (i != active) {

			elez = this._columns[i].getElement('.ajax-col');

			elez.setStyle("visibility","hidden");

			elez.setStyle('display','none');

			elez.setStyle('height','0px');

			}

		}	

		

		var l = 0;

		for( v = 0; v < 6; v++ ) {

			if (this._panel_menu[v].getStyle('text-decoration') == 'underline') l++;

		}

		if (l<1) this.resetsiteBG();

		

		

		var ele = this._columns[active].getElement('.ajax-col');

		//////////console.log("yes");

		this._prink_menu.setStyle('top', '-234px');

		this.resetLoadedMainContent();

		this.resetLoadedContent();

		this.resetSubMenu();

		

		

		// detect IE7 only? Try in IE8

		//var ie7 = (document.all && !window.opera && window.XMLHttpRequest) ? true : false;

		ele.setStyle("position","relative");

		if (active == 3) {

			ele.setStyle('top','398px');

			ele.setStyle('left','-244px');

			ele.setStyle("position","absolute");

		} else if (active == 1) {

			if (ie7 == true) ele.setStyle('top','280px');

			else ele.setStyle('top','290px');

		} else if (active == 2) {

			if (ie7 == true) ele.setStyle('top','394px');

			else ele.setStyle('top','394px');
			
			ele.setStyle("position","absolute");

		} else {

			ele.setStyle('top','290px');

		}

		

		ele.setStyle("visibility","visible");

		ele.setStyle('display','block');

		ele.setStyle('width','486px');

		ele.setStyle('opacity','1');

		ele.set('html', new_content);



		var h_from = ele.getStyle('height').toInt();

		var hx = 0;

		if (document.getElementById("doc-page") != null)

		{

			//var hx = document.getElementById("doc-page").getStyle('height').toInt();

			hx = document.getElementById("doc-page").offsetHeight

		}

		//var  h_to = eleg_result / 2.9;

		var  h_from = hx;

		



		if (h_from > 365) {

			var foot_top = h_from - 440;

			var	v_to = h_from - 360;

			this._panel_prink_commands[0]  = {top:v_to};

			

			var l = 0;

			for( v = 0; v < 6; v++ ) {

				if (this._panel_menu[v].getStyle('text-decoration') == 'underline') l++;

			}

			if (l<1) this.siteBG();	



		} else {

			var foot_top = -55;

			var	v_to = h_from;

			this._panel_prink_commands[0]  = {top:0};



		}

		

		

		this._fx_panel_prink.start(this._panel_prink_commands);

		ele.setStyle('height',h_from+'px');

		

		var myVerticalSlide = new Fx.Slide('doc-article').hide();

		myVerticalSlide.slideIn();





		// Footer



		if (foot_top < 1) foot_top = -55;

		this._doc_footer_commands[0]  = {top:foot_top};

		this._fx_doc_footer.start(this._doc_footer_commands);

		// !Footer

		

		this._subsubnav   = $$('.primary-sub-menu li a');

		this._subsubnav.each(function(link){

				link.addEvent("click", function(event) { 

						//////////console.log("REST Link Clicker");

						//stop the regular link activating

						new Event(event).stop();			

						//execute the actions for a link click.				

						this.ajaxLinkClick(link);



						

					}.bind(this)

				);

		}.bind(this));



  	},

	

	showLoadedModulesContent: function(new_content){

		var ele = $$('#doc-modules');

		ele.set('html', new_content);

	},



	

	showLoadedMainContent: function(new_content){





	//	this.resetMenu();

		this.resetLoadedMainContent();

		this.resetLoadedContent();

		this.resetSubMenu();

		

		for( v = 1; v < 5; v++ ) {

				if (v == 1) {

					$$('#section-link-about').setStyle("background-image","url("+this._base_url+"public/images/section_images/1.png)");	

					this._section_hover_commands[v]  = {opacity: 0, top:372};

					//this._link_hover_commands[v]     = {top:372};

				} else if (v == 2) {

					$$('#section-link-whatson').setStyle("background-image","url("+this._base_url+"public/images/section_images/2.png)");	

					this._section_hover_commands[2]  = {opacity: 0, top:372};

					//this._link_hover_commands[v]     = {top:372};

				} else if (v == 3) {

					$$('#section-link-yourvisit').setStyle("background-image","url("+this._base_url+"public/images/section_images/3.png)");	

					this._section_hover_commands[3]  = {opacity: 0, top:372, visiblity:"hidden",display:"none"};

					//this._link_hover_commands[v]     = {top:310, "padding-bottom":78};

					

				} else if (v == 4) {

					$$('#section-link-buytickets').setStyle("background-image","url("+this._base_url+"public/images/section_images/4.png)");

					this._section_hover_commands[4]  = {opacity: 0, top:372};

					//this._link_hover_commands[v]     = {top:352};

				}  else {

					this._section_hover_commands[v]  = {opacity: 0, top:372};

				}

				this._link_hover_commands[v]  = {top:372};	

				

		}

	this._fx_section_desc.start(this._section_hover_commands);

	this._fx_link_hover.start(this._link_hover_commands);

		

		

		var l = 0;

		for( v = 0; v < 6; v++ ) {

			if (this._panel_menu[v].getStyle('text-decoration') == 'underline') l++;

		}

		if (l<1) this.resetsiteBG();

	

		var exez;

		for( i = 1; i < 3; i++ ) {

			elez = this._columns[i].getElement('.ajax-col');

			elez.setStyle("visibility","hidden");

			elez.setStyle('display','none');

			elez.setStyle('height','0px');

		}	



		var ele = this._columns[0].getElement('.ajax-col');

		ele.set('html', new_content);



		ele.setStyle('top','0');

		ele.setStyle("visibility","visible");

		ele.setStyle('display','block');

		ele.setStyle('width','486px');

		ele.setStyle('opacity','1');

		

		var eleg = $('ajax-col-internal').innerHTML;

		var eleg_result = eleg.search("doc-article-footer");

		

		var hx = 0;

		if (document.getElementById("doc-page") != null)

		{

			//var hx = document.getElementById('doc-page').getStyle('height').toInt();

			hx = document.getElementById("doc-page").offsetHeight

		}

		



		//var  h_to = eleg_result / 2.9;

		var  h_to = hx;

		//alert(hx+"-"+h_to);











		if (document.getElementById('sendContact') != null) {

				if (h_to > 600) {

			h_to = h_to;

			var p_top = h_to - 600;// Panel



			var m_top = h_to - 508;// Menu

			var f_top = (h_to - 711) - 130;// Footer

			var ext_top = h_to +44;// sideparts

			

			var elex = $$('#prink_menu');

			elex.setStyle('top',m_top+'px');

			

			var elex = $$('#ext_left');

			elex.setStyle('top',ext_top+'px');

	

				

	

			} else {

				h_to = 446 + 109;

				var p_top = 0;

				var f_top = -240;// Footer

				

				var ele = $$('#prink_menu');

				ele.setStyle('top','90px');

		

				var elex = $$('#ext_left');

				elex.setStyle('top','554px')

				

			}

			} else if (document.getElementById('search_results') != null) {

				

					//h_to = h_to / 2;

					//alert(h_to);

					if (h_to > 400) {

						h_to = h_to;

						var p_top = h_to - 496;// Panel

			

						var m_top = h_to - 400;// Menu

						var f_top = (h_to - 315) - 240;// Footer

						var ext_top = h_to +64;// sideparts

						

						var elex = $$('#prink_menu');

						elex.setStyle('top',m_top+'px');

						

						var elex = $$('#ext_left');

						elex.setStyle('top',ext_top+'px');

						

						var l = 0;

						for( v = 0; v < 6; v++ ) {

							if (this._panel_menu[v].getStyle('text-decoration') == 'underline') l++;

						}

						if (l<1) this.siteBG();	

							

			

					} else {

						h_to = 446 + 109;

						var p_top = 0;

						var f_top = -240;// Footer

						

						var ele = $$('#prink_menu');

						ele.setStyle('top','90px');

				

						var elex = $$('#ext_left');

						elex.setStyle('top','554px')

						

					}

				h_to = h_to + 200;

				

			} else {

		

		if (h_to > 561) {





			h_to = h_to;

			var p_top = h_to - 561;// Panel



			var m_top = h_to - 473;// Menu

			var f_top = (h_to - 471) - 154;// Footer

			var ext_top = h_to -9;// sideparts

			

			var elex = $$('#prink_menu');

			elex.setStyle('top',m_top+'px');

			

			var elex = $$('#ext_left');

			elex.setStyle('top',ext_top+'px');



			var l = 0;

			for( v = 0; v < 6; v++ ) {

				if (this._panel_menu[v].getStyle('text-decoration') == 'underline') l++;

			}

			if (l<1) this.siteBG();	



		} else {

			h_to = 446 + 109;

			var p_top = 0;

			var f_top = -75;// Footer

			

			var ele = $$('#prink_menu');

			ele.setStyle('top','90px');

	

			var elex = $$('#ext_left');

			elex.setStyle('top','554px')

			

		}

			}

		if (p_top < 0) p_top = 0;

		if (f_top < -75) f_top = -25;



		this._panel_prink_commands[0]  = {top:p_top};

		this._doc_footer_commands[0]  = {top:f_top}

		this._fx_panel_prink.start(this._panel_prink_commands);

		this._fx_doc_footer.start(this._doc_footer_commands);

		this._col_internal_commands[0]  = {display:'block',opacity:1,visibility:'visible',height:h_to};

		this._fx_col_internal_hide.start(this._col_internal_commands);



		// Hide AJAX COL

		//ajax-col-yourvisit

		//ajax-col-whatson

		

		



		this._subsubnav   = $$('.primary-sub-menu li a');

		this._subsubnav.each(function(link,u){	  

					link.addEvent("click", function(event) { 

						//////////console.log("REST Link Clicker");

						//stop the regular link activating

						

						new Event(event).stop();

						this.clearLinks();

						

						var temp = link.href.split('/');

						var tx = '';

						for( i = 0; i < 4; i++ ) {

							tx+=temp[3].charAt(i);

						}	



						if (tx == 'main' || tx == 'ajax') {

							this.ajaxPanelClick(link,6,'main');

						}

						else this.normalLinkClick(link);



						

					}.bind(this)

		  			);

		// 		}



		}.bind(this));



		if (document.getElementById('sendContact') != null) {

					var eles = $$('.sendContact');

				eles.addEvent("click", function(event) { 

							//this.checkContact();

				}.bind(this));

		}

		

		if (document.getElementById('search_results') != null) {

			this._searchres = $$('#search_results a');

			this._searchres.each(function(link){	  

						link.addEvent("click", function(event) { 

							//////////console.log("REST Link Clicker");

							//stop the regular link activating

							

							new Event(event).stop();

							

							

							var temp = link.href.split('/');

							var tx = '';

							for( i = 0; i < 4; i++ ) {

								tx+=temp[3].charAt(i);

							}	

							

							//if (tx == 'main' || tx == 'ajax') 

							//	this.ajaxPanelClick(link);

							this.normalLinkClick(link);

	

							

						}.bind(this)

						);

			// 		}

	

			}.bind(this));

		}



  	},

	

	

	showLoadedPanelContent: function(active,new_content){

		var ele = $$('#panel_'+active);

		

		ele.setStyle("visibility","visible");

		ele.setStyle('padding-top','10px');

		ele.setStyle('display','block');

		ele.setStyle('width','974px');

		

		

		

		ele.set('html', new_content);

		

		var eleg = $('panel_'+active).innerHTML;

		var eleg_result = eleg.search("panel-footer");

		

		var  h_to = eleg_result / 2.9;

		

			

		var myVerticalSlide = new Fx.Slide('panel_'+active).hide();

		myVerticalSlide.slideIn();

									

		var windowScrollFX = new Fx.Scroll(window);

			windowScrollFX.toElement("panel-footer");						

	// window.scrollTo(selectedPosX,selectedPosY);



		

  	},

	

	

	

	showPanel: function () {

		this._panel_prink_commands[0]  = {display:'block',opacity:1,visibility:'visible'};

		this._fx_panel_prink.start(this._panel_prink_commands);

		return;

	},

	

	showModules: function () {

		this._doc_modules_commands[0]  = {display:'block',opacity:1,visibility:'visible', height:240};

		this._fx_doc_modules.start(this._doc_modules_commands);

		return;

		

	},

	

	showFooter: function() {

		// Footer

		this._doc_footer_commands[0]  = {top:-50};

		this._fx_doc_footer.start(this._doc_footer_commands);

		// !Footer

	},

	/*

	RESETs

	*/

	

	resetLoadedPanelContent: function(active){

		

		var myVerticalSlide = new Fx.Slide('panel_'+active);

		myVerticalSlide.slideOut();

		var ele = $$('#panel_'+active);

		ele.setStyle('padding-top','0');

		ele.setStyle('visibility','hidden');

		ele.setStyle('display','none');

		

  	},

	

	resetFooter: function() {

		// Footer

		this._doc_footer_commands[0]  = {top:0};

		this._fx_doc_footer.start(this._doc_footer_commands);

		// !Footer

		return;

	},

	

	resetPanelContent: function(active){

		

		this._panel_links.each(function(link,k){

			var j = k + k;	  

			

			var r = this._panel_menu[j].getStyle('text-decoration');

							if (r == 'underline') {

								this._panel_menu[j].setStyle("text-decoration","");

								this.resetLoadedPanelContent(j);

							}

		},this);

		return;

  	},

	

	resetLoadedMainContent: function(){

		// Main Content such as search etc

		var ele = $$('#main-content');

		ele.setStyle("visibility","hidden");

		ele.set("html","");

		

		var ele = $$('#ajax-col-internal');

		ele.set("html","");

		

		

		

		this._col_internal_commands[0]  = {display:'none',opacity:0,visibility:'hidden'};

		this._fx_col_internal_hide.start(this._col_internal_commands);

		

		return;

  	},

	

	resetMenu: function(){

		var ele = $$('#prink_menu');

		ele.setStyle('top','109px');

		

		var elex = $$('#ext_left');

		elex.setStyle('top','573px');

		

		// Close all menus

		this._columns.each(function(r,k) {

			this._link_hover_commands[k]     = {top:372};

			

			this._section_hover_commands[k]  = {opacity:0,visibility:'hidden',display:'none'};

			

			if (k == 1) {

					$$('#section-link-about').setStyle("background-image","url("+this._base_url+"public/images/section_images/1.png)");

					$$('#section-link-about').setStyle("height","72px");

			} 

			if (k == 2) {

					$$('#section-link-whatson').setStyle("background-image","url("+this._base_url+"public/images/section_images/2.png)");

					$$('#section-link-whatson').setStyle("height","72px");

			} 

			if (k == 3) {

					$$('#section-link-yourvisit').setStyle("background-image","url("+this._base_url+"public/images/section_images/3.png)");

					$$('#section-link-yourvisit').setStyle("height","72px");

			} 

			if (k == 4) {

					$$('#section-link-buytickets').setStyle("background-image","url("+this._base_url+"public/images/section_images/4.png)");

					$$('#section-link-buytickets').setStyle("height","72px");

			} 

			

			

		},this);



		this._fx_link_hover.start(this._link_hover_commands);

		this._fx_section_desc.start(this._section_hover_commands);

		return;

  	},

	

	resetSubMenu: function(){

		this._panel_prink.setStyle('top','0');

		return;

	},

	

	

	resetPanel: function() {

		this._panel_prink_commands[0]  = {display:'none',opacity:0,visibility:'hidden'};

		this._fx_panel_prink.start(this._panel_prink_commands);

		return;

	},

	

	resetModules: function () {

		

		var ele = $$('#doc-modules');

		ele.set('html','');

		

		this._doc_modules_commands[0]  = {display:'none',opacity:0,visibility:'hidden', height:0};

		this._fx_doc_modules.start(this._doc_modules_commands);

		

		return;		

		

	},

	

	resetDocPage: function() {

		var ele = $$('#doc-page');

		ele.set('html','');

	},

	

	resetLoadedContent: function(){

		

		this._columns.each(function(r,k) {

			var ele = this._columns[k].getElement('.ajax-col');

			ele.set('html','');

		},this);

		

		//main-content



		

		return;

  	},

	

	navMenuReset: function() {

		

		

		var myEffect = new Fx.Morph('prink_menu', {duration: 'short', transition: Fx.Transitions.Sine.easeIn});

 

		myEffect.start({

			'top': 109

		});

		

		var myEffect = new Fx.Morph('ext_left', {duration: 'short', transition: Fx.Transitions.Sine.easeIn});

 

		myEffect.start({

			'top': 573

		});



	},

	

	siteBG: function () {



		if (document.body){

			var ex = document.body;

			ex.setStyle("background-image","url("+this._base_url+"public/images/background/prinknash_background.gif)");

			ex.setStyle("background-repeat","no-repeat");



		}

		return;

	},

	

	resetsiteBG: function () {

		if (document.body){

			var ex = document.body;

			ex.setStyle("background-image","");

		}

		return;

	},

	

	resetAll: function(){

		

		this.resetLoadedMainContent();

		this.resetLoadedContent();

		this.resetMenu(); // Resets menu's

		this.resetModules(); // Resets modules

		this.resetPanel();

		this.resetFooter();

		this.navMenuReset();

		this.resetSubMenu();

		this.resetPanelContent();

		this.resetsiteBG();

		

		//alert(ajax_url);

		

		window.location.assign(this._base_url);



		//return;

	},

	

	

  	

  	

  	redirectForms:function(e){

  		

  		//select all the links

  		var content_forms = $$('.ajax-col form');

  		  		

  		//add onclick event to each

  		content_forms.each(function(f,n){

  			////////console.log("FORM FOUND: " + f);

  			f.addEvent("submit", function(e){

  				new Event(e).stop();

  				////////console.log("WELL I WAS GOING TO SUBMIT BUT YOU STOPPED ME");

  				////////console.log(f.action);

  				/*

  				new Ajax(f.action,{

				

				  				method:'get',

								

								onComplete: function(e){

									//////console.log(e);

									//$('mbcount').setHTML(e);

									//this.mb();

								}.bind(this)								  				

				 }).request();*/

				 this.send({

					update: 'doc-internal-article',

					onComplete: function() {

						//log.removeClass('ajax-loading');

						//////console.log('form processing complete');

					}

				});

				 

  				

  			});

  			/*

  					var ajax_url = l.href;//.replace(this._base_url,this._base_url + prefix);

					//////////console.log("CHANGING " + link.href + " to "+ajax_url+" TO LOAD INTO " + target );

					l.addEvent('click', function(event){

						//stop the link

						new Event(event).stop();

						//////console.log("MB: " + l.href+ "&s=" + this._session_id+ "&sn=" + this._session_name);

						//send the ajax...

						new Ajax(l.href+ "&s=" + this._session_id,{

				

				  				method:'get',

								

								onComplete: function(e){

									//////console.log(e);

									$('mbcount').setHTML(e);

									//this.mb();

								}.bind(this)								  				

				  		}).request();

						

						

			  		}.bind(this));

  			*/

  		});

  		

  	},

  	

  	//sets the ajax links

  	setContentLinks: function(element){

  		//$('section-cat-menu li ul').setStyle('display','none');

  		//select all the links

  		var content_links = $$('.ajax-col a');

  		

  		//add onclick event to each

  		content_links.each(function(l,n){

  		//console.log("LINK FOUND: " + l);

  			//MOD: DA ignore the memory box link and do something different with that

  			if(l.hasClass('memboxlink')){

  					//console.log('---> and is the membox link');

  					var ajax_url = l.href;//.replace(this._base_url,this._base_url + prefix);

					//////////console.log("CHANGING " + link.href + " to "+ajax_url+" TO LOAD INTO " + target );

					l.addEvent('click', function(event){

						//stop the link

						new Event(event).stop();

						//////console.log("MB: " + l.href+ "&s=" + this._session_id+ "&sn=" + this._session_name);

						//send the ajax...

						new Ajax(l.href+ "&s=" + this._session_id,{

				

				  				method:'get',

								

								onComplete: function(e){

									//////console.log(e);

									$('membox-container').setStyle('opacity', '1');

									$('mbcount').setHTML(e);

									this._fx_mb.start({opacity:[0,1]});

									if(eval(e)< 1){

										this._fx_mb.start({opacity:[1,0]});

									}

									//this.mb();

								}.bind(this)								  				

				  		}).request();

						

						

			  		}.bind(this));

  				}else{

  				if(!l.hasClass('noJSLink')){

					

  					this.activateAjaxLink(l,element,"");

  				}

  			}

  			

  		},this);

  		

  	},

  	

  	/**

  	* convert a link to ajax

  	**/

  	activateAjaxLink: function(link,target,prefix){

  		//this.loadContent.bind(this).pass(ajax_url,this._columns[active].getElement('.ajax-col')).delay(3000);

  		

  		var ajax_url = link.href;//.replace(this._base_url,this._base_url + prefix);

		//////////console.log("CHANGING " + link.href + " to "+ajax_url+" TO LOAD INTO " + target );

		link.addEvent('click', function(event){

			//stop the link

			new Event(event).stop();

			//define the animation

	 		//this._fx_loaded_content_p = new Fx.Elements($('doc-article').getChildren(),{duration: 100,fps:60});

	 		//clear all current commands if any

	 		this._content_p_commands = {};

	 		

	 		//$('doc-article').getChildren().each(function(el,i){

	 		//	this._content_p_commands[i] = { opacity: [1,0] }; 

	 		//},this);

	 		

	 		//	this._fx_loaded_content_p.start(this._content_p_commands).chain(

	 			//this.loadContent.bind(this).pass(ajax_url,target)			

	 		//);

	 		this.loadContent(ajax_url,target);

  		}.bind(this));

  	

  	},

  	

  	/**

  	* Open up a section

  	**/

  	_setSectionPane: function(pane){

  		

  		//clear previous pane

  		this._new_article_height = null;

  		this._old_article_height = null;

  		

  		//reset animation commands

  		this._column_commands = {};

		this._link_commands  = {};

		this._ajax_commands  = {};

		this._fade_commands  = {};

		

		var w_from = this._columns[pane].getStyle("width").toInt();

		var w_to   = this._column_widths[pane+1][pane];

	

  		

  	},

	

	panelclose: function (j) {

		

		this._panel_menu[j].setStyle("text-decoration","");

		this.resetLoadedPanelContent(j);

		

		var l = 0;

		for( v = 0; v < 6; v++ ) {

		if (this._panel_menu[v].getStyle('text-decoration') == 'underline') l++;

		}

		if (l<1) this.resetsiteBG();

		

		

	},

  	

  	setSectionPane: function(pane){

  		this._prink_menu.setStyle('top', '-234px');

		

		var elex = $$('#ext_left');

		elex.setStyle('top','230px');

		

  		//clear previous pane

  		this._new_article_height = null;

  		this._old_article_height = null;



  		//reset animation commands

  		this._column_commands = {};

		this._link_commands  = {};

		this._ajax_commands  = {};

		this._fade_commands  = {};

		

		//from and to widths for the active column

		this._links[0].setStyle('visibility','hidden');

		this._links[0].setStyle('position','relative');

			

		

			//begin the animation

			//////////console.log(this._column_commands);

			this._fx_column_slide.start(this._column_commands);

			//this._fx_link_hide.start(this._link_commands);

			this._fx_column_fade.start(this._fade_commands);

			return true;



				  	

  	},

  	

  	/* Hover the active link*/

  	sectionLinkOver: function(active){

  		////////console.log('linkover: ' + active);	

		this._descs.setStyle('display','block');

		//this._active_column = active;

		//reset the fx command sets

		this._link_hover_commands    = {};

		this._section_hover_commands = {};

		

		//set the commands for the active element

		this._descs.setStyle('visibility', 'visible');



		

		if (active == 1) {

			this._link_hover_commands[active]     = {top:352};

			$$('#section-link-about').setStyle("background-image","url("+this._base_url+"public/images/section_images/1_up.png)");

			this._section_hover_commands[active]  = {opacity:0.75 ,top:300};

		} else if (active == 2) {

			this._link_hover_commands[active]     = {top:342, "padding-bottom":20};

			$$('#section-link-whatson').setStyle("background-image","url("+this._base_url+"public/images/section_images/2_up.png)");

			this._section_hover_commands[active]  = {opacity:0.75 ,top:266,height:76};

		} else if (active == 3) {

			this._link_hover_commands[active]     = {top:310, "padding-bottom":78};

			$$('#section-link-yourvisit').setStyle("background-image","url("+this._base_url+"public/images/section_images/3_up.png)");

			this._section_hover_commands[active]  = {opacity:0.75,top:180,height:96};

		}  else if (active == 4) {

			this._link_hover_commands[active]     = {top:352};

			$$('#section-link-buytickets').setStyle("background-image","url("+this._base_url+"public/images/section_images/4_up.png)");

			this._section_hover_commands[active]  = {opacity:0.75 ,top:300,height:20};

		} else {

			this._link_hover_commands[active]     = {top:352};

			

			this._section_hover_commands[active]  = {opacity:0.75 ,top:300};

		}

		

		this._links.each(function(other,j) {

			//ignore the active element

			if(active != j) {

				

				if (j == 1) {

					$$('#section-link-about').setStyle("background-image","url("+this._base_url+"public/images/section_images/1.png)");	

					this._section_hover_commands[1]  = {opacity: 0, top:372};

				} else if (j == 2) {

					$$('#section-link-whatson').setStyle("background-image","url("+this._base_url+"public/images/section_images/2.png)");	

					this._section_hover_commands[2]  = {opacity: 0, top:372};

				} else if (j == 3) {

					$$('#section-link-yourvisit').setStyle("background-image","url("+this._base_url+"public/images/section_images/3.png)");	

					this._section_hover_commands[3]  = {opacity: 0, top:0, visiblity:"hidden",display:"none"};

				} else if (j == 4) {

					$$('#section-link-buytickets').setStyle("background-image","url("+this._base_url+"public/images/section_images/4.png)");

					this._section_hover_commands[4]  = {opacity: 0, top:372};

				}  else {

					this._section_hover_commands[j]  = {opacity: 0, top:372};

				}

				this._link_hover_commands[j]  = {top:372};	

					

			}

			

		},this);

		

		//set the hover positions to focus the hovered link

		this._fx_link_hover.start(this._link_hover_commands);

			//this._descs.setStyle('display', 'block');

			//this._descs.setStyle('visibility', 'visible');

			

			this._fx_section_desc.start(this._section_hover_commands);

		//	var activex = active + 1

		//	this._p_current = 0;

		//	this.changeBgImage(this._bg[activex][this._p_current]);

			

//		}

		this._p_last_action = true;

		

  	},

  	  	

  	/**

  	* reset the links to their reset positions

  	**/

  	sectionLinksReset: function(){

  		//cleanse fx lists

 		this._link_hover_commands    = {};

		this._section_hover_commands = {};

		

		//for each link

		this._links.each(function(link,j){

			//set the commands

			this._link_hover_commands[j]  = {top:372};

			this._section_hover_commands[j]  = {opacity: 0, top:372};

		},this);

		

		//start the animation

		this._fx_section_desc.start(this._section_hover_commands);

		this._fx_link_hover.start(this._link_hover_commands);		

		this._p_last_action = true;

		

  	},

  	

  	/**

  	*	Triggers for the clicking of a section link

  	**/

  	sectionLinkClick: function(active){

  		// hide all ajax content

  		$$('.ajax-col').setStyle('display','none');

		this.clearLinks();

		

		$$('#content-col-about').setStyle('overflow','visible');

		$$('.ajax-col').setStyle('position','relative');

		$$('.ajax-col').setStyle('top','200px');

		$$('.ajax-col').setStyle('width','485px');

		$$('.ajax-col').setStyle('float','left');

		

		

  		//set the active column

  		this._active_column = active;

  		var activex = active + 1

		//alert(this._bg[activex][0]);

  		this.changeBgImage(this._bg[activex][0]);

  		this.p_current = activex;



  		//onpen the pane

  		this.setSectionPane(active);//.chain(////////////console.log('pane animation complete'));

  		//set activity to true;

  		this._p_last_action = true;

  		//load in ajax content

		

  		var ajax_url = this._links[active].href.replace(this._base_url,this._base_url + "ajax");

		//this._internal = false;

		var ele = this._columns[active].getElement('.ajax-col');

		//ele.setStyle("background-color","#ff00ff");



		

		this.loadContent(ajax_url, active);

		

  		//this.loadContent.bind(this).pass(ajax_url,active).delay(100);

				

  	},

  	

  	/**

  	* attach links to non section menus

  	**/

	

	filter: function() {

		var searchterm = this._search.get('value')

		//alert(searchterm);

		// show results in the search window

		var ajax_url = this._base_url + "ajaxsearch/"+searchterm;

		this.loadAjaxContent(ajax_url,'','main');

		

	},



	checkEnter: function(event) {

		

		this._search.addEvent('keypress', function(event) { 

					 if( event.key == 'enter' )	this.filter();

		

		}.bind(this));

	},

	

	checkSearch: function(event) {

		var eles = $$('.searchbtn');

		eles.addEvent("click", function(event) { 

					 this.filter();

		}.bind(this));

	},

	

	

  	attachLinkClicks: function(){

  		//assign the links the new ajax thing ;)

			

	

		this._panel_links.each(function(link,k){

		  			//handle the fist email

		  			//handle the fist email

		  			link.addEvent("click", function(event) { 

							// underline the link

		  					new Event(event).stop();

							this.clearLinks();

							//alert(k);

							var j = k + k

							

							var r = this._panel_menu[j].getStyle('text-decoration');

							

							

							

							if (r == 'underline') {

								this._panel_menu[j].setStyle("text-decoration","");

								this.resetLoadedPanelContent(j);

								

								var l = 0;

								for( v = 0; v < 6; v++ ) {

									if (this._panel_menu[v].getStyle('text-decoration') == 'underline') l++;

								}

								if (l<1) this.resetsiteBG();

								

							} else {

								this._panel_menu[j].setStyle("text-decoration","underline");

		  						this.ajaxPanelClick(link,j,'panel'); 

								

								

								this.siteBG();

								

							}

		  				}.bind(this)

		  			);

  		},this);

		

		

		this._doc_footer_links.each(function(link,l){

					

		  			link.addEvent("click", function(event) { 

							// underline the link

		  					new Event(event).stop();

							

								//alert(k);

							var j = l+1+92;

							this.clearLinks();

							if (j == 93) {

								this.normalLinkClickNew(link); 

							} else if (j == 94) {

								this.normalLinkClickNew(link); 

							} else if (j == 95) {

								this.normalLinkClickNew(link); 

							}  else {

								this._menu_item = 1;

								this._p_current = 0;

								this.changeBgImage(this._bg[this._menu_item][this._p_current]);

								this.ajaxPanelClick(link,1,'main');

							}



		  				}.bind(this)

		  			);

  		},this);

		

		

	

	this._sec_links.each(function(link,k){

					

		  			link.addEvent("click", function(event) { 

							// underline the link

		  					new Event(event).stop();

	

								//alert(k);

							var j = k+60+4;

							this.clearLinks();

							if (j == 65) {

								this.normalLinkClick(link); 

							} else if (j == 66) {

								this.normalLinkClick(link); 

							} else if (j == 64) {

								this._p_current = 0;

								this.changeBgImage(this._bg[11][this._p_current]);

								this.ajaxPanelClick(link,11,'main');

								

							}



		  				}.bind(this)

		  			);

  		},this);

	

		this._main_links.each(function(link,k){

					

		  			link.addEvent("click", function(event) { 

							// underline the link

		  					new Event(event).stop();

	

								//alert(k);

							var j = k+1+4;

							this.clearLinks();

							if (j == 5) {

								

								this.resetAll();

								

								this._main_links[k].setStyle("text-decoration","underline");

								this._main_links[k].setStyle("color","#FFFFFF");

							} else if (j == 9) {

								this.normalLinkClick(link); 

							} else {

								

								this._main_links[k].setStyle("text-decoration","underline");

								this._main_links[k].setStyle("color","#FFFFFF");

								this._menu_item = j - 1;

								this._p_current = 0;

								this.changeBgImage(this._bg[j][this._p_current]);

								this.ajaxPanelClick(link,j,'main');

							

							}



		  				}.bind(this)

		  			);

  		},this);

		

		

		this._whatson_links.each(function(link,i){



		  			//handle the fist email

		  			link.addEvent("click", function(event) { 

		  					//////////console.log("REST Link Clicker");

		  					//stop the regular link activating

		  					new Event(event).stop();			

		  					//execute the actions for a link click.		

							

							this.clearLinks();

							

							var activex = 21;

							this._p_current = 0;
	
							this.changeBgImage(this._bg[activex][this._p_current]);

								this._whatson_links[i].setStyle("text-decoration","underline");

								this._whatson_links[i].setStyle("color","#FFFFFF");

		  					this.ajaxLinkClick(link); 

		  				}.bind(this)

		  			);

  		},this);

		

		this._yourvisit_links.each(function(link,i){

				

		  			//handle the fist email

		  			link.addEvent("click", function(event) { 

		  					//////////console.log("REST Link Clicker");

		  					//stop the regular link activating

		  					new Event(event).stop();	

							this.clearLinks();

		  					//execute the actions for a link click.	

							j = i + 1 + 30;

							

							var activex = j;

							this._p_current = 0;

							

							this.changeBgImage(this._bg[activex][this._p_current]);

							

								this._yourvisit_links[i].setStyle("text-decoration","underline");

								this._yourvisit_links[i].setStyle("color","#FFFFFF");

								

							this._menu_item = j - 1;

		  					this.ajaxLinkClick(link); 

		  				}.bind(this)

		  			);



  		},this);

  		

		

		

		

		this._sub_nav_links.each(function(link,i){

				

		  			//handle the fist email

		  			link.addEvent("click", function(event) { 

		  					//////////console.log("REST Link Clicker");

		  					//stop the regular link activating

		  					new Event(event).stop();	

							this.clearLinks();

		  					//execute the actions for a link click.				

		  					//this.ajaxLinkClick(link); 

							alert(link);

		  				}.bind(this)

		  			);



  		},this);

  		

  		//OVERRIDE LINK ACTIONS FOR THE SUB MENU

  		this._sub_links.each(function(link,i){

  		  		link.addEvent("click", function(event) { 

						//////////console.log(link);

	  					//stop the regular link activating

	  					new Event(event).stop();			

	  					//execute the actions for a link click.

						this.clearLinks();

	  					this.normalLinkClick(link); 

	  				}.bind(this)

	  			);

		  		

  		},this);

  	},

  	

  	

  	/**  	

  	* NORMAL LINK CLICK

  	*

  	* disables the conventional click of the link sent via args, 

  	* takes the url, prefixes the first parameter after base url with ajax-

  	* to guide it to the mirrored menus that use the cut down ajax templates.

   	**/

  	normalLinkClick: function(link){

  		// hide all ajax content

  		window.location = link;



  		//this.loadContent.bind(this).pass(ajax_url,this._columns[active].getElement('.ajax-col')).delay(1000);

  	},

	

	normalLinkClickNew: function(link){

  		// hide all ajax content

  		window.open(link);



  		//this.loadContent.bind(this).pass(ajax_url,this._columns[active].getElement('.ajax-col')).delay(1000);

  	},

	

	ajaxLinkClick: function(link){

  		// hide all ajax content

  		//$$('.ajax-col').setStyle('display','none');

  		//set the active column

  		var r = this._descs.getStyle('visibility');

		

		for ( k in r ) {

		   if (r[k] == 'visible') {

			   var active = k;

			//   this._columns[k].setStyle('overflow','visible');

		   }

		}



  		this._active_column = active;



  		this.setSectionPane(active);//.chain(////////////console.log('pane animation complete'));

  		this._p_last_action = true;



  		var ajax_url = link.href.replace(this._base_url,this._base_url);

		this._internal = true;

		

		/*

		$$('.ajax-col').setStyle('position','relative');

		$$('.ajax-col').setStyle('top','200px');

		$$('.ajax-col').setStyle('width','486px');

		$$('.ajax-col').setStyle('float','left');

		*/

		

		this.loadContent(ajax_url, active);

		

  		//this.loadContent.bind(this).pass(ajax_url,this._columns[active].getElement('.ajax-col')).delay(500);

  	},

  

  

  ajaxLinkFollow: function(ajax_url,active){

  		// hide all ajax content

		$$('.ajax-col').setStyle('display','none');

		this._columns[active].setStyle('overflow','visible');

  		this._active_column = active;

  		//////////console.log("clicked: "  + active);

  		//this.changeBgImage(active);

  		//onpen the pane

  		this.setSectionPane(active);//.chain(////////////console.log('pane animation complete'));

  		//set activity to true;

  		this._p_last_action = true;

  		//load in ajax content

		//////////console.log(ajax_url);

		//var ajax_target = ;

		this._internal = true;

		

		

		$$('.ajax-col').setStyle('position','relative');

		$$('.ajax-col').setStyle('width','485px');

		$$('.ajax-col').setStyle('float','left');

		

		

		if (active == 1) {

			this._link_hover_commands[active]     = {top:352};

			$$('#section-link-about').setStyle("background-image","url("+this._base_url+"public/images/section_images/1_up.png)");

			this._section_hover_commands[active]  = {opacity:0.75 ,top:300,display:"block"};

		} else if (active == 2) {

			this._link_hover_commands[active]     = {top:342, "padding-bottom":20};

			$$('#section-link-whatson').setStyle("background-image","url("+this._base_url+"public/images/section_images/2_up.png)");

			this._section_hover_commands[active]  = {opacity:0.75 ,top:266,height:20,display:"block"};

		} else if (active == 3) {

			this._link_hover_commands[active]     = {top:310, "padding-bottom":78};

			$$('#section-link-yourvisit').setStyle("background-image","url("+this._base_url+"public/images/section_images/3_up.png)");

			this._section_hover_commands[active]  = {opacity:0.75,top:180,height:96,display:"block"};

		} 	else if (active == 4) {

			this._link_hover_commands[active]     = {top:352};

			$$('#section-link-buytickets').setStyle("background-image","url("+this._base_url+"public/images/section_images/4_up.png)");

			this._section_hover_commands[active]  = {opacity:0.75 ,top:300,display:"block"};

		} else {

			this._link_hover_commands[active]     = {top:352};

			this._section_hover_commands[active]  = {opacity:0.75 ,top:300,display:"block"};

		}

		

		this._fx_link_hover.start(this._link_hover_commands);

		this._fx_section_desc.start(this._section_hover_commands);

		

		

		

		this.loadContent(ajax_url, active);

		

  		//this.loadContent.bind(this).pass(ajax_url,this._columns[active].getElement('.ajax-col')).delay(500);

  	},

  

	ajaxPanelClick: function(link,j,type){

		var ajax_url = link.href.replace(this._base_url,this._base_url);

		this.loadAjaxContent(ajax_url, j,type);

		if (type != 'panel') {

		

		var strLen = ajax_url.length;

		var end_point = ajax_url.slice(strLen-1,strLen); 

		

		if (end_point == '/') ajax_url = ajax_url.slice(0,strLen-1); 



		var temp = new Array();

		temp = ajax_url.split('/');

		var tx = temp.length - 1;

		ajax_url = temp[tx].replace('main','modules');

		

		this.loadAjaxContent(ajax_url,'1','Modules');

		}

		

		

  	},

	

	ajaxPanelFollow: function(ajax_url,j,type){

		this.loadAjaxContent(ajax_url, j,type);

		if (type != 'panel') {

		

		var strLen = ajax_url.length;

		var end_point = ajax_url.slice(strLen-1,strLen); 

		

		if (end_point == '/') ajax_url = ajax_url.slice(0,strLen-1); 



		var temp = new Array();

		temp = ajax_url.split('/');

		var tx = temp.length - 1;

		ajax_url = temp[tx].replace('main','modules');

		

		this.loadAjaxContent(ajax_url,'1','Modules');

		}

		

		

  	},

	

 	

  	/**

  	* Reset to initial setup

  	**/

  	reset: function(){

  	

		this._ajax_columns.setStyle('display','none');

		this._fades.setStyle('display','none');

		

		////////console.log("PANE RESET");

		this._active_column = -1



		

		this._links.each(function(r,k) {

			newwidth = this._column_widths[0][k]

			this._columns[k].setStyle('width',newwidth);

			if (this._links[k].getStyle("position") == "absolute") {

				this._links[k].setStyle('visibility','visible');

				this._links[k].setStyle('position','relative');

			};

			

		},this);

	

		$('doc-header').setStyle("background-image","url("+this._base_url+"public/images/doc-header/logo.gif)");

		

  	},

  		

  	/**

  	*  changes the background image

  	**/

  	changeBgImage: function(path){

  		////////console.log("CHANGING BG TO: " + path);

  		//change the background if needed

		

		if($('content-background').getStyle('background-image') != 'url(' + path +')'){

			//////////console.log(this._base_url);

			//swap the background to the wipe, before fading

			$('content-background-white').setStyle('background-image',$('content-background').getStyle('background-image'));

			$('content-background').setStyle('opacity','0');

			$('content-background-white').setStyle('opacity','1');

			//set the background to the new image since its covered


			$('content-background').setStyle('background-image','url('+path+')');

			

			//fade the now old background

			this._fx_white_bg.start({opacity: [1,0]});

			//fade in the new background		

			this._fx_content_bg.start({opacity: [0,1]});

			

	

		}

 	},

  	/**

  	* perodically change the background image

  	**/

	

	//this.bgSlideShow.periodical(this._p_interval,this);

	

  	bgSlideShow: function(){

  		////////console.log("bgSlideShow");

  		//if no action was taken and not in a section

		

		if(!this._p_last_action){

  			//check current number is in valid range, if not reset to 0

  			if(this.p_current > 11 || !this.p_current){ this.p_current = 0;};

  			//var s = this._active_column > 0 ? this._active_column : Math.round(Math.random() *4)+1; 

			if (this._menu_item) {
				var s = this._menu_item;
				s = s + 1;
			} else {
				var s = this._active_column > 1 ? this._active_column : 1; 
				if (this._active_column > 0) {
					s = s + 1;
				}
			}


  			if(!this._bg[s][this.p_current]){

  				this.p_current = 0;

  			}
			
  			this.changeBgImage(this._bg[s][this.p_current]); 

  			this.p_current++;

  		}else{

  			//enable for the next cycle

  			this._p_last_action = false;

  		}

		/*

		

		

		if (this._menu_item) var s = this._menu_item;

		else var s = this._active_column > 1 ? this._active_column : 0; 

		s = s + 1



  		if(!this._p_last_action){

			

			

			if(this.p_current > 5 || !this.p_current){ this.p_current = 0;};

  			////////console.log("this._bg[" + s + "][" +this.p_current + "]");

  			if(!this._bg[s][this.p_current]){

  			this.p_current = 0;

  			}

  			this.changeBgImage(this._bg[s][this.p_current]);

  			this.p_current++;

			



			if(!this.p_current) this.p_current = 1;

			

			if(!this._bg[s][this.p_current]){

  			this.p_current = 0;

				//if (s==2) s = 1;

  			}

			this.p_current++;

  			this.changeBgImage(this._bg[s][this.p_current]);			

			

		

  		}else{

  			//enable for the next cycle

  			this._p_last_action = false;

  		}*/

  	},

  	

  	setBgBasepath: function(path){

  		this._bg_basepath = path;

  	},

  	

  	/**

  	* ADD AN IMAGE TO THE BACKGROUND IMAGES ARRAY

  	**/

  	addBgImage: function(pane, filepath){

  		//create an array if not yet initialised

  		if(!this._bg[pane]) {

  			this._bg[pane] = new Array();

  		}

  		//push the file path into the array

  		this._bg[pane].push(filepath);

  	},

  	

  	/**

  	* PRELOAD ALL THE IMAGES IN THE BACKGROUNDS ARRAY

  	**/

  	preloadImages: function(){

  		//for each section

  		this._bg.each(function(section,i){

  			new Asset.images(section);

  			

  		}, this);

  		//foreach file page

  	},

  	

  	addToMemoryBox: function(id){

  		//////console.log("adding " + id + "to memory box");

  		return false;

  	},

  	mb: function(){

 	 $('getquote').addEvent("click", function(e){

				//////console.log("GET A QUOTE CALLED");

				new Event(e).stop();

				obj.normalLinkClick($('getquote'));

			});

			

			$('clearmembox').addEvent("click", function(e){

				//////console.log("CLEAR QUOTE CALLED");

				new Event(e).stop();

				new Ajax($('clearmembox').href,{

				

				  				method:'get',

								

								onComplete: function(e){

									////console.log(e);

									$('mbcount').setHTML(e);

									$('membox-container').setStyle('opacity', '0');

								}.bind(this)								  				

				  		}).request();								



			});

}

 });//end of hush class
