/**
 * jquery.placeholder.js
 * A Simple jQuery Placeholder Plugin
 * A plugin to clear/restore the default values of form elements
 * @author: Ben Tadiar <ben@bentadiar.co.uk>
 * @version: 0.1
 */
(function($){
	$.fn.placeholder = function()
	{
		this.focus(function(){ 
			if($(this).val() == $(this).attr('placeholder')){
				$(this).val('');
			}
		});
		this.blur(function(){
			if($(this).val() == ''){
				$(this).val($(this).attr('placeholder'));
			}
		});
	};
})( jQuery );


/**
 * common.js
 * Global JS functionality for Assembly Studios
 * @author Assembly Studios Ltd
 */
$(function(){
	$('#search-form input[type="text"]').placeholder();
	$('.projectItem, .servicesoverviewhubapp-hub li a').hover(
		function(){
			$(this).children('img').stop().animate({opacity : 0.75}, 200);
		},
		function(){
			$(this).children('img').stop().animate({opacity : 1.00}, 200);
		}
	);
	
	$('.hubProjectItem').hover(
			function(){
				$(this).stop().animate({opacity : 0.75}, 200);
			},
			function(){
				$(this).stop().animate({opacity : 1.00}, 200);
			}
		);
	
	$('.homeProjectItem').hover(
			function(){
				$(this).stop().animate({opacity : 0.75}, 200);
			},
			function(){
				$(this).stop().animate({opacity : 1.00}, 200);
			}
		);
	
	$('.hubRollImageItem').hover(
			
			function(){
				$("#im2", this).css({
					'display':'block',
					'opacity':0
				}) 
				$("#im2", this).animate({opacity : 1}, 200);
			},
			
			function(){
				$("#im2", this).stop().animate({opacity : 0}, 200);
			}
			
		);

})


var flashMovieArray = [];
function regFlashVideo( flID )
{
	flashMovieArray.push( flID );
}

$(window).resize(function(){
	
	
	for (i=0;i<=flashMovieArray.length;i++)
	{
		var flID = flashMovieArray[i];
		var w = $('#'+flID).parent().parent().width();
		var h = w / 1.243;
		
		var flMovie = document.getElementById(flID);
		$('#'+flID).css('width',w);
		$('#'+flID).css('height',w);
		
		//flMovie.doVidSize(w);
	
	}

})


