var mT, signDefault = new Array(), curDay, page=1;

/*///////////////////////////////////////*/
/*////////////// GENERAL ////////////////*/
/*///////////////////////////////////////*/

function messageBox(message,secondsOut) {
	i='messageBox';
	if (mT) clearTimeout(mT);
	mT=null;
	if ($(i) != null) {
		$(i).update(message);
		centreElement (i,1);
		$(i).show();
		mT = setTimeout(function () { $(i).hide(); }, (secondsOut*1000));
	}
	else {
		alert('Message box doesn\'t exist');	
	}
}

function centreElement (e, vert) {
	var theScrolls = document.viewport.getScrollOffsets();
	theLeft = Math.floor(((document.viewport.getWidth())-($(e).getWidth()))/2) + theScrolls[0];
	theTop = Math.floor(((document.viewport.getHeight())-($(e).getHeight()))/2) + theScrolls[1];
	if (theTop < 0) theTop = 0;
	if (vert==1)  {
		$(e).setStyle({ top: '0px' });
		$(e).setStyle({ top: theTop+'px' });
	}
	$(e).setStyle({ left: theLeft+'px' });
	
}

function Select_Value_Set(SelectName, Value) {
  eval('SelectObject = document.' + 
    SelectName + ';');
  for(index = 0; 
    index < SelectObject.length; 
    index++) {
   if(SelectObject[index].value == Value)
     SelectObject.selectedIndex = index;
   }
}

function pageOverlay() {
	var theScrolls = document.viewport.getScrollOffsets();
	pageWidth = document.viewport.getWidth() + theScrolls[0]; pageHeight = document.viewport.getHeight() + theScrolls[1];
	if (pageWidth < $('mainContainer').getWidth()) pageWidth = $('mainContainer').getWidth();
	if (pageHeight < ($('mainContainer').getHeight())) pageHeight = ($('mainContainer').getHeight());
	$('pageOverlay').setStyle({ opacity: '0.85', display: 'block', width:pageWidth+'px', height:pageHeight+'px' });
	$('pageOverlay').show();
}

function showBox(id) {
	pageOverlay();
	centreElement (id,1);
	$(id).show();
	new Draggable(id, { scroll: window });
}

function ord(n) {
	var sfx = ["th","st","nd","rd"];
	var val = n%100;
	return n + (sfx[(val-20)%10] || sfx[val] || sfx[0]);
}

function clearInputBox(i,t,o,c) {
	if (o==1) {
		if ($F(i) == t) $(i).value='';
	}
	else if (o==2) {
		$(i).observe('focus', function () { clearInputBox(i,t,1,c); });
		$(i).observe('blur', function () { clearInputBox(i,t,0,c); });
	}
	else {
		if ($F(i) == '') $(i).value=t;	
	}
	if (c) { $(i).setStyle({ color: c }); }
}

function tabbing() {
	$j("a.tab").click(function () {
		if (curDay != $j(this).attr("title")) {
			$j(".active").removeClass("active");    
			$j(this).addClass("active");    
			$j(".tab-content").slideUp();
			var content_show = $j(this).attr("title"); 
			curDay = $j(this).attr("title")
			$j("#"+content_show).slideDown(); 
		}
	});	
}

function overClass (c) {
	$j(function() {
		$j(c).hover(function(){
			$j(this).addClass('over');
		}, function() {
			$j(this).removeClass('over');
		});
	});
}

function c(i) { // IF ID EXISTS
	if (i != null) return true;
	else return false;
}

function encode_utf8(s) {
	return unescape( encodeURIComponent( s ) );
}

function decode_utf8 (s) {
	return decodeURIComponent( escape( s ) );
}

function handleEnter (field, event, clickButtonId) {
	var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
	if (keyCode == 13) {
		if (clickButtonId != '') {
			var b = $(clickButtonId);
			if (b && typeof(b.click) == 'undefined') {
				b.click = function(){
					var result = true; if (b.onclick) result = b.onclick();
					if (typeof(result) == 'undefined' || result) {
						eval(b.href);
					}
				}
			}
		}
		if (clickButtonId != '' && $(clickButtonId)) {
			if (thisPage == 'gallery') gallerySearch ();
			if (thisPage == 'video') {
				if ($F('searchBox') != '') {
					loadVideoGallery('',1,$F('searchBox'));
				}
				else messageBox('Please enter some text',3);
			}
		} 
		return false;
	}
	else return true;
}

