/**
 * jQuery sound plugin (no flash)
 * 
 * port of script.aculo.us' sound.js (http://script.aculo.us), based on code by Jules Gravinese (http://www.webveteran.com/) 
 * 
 * Copyright (c) 2007 Jörn Zaefferer (http://bassistance.de) 
 * 
 * Licensed under the MIT license:
 *   http://www.opensource.org/licenses/mit-license.php
 *   
 * $Id: jquery.sound.js 5854 2008-10-04 10:22:25Z joern.zaefferer $
 */

/**
 * API Documentation
 * 
 * // play a sound from the url
 * $.sound.play(url)
 * 
 * // play a sound from the url, on a track, stopping any sound already running on that track
 * $.sound.play(url, {
 *   track: "track1"
 * });
 * 
 * // increase the timeout to four seconds before removing the sound object from the dom for longer sounds
 * $.sound.play(url, {
 *   timeout: 4000
 * });
 * 
 * // stop a sound by removing the element returned by play
 * var sound = $.sound.play(url);
 * sound.remove();
 * 
 * // disable playing sounds
 * $.sound.enabled = false;
 * 
 * // enable playing sounds
 * $.sound.enabled = true
 */

(function($) {
	
$.sound = {
	tracks: {},
	enabled: true,
	template: function(src) {
		// todo: move bgsound element and browser sniffing in here
		// todo: test wmv on windows: Builder.node('embed', {type:'application/x-mplayer2', pluginspage:'http://microsoft.com/windows/mediaplayer/en/download/',        id:'mediaPlayer', name:'mediaPlayer', displaysize:'4', autosize:'-1', bgcolor:'darkblue', showcontrols:'false', showtracker:'-1', showdisplay:'0', showstatusbar:'-1', videoborder3d:'-1', width:'0', height:'0', src:audioFile, autostart:'true', designtimesp:'5311', loop:'false'});
		// is_win = (agt.indexOf("windows") != -1);
		return '<embed style="height:0" loop="false" src="' + src + '" autostart="true" hidden="true"/>';
	},
	play: function(url, options){
		if (!this.enabled)
			return;
		options = $.extend({
			url: url,
			timeout: 2000
		}, options);
		
		if (options.track) {
			if (this.tracks[options.track]) {
				var current = this.tracks[options.track];
				// TODO check when Stop is avaiable, certainly not on a jQuery object
				current[0].Stop && current[0].Stop();
				current.remove();  
			}
		}
		
		var element = $.browser.msie
		  	? $('<bgsound/>').attr({
		        src: options.url,
				loop: 1,
				autostart: true
		      })
		  	: $(this.template(options.url));
			
		$("body").append(element);
		
		if (options.track) {
			this.tracks[options.track] = element;
		}
		
		setTimeout(function() {
			element.remove();
		}, options.timeout)
		
		return element;
	}
};

})(jQuery);

