curWin = 0
function QueryString(){
	search=document.location.search
	fullqs=search.substring(1,search.length)
	pairs=fullqs.split("&")
	for(var i=0;i<pairs.length;i++){
		bits=pairs[i].split("=")
		this[bits[0]]=bits[1]
	}
}
	
function buildHTML(startUpMode){
	q = new QueryString()
	whichRecording=q.rec

	if (whichRecording) { 
		startUpMode = "recording"
	} else {
		whichRecording = "void"
	}
	

	here = document.location.href
	urlPath = here.substring(0,here.lastIndexOf("/")+1)

	html = '<object classid="clsid:166B1BCA-3F9C-11CF-8075-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0" ID=world width=790 height=472><param name=swURL value="'+urlPath+'"><param name="sw1" value="'+startUpMode+'"><param name="sw2" value="'+whichRecording+'"><param name=src value="loader.dcr"><param name=swRemote value="swSaveEnabled=\'false\' swVolume=\'false\' swRestart=\'false\' swPausePlay=\'false\' swFastForward=\'false\' swContextMenu=\'false\' "><param name=swStretchStyle value=none><PARAM NAME=bgColor VALUE=#FFFFFF><embed src="loader.dcr" bgColor=#FFFFFF  swURL="'+urlPath+'" sw1="'+startUpMode+'" sw2="'+whichRecording+'" width=790 height=472 swRemote="swSaveEnabled=\'false\' swVolume=\'false\' swRestart=\'false\' swPausePlay=\'false\' swFastForward=\'false\' swContextMenu=\'false\' " swStretchStyle=none type="application/x-director" pluginspage="http://www.macromedia.com/shockwave/download/"></embed></object>'

	document.write(html)
}

function launchWindow(whichWindow){
	//alert("a1")
	if (whichWindow=="station1"){
		url = "html/station1.html"
		winProps = "width=417, height=545, scrollbars=yes"
	} else if (whichWindow=="station2"){
		url = "html/station2.html"
		winProps = "width=348, height=548, scrollbars=yes"
	} else if (whichWindow=="station3"){
		url = "html/station3.html"
		winProps = "width=417, height=548, scrollbars=yes"
	} else if (whichWindow=="station4"){
		url = "html/station4.html"
		winProps = "width=417, height=526, scrollbars=yes"
	} else if (whichWindow=="station5"){
		url = "html/station5.html"
		winProps = "width=417, height=283, scrollbars=yes"
	} else if (whichWindow=="station6"){
		url = "html/station6.html"
		winProps = "width=417, height=219, scrollbars=yes"
	} else if (whichWindow=="help"){
		url = "html/help.html"
		winProps = "width=400, height=400, scrollbars=yes"
	} else if (whichWindow=="donate_details"){
		url = "html/donate_details.html"
		winProps = "width=400, height=400, scrollbars=no"
	}
	//alert("b1")
	if (curWin!=0){
		curWin.close()
		curWin=0
	}
	//alert("c1")
	curWin = window.open(url, "popup", winProps)
}

function sm_SafariCheck(redirect){
	var q = new QueryString()
	ignoreSafari=q.ignoreSafari

	if (ignoreSafari!="1") { 
		if (navigator.userAgent.indexOf("Safari")!=-1){
			document.location = redirect
			return false
		}
	}
	return true
}