function setUpAllPages () {
	if (c('signUpForm')) {
		$('signUpForm').reset();
		var a=$$('#signUpForm input.textbox');
		a.each(function(n){
			if ($F(n.id) != null && n.id != null) {
				clearInputBox($(n.id),$F(n.id),2);
				signDefault[n.id]=$F(n.id);
			}
		});
		$('register').observe('click', function () {
			var allNodes = Form.serialize("signUpForm");
			var aj1 = new Ajax.Request(pageURL+'/ajaxStuff.php', {method: 'post', parameters: 'emailSignup=1&'+allNodes,onComplete: function(resp) {
				var r = resp.responseText;
				if (r != null && r != '' ) {
					messageBox(r,3);
				}
				if (r == 'Thanks, your details have been added.' ) {
					$('signUpForm').reset();
				}
			}});
		});
	}
	if ($('loginBox') != null) {
		$('loginBox').setStyle({ cursor:'pointer' });
		$('loginBox').observe('click', function () {
			window.location=pageURL+'login.php';
		});
	}
	var ua = navigator.userAgent.toLowerCase();
	if ( ua.indexOf( "chrome" ) != -1 ) {
		$('leftColumn').setStyle({ width: '670px' });	
	}
	if (thisPage!='club_nights') createSCPlayer (192, 187, 'the-cockpit', 'the-cockpit-playlist', 'soundcloud1', 1);
}

function GetBaseName(file) {
	var Parts = file.split('\\');
	if( Parts.length < 2 )
	Parts = file.split('/');
	return Parts[ Parts.length -1 ];
} 

function createSCPlayer (width, height, user, permalink, divID, set, type) {
	if (set) user = user + '/sets';
	if (type == null || type != 'tiny') type = 'main';
	var flashvars = { url: "http://soundcloud.com/"+user+"/"+permalink,color: "cd0065",player_type:type};
	var params = {allowscriptaccess: "always",wmode: "transparent"};
	var attributes = {name: "myPlayer"};
	swfobject.embedSWF("http://player.soundcloud.com/player.swf", divID, width, height, "9.0.0","expressInstall.swf", flashvars, params, attributes);
}

/*///////////////////////////////////////*/
/*/////////////// HOME //////////////////*/
/*///////////////////////////////////////*/

function setUpHome () {
	tabbing();
	dhtmlLoadScript();
	var today=new Date() ;
	var thisDay=today.getDay();
	var myDays = ["sunday","monday","tuesday","wednesday","thursday","friday","saturday","sunday"];
	if ( thisDay != 1) {
		$j("#tabmonday").removeClass("active");
		curDay = myDays[thisDay]+'-listings';
		$j("#tab"+myDays[thisDay]).addClass("active");
		$j(".tab-content").slideUp();
		$j("#"+myDays[thisDay]+'-listings').slideDown();
	}
	else curDay = 'monday-listings';
	if ($('tellFriend') != null) {
		var object = SHARETHIS.addEntry({title:'Cockpit',summary: 'Listings'}, {button:false} );
		var element = $('tellFriend');
		object.attachButton(element);
	}
}


/*///////////////////////////////////////*/
/*/////////////// VIDEO /////////////////*/
/*///////////////////////////////////////*/

function setUpVideo () {
	overClass ('a.arrow');
	var n='searchBox';
	clearInputBox($(n),$F(n),2);
	signDefault[n]=$F(n);
	selectVideo(videoID);
}

function selectVideo(vidID) {
	var flashvars = {clip_id: vidID,server: "vimeo.com",show_title: "1",show_byline: "1",show_portrait: "0",fullscreen: "1",color: "5efcf9"};
	var params = {allowfullscreen: "true",allowscriptaccess: "always",movie: "http://vimeo.com/moogaloop.swf"};
	var attributes = {clip_id: vidID};
	swfobject.embedSWF("http://vimeo.com/moogaloop.swf", "vidBox", "650", "351", "9.0.0","expressInstall.swf", flashvars, params, attributes);
}

