// The following is a jQuery implementation for the javascript behaviour used with the site

$(function() {
		
	//Adding the default value (prompt) to the login fields
	$('.membersBar .loginField').defaultvalue('Email or Member No.');
	$('.membersBar .passwordField').defaultvalue('Password');

	//Adding the transparency hover state to the appropriate buttons
	$('.loginButton, .logoutButton, .membersBar a img, .keyLooks a img').hover(
		function() {
			$(this).css("opacity", 0.6);
		},
		function() {
			$(this).css("opacity", 1);
		}
	);

	$('.content.dlsVideoListing .contentInner').css({'width':'100%'});
		
	//Adding the scroll panel functionality to the appropriate divs
	$(".content.dlsVideoListing .videoItemBox").scrollpanel($(".content"), $(".submenuContainer"), ".videoItem", 235, 235, false, true, "scrollPanel");
	
	// using javascript to insert plusTip for Prizes page
	var prizesClassMatch = new String($('.contentBox').children('.content').attr('class'));
	if(prizesClassMatch.match(/prizes/)){
		var plustipInsert = '<a href="#" class="plusTip plusTip1"><span><img src="/Images/elements/plusTipIcon.gif" alt="+" /><strong>5 NIGHTS ACCOMMODATION AND $2000 SPENDING MONEY</strong></span></a>';
		var plustipInsert2 = '<a href="#" class="plusTip plusTip2"><span><img src="/Images/elements/plusTipIcon.gif" alt="+" /><strong>RETURN AIRFARES TO PARIS FOR TWO</strong></span></a>';
		$('.contentInner', this).after(plustipInsert);
		$('.contentInner', this).after(plustipInsert2);
	}
	$('.plusTip').click(function(){ return false; });

$('.videoThumbnail a').hover(function(){
		$('img', this).css({'opacity':0.8});
	}, function(){
		$('img', this).css({'opacity':1});
	});
$('.viewDetailButton, .submitButton, .homeContent .col1 h2 a img').hover(function(){
		$(this).css({'opacity':0.8});
	}, function(){
		$(this).css({'opacity':1});
	});
	
	// DLS pages
	$('.screenNameHelp').hover(function(){
		$('.screenName').fadeIn(100);
	}, function(){
		$('.screenName').fadeOut(100);
	});
	$('.youTubeURLHelp').hover(function(){
		$('.youTubeURL').fadeIn(100);
	}, function(){
		$('.youTubeURL').fadeOut(100);
	});
	
	//Add the hover state to the plus tips
	$(".plusTip").hover(
		function() {
			var $this = $(this).children("span");
			var plusImg = $this.children("img");
			plusImg.stop(true, false);
			plusImg.animate({opacity: "0"}, "fast");
			$this.stop(true, false);
			$this.animate({width: $this.children("strong").outerWidth()+15 + "px", marginLeft: '-'+$this.children('strong').outerWidth()+'px' }, "fast");
		},
		function() {
			var $this = $(this).children("span");
			var plusImg = $this.children("img");
			plusImg.stop(true, false);
			plusImg.animate({opacity: "1"}, "fast");
			$this.stop(true, false);
			$this.animate({width: "13px", marginLeft: 0+'px' }, "fast");
		}
	);

});