﻿$(document).ready(function(){
	$('a.iframe').fancybox({
		'width'			: '90%',
		'height'		: '90%',
        	'autoScale'     	: false,
        	'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'			: 'iframe'
	});
	
	$("a.movie").fancybox({
	    	'padding'           : 2,
	    	'width'			: 650,
	    	'height'		: 410,
        	'autoScale'     	: true,
        	'transitionIn'		: 'none',
		'transitionOut'		: 'none'
	});
	
	$("a.youtube").click(function(){
	$.fancybox({
			'padding'		: 0,
			'autoScale'		: false,
			'transitionIn'	: 'none',
			'transitionOut'	: 'none',
			'title'			: this.title,
			'width'		: 680,
			'height'		: 495,
			'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
			'type'			: 'swf',
			'swf'			: {
			   	 'wmode'		: 'transparent',
				'allowfullscreen'	: 'true'
			}
		});

		return false;
	});
	

});


function wFlash(id,movie)
{
	var params = {};
       	var flashvars = {};
       	var url = movie;
       	
       	params.allowfullscreen = "true";
       	params.allowscriptaccess = "true";
        params.wmode = "transparent"; 
                            
       	swfobject.embedSWF(url, id, "100%", "100%", "10.0.0" ,false,flashvars,params);
}

jQuery.fn.flowScroll = function() 
{
	this.find("a[href^=#]").click(function() {
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
		    && location.hostname == this.hostname) {
		      var $target = $(this.hash);
		      $target = $target.length && $target 
		      || $('[name=' + this.hash.slice(1) +']');
		      if ($target.length) {
		        var targetOffset = $target.offset().top - 94;
		        $('html,body')
		        .animate({scrollTop: targetOffset},{duration: 600, easing:'easeInSine'});
		       return false;
		      }
		    }
	     });
}

jQuery.fn.emailLinks = function()
{
    	try{
		var sEmail = this.text();
		sEmail = sEmail.replace("[at]","@").toLowerCase();
		this.hide();
		this.after('<a href="mailto:' + sEmail + '">' + sEmail + '</a>');
		this.remove();

	}
	catch(e){ }

}
