// JavaScript - For WMS pages

$(document).ready(function(){
    
    // *** Complex jQuery Sliders for homepage ***
    if($('.sliders').length){
		// Image Slide with overlay
		
		$('#top-scrollable').scrollable({ circular: true, speed: 1000, next: ".topnext", prev: ".topprev" }).autoscroll({ autoplay: true, interval: 6000 }).navigator();
		
		// Pointer Slider
		
		$('#bottom-scrollable').scrollable({ circular: false, speed: 1000 });
		
		$('.navi a').each(function(){
			var anchorIndex = $(this).index() + 1;
			$(this).text(anchorIndex); 
		});	
		
		var topapi = $("#top-scrollable").data("scrollable");
		var bottapi = $("#bottom-scrollable").data("scrollable");
		
		topapi.onBeforeSeek(function(event, target){
			topapi.stop();
			topapi.play();
			bottapi.seekTo(target);
			$('#bottom-scrollable span').removeClass('active');
			$('#bottom-scrollable span:eq(' + target + ')').addClass('active');
		});
	}
	
	// Newsletter Box
	$('#newsletter_email').val('Enter email address here');	
	$('#newsletter_email').focus(function(){
		var currVal = $('#newsletter_email').val();
		if(currVal=='Enter email address here'){
			$(this).val('');
		} else {
			$(this).val(currVal);
		}
	});
	$('#newsletter_email').blur(function(){
		var currVal = $('#newsletter_email').val();
		if(currVal==''){
			$(this).val('Enter email address here');
		} else {
			$(this).val(currVal);
		}
	});
	
});

var flashvars = {};
flashvars.flvURL = "http://download.polypipe.com/wms/Jasons-vox-pop_1_1.flv";
flashvars.imageURL = "../wms/images/video-img.jpg";
var params = {};
var attributes = {};
swfobject.embedSWF("../flash/videoplayer.swf", "video-flashdiv", "220", "165", "9.0.0", false, flashvars, params, attributes);
