$(function() {

$(".video-entries li a").click(function(){
			$(".video-entries li div").removeClass("active");
    $(this).parent().addClass("active");
				return false;
																																								}
);
});

// Create Videos

function createVideo( videoURL) {
			$('#video').html( '<object id="charts10" type="application/x-shockwave-flash" style="width: 480px; height: 290px;" data="'+ videoURL +'"><param name="quality" value="high"><param name="wmode" value="transparent"><param name="autoplay" value="true"><param name="movie" value="'+ videoURL +'"></object> ');

	}

// Create Video Titles

function createVideoTitle( videoTitle) {
			$('#now-playing').html( '<p>'+ videoTitle +'</p>');

	} 

// Videos

$(function () {
			
			$('.video-entries li a').click(function () {
				
						createVideo( $(this).attr('href') );
						createVideoTitle( $(this).attr('title') );
						
						$(".video-entries li div").removeClass("active");
						$(this).parent().addClass("active");
						
						return false;
					})
			.filter(':first').click();
		});

// Initiate scrollbars

$(function()
			{
				$('#scroller').jScrollPane();
				$('#galleryScroll').jScrollPane();
				$('#scroller').jScrollPane({showArrows:false});
				$('#galleryScroll').jScrollPane({showArrows:false});
				$('#scroller').jScrollPane({scrollbarWidth:15, scrollbarMargin:10});
				$('#galleryScroll').jScrollPane({scrollbarWidth:15, scrollbarMargin:10});
                

			});

// Schedule Day Selector

$(function () {
			var tabContainers = $('div#scheduleMonth > div');
			tabContainers.hide().filter(':first').show();
			
			$('ul#selectDay li a').click(function () {
				tabContainers.hide();
				tabContainers.filter(this.hash).show();
				$('ul#selectDay li a').removeClass('active');
				$(this).addClass('active');
				return false;
			}).filter(':first').click();
		});

												
//swfobject embedding the flash

$(function() {     
												$('.topLeft').flash({   
												swf: 'http://wakestock.ae/swf/rider.swf', width: '600', height: '270', wmode: 'transparent',
												flashvars: {   name1: 'jQuery',   name2: 'SWFObject',   name3: 'Plugin'   }   
												}); 
												
												$('.topRight').flash({   
												swf: 'http://wakestock.ae/swf/rockers.swf', width: '270', height: '187', wmode: 'transparent',
												flashvars: {   name1: 'jQuery',   name2: 'SWFObject',   name3: 'Plugin'   }   
												});
												
												$('.singer').flash({   
												swf: 'http://wakestock.ae/swf/singer2.swf', width: '260', height: '270', wmode: 'transparent',
												flashvars: {   name1: 'jQuery',   name2: 'SWFObject',   name3: 'Plugin'   }   
												});
												
												$('#band1').flash({   
												swf: 'http://www.youtube.com/v/V9twbBh2Hd0&hl=en_GB&fs=1&', width: '235', height: '189', wmode: 'transparent', allowfullscreen: '1',
												flashvars: {   name1: 'jQuery',   name2: 'SWFObject',   name3: 'Plugin'   }   
												});
												
												$('#band2').flash({   
												swf: 'http://www.youtube.com/v/Q2Ebc0bnD_Y&hl=en_GB&fs=1&', width: '235', height: '189', wmode: 'transparent', allowfullscreen: '1',
												flashvars: {   name1: 'jQuery',   name2: 'SWFObject',   name3: 'Plugin'   }   
												});
												
												$('#band3').flash({   
												swf: 'http://www.youtube.com/v/NjtWjNxmvJs&hl=en_GB&fs=1&', width: '235', height: '189', wmode: 'transparent', allowfullscreen: '1',
												flashvars: {   name1: 'jQuery',   name2: 'SWFObject',   name3: 'Plugin'   }   
												});
												
												$('#band4').flash({   
												swf: 'http://www.youtube.com/v/R6hRPL2y5hk&hl=en_GB&fs=1&', width: '235', height: '189', wmode: 'transparent', allowfullscreen: '1',
												flashvars: {   name1: 'jQuery',   name2: 'SWFObject',   name3: 'Plugin'   }   
												});
												
												$('#band5').flash({   
												swf: 'http://www.youtube.com/v/1IL9LZIT5CQ&hl=en_GB&fs=1&', width: '235', height: '189', wmode: 'transparent', allowfullscreen: '1',
												flashvars: {   name1: 'jQuery',   name2: 'SWFObject',   name3: 'Plugin'   }   
												});
												
												$('#parkVid').flash({   
												swf: 'http://video.mpora.com/ep/aOdOKOuxO/', width: '235', height: '189', wmode: 'transparent', allowfullscreen: '1',
												flashvars: {   name1: 'jQuery',   name2: 'SWFObject',   name3: 'Plugin'   }   
												});

										});

