// jQuery functions

// add fading effect to specific images contained
// inside links classed as hoverfade
$(function(){
	// Sets img opacity to fade down to 60%
	$(".hoverfade").each(function() {
		img = $(this).find("img");
		img.fadeTo("slow", 0.6);
		img.hover(function(){
			$(this).fadeTo("slow", 1.0); // set the opacity to 100% on hover					 
		},function(){
			$(this).fadeTo("slow", 0.6); // set the opacity back to 60% on mouseout
		});
	});
	
});

$(function(){
	$("#main-menu li").hover(
		function(){ $("ul", this).fadeIn("fast"); }, 
		function() { } 
	);
	if (document.all) {
		$("#main-menu li").hoverClass("ie6hover");
	}
});

$.fn.hoverClass = function(c) {
	return this.each(function(){
		$(this).hover( 
			function() { $(this).addClass(c);  },
			function() { $(this).removeClass(c); }
		);
	});
};

var FLAG_DEBUG = false;
/**
 * Google Analytics
 * Depends on jquery.ga.js and urchin.js
 */
$(function(){
	options = {
		domains: ANALYTICS_TRACKED_DOMAINS,
		restricted: ['ad.doubleclick.net'],
		fileTypes : ['zip','wmv','gz','mov','txt','ppt','doc','xls','mpg','mpeg','mp3','pdf','avi'],
		trackAnchors : true,
		trackFiles : true,
		trackForms : true,
		debug: FLAG_DEBUG
	};
	$(document).ga(_uacct,options);
});


function openListenLive(file) {
	var location = "";
	if(file != null && file.length > 0) {
		location = MEDIAPLAYER_URL + "?file=" + file;
	} else {
		location = MEDIAPLAYER_URL;
	}
	var win = window.open(location,'ListenLiveWindow','width='+MEDIAPLAYER_WIDTH+',height='+MEDIAPLAYER_HEIGHT+',status=0,scrollbars=0,resizable=0');
	win.focus();
	return false;
}

// for dart_adcall.js
var ord = Math.random() * 1000000000000000000;