$(document).ready(function() {
/*  stardard format videos   */	
			$(".stvid").click(function() {
	$.fancybox({
			'padding'		: 0,
			'autoScale'		: false,
			'transitionIn'	: 'none',
			'transitionOut'	: 'none',
			'title'			: this.title,
			'width'		    : 600,
			'height'		: 466,
			'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
			'type'			: 'swf',
			'swf'			: {
			   	 'wmode'		: 'transparent',
				'allowfullscreen'	: 'true'
			}
		});

	return false;
});
			
				$(".insidevid").click(function() {
	$.fancybox({
			'padding'		: 0,
			'autoScale'		: false,
			'transitionIn'	: 'none',
			'transitionOut'	: 'none',
			'titlePosition'	: 'inside',
			'title'			: this.title,
			'width'		    : 425,
			'height'		: 330,
			'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
			'type'			: 'swf',
			'swf'			: {
			   	 'wmode'		: 'transparent',
				'allowfullscreen'	: 'true'
			}
		});

	return false;
});		
			
		/*  WIDE format videos   */		
	$(".widevid").click(function() {
	$.fancybox({
			'padding'		: 0,
			'autoScale'		: false,
			'transitionIn'	: 'elastic',
			'transitionOut'	: 'elastic',
			'titlePosition'	: 'inside',
			'title'			: this.title,
			'width'		    : 640,
			'height'		: 360,
			'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
			'type'			: 'swf',
			'swf'			: {
			   	 'wmode'		: 'transparent',
				'allowfullscreen'	: 'true'
			}
		});

	return false;
});		
		// add images to links  //
	    $("a[href$=.pdf]").after(" <img src='../images/icons/pdf.png' alt='pdf document' class='pdf_icon' />&nbsp;");
		$("a[href$=.doc]").after(" <img src='../images/icons/worddoc.png' alt='word document' class='doc_icon' />&nbsp;");
		$("a[href^=mailto]").after(" <img src='../images/icons/email.png' alt='email link' class='email_link' />&nbsp;");
		//$("#webarticle a[target]").after(" <img src='../images/icons/external_link.png' alt='external link' />");	
	    $("#webarticle a, #footer a").filter(function() {
        return this.hostname && this.hostname !== location.hostname;
         }).after(" <img src='../images/icons/external_link.png' alt='external link' class='ext_link_icon' />&nbsp;");
		 
///  Home page hover event  //
			//move the image in pixel
	var move = -15;
	
	//zoom percentage, 1.2 =120%
	var zoom = 1.2;

	//On mouse over those thumbnail
	$('.featureditem').hover(function() {
		
		//Set the width and height according to the zoom percentage
		width = $('.featureditem').width() * zoom;
		height = $('.featureditem').height() * zoom;
		
		//Move and zoom the image
		$(this).find('img').stop(false,true).animate({'width':width, 'height':height, 'top':move, 'left':move}, {duration:200});
		
		//Display the caption
		$(this).find('div.caption').stop(false,true).fadeIn(200);
	},
	function() {
		//Reset the image
		$(this).find('img').stop(false,true).animate({'width':$('.featureditem').width(), 'height':$('.featureditem').height(), 'top':'0', 'left':'0'}, {duration:100});	

		//Hide the caption
		$(this).find('div.caption').stop(false,true).fadeOut(200);
	});
 
		 
		 
		 	
});


