function thisMovie(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return window[movieName]
    }
    else {
        return document[movieName]
    }
}
 
function mailTo(address) {
	document.location = "mailto:"+address.replace("ThisIsTheEmail-","");
}

function playSound(url,text) {
	//thisMovie("BgSound").stopMusic();
	newwindow = window.open("HawlkPlayer.htm?path="+url+"&text="+text,"HawlkPlayer","location=0,status=0,scrollbars=0,width=300,height=100");
	if (window.focus) {newwindow.focus()}
}

function insertPlayer(path) {
	document.write('<div id="mysong">'+path+'</div>');
	$(document).ready(function(){
		// default options
		$(".mp3").jmp3();
		// custom options
		$("#mysong").jmp3({
			backcolor: "000000",
			forecolor: "0099FF",
			width: 280,
			showdownload: "false"
		});
	});
}

/* popup function */
function popIt(theURL,width,height) {
	window.open(theURL,null, "width="+width+",height="+height+",status=no,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=no");
}
function popItScroll(theURL,width,height) {
	window.open(theURL,null, "width="+width+",height="+height+",status=no,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes");
}
function popImage(theURL) {
	myWindow = window.open("imagePop.htm?path="+theURL,null,"status=no,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=no");
}

function parseQueryString (str) {
  str = str ? str : location.search;
  var query = str.charAt(0) == '?' ? str.substring(1) : str;
  var args = new Object();
  if (query) {
    var fields = query.split('&');
    for (var f = 0; f < fields.length; f++) {
      var field = fields[f].split('=');
      args[unescape(field[0].replace(/\+/g, ' '))] = 
unescape(field[1].replace(/\+/g, ' '));
    }
  }
  return args;
}

function insertPoker() {
	document.write('<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab" WIDTH="470" HEIGHT="365">');
	document.write('<PARAM NAME="src" VALUE="video/poker480.mov" />');
	document.write('<PARAM NAME="type" VALUE="video/quicktime" />');
	document.write('<PARAM NAME="autostart" VALUE="true" />');
	document.write('<PARAM NAME="name" VALUE="poker" />');
	document.write('<PARAM NAME="EnableJavaScript" VALUE="true" />');
	document.write('<embed src="video/poker480.mov" type="video/quicktime" width="470" height="365" autostart="true" name="poker" EnableJavaScript="true" align="absmiddle"></embed>');
	document.write('</OBJECT>');
}
function insertPSP() {
	document.write('<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab" WIDTH="470" HEIGHT="365">');
	document.write('<PARAM NAME="src" VALUE="video/psp480.mov" />');
	document.write('<PARAM NAME="type" VALUE="video/quicktime" />');
	document.write('<PARAM NAME="autostart" VALUE="true" />');
	document.write('<PARAM NAME="name" VALUE="psp" />');
	document.write('<PARAM NAME="EnableJavaScript" VALUE="true" />');
	document.write('<embed src="video/psp480.mov" type="video/quicktime" width="470" height="365" autostart="true" name="psp" EnableJavaScript="true" align="absmiddle"></embed>');
	document.write('</OBJECT>');	
}
function startCarousel() {
	document.getElementById("carousel").startCarousel();
}

function SwitchToSection(section) {
	$(".section").fadeOut(250,function(){
		setTimeout(function(){
			$("#"+section).slideDown(500);
		},250);
	});
	$(".sectionTD").css("background-image","none");
	$("#"+section+"TD").css("background-image","url(images/bodyBGpixel.png)");
}