function loadVideoGallery(g,p,s) {
	var params;
	if (p == null) p = 1;
	if (s != null) params = 'loadVideoGallery=1&gallery='+g+'&page='+p+'&search='+s;
	else params = 'loadVideoGallery=1&gallery='+g+'&page='+p;
	var aj = new Ajax.Request(pageURL+'ajaxStuff.php', {method: 'post', parameters: params+'&type=videos',onComplete: function(response) {
		var reply = response.responseText.split("||message||");
		if (reply[0] == 'no_results') {
			messageBox('Sorry there were no results',3);
		}
		else {
			$('videos').update(reply[0]);
			if (s != null) { // IF SEARCHING BLOCK OUT GALLERY SCROLLER
				$('gallery-hide').setStyle({ opacity: '0.90', display: 'block', width:$('allVidGalls').getWidth()+'px', height:($('allVidGalls').getHeight())+'px' });
				$('gallery-hide').show();
			}
			selectVideo(reply[1])
		}
	}});
	var aj2 = new Ajax.Updater('videoPages', pageURL+'ajaxStuff.php', {method: 'post', parameters: params+'&type=pages',onComplete: function(response) {
		var reply = response.responseText;
	}});
}

/*///////////////////////////////////////*/
/*////////////// GALLERY ////////////////*/
/*///////////////////////////////////////*/

function setUpGallery () {
	overClass ('a.arrow');
	var n='searchBox';
	clearInputBox($(n),$F(n),2);
	signDefault[n]=$F(n);
}

function gallerySearch () {
	if ($F('searchBox') != '') {
		var aj = new Ajax.Request(pageURL+'ajaxStuff.php', {method: 'post', parameters: 'gallerySearch='+$F('searchBox'),onComplete: function(response) {
			var reply = response.responseText;
			if (reply == 'no_results') {
				messageBox('Sorry there were no results',3);
			}
			else {
				$('galleryThumbs').update(reply);
				$('gallery-hide').setStyle({ opacity: '0.90', display: 'block', width:$('theGalleries').getWidth()+'px', height:($('theGalleries').getHeight()-20)+'px' });
				$('gallery-hide').show();
				$j('.infiniteCarousel').infiniteCarousel();
				var a=$$('#galleryThumbs img');
				var imgID = a[0]['id'];
				largeImage(GetBaseName($(imgID).src));
			}
		}});
	}
	else messageBox('Please enter some text',3);
}

function largeImage(i) {
	$('gallery-image').update('<img src="'+pageURL+'_images/_gallery/_live/_main/'+i+'" width="650" height="351" alt="gallery image" />');	
}


/*///////////////////////////////////////*/
/*/////////////// VENUE /////////////////*/
/*///////////////////////////////////////*/

function setUpVenue () {
	$j(function() {
		$j('.venue-history').jScrollPane();
	});
	$('sendDetails').observe('click', function () {
		var allNodes = Form.serialize("contactForm");
		var aj1 = new Ajax.Request(pageURL+'/ajaxStuff.php', {method: 'post', parameters: 'sendDetails=1&'+allNodes,onComplete: function(resp) {
			var r = resp.responseText;
			if (r != null && r != '' ) {
				messageBox(r,3);
			}
			if (r == 'Thanks, your question has been sent.' ) {
				$('contactForm').reset();
			}
		}});
	});
}


/*///////////////////////////////////////*/
/*/////////////// FAQS //////////////////*/
/*///////////////////////////////////////*/

function setUpFaqs () {
	$('sendDetails').observe('click', function () {
		var allNodes = Form.serialize("faqQuestionForm");
		var aj1 = new Ajax.Request(pageURL+'/ajaxStuff.php', {method: 'post', parameters: 'sendDetails=1&'+allNodes,onComplete: function(resp) {
			var r = resp.responseText;
			if (r != null && r != '' ) {
				messageBox(r,3);
			}
			if (r == 'Thanks, your question has been sent.' ) {
				$('faqQuestionForm').reset();
			}
		}});
	});
}


/*///////////////////////////////////////*/
/*////////////// LISTINGS ///////////////*/
/*///////////////////////////////////////*/

function setUpListings () {
	overClass ('.list-item a img');
	$j("#tabs").tabs();
	$j("a.tab").click(function () {  
		$j(".active").removeClass("active");    
		$j(this).addClass("active"); 
	});
	if ($('tellFriend') != null) {
		var object = SHARETHIS.addEntry({title:'Cockpit',summary: 'Listings'}, {button:false} );
		var element = $('tellFriend');
		object.attachButton(element);
	}
	if (selectListing != null) {
		//showListing (selectListing);
		pageOverlay();
		centreElement ('eventOverlay',1);
	}
}

