/**
 * @author silvia rebelo
 */

function initialiseNyroModal(){
	
	//modal sizes
	var width = 640; //425
	var height = 385; //375		

	//Settings
	$.nyroModalSettings({
	    processHandler: function(settings) {	
	      var from = settings.from;
		  var modalType =  $(from).children('.modalType').html();
		  var nWidth = parseInt($(from).children('.modalWidth').html());
		  var nHeight = parseInt($(from).children('.modalHeight').html());
		  if(nWidth != 0) 	width = nWidth; 	
		  if(nHeight != 0)  height = nHeight; 	
	      if (from && from.href && from.href.indexOf('http://www.youtube.com/watch?v=') == 0 && modalType == 'VIDEO_URL') {				  
	        $.nyroModalSettings({
	          type: 'swf',
	          height: height,
	          width: width,
	          url: from.href.replace(new RegExp("watch\\?v=", "i"), 'v/')+"&rel=0&showinfo=0&color1=0x000000&color2=0x000000&border=0"
	        });
	      } else 
		  if (from && from.href && modalType == 'IFRAME_URL'){
		  	$.nyroModalSettings({
		        type: 'iframe',
		        wrap:{
					iframe: '<div class="wrapperIframe"></div>'
				}
	        });
		  } else {
		  	$.nyroModalSettings({
		  		type: 'image'
			});
		  }
	    }
	  });
	//Init	  
	$('.zoomImage a').nyroModal();		
}



// colour overlay for portfolio items
function colourImageOverlay(pageType){
	
	if(pageType=="h_large" || pageType=="v_large"){
		$(".zoomImageContain").hover(function(){		
			$(this).css("background", "#FF0099");
			var image = $(this).children("a").children("img");
			image.stop().animate({opacity:'0.5'},200);
			$(this).children(".zoomImageTitle").stop().animate({bottom:'30px'},200);
		}, function(){
			$(this).css("background", "none");	
			var image = $(this).children("a").children("img");
			image.stop().animate({opacity:'1'},200);
			$(this).children(".zoomImageTitle").stop().animate({bottom:'0px'},200);
		});	
	}	
}