// drop-down menu

$(function(){

	$("ul#nav li a").mouseover(function() { 

		$(this).parent().find("ul.subnav").slideDown('fast').show();

		$(this).parent().hover(function() {
		}, function(){
			$(this).parent().find("ul.subnav").slideUp('slow');
		});
		
		$("ul#nav li.riders a").mouseover(function() { 

		$(this).parent().find("div.ridersnav").slideDown('fast').show();

		$(this).parent().hover(function() {
		}, function(){
			$(this).parent().find("div.ridersnav").slideUp('slow');
		});

		//Following events are applied to the trigger (Hover events for the trigger)
		}).hover(function() {
			$(this).addClass("subhover"); //On hover over, add class "subhover"
		}, function(){	//On Hover Out
			$(this).removeClass("subhover"); //On hover out, remove class "subhover"
	});

});
	});

// Nav Rider thumbs

$(function(){
$('.ridersnav li a').hover(function() {
	$('div#riderThumb').show();
	}, function() {
	$('div#riderThumb').hide();
	});
	});

$(function(){
$('#thAE').hover(function() {
	$('div#riderThumb').html("<img src='http://www.wakestock.ae/images/th-aerrington.jpg'/><p>Age:&nbsp;21</p><p>From: USA</p>");
		}, function() {
	$('div#riderThumb').html("");
});
$('#thRM').hover(function() {
	$('div#riderThumb').html("<img src='http://www.wakestock.ae/images/th-rmalinoski.jpg'/><p>Age: 26</p><p>From: USA</p>");
		}, function() {
	$('div#riderThumb').html("");
});
$('#thAW').hover(function() {
	$('div#riderThumb').html("<img src='http://www.wakestock.ae/images/th-awing.jpg'/><p>Age: 27</p><p>From: AUS</p>");
		}, function() {
	$('div#riderThumb').html("");
});
$('#thAAR').hover(function() {
	$('div#riderThumb').html("<img src='http://www.wakestock.ae/images/th-arathy.jpg'/><p>Age: 21</p><p>From: CAN</p>");
		}, function() {
	$('div#riderThumb').html("");
});
$('#thAR').hover(function() {
	$('div#riderThumb').html("<img src='http://www.wakestock.ae/images/th-areed.jpg'/><p>Age: 22</p><p>From: AUS</p>");
		}, function() {
	$('div#riderThumb').html("");
});
$('#thCC').hover(function() {
	$('div#riderThumb').html("<img src='http://www.wakestock.ae/images/th-ccornaro.jpg'/>");
		}, function() {
	$('div#riderThumb').html("");
});
$('#thJW').hover(function() {
	$('div#riderThumb').html("<img src='http://www.wakestock.ae/images/th-jwebb.jpg'/><p>Age: 22</p><p>From: AUS</p>");
		}, function() {
	$('div#riderThumb').html("");
});
$('#thJY').hover(function() {
	$('div#riderThumb').html("<img src='http://www.wakestock.ae/images/th-jyoung.jpg'/>");
		}, function() {
	$('div#riderThumb').html("");
});
$('#thDN').hover(function() {
	$('div#riderThumb').html("<img src='http://www.wakestock.ae/images/th-dnott.jpg'/><p>Age: 25</p><p>From: UK</p>");
		}, function() {
	$('div#riderThumb').html("");
});
$('#thDH').hover(function() {
	$('div#riderThumb').html("<img src='http://www.wakestock.ae/images/th-dharf.jpg'/><p>Age: 25</p><p>From: USA</p>");
		}, function() {
	$('div#riderThumb').html("");
});
$('#thDF').hover(function() {
	$('div#riderThumb').html("<img src='http://www.wakestock.ae/images/th-dfriday.jpg'/><p>Age: 23</p><p>From: USA</p>");
		}, function() {
	$('div#riderThumb').html("");
});
$('#thDS').hover(function() {
	$('div#riderThumb').html("<img src='http://www.wakestock.ae/images/th-dsmith.jpg'/><p>Age: 25</p><p>From: AUS</p>");
		}, function() {
	$('div#riderThumb').html("");
});
$('#thPS').hover(function() {
	$('div#riderThumb').html("<img src='http://www.wakestock.ae/images/th-psoven.jpg'/><p>Age:&nbsp;20</p><p>From: USA</p>");
		}, function() {
	$('div#riderThumb').html("");
});
$('#thMR').hover(function() {
	$('div#riderThumb').html("<img src='http://www.wakestock.ae/images/th-mrossiter.jpg'/><p>Age: ?</p><p>From: ?</p>");
		}, function() {
	$('div#riderThumb').html("");
});
$('#thHC').hover(function() {
	$('div#riderThumb').html("<img src='http://www.wakestock.ae/images/th-hclifford.jpg'/><p>Age: 17</p><p>From: AUS</p>");
		}, function() {
	$('div#riderThumb').html("");
});
$('#thND').hover(function() {
	$('div#riderThumb').html("<img src='http://www.wakestock.ae/images/th-ndavies.jpg'/><p>Age:&nbsp;20</p><p>From: UK</p>");
		}, function() {
	$('div#riderThumb').html("");
});
$('#thTH').hover(function() {
	$('div#riderThumb').html("<img src='http://www.wakestock.ae/images/th-thansen.jpg'/><p>Age: 24</p><p>From: USA</p>");
		}, function() {
	$('div#riderThumb').html("");
});
$('#thNB').hover(function() {
	$('div#riderThumb').html("<img src='http://www.wakestock.ae/images/th-nbutler.jpg'/><p>Age: 17</p><p>From: UK</p>");
		}, function() {
	$('div#riderThumb').html("");
});
$('#thAA').hover(function() {
	$('div#riderThumb').html("<img src='http://www.wakestock.ae/images/th-aadkison.jpg'/><p>Age: 29</p><p>From: USA</p>");
		}, function() {
	$('div#riderThumb').html("");
});
});


// external links

function externalLinks() {  
 if (!document.getElementsByTagName) return;  
 var anchors = document.getElementsByTagName("a");  
 for (var i=0; i<anchors.length; i++) {  
   var anchor = anchors[i];  
   if (anchor.getAttribute("href") &&  
       anchor.getAttribute("rel") == "external")  
     anchor.target = "_blank";  
 }  
}  
window.onload = externalLinks;

// Clear

function clearField(thefield) {
		if (thefield.defaultValue==thefield.value)
		thefield.value = ""
	} 
	
	// Photos
	
	$(document).ready(function(){

	$(".riderThumbs li a").click(function(){
	
		var largePath = $(this).attr("href");
		var largeAlt = $(this).attr("title");
		
		$("#largeImg").attr({ src: largePath, alt: largeAlt });
	return false;
	});
	
});
	
// Form thanks

$(function(){
$('input#btnSend').click(function() {
	$('#Message p').show();
	});
	});

// Initiate PrettyPhoto

$(document).ready(function(){
			$("a[rel^='prettyPhoto']").prettyPhoto();
		});