function showListing (i) {
	pageOverlay();
	$('title').update('');
	$('date').update('');
	$('text').update('');
	$('buyTickets').hide();
	getListing (i);
	centreElement ('eventOverlay',1);
	$('eventOverlay').show();
	if ($('soundcloud1') != null) $('soundcloud1').hide();
	//new Effect.ScrollTo('eventOverlay');
	$('closeBox').observe('click', function () { $('eventOverlay').hide(); $('pageOverlay').hide(); if ($('soundcloud1') != null) $('soundcloud1').show(); });
}

function getListing (i) {
	var aj = new Ajax.Request(pageURL+'ajaxStuff.php', {method: 'post', parameters: 'getListing='+i,onComplete: function(response) {
		var reply = response.responseText.split("||message||");
		$('title').update(reply[0]);
		$('date').update(reply[1]);
		$('text').update(reply[2]);
		$('image').update(reply[3]);
		if (reply[4] != 'none') {
			$('buyTickets').href = reply[4];
			$('buyTickets').show();
		}
		if ($('tellFriend') != null) {
			var object = SHARETHIS.addEntry({title:encode_utf8(reply[0]),summary: encode_utf8(reply[2]),url: pageURL+'listings/'+encode_utf8(reply[5]),icon: encode_utf8(reply[6])}, {button:false,embeds:true} );
			var element = $('tellFriend');
			object.attachButton(element);
		}
		if ($('fbHolder') != null) {
		$('fbHolder').update('<iframe src="http://www.facebook.com/plugins/like.php?href='+pageURL+'listings/'+encode_utf8(reply[5])+'&amp;layout=button_count&amp;show_faces=false&amp;width=160&amp;action=like&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:160px; height:21px;" allowTransparency="true"></iframe>');
		}
		if ($('twHolder') != null) {
		$('twHolder').update('<iframe allowtransparency="true" frameborder="0" scrolling="no" src="http://platform.twitter.com/widgets/tweet_button.html?url='+pageURL+'listings/'+encode_utf8(reply[5])+'" style="width:160px; height:21px;"></iframe>');
		}
	}});
}


function setUpClubs () {
	if ($('tellFriend') != null) {
	var object = SHARETHIS.addEntry({title:'Cockpit',summary: 'Club Nights'}, {button:false} );
	var element = $('tellFriend');
	object.attachButton(element);
	}
	createSCPlayer (192, 293, 'the-cockpit', 'the-cockpit-playlist', 'soundcloud2', 1);
}

function showClub (i) {
	pageOverlay();
	$('title').update('');
	$('date').update('');
	$('text').update('');
	$('buyTickets').hide();
	getClub (i);
	centreElement ('eventOverlay',1);
	$('eventOverlay').show();
	if ($('soundcloud2') != null) $('soundcloud2').hide();
	$('closeBox').observe('click', function () { $('eventOverlay').hide(); $('pageOverlay').hide(); if ($('soundcloud2') != null) $('soundcloud2').show(); });
}

function getClub (i) {
	var aj = new Ajax.Request(pageURL+'ajaxStuff.php', {method: 'post', parameters: 'getClub='+i,onComplete: function(response) {
		var reply = response.responseText.split("||message||");
		$('title').update(reply[0]);
		$('date').update(reply[1]);
		$('text').update(reply[2]);
		$('image2').update(reply[3]);
		if (reply[4] != 'none') {
			$('buyTickets').href = reply[4];
			$('buyTickets').show();
		}
		if ($('tellFriend') != null) {
		var object = SHARETHIS.addEntry({title:encode_utf8(reply[0]),summary: encode_utf8(reply[2]),url: pageURL+'club-nights/'+encode_utf8(reply[5]),icon: encode_utf8(reply[6])}, {button:false,embeds:true} );
		var element = $('tellFriend');
		object.attachButton(element);
		}
		if ($('fbHolder') != null) {
		$('fbHolder').update('<iframe src="http://www.facebook.com/plugins/like.php?href='+pageURL+'listings/'+encode_utf8(reply[5])+'&amp;layout=button_count&amp;show_faces=false&amp;width=160&amp;action=like&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:160px; height:21px;" allowTransparency="true"></iframe>');
		}
		if ($('twHolder') != null) {
		$('twHolder').update('<iframe allowtransparency="true" frameborder="0" scrolling="no" src="http://platform.twitter.com/widgets/tweet_button.html?url='+pageURL+'listings/'+encode_utf8(reply[5])+'" style="width:160px; height:21px;"></iframe>');
		}
	}});
}


