/*
 * Author => Company       : Prodo Ltd
 *        => Website       : http://www.prodo.com
 * Code   => Last Modified : 03 June 2010
 */

$(function() {
	
	/*
	 * External Links
	 */
	$('a[rel=external]').click(function(e) {
		open(this.href);
		e.preventDefault();
	}).attr('title', 'Opens in a new window');
	
	/*
	 * Lists >> Last Item
	 */
	$('li:last-child').addClass('last-item');
	
	/*
	 * Hover Boxes
	 */
	$('.boxes .box').hover(function() {
		$('a span', this).stop().animate({top:'0'}, 500);
	}, function() {
		$('a span', this).stop().animate({top:'85px'}, 300).animate({top:'83px'}, 100);
	});
	
	/*
	 * FancyBox
	 */
	$('a[rel=modal]').fancybox({
		autoScale     : false,
		height        : '80%',
		titleShow     : false,
		transitionIn  : 'fade',
		transitionOut : 'elastic',
		type          : 'iframe',
		width         : '80%'
	});
	
	$('a.video').fancybox({
		autoScale     : false,
		frameHeight   : '320',
		frameWidth    : '420',
		titleShow     : false,
		transitionIn  : 'fade',
		transitionOut : 'elastic',
		type          : 'iframe'
	});
	
	/*
	 * Video
	 */
	if($('div.video').length > 0) {

		$('div.video').flash({
			flashvars : {
				autostart : true,
				file  : 'http://plumlife.live.mandogroup.com/Video/storage/media/plumlife_c200.flv',
				volume    : '50'
			},
			height    : '324',
			swf       : 'http://plumlife.live.mandogroup.com/Video/storage/player.swf',
			width     : '400'
		});
		
	}

         /* 
	  * temp code for talbot Video  - used full url to solve path issues quickly 
	  * http://www.plumlife.co.uk/Virtual-Tours/TalbotRoad.aspx
	  */

	if($('div.videotalbot').length > 0) {

		$('div.videotalbot').flash({
			flashvars : {
				autostart : true,
				file  : 'https://s3-eu-west-1.amazonaws.com/prododigital/Plumlife%2FComp_music_02.f4v',
				volume    : '50'
			},
			height    : '200',
			swf       : 'http://www.plumlife.co.uk/Video/storage/player.swf',
			width     : '356'
		});
		
	}

	
    // ASP.NET Custom Validation [BEGIN]
       var OriginalValidatorUpdateDisplay = null;
       
       function NewValidatorUpdateDisplay(val) {
              OriginalValidatorUpdateDisplay(val);
              
              if (val.controltovalidate) {
                     if (val.isvalid) {
                           $('#' + val.controltovalidate).removeClass('required')
                     }
                     else {
                           $('#' + val.controltovalidate).addClass('required');
                     }
              }
       }
       
       if (typeof (ValidatorUpdateDisplay) == 'function') {
              OriginalValidatorUpdateDisplay = ValidatorUpdateDisplay;
              ValidatorUpdateDisplay = NewValidatorUpdateDisplay;
       }
       // ASP.NET Custom Validation [END]

	
});


