// HP Creative Studio Hide Left Filter Code for Gallery Pages Only
// This code needs Mootools to work properly

	function cs_getpageidfromurl(){
		var currenturl = window.location.href;
		if (currenturl.indexOf("?")>-1)
	 		currenturl = currenturl.substr(0,currenturl.indexOf("?")).toLowerCase();
		currenturl = currenturl.substring(currenturl.lastIndexOf('/') + 1);
		currenturl = currenturl.substring(0,currenturl.lastIndexOf('.'));
		return currenturl;
	}
	function cs_showleftfilter(){
		//Hide left filter for all gallery pages, except those where the second element in the page name ('-' delimited) matches 'lifeevents', 'holidays', or 'other_themes'
		var pageid = cs_getpageidfromurl();
		//Change default to true - rudi
		var showfilter = true;
		// show left filter in all theme gallery pages
		if (this.location.href.indexOf('/themes') != -1) {
			showfilter = true;
		}		
		// specific rules about filters in other pages
		if (pageid.indexOf("-")>-1){
			var temp_pageidarray = pageid.split("-");
			if ((temp_pageidarray[1] == 'lifeevents') || (temp_pageidarray[1] == 'holidays') || (temp_pageidarray[1] == 'other_themes')) {
				showfilter = true;
			}
		}
		//Remove filter for spider pages - rudi
		if (this.location.href.indexOf('-themes') != -1) {
			showfilter = false;
		}		
		if (showfilter!= true){
			$('filterleftclosed').setStyle('display','none');
			$('filterleftopen').setStyle('display','none');
			$('csmainfilterlegend2').setStyle('display','none');
			$('csmainfilterlegend1').setStyle('left','624px');
		}
	}