/*///////////////////////////////////////*/
/*////////////// EVENTS ///////////////*/
/*///////////////////////////////////////*/

function setUpEvents () {
	if ($('tellFriend') != null) {
	var object = SHARETHIS.addEntry({title:'Cockpit',summary: 'Listings'}, {button:false} );
	var element = $('tellFriend');
	object.attachButton(element);
	}
}

function showEvent (i) {
	pageOverlay();
	$('title').update('');
	$('date').update('');
	$('text').update('');
	$('gallery').update('');
	getEvent (i);
	centreElement ('eventOverlay',1);
	if ($('soundcloud1') != null) $('soundcloud1').hide();
	$('eventOverlay').show();
	$('closeBox').observe('click', function () { $('eventOverlay').hide(); $('pageOverlay').hide(); if ($('soundcloud1') != null) $('soundcloud1').show(); });
}

function getEvent (i) {
	var aj = new Ajax.Request(pageURL+'ajaxStuff.php', {method: 'post', parameters: 'getEvent='+i,onComplete: function(response) {
		var reply = response.responseText.split("||message||");
		$('title').update(reply[0]);
		$('date').update(reply[1]);
		$('text').update(reply[2]);
		$('image').update(reply[3]);
		if (reply[4]=='none') {
			$('gallery').hide();
		}
		else {
			$('gallery').show();
			$('gallery').update(reply[4]);
		}
		if ($('tellFriend') != null) {
		var object = SHARETHIS.addEntry({title:encode_utf8(reply[0]),summary: encode_utf8(reply[2]),url: pageURL+'listings/'+encode_utf8(reply[5]),icon: encode_utf8(reply[6])}, {button:false,embeds:true} );
		var element = $('tellFriend');
		object.attachButton(element);
		}
		if ($('fbHolder') != null) {
		$('fbHolder').update('<iframe src="http://www.facebook.com/plugins/like.php?href='+pageURL+'listings/'+encode_utf8(reply[5])+'&amp;layout=button_count&amp;show_faces=false&amp;width=160&amp;action=like&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:160px; height:21px;" allowTransparency="true"></iframe>');
		}
		if ($('twHolder') != null) {
		$('twHolder').update('<iframe allowtransparency="true" frameborder="0" scrolling="no" src="http://platform.twitter.com/widgets/tweet_button.html?url='+pageURL+'listings/'+encode_utf8(reply[5])+'" style="width:160px; height:21px;"></iframe>');
		}
	}});
}


/*///////////////////////////////////////*/
/*//////////// COMPETITIONS /////////////*/
/*///////////////////////////////////////*/

function setUpCompetitions () {
	if ($('tellFriend') != null) {
	var object = SHARETHIS.addEntry({title:'Cockpit',summary: 'Competitions'}, {button:false} );
	var element = $('tellFriend');
	object.attachButton(element);
	}
	if (selectComp != null) showCompetition (selectComp);
	if ($('compID') != null) {
		$('enterButton').observe('click', sendCompEntry);
	}
}

function showCompetition (i) {
	pageOverlay();
	$('title').update('');
	$('date').update('');
	$('text').update('');
	if ($('compID') != null) {
		$('completeText').update('');
		$('userName').value = '';
		$('userEmail').value = '';
		$('userAnswer').value = '';
		$('compID').value = '';
	}
	getCompetition (i);
	centreElement ('competitionsOverlay');
	$('competitionsOverlay').show();
	if ($('soundcloud1') != null) $('soundcloud1').hide();
	$('closeBox').observe('click', function () { $('competitionsOverlay').hide(); $('pageOverlay').hide(); if ($('soundcloud1') != null) $('soundcloud1').show(); });
}

