  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: 10000,
  	
  	/* 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,
	_main_links: null,
	_sub_links: null,
	_links: 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: {},
	_section_hover_commands: {},
	_content_p_commands:{},
	
	/* ajax vars*/ 	
	_tmp: null,
	_internal: false,
	
	/*scrolling*/
	_scroll: null,
  	/**
  	* initialize the class
  	**/
  	initialize: function(base,sid,sn){
  		
  		SWFAddress.addEventListener(SWFAddressEvent.CHANGE, this.handleAddressChange.bind(this));
  		
  		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','kitchen','living','dining','bedroom','accessories'); 
  		
  		
  		$('doc-container').setStyle("background-position","-9999px bottom");
  		//build  open widths array
  		
  		this._column_widths.push(Array(0,197,198,196,198,197)); //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
		this._column_widths.push(Array(0,100,82,93,120,591));   //acccessories
		
		
		//define element collections
		this._ajax_columns = $$('.ajax-col'); 
		this._columns      = $$('.content-col');
		this._descs        = $$('.section-description');
		this._fades        = $$('.content-col-fade');
		this._links        = $$('.section-link');
		this._main_links   = $$('#primary-navigation a');
  		this._sub_links    = $$('.sub-menu a');
  		this._foot_links   = $$('#doc-footer a');
  		//console.log("FOOTER");
  		//console.log(this._foot_links);
		
		//this._home_link;
		
		//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_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.Styles('content-background', {fps: 60,wait: false, duration:1300,transition: Fx.Transitions.linear});
		this._fx_white_bg       = new Fx.Styles('content-background-white', {fps: 60,wait: false, duration:1300,transition: Fx.Transitions.linear});
		this._fx_mb             = new Fx.Styles('membox-container', {fps: 60,wait: false, duration:1300,transition: Fx.Transitions.Bounce.easeOut});
		
		//assign actions
		this.assignSectionLinkActions();
		
		//start slide show monitor
		this.bgSlideShow.periodical(this._p_interval,this);
		//this.showInternal();
		this.attachLinkClicks();
		
		/*SHOW OR HIDE THE MEMBOX*/
		new Ajax("/membox.php",{
				
				  				method:'get',
								
								onComplete: function(e){
									//////console.log("CHECK FOR MEMBOX COMPLETE " + (e.toInt()+1));
									if(e.toInt() < 1){
									$('membox-container').setStyle('opacity','0');
									}else{
										this._fx_mb.start({opacity:[0,1]});
									}
									//this.mb();
								}.bind(this)								  				
				  		}).request();
		
  	},
  	
  	/*
  	*	Contoller for changes in address :- should be rerouting all request through here.
  	*
  	*
  	*/
  	handleAddressChange: function(event){
  		//console.log("ADDRESS CHANGE");
  		//console.log(event);
  		var t_path = event.path;
  		var xx = "";
  		//is it a section?
  		var t_section  = event.pathNames[0];
  		var old_col =this._active_column;
  		switch(t_section){
  			case "kitchen":
  				this._active_column=1;
  				xx = "Contemporary Kitchens | ";
  				break;
  			case "living":
  				this._active_column=2;
  				xx = "Contemporary Living | ";
  				break;
  			case "dining":
  				this._active_column=3;
  				xx = "Contemporary Dining | ";
  				break;
  			case "bedroom":
  				this._active_column=4;
  				xx = "Contemporary Bedrooms | ";
  				break;
  			case "accessories":
  				this._active_column=5;
  				xx = "Contemporary Accessories | ";
  				break;
  			default:
  				this._active_column=0;
  				xx = "";
  				break;
  		}
  		document.title = xx + (event.pathNames[1] ? event.pathNames[1].replace("-", " ").replace("-", " ").replace("-", " ") + " | " : "" ) + " Contempory | Kitchens | Dining | Living | Bedrooms | Accessories | Hush | Interiors | Cheltenham | Gloucestershire | UK";
  		if(this._active_column){
  			//sectioned
  			//console.log("found the section: " + t_section  + ' >>>>>   ' + event.path.replace("/","/ajax"));
  			if(this._active_column != old_col){
  				this.setSectionPane(this._active_column);
  			}
  			this.loadContent.bind(this).pass(event.value.replace("/","/ajax"),this._columns[this._active_column].getElement('.ajax-col')).delay(500);
  			
  		}else if(event.path != '/'){
  			//internal
  			//console.log("found no section , poss internal?: " + t_section + " >> " + event.path.replace("/","/ajax"));
  			//replace(this._base_url,this._base_url + "ajax");
  		//	console.log(this.base_url);
  			this._active_column = 0;
  			//console.log(this._active_column);
  			this.setSectionPane(0);
  			this.loadContent.bind(this).pass(event.path.replace("/","/ajax"),this._columns[0].getElement('.ajax-col')).delay(500);
  		}else{
  			this.reset();
  			this._active_column = -1;
  		}
  	},
  	
  	/**
  	* 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();			
  					//execute the actions for a link click.				
  					this.sectionLinkClick(i); 
  				}.bind(this)
  			);
  			
  			
	  		
  		},this);
  	},
  	
  	/**
  	* Load content into a section
  	**/
  	loadContent: function(url,element){
  		//SWFAddress.setValue(url.replace(this._base_url,""));
  		//SWFAddress.setValue(url.replace(this._base_url + "ajax",""));
		//this.fadeOutContent();
  		new Ajax(url,{
				
  				method:'get',
				
				onComplete: function(e){
					//TODO: add hide loading here
					//urchinTracker(url);
					//console.log("url: " + url);
					//show content here
					this._internal = true;
					this.showLoadedContent(this._columns[this._active_column].getElements('.ajax-col'), e);
					$$('.loading-flash').setStyle('display','none');
				}.bind(this)								  				
  		}).request();
  		$$('.loading-flash').setStyle('display','none');
  		//this._scroll.toTop();
		this._scroll.toElement($('doc-container'));
  		
  	},
  	
  	
  	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 win = window.getSize();
  		var x = posis[this._active_column+1] + ((win.size.x/2)-515);
  		//console.log(x + " - NEW POS");
  		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 100px");
  		//$('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.Style(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.Style(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
  	**/
  	showLoadedContent: function(element,new_content){
  		$$('.loading-flash').setStyle('display','none');
  		is_internal = false;
		//////////console.log("yes");
		if(this._internal){
  			//////console.log("showInternalContent");
  			//////console.log(element);
  			//////console.log(element.getProperty("id"));
  			//////////console.log(new_content);
  			element.setHTML(new_content);
  			this.fadeInContent();
  			
  			element.setStyle('display','block');
  			element.setStyle('opacity','0');
  			
  			  		
  			//alert("SETLC: INTERNAL");
  			this.setContentLinks(element);
  			this.redirectForms(element);
  			this.setRemove(element);
  		}else{
  			
	  		element.setStyle('opacity','1');
	  		$('doc-sub-content').setStyle('opacity','0');
	  		$('doc-footer').setStyle('opacity','0');
	  		element.setHTML(new_content);
	  		$('doc-article').getChildren().setStyle('opacity','0');
	  		$('doc-sub-content').setStyle('opacity','1');
	  		$('doc-footer').setStyle('opacity','1');
	  		element.setStyle('opacity','0.5');
	  		//////////console.log(element);
	  		//reset
	  		
	  		this._new_article_height = $('doc-article').getStyle('height'); 
	  		//$('doc-article').setStyle('height',this._old_article_height ? 110 :this._new_article_height );
	  		//$('doc-article').setStyle('opacity','0');
	  		
	  		element.setStyle('display','block');
	  		//element.getElement('#doc-cat-nav').setStyle('width',1000);
	  		
	  		element.setStyle('opacity','1');
	  		this.fadeInContent();
	  		
	  		
	  		//define animation if not already defined`...........................
	  		
	 		
	 		//alert("SETLC: EXTERNAL");
	 		this.setContentLinks(element);
	 		this.redirectForms(element);
	 		this.setRemove(element);
	 		
	 	}
		this.showExtendedLogo();
		//section nav hover show and hide
 		this._subsubnav   = $$('#section-cat-menu li ul');
		this._subsubnav.setStyle('display','none');
		
		//NICE ONE RICH - try a relevent object name such as section_further_link
		this._testlink = $$('#section-cat-menu li.parent');
		this._subsubnav.setStyle('display','none');
				
				this._testlink.each(function(sub,i){
				//this._subsubnav.setStyle('display','none');
				sub.addEvent('mouseenter',function(){
				sub.getElements('ul').setStyle('display','block')
				//this._subsubnav.setStyle('display','block');
						
				}.bind(this));
				},this);
				
				
				
				this._testlink.each(function(sub,i){
				sub.addEvent('mouseleave',function(){
				
				this._subsubnav.setStyle('display','none');
						
				}.bind(this));
			
				},this);
				
				
				this._subsubnav.each(function(sub,i){
					sub.addEvent('mouseleave',function(){
					
					this._subsubnav.setStyle('display','none');
							
					}.bind(this));
				
				},this);
				
		//this._subsubnav.setStyle('display','none');
		//////////console.log(this._thelink[0]);	

		

			
  		

  		
  	},
  	
  	
  	redirectForms:function(e){
  		
  		//select all the links
  		var content_forms = $$('#ajax-col-internal form');
  		  		
  		//add onclick event to each
  		content_forms.each(function(f,n){
  			//console.log(this);
  		//	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");
  				this.send({
					update: 'ajax-col-internal',
					onComplete: function() {
						//console.log('form processing complete');
						//console.log("--");
					}
				});
					 
	  				
	  		});
	  			
	  	},this)
  		
  	},
  	
  	//sets the ajax links
  	setContentLinks: function(element){
  		//console.log("setContentLinks");
  		//$('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,"/" +prefix);
  		var new_url = ( link.href.replace(this._base_url,"").replace("ajax","")).replace("ajax","");
  		link.href   =( link.href.replace(this._base_url,"").replace("ajax","")).replace("ajax","")
		//console.log("CHANGING " + link.href + " to "+ new_url );
		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 = {};
	 		SWFAddress.setValue(new_url);
  		
	 		//$('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];
	
  		
  	},
  	
  	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  = {};
		
		//from and to widths for the active column
		this._links[0].setStyle('visibility','hidden');
		this._links[0].setStyle('position','relative');
		
				
			if (pane == 5) {
		
			var w_from = this._columns[5].getStyle("width").toInt();
			var w_to   = this._column_widths[6][5];
			}
			else {
			var w_from = this._columns[pane+1].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]}
			//////////console.log("PANEPARAMS");
			//////////console.log(pane + ": " + 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('opacity', '0');
			this._fades.setStyle('background-color', '#000');
			
			//hide elements
			
			
			if(this._links[pane]){
				this._links[pane].setStyle('position','absolute');
			}
			
			//show the loading frame for this pane
			$$('.loading-flash').setStyle('display','none');
			this._columns[pane].getElements('.loading-flash').setStyle('display','block');
			var t_el = this._columns[pane].getElements('.loading-flash')
			t_el.setStyle('width', w_to);
			this._ajax_columns.setStyle('display','none');
			//////////console.log('CHANGING HEADER TO: ' + "/public/images/doc-header/logo_" +this._column_list[pane+1]+ ".gif");
			$('doc-header').setStyle("background-image","url("+this._base_url+"public/images/doc-header/logo_" +this._column_list[pane]+ ".gif)");
							
			
			//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();
					//////////console.log("WIDTH OF " + j + " IS " + w);
					if(w != this._column_widths[pane+1][j]) this._column_commands[j] = {width: [w, this._column_widths[pane+1][j]]};
					if(w = 0){
						this._columns[j].setStyle('display','none');
						
					}else{
						this._columns[j].setStyle('display','block');
						this._link_commands[j]  = {opacity: 1};
						this._fade_commands[j]  = {opacity: 0.5,width:this._column_widths[pane+1][j]};
						this._ajax_commands[j]  = {};
					}
					this._links[j].setStyle('position','relative');
				}else{
					//this._column_commands[j] = {width: [w, this._column_widths[pane+1][j]]};
					//this._ajax_commands[j]  = {opacity: 0.5,width:this._column_widths[pane+1][j]};
				}
				
			},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);
			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._link_hover_commands[active]     = {top:352};
		this._section_hover_commands[active]  = {opacity:0.75 , backgroundColor:'#000',top:352,height:96};
		
		this._links.each(function(other,j) {
			//ignore the active element
			if(active != j) {
				
				this._link_hover_commands[j]  = {top:372};
				this._section_hover_commands[j]  = {opacity: 0, top:372};
				
			}
			
		},this);
		
		//set the hover positions to focus the hovered link
		this._fx_link_hover.start(this._link_hover_commands);
		////////console.log("CLICKED WITH ACTIVE " + this._active_column );
		//if not in a section
		if(this._active_column == -1){
			////////console.log("TRACING HOME CLICK");
			//show the description
			this._descs.setStyle('display', 'block');
			this._descs.setStyle('visibility', 'visible');
			this._fx_section_desc.start(this._section_hover_commands);
			this.changeBgImage(this._bg[active][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');
  		//set the active column
  		this._active_column = active;
  		
  		this.changeBgImage(this._bg[active][0]);
  		this.p_current++;

  		//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
		SWFAddress.setValue(this._links[active].href.replace(this._base_url,""));
  		var ajax_url = this._links[active].href.replace(this._base_url,this._base_url + "ajax");
		//this._internal = false;

  		//this.loadContent.bind(this).pass(ajax_url,this._columns[active].getElement('.ajax-col')).delay(100);
				
  	},
  	
  	/**
  	* attach links to non section menus
  	**/
  	attachLinkClicks: function(){
  		//assign the links the new ajax thing ;)
  		//OVERIDE MAIN MENU ACTIONS, SKIP FIRST COS ITS HOME
  		this._main_links.each(function(link,i){
				
  		  		if(i){
	  		  		link.addEvent("click", function(event) { 
		  					//stop the regular link activating
		  					new Event(event).stop();
		  					
		  					
  							//SWFAddress.setValue(link.href);			
		  					//execute the actions for a link click.				
		  					this.normalLinkClick(link); 
		  				}.bind(this)
		  			);
		  		}else{
		  			//handle the fist email
		  			link.addEvent("click", function(event) { 
		  					//////////console.log("REST Link Clicker");
		  					//stop the regular link activating
		  					SWFAddress.setValue('/');
		  					new Event(event).stop();			
		  					//execute the actions for a link click.				
		  					this._active_column = -1;
		  					//this.reset();
		  				}.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.normalLinkClick(link); 
	  				}.bind(this)
	  			);
		  		
  		},this);
  		
  		//OVERRIDE LINK ACTIONS FOR THE FOOTER MENU
  		this._foot_links.each(function(link,i){
  		  		if(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.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){
  		//console.log("normal link click");
  		// hide all ajax content
  		$$('.ajax-col').setStyle('display','none');
  		//set the active column
  		var active = 0;
  		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
  		SWFAddress.setValue(link.href.replace(this._base_url,""));
  		var ajax_url = link.href.replace(this._base_url,this._base_url + "ajax");
  		//console.log("CHANGING");
  		//SWFAddress.setValue(link.href);
	   // console.log(ajax_url);
		//var ajax_target = ;
		this._internal = true;
		//console.log("LOAD INTERNAL CONTENT");
		/**********************
		dont be scared rich
		its really quite simple, once it sinks in...
		this is a chained event, read it right to left, so, 
				loadcontent
				|--- SEND (pass) the new url and
				|   |---- new_url
				|   |---- (getElement) the ajax-col element IN (this._columns[active])
				|--- delay1000 milliseconds
				 
		***********************/

  		//this.loadContent.bind(this).pass(ajax_url,this._columns[active].getElement('.ajax-col')).delay(1000);
  	},
  
  	
  	/**
  	* 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
  	**/
  	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 > 5 || !this.p_current){ this.p_current = 0;};
  			var s = this._active_column > 0 ? this._active_column : Math.round(Math.random() *4)+1; 
  			////////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++;
  		}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
 
  