$(document).ready(function() {
	$("#videoPopup, #sitemapVideoPopup").click( function() {
		
		currentscrollpos = 0
		
		$("<div class='blackout'></div>").hide().css("opacity",0.8).appendTo('body').delay(300).fadeIn( function() {
			$("<div class='promoVideo'></div>").hide().appendTo('#loginform');
			$("<div class='promoContainer'><img class='closePromo' src='/images/home/bondholder-login/password_close.png' width='30' height='30' alt='close' /></div>").appendTo("div.promoVideo");
			$(".promoVideo").slideToggle( function() {
			$('.promoContainer').prepend('<object id="player" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" name="player" width="650" height="350"><param name="movie" value="/jwplayer/player.swf" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="wmode" value="opaque" /><param name="flashvars" value="file=5min.flv&image=preview.jpg" /><embed type="application/x-shockwave-flash" style="z-index:1" id="player2" name="player2" src="/jwplayer/player.swf" width="650" height="350" allowscriptaccess="always" wmode="opaque" allowfullscreen="true" flashvars="file=5min.flv&autostart=true" /></object><p style="margin-top:5px;">For an explanation of the Holiday Property Bond see "<a href="/howitworks">How it works</a>".</p>');
        	});
		});
		
		$("html, body").animate({ scrollTop: 0 }, 500);
	
	});
	
	
	$("img.closePromo").live('click', function() {
		$(".promoVideo").slideToggle( function() {
			$(".promoContainer").find("object").remove();
			$(".promoContainer").remove();
			$(".promoVideo").remove();
			$(".blackout").fadeOut( function() {
				$(".blackout").remove();
			})
        });
 	});
});
