// JavaScript Document
// JS Libraries for Smoove
<!--
function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function refreshTitleArtist()
{
	radioXML.async = false;
	radioXML.load("/mos/ministryofsound/radio/maestro.xml")
	var strArtist = radioXML.selectSingleNode("//ARTIST").text;
	if (strArtist != "") {
			Artist.innerHTML = strArtist;
	}
	var strTitle = radioXML.selectSingleNode("//TITLE").text;
	if (strTitle != "") {
			Title.innerHTML = strTitle;
	}
}

function refreshImage()
{
	imageXML.async = false;
	imageXML.load("/mos/ministryofsound/radio/RadioImage.xml")
	var strImage = imageXML.selectSingleNode("//url").text;
	if (strImage != "") {
			var build;
			build = "<img src='";
			build += strImage;
			build += "'>";
			ImageUrl.innerHTML = build;
			//alert(build);
	}
}

function OpenMC()
{	window.open('http://engine.metacharge.com/templates/mos/0018/?product=mos0018&amp;aff=default','mos0018','scrollbars=no,height=375,width=440,status=yes,location=no,resizable=yes,screenx=100,screeny=100,left=100,top=100');
}


function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function openAudioPlayer(media, guid)
{
	var url = "/mos/ministryofsound/Templates/AudioPlayer.aspx?media=";
	url += media;
	url += "&guid=";
	url += guid;
	var windowName = "mosAudioPlayer";
	var features = "height=310,width=815,top=50,left=50,status=no,toolbar=no,menubar=no,location=no";
	var mosAudioPlayerWindow;
	mosAudioPlayerWindow = window.open(url, windowName, features);
	mosAudioPlayerWindow.focus();
}
//For summary links
function openSummaryAudioPlayer(media, guid)
{
	var url = "/mos/ministryofsound/Templates/AudioPlayer.aspx?media=";
	url += media;
	url += "&guid=null";
	var windowName = "mosAudioPlayer";
	var features = "height=275,width=815,top=50,left=50,status=no,toolbar=no,menubar=no,location=no";
	var mosAudioPlayerWindow;
	mosAudioPlayerWindow = window.open(url, windowName, features);
	mosAudioPlayerWindow.focus();
}
function openTVPlayer(media, guid)
{
	var url = "/mos/ministryofsound/Templates/TVPlayer.aspx?media=";
	url += media;
	url += "&guid=";
	url += guid;
	var windowName = "mosTVPlayer";
	var features = "height=513,width=508,top=50,left=50,status=no,toolbar=no,menubar=no,location=no";
	var mosTVPlayerWindow;
	mosTVPlayerWindow = window.open(url, windowName, features);
	mosTVPlayerWindow.focus();
}
//for Summary links
function openSummaryTVPlayer(media, guid)
{
	var url = "/mos/ministryofsound/Templates/TVPlayer.aspx?media=";
	url += media;
	url += "&guid=null";
	var windowName = "mosTVPlayer";
	var features = "height=513,width=508,top=50,left=50,status=no,toolbar=no,menubar=no,location=no";
	var mosTVPlayerWindow;
	mosTVPlayerWindow = window.open(url, windowName, features);
	mosTVPlayerWindow.focus();
}

//for Summary links
function openShopTVPlayer(media, guid)
{
	var url = "http://www.ministryofsound.com/mos/ministryofsound/Templates/TVPlayer.aspx?media=";
	url += media;
	url += "&guid=null";
	var windowName = "mosTVPlayer";
	var features = "height=513,width=508,top=50,left=50,status=no,toolbar=no,menubar=no,location=no";
	var mosTVPlayerWindow;
	mosTVPlayerWindow = window.open(url, windowName, features);
	mosTVPlayerWindow.focus();
}
function openTVShow()
{
	var url = "/mos/ministryofsound/tv/TVShow.aspx?media=/mos/ministryofsound/asx/MoSTV_300k.asx";
	//url += media;
	var windowName = "mosTVPlayer";
	var features = "height=513,width=508,top=50,left=50,status=no,toolbar=no,menubar=no,location=no";
	var mosTVPlayerWindow;
	mosTVPlayerWindow = window.open(url, windowName, features);
	mosTVPlayerWindow.focus();
}
function openTVShowAsx(media)
{
	var url = "/mos/ministryofsound/TV/TVShow.aspx?media=";
	url += media;

	var windowName = "mosTVPlayer";
	var features = "height=513,width=508,top=50,left=50,status=no,toolbar=no,menubar=no,location=no";
	var mosTVPlayerWindow;
	mosTVPlayerWindow = window.open(url, windowName, features);
	mosTVPlayerWindow.focus();
}
function openRadioPlayer()
{
	var url = "/mos/ministryofsound/radio/RadioPlayer.aspx";
	var windowName = "mosRadioPlayer";
	var features = "height=324,width=815,top=50,left=50,status=no,toolbar=no,menubar=no,location=no";
	var mosRadioPlayerWindow;
	mosRadioPlayerWindow= window.open(url, windowName, features);
	mosRadioPlayerWindow.focus();
}
function openRadioPlayer_Mac()
{
	var url = "/mos/ministryofsound/radio/RadioPlayer_Mac.aspx";
	var windowName = "mosRadioPlayer";
	var features = "height=324,width=815,top=50,left=50,status=no,toolbar=no,menubar=no,location=no";
	var mosRadioPlayerWindow;
	mosRadioPlayerWindow= window.open(url, windowName, features);
	mosRadioPlayerWindow.focus();
}
function openRadioTrialPlayer(metaChargeQs)
{
	var url = "http://dev.ministryofsound.com/Radio/TrialPlayerFrameset.aspx";
	url += metaChargeQs;

	var windowName = "mosRadioPlayer";
	var features = "height=390,width=698,top=50,left=50,status=no,toolbar=no,menubar=no,location=no";
	var mosRadioPlayerWindow;
	mosRadioPlayerWindow= window.open(url, windowName, features);
	mosRadioPlayerWindow.focus();
	self.close();
}

function openMetaCharge(metaChargeTemplate)
{
	var url="http://engine.metacharge.com/templates/mos/?product="
	url += metaChargeTemplate;
	var ppvWindow;

	ppvWindow = window.open(url, metaChargeTemplate,'scrollbars=no,height=440,width=440,status=yes,location=no,resizable=yes,screenx=100,screeny=100,left=100,top=100');
	ppvWindow.focus();
}

function openWindow(theURL,winName,features) {
window.open(theURL,winName,features);
}	

function PostionDiv()
{
	//W = screen width (1024 etc)
	//P = content width (765)
	//L = the gap at the side of the page
	//D = Div distance from left
	var W = document.body.clientWidth;
	var P = 770;
	
	if ((W - P) > 0)
	{
		var L = (W - P) / 2;
		var D = P + L;
		//alert("window size: " + W);
		//alert("bigger:" + D);
	}
	else
	{
		var D = 780;
		//alert("window size: " + W);
		//alert("Smaller: " + D);
	}
		
	return D
}

function Refresh()
{
	window.location = window.location;
}

function openTop100AudioPlayer(media)
{
	var url = "/mos/ministryofsound/sections/Top100_2005/Top100Player.aspx?media=";
	url += media;
	var windowName = "Top100Player";
	var features = "height=285,width=700,top=50,left=50,status=no,toolbar=no,menubar=no,location=no";
	var mosAudioPlayerWindow;
	mosAudioPlayerWindow = window.open(url, windowName, features);
	mosAudioPlayerWindow.focus();
}

