// JavaScript Document

// get the domain name
var dn = document.domain;

jQuery.noConflict();
jQuery(document).ready(function($) { // Code that uses jQuery's $ can follow here. This conflicts with prototype.
	// FLOWPLAYER - IN-LINE PLAYER
	$(function() {
		$f("a.inlineplayer", "/includes/javascript/flowplayer-3.1.5/flowplayer-3.1.5.swf", {
		
			// clip: {baseUrl: 'http://www.atlasroofing.com/media/video'},
			clip: {baseUrl: 'http://' + dn + '/media/video'},
		
			// perform custom stuff before default click action
			onBeforeClick: function() {
				// unload previously loaded player
				$f().unload();
				// get wrapper element as jQuery object
				var wrap = $(this.getParent());
				// hide nested play button
				wrap.find("img").fadeOut();
				// start growing animation
				wrap.animate({width:406, height:303}, 500, function() {
					// when animation finishes we will load our player
					$f(this).load();
				});	
				// disable default click behaviour (player loading)
				return false; 
			}, 
		
			// unload action resumes to original state		
			onUnload: function() {
				$(this.getParent()).animate({width:190, height:150}, 500, function()  {
					// make play button visible again
					$(this).find("img").fadeIn();		
				});				
			}, 
			
			// when playback finishes perform our custom unload action
			onFinish: function() {
				this.unload();	
			},
			
			// when playback finishes perform our custom unload action
			onPause: function() {
				this.unload();	
			}
		});
	});
});