// JavaScript Document

$(document).ready(function(){
	$('#translators .slide');
	setInterval(function(){
		$('#translators .slide').filter(':visible').fadeOut(2000,function(){
			if($(this).next('li.slide').size()){
				$(this).next().fadeIn(1000);
			}
			else{
				$('#translators .slide').eq(0).fadeIn(1000);
			}
		});
	},1000);	

	$("#nav-one li").hover(function(){
		$("ul", this).fadeIn("fast");},
			function() { }
	);

	if (document.all) {
		$("#nav-one li").hoverClass("sfHover");
	}

	$("a[rel]").overlay({
		effect:'apple',
		mask: '#3d3d3d',
		top: 'center',
		onBeforeLoad: function() {
			var wrap = this.getOverlay().find("div.wrap");
			var href = this.getTrigger().attr("href");
			var sep = "?";
			if (href.indexOf(sep) > 0) {
				sep = "&";
			}
			wrap.load(href+sep+"type=ajax");	
		},
		onClose: function() {
			var wrap = this.getOverlay().find("div.wrap");
			wrap.empty();
		}
	});
});
  
$.fn.hoverClass = function(c) {
	return this.each(function(){
		$(this).hover(
			function() { $(this).addClass(c);  },
			function() { $(this).removeClass(c); }
		);
	});
};

function NewWindow(mypage, myname, w, h, scroll, resize) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
 if (resize == 'yes') {
	resize = ',resizable=1'
 } else {
	resize = ',resizable=0'
 }
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+''+resize+''
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

function listen() {
	var ua = navigator.userAgent;
	if (ua.indexOf("iPhone") > 0 || ua.indexOf("iPad") > 0) {
		document.location.replace("http://www.mystaticradio.com/listen.pls");
	} else if (ua.indexOf("Android") > 0) {
		document.location.replace("http://www.mystaticradio.com/iphone/listen_android.html");
	} else {
		NewWindow('listen.asp','StaticRadioListen','760','144','no','no');
	}
	//return false;
}