// JavaScript Document
 $(document).ready(function(){
//$(".Nextend").css({"display":"none"});							
//				
//
//	$(".login").attr({"href":"#small_box"});
//	$('a.login').fancybox({
//		'hideOnContentClick': false,
//		'frameHeight' : 159,
//		'zoomSpeedIn': 600,
//		'zoomSpeedOut': 500,
//		'overlayOpacity':.8
//	 }); 
//	 if ($(".errorLOGIN").length){
//		$.sound.play("http://www.digitalbarn.tv/lib/JS/Error.wav", {timeout: 3000});		 
//		$('a.login').fancybox({
//		 'hideOnContentClick': false,
//		 'frameHeight' : 159,
//		 		 'overlayOpacity':.8,
//		 'callbackOnShow': function() {}
//		 }).trigger('click');
//	
//	 }
//	 
//	 
//	 
//	 
//	var CONme = '';
//	$(".CONme").hover(
//		  function () {
//		CONme = $(this).attr('href');
//		   $(this).attr({"href":"#CONme_Box"});
//		  }, 
//		  function () {
//			$(this).attr({"href":""+CONme+""});
//	
//		  }
//		);	 
//	$('a.CONme').fancybox({
//			'hideOnContentClick': false,
//			'frameHeight' : 325,
//			'frameWidth' : 520,
//			'zoomSpeedIn': 600,
//			'zoomSpeedOut': 500,
//			'overlayOpacity':.8,
//			'callbackOnShow': function() {
//						$("#fancy_div").load(""+CONme+" .ConTar");
//					 }
//				
//	 }); 
//	 if ($(".errorCONme").length){
//		$.sound.play("http://www.digitalbarn.tv/lib/JS/Error.wav", {timeout: 3000});		 
//		$('a.CONme').fancybox({
//		 'hideOnContentClick': false,
//		 'frameHeight' : 159,
//		 		 'overlayOpacity':.8,
//		 'callbackOnShow': function() {$("#fancy_div").load(""+CONme+", .contactform");}
//		 }).trigger('click');
//	
//	 }
//	 
//	 
//	 
//	 
//	 
////	var imgPrev = '';
////	$(".imgPrev").hover(
////		  function () {
////		imgPrev = $(this).attr('href');
////		   $(this).attr({"href":"#imgPrev_Box"});
////		  }, 
////		  function () {
////			$(this).attr({"href":""+imgPrev+""});
////	
////		  }
////		);	 
//	$('a.imgPrev').fancybox({
//		 		 'overlayOpacity':.8,
//				 		'zoomSpeedIn'			: 600,
//		'zoomSpeedOut'			: 500
//	 });  
//	 
//	$("#m3moduleform_1").validate();
//	
//	var weblinK = '';
//	$(".webLinks").hover(
//		  function () {
//		weblinK = $(this).attr('href');
//		   $(this).attr({"href":"#web_Box"});
//		  }, 
//		  function () {
//			$(this).attr({"href":""+weblinK+""});
//	
//		  }
//		);
//	$('a.webLinks').fancybox({
//		'hideOnContentClick': false,
//		'frameHeight' : 600,
//		'frameWidth' : 800,
//		'overlayOpacity':.8,
//		'callbackOnShow': function() {
//		$("#fancy_div").append(' <iframe src="'+weblinK+'" id="myiframe" name="myiframe"></iframe>');
//				 }
//				
//	 }); 
//	var medialinK = '';
//	$(".mediaLinks").hover(
//		function () {
//			medialinK = $(this).attr('href');
//			$(this).attr({"href":"#media_Box"});
//		}, 
//		function () {
//			$(this).attr({"href":""+medialinK+""});
//		}
//	);
//	$(".mediaLinks").fancybox({
//		'hideOnContentClick': false,
//		'frameHeight' : 300,
//		'frameWidth' : 400,
//		'overlayOpacity':.8,
//		'zoomSpeedIn': 600,
//		'zoomSpeedOut': 500,
//		'callbackOnShow': function() {					
//						//alert(NewString);		 
//						$f("fancy_div", "http://www.digitalbarn.tv/lib/JS/flowplayer-3.1.0.swf", {	
//								play: { opacity: 0},
//								clip: {
//									autoPlay: true,
//									autoBuffering: true,
//									url: 'http://www.digitalbarn.tv/'+ medialinK +'',
//									onFinish: function(){ $('#fancy_close').trigger('click'); }
//								}	
//						});
//						$('#fancy_close').click(function () { 
//						  $("#fancy_div_api").remove(); 
//						});	
//                  },
//		'callbackOnClose':function() {$("#fancy_div_api").remove();}
//
//	});
////	$("#primary-nav a,[class*='BTN']").bind("mouseenter",function(){
////		$.sound.play("http://www.digitalbarn.tv/lib/JS/clickerx.wav");
////	});
//
//
//
//
//
//
//
//var ORbkCOLOR = "";
//var ORcolor = "";
//$(".extendHANDLE").hover(function () {						   
//		var bk = $(this).attr("class");
//		var ORbkCOLOR = $(this).css("background-color");
//		var ORcolor = $(this).css("color");
//		bk = bk.replace(/ /,"")
//		//alert(bk);
//		var bkCOLOR = "#C9C9C9";
//		var COLOR = "#333333";
//		//alert(bkCOLOR);
//        $(this).css({"background-color":""+bkCOLOR+"","color":""+COLOR+""});
//      }, 
//      function () {
//        $(this).css({"background-color":""+ORbkCOLOR+"","color":""+ORcolor+""});
//      }
//);
//$(".extendHANDLE").click(function () {
//								   
//	  if ($(this).next().hasClass("Nextend")) {
//		$(this).find("span").text("[-]");
//		$(this).next().slideDown("fast");
//		//$(this).next().css({'display':'block','visibility':'visible'});
//		$(this).next().removeClass("Nextend");
//		$(this).next().addClass("extend");
//		//$(this).next().slideDown("fast");
//		
//	  } else {
//		  $(this).next().slideUp("fast");
//		  $(this).find("span").text("[+]");
//		  $(this).next().addClass("Nextend");
//		  $(this).next().removeClass("extend");
//	  }
//});
//$('.NewsHolder').cycle({ 
//    prev:   '#prev', 
//    next:   '#next', 
//    delay:  2000, 
//    speed:  500,
//	pause:  1
//});
//
//$('.headerIMG').cycle({
//	timeout: 8000, 
//    delay:  4000, 
//    speed:  2000
//});



});
 
 $(function () {
	TranslateIt.init();
	$.bookmark.setDefaults({icons: 'http://media.digitalbarn.tv/images/bookmarks.png'
						   });
	$('#basicBookmark').bookmark();
	
	

});
 
 
 
 
 
 
 
 
 $(document).ready(function(){
		$(".login").attr({"href":"#small_box"});
		$('a.login').fancybox({'hideOnContentClick':false,'frameHeight':159,'zoomSpeedIn':600,'zoomSpeedOut':500,'overlayOpacity':.8});
			if($(".errorLOGIN").length){$.sound.play("http://www.digitalbarn.tv/lib/JS/Error.wav",{timeout:3000});
				$('a.login').fancybox({'hideOnContentClick':false,'frameHeight':159,'overlayOpacity':.8,'callbackOnShow':function(){}}).trigger('click');
			}
			
var CONme='';
$(".CONme").hover(function(){
						   CONme=$(this).attr('href');
						   $(this).attr({"href":"#CONme_Box"});
						   },
				function(){
					$(this).attr({"href":""+CONme+""});
					});
$('a.CONme').fancybox({'hideOnContentClick':false,'frameHeight':360,'frameWidth':530,'zoomSpeedIn':600,'zoomSpeedOut':500,'overlayOpacity':.8,'callbackOnShow':function(){$("#fancy_div").load(""+CONme+" .ConTar");}});if($(".errorCONme").length){$.sound.play("http://www.digitalbarn.tv/lib/JS/Error.wav",{timeout:3000});$('a.CONme').fancybox({'hideOnContentClick':false,'frameHeight':159,'overlayOpacity':.8,'callbackOnShow':function(){$("#fancy_div").load(""+CONme+", .contactform");}}).trigger('click');}
$('a.imgPrev').fancybox({'overlayOpacity':.8,'zoomSpeedIn':600,'zoomSpeedOut':500});$("#m3moduleform_1").validate();var weblinK='';$(".webLinks").hover(function(){weblinK=$(this).attr('href');$(this).attr({"href":"#web_Box"});},function(){$(this).attr({"href":""+weblinK+""});});$('a.webLinks').fancybox({'hideOnContentClick':false,'frameHeight':600,'frameWidth':800,'overlayOpacity':.8,'callbackOnShow':function(){$("#fancy_div").append(' <iframe src="'+weblinK+'" id="myiframe" name="myiframe"></iframe>');}});

var medialinK='';
$(".mediaLinks").hover(function(){
		medialinK=$(this).attr('href');
		$(this).attr({"href":"#media_Box"});
		},function(){
			$(this).attr({"href":""+medialinK+""});
});

$(".mediaLinks").fancybox({
		'hideOnContentClick':false,
		'overlayOpacity':.8,
		'zoomSpeedIn':600,
		'zoomSpeedOut':500,
		'callbackOnShow':function(){
			$f("fancy_div",
			   "http://www.digitalbarn.tv/lib/JS/flowplayer-3.1.0.swf",
			   {
			   play:{opacity:0},
			   clip:{autoPlay:true,
			   			autoBuffering:true,
						url:'http://www.digitalbarn.tv/'+medialinK+'',
						onStart:function(clip){
							var wrap=jQuery(this.getParent());
							$("#fancy_outer").css({
									width:clip.metaData.width,
									height:clip.metaData.height
									});
							},
						onFinish:function(){
							$('#fancy_close').trigger('click');
							}
					}
				});
			$('#fancy_close').click(function(){
					$("#fancy_div_api").remove();
					});
			},
		'callbackOnClose':function(){
			$("#fancy_div_api").remove();
			}
	
	});

$(".mediaLinks").hover(function(){
								$(this).next().slideDown("fast");
								},function(){});

$(".VidLINKCon").hover(function(){},function(){$(this).slideUp("fast");});$(".extendHANDLE").click(function(){if($(this).next().hasClass("Nextend")){$(this).find("span").text("[-]");$(this).next().slideDown("fast");$(this).next().removeClass("Nextend");$(this).next().addClass("extend");}else{$(this).next().slideUp("fast");$(this).find("span").text("[+]");$(this).next().addClass("Nextend");$(this).next().removeClass("extend");}});$('.NewsHolder').cycle({prev:'#prev',next:'#next',delay:2000,speed:500,pause:1});
$("head").append('<link rel="stylesheet" href="http://scripts.digitalbarn.tv/lib/CSS/pop.5.30.09.css" type="text/css" media="screen" />');
$('.headerIMG').cycle({
	timeout: 8000, 
    delay:  4000, 
    speed:  2000
});









    $('.quickFlip').hover(function(ev) {
        var $target = $(ev.target);
        if ( !$target.hasClass('quickFlip') ) $target = $target.parent();
        
        $target.quickFlipper();
		
		var medialinK='';
$(".mediaLinks").hover(function(){
		medialinK=$(this).attr('href');
		//$(this).attr({"href":"#media_Box"});
		},function(){
		//	$(this).attr({"href":""+medialinK+""});
		medialinK='';
});

$(".mediaLinks").fancybox({
		'hideOnContentClick':false,
		'overlayOpacity':.8,
		'zoomSpeedIn':600,
		'zoomSpeedOut':500,
		'callbackOnShow':function(){
			$f("fancy_div",
			   "http://www.digitalbarn.tv/lib/JS/flowplayer-3.1.0.swf",
			   {
			   play:{opacity:0},
			   clip:{autoPlay:true,
			   			autoBuffering:true,
						url:'http://www.digitalbarn.tv/'+medialinK+'',
						onStart:function(clip){
							var wrap=jQuery(this.getParent());
							$("#fancy_outer").css({
									width:clip.metaData.width,
									height:clip.metaData.height
									});
							},
						onFinish:function(){
							$('#fancy_close').trigger('click');
							}
					}
				});
			$('#fancy_close').click(function(){
					$("#fancy_div_api").remove();
					});
			},
		'callbackOnClose':function(){
			$("#fancy_div_api").remove();
			}
	
	});
		
    },function(ev) {
        var $target = $(ev.target);
        if ( !$target.hasClass('quickFlip') ) $target = $target.parent();
        
        $target.quickFlipper();
    });



});