function getCompetition (i) {
	var aj = new Ajax.Request(pageURL+'ajaxStuff.php', {method: 'post', parameters: 'getCompetition='+i,onComplete: function(response) {
		var reply = response.responseText.split("||message||");
		$('title').update(reply[0]);
		$('date').update(reply[1]);
		$('text').update(reply[2]);
		$('image').update(reply[3]);
		$('compID').value = reply[7];
		$('enterButton').href='mailto:'+reply[4];
		if (i==9) {
			$('completeForm').hide();
			$('enterButton').stopObserving('click');
			$('enterButton').observe('click', function() { window.location.href= 'http://www.thecockpit.co.uk/_files/Entry_Form_2010.doc'});
			$('enterButton').href='http://www.thecockpit.co.uk/_files/Entry_Form_2010.doc';
		}
		else {
			$('completeForm').show()
			if ($('compID') != null) {
				$('enterButton').stopObserving('click');
				$('enterButton').observe('click', sendCompEntry);
			}
		}
		if ($('tellFriend') != null) {
		var object = SHARETHIS.addEntry({title:encode_utf8(reply[0]),summary: encode_utf8(reply[2]),url: pageURL+'competitions/'+encode_utf8(reply[5]),icon: encode_utf8(reply[6])}, {button:false,embeds:true} );
		var element = $('tellFriend');
		object.attachButton(element);
		}
		if ($('fbHolder') != null) {
		$('fbHolder').update('<iframe src="http://www.facebook.com/plugins/like.php?href='+pageURL+'competitions/'+encode_utf8(reply[5])+'&amp;layout=button_count&amp;show_faces=false&amp;width=160&amp;action=like&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:160px; height:21px;" allowTransparency="true"></iframe>');
		}
		if ($('twHolder') != null) {
		$('twHolder').update('<iframe allowtransparency="true" frameborder="0" scrolling="no" src="http://platform.twitter.com/widgets/tweet_button.html?url='+pageURL+'competitions/'+encode_utf8(reply[5])+'" style="width:160px; height:21px;"></iframe>');
		}
	}});
}

function sendCompEntry () {
	var allNodes = Form.serialize('completeForm');
	if ($F('userName') && $F('userEmail') && $F('userAnswer')) {
		var aj = new Ajax.Request(pageURL+'ajaxStuff.php', {method: 'post', parameters: 'enterCompetition=1&'+allNodes,onComplete: function(response) {
			var reply = response.responseText;
			$('completeForm').reset();
			$('completeText').update('Thanks, your details have been entered.');
			setTimeout(function () { $('completeText').update('') }, 3000);
		}});
	}
	else {
		$('completeText').update('Please enter all fields');
	}
}


/*///////////////////////////////////////*/
/*/////////////// LOGIN /////////////////*/
/*///////////////////////////////////////*/

function setUpLogin () {
	$('loginForm').reset();
	var a=$$('#loginForm input');
	a.each(function(n){
		if ($F(n.id) != null && n.id != null) {
			clearInputBox($(n.id),$F(n.id),2);
			signDefault[n.id]=$F(n.id);
		}
   	});
	$('submitSignup').observe('click',loginSubmit);
}

function loginSubmit () {
	var allNodes = Form.serialize("loginForm");
	var aj = new Ajax.Request(pageURL+'ajaxStuff.php', {method: 'post', parameters: 'loginSubmit=1&'+allNodes,onComplete: function(response) {
			var response = response.responseText;
			if (response != null && response != '' ) {
				messageBox(response,3);
			}
			if (response == 'You have been logged in.' ) {
				setTimeout(window.location=pageURL+'admin.php',2000);
			}
		}});
}

function adminLogout () {
	new Ajax.Request(pageURL+'ajaxStuff.php', { method: 'post', parameters: 'adminLogout=1',onComplete: function(response) {
		var response = response.responseText;
		setTimeout(window.location=pageURL+'login.php',2000);
	}});
}

function myPopup(id) {
	
	window.open( $(id).href, "myWindow", "status = 1, height = 300, width = 500" );
	
}


/*///////////////////////////////////////*/
/*///////////// OBSERVERS ///////////////*/
/*///////////////////////////////////////*/

$j(document).ready(function(){ 
	if (thisPage=='video') setUpVideo();
	if (thisPage=='events') setUpEvents();
	if (thisPage=='gallery') setUpGallery();
	if (thisPage=='faqs') setUpFaqs();
	if (thisPage=='venue') setUpVenue();
	if (thisPage=='listings') setUpListings();
	if (thisPage=='club_nights') setUpClubs();
	if (thisPage=='competitions') setUpCompetitions();
	if (thisPage=='home') setUpHome();
	setUpAllPages ();
});
