function resizeCurrentWindow()
{
  if (window.screen) {
    window.moveTo(0, 0);
    window.resizeTo(screen.availWidth, screen.availHeight);
  }
}

function open_media(file_name, width, height) {
	var re = new RegExp ('&', 'gi') ;
	if(file_name == "dl_file") {
		var ie = document.all ? true : false
		if(ie)
		{
			moveToW = (Number(window.document.body.clientWidth)) / 2
			moveToH = (Number(window.document.body.clientHeight)) / 2
		}
		else
		{
			moveToW = (Number(window.outerWidth)) / 2
			moveToH = (Number(window.outerHeight)) / 2
		}

		vids = window.open("/live/video_popup.php/" + file_name.replace(re,'%26') + "?filename=" + file_name.replace(re,'%26') + "&width=" + width+ "&height=" + height, "_blank", "width=" + width + ",height=" + height + ",resizable=no,scrollbars=no,toolbar=no,titlebar=no,location=no,locationbar=no,directories=no,status=no,menubar=no,personalbar=no,width=350,height=100,left=" + 20 + ",top=" + 20)
	}
	else
		vids = window.open("/live/video_popup.php?filename=" + file_name.replace(re,'%26') + "&width=" + width+ "&height=" + height, "_blank", "width=" + width + ",height=" + height + ",resizable=yes,scrollbars=no,toolbar=no,titlebar=no,location=no,locationbar=no,directories=no,status=no,menubar=no,personalbar=no,width=480,height=375,left=20,top=20")		
}

function open_listen(id) {
	lis = window.open("listen_popup.php?id=" + id, "_blank", "width=230,height=242,resizable=yes,scrollbars=no,toolbar=no,titlebar=no,location=no,locationbar=no,directories=no,status=no,menubar=no,personalbar=no,left=20,top=20")
}

function open_new_window(file) {
	new_win = window.open(file, "_blank")
}

function open_directions(id) {
	var ieMac = (navigator.platform.indexOf("Mac") != -1 && document.all) ? true : false
	if(ieMac)
		dirs = window.open("/live/directions.php?id=" + id + "", "_blank", "width=329,height=148,resizable=yes,scrollbars=yes,toolbar=no,location=no,locationbar=no,directories=no,status=no,titlebar=no,menubar=no,personalbar=no,left=20,top=20")
	else
		dirs = window.open("/live/directions.php?id=" + id + "", "_blank", "width=330,height=148,resizable=yes,scrollbars=no,toolbar=no,location=no,locationbar=no,directories=no,status=no,titlebar=no,menubar=no,personalbar=no,left=20,top=20")
}

function resize(elementID)
{
	myElement = document.getElementById(elementID);
	theWidth = Number(myElement.offsetWidth);
	theHeight = Number(myElement.offsetHeight);
	window.resizeTo(340, theHeight);
}

function comingSoon()
{
	alert("This item will be updated soon");
}

function resize_window(width, height)
{
	var nn = (navigator.appName == "Netscape" || document.layers) ? true : false
	var ie = document.all ? true : false
	var Mac = (navigator.platform.indexOf("Mac") != -1) ? true : false;
	var ieMac = (navigator.platform.indexOf("Mac") != -1 && document.all) ? true : false
	var aol = (navigator.userAgent.indexOf("AOL ") != -1) ? true : false;
	var xp = (navigator.userAgent.indexOf("NT 5.1") != -1) ? true : false;
	var vista = (navigator.userAgent.indexOf("NT 6.") != -1) ? true : false;
	var ie7 = (navigator.userAgent.indexOf("MSIE 7.") != -1) ? true : false;
	var firefox = (navigator.userAgent.indexOf("Firefox") != -1) ? true : false;
	var firefox3 = (navigator.userAgent.indexOf("Firefox/3.0") != -1) ? true : false;
	var chrome = (navigator.userAgent.indexOf("Chrome") != -1) ? true : false;
	var safari = (navigator.userAgent.indexOf("Safari") != -1) ? true : false;
	
	if(Mac) {
		newHeight = Number(height) + 28;
		newWidth = Number(width);
	}
	else if(ieMac) {
		newHeight = Number(height);
		newHeight -= Number(document.body.clientHeight);
		newHeight += Number(height);
		
		newWidth = Number(width);
		newWidth -= Number(document.body.clientWidth);
		newWidth += Number(width);
	}
	else if(aol) {
		newHeight = Number(height);
		newWidth = Number(width);

		newHeight += 4;
	}
	else if(xp && (firefox || firefox3)) {
		newHeight = Number(height);
		newWidth = Number(width);
		
		if(firefox3)
			newHeight += 86;
		else
			newHeight += 54;
		newWidth += 7;
	}
	else if(vista && (firefox || firefox3)) {
		newHeight = Number(height);
		newWidth = Number(width);
		
		if(firefox3)
			newHeight += 86;
		else
			newHeight += 54;
		newWidth += 7;
	}
	else if(ie7) {
		newHeight = Number(height);
		newWidth = Number(width);

		newHeight += 94;
		newWidth += 7;
	}
	else if(chrome) {
		newHeight = Number(height);
		newWidth = Number(width);

		newHeight += 63;
		newWidth += 7;
		moveWindow(newWidth, newHeight);
	}
	else if(xp) {
		newHeight = Number(height);
		newWidth = Number(width);

		if(safari)
		{
			newHeight += 35;
			newWidth += 4;
		}
		else
		{
			newHeight += 65;
			newWidth += 12;
		}
	}
	else if(ie)	{
		newHeight = Number(height);
		newWidth = Number(width);
	}
	else {
		newHeight = Number(height);
		newHeight -= Number(window.innerHeight);
		newHeight += Number(height);
		
		newWidth = Number(width);
		newWidth -= Number(window.innerWidth);
		newWidth += Number(width);
	}

	if(firefox && !Mac)
		newHeight += 8;
		
	
	if(chrome)
		setTimeout("window.resizeTo(newWidth, newHeight)", 100);
	else
	{
		window.resizeTo(newWidth, newHeight);
		moveWindow(newWidth, newHeight);
	}

}

function moveWindow(width, height)
{
	var nn = (navigator.appName == "Netscape" || document.layers) ? true : false
	var ie = document.all ? true : false
	var chrome = (navigator.userAgent.indexOf("Chrome") != -1) ? true : false;

  if (window.screen) 
  {
	if(ie || chrome)
	{
		if(chrome)
		{
			moveToW = (Number(window.opener.document.body.clientWidth) - width) / 2
			moveToH = (Number(window.opener.document.body.clientHeight) - height) / 2
		}
		else
		{
			moveToW = (Number(window.opener.document.body.clientWidth) - Number(document.body.clientWidth)) / 2
			moveToH = (Number(window.opener.document.body.clientHeight) - Number(document.body.clientHeight)) / 2
		}
	}
	else
	{
		moveToW = (Number(window.opener.outerWidth) - Number(window.outerWidth)) / 2
		moveToH = (Number(window.opener.outerHeight) - Number(window.outerHeight)) / 2
	}
    window.moveTo(moveToW, moveToH);
  }

}

function embedMovie(f_path, f_name, f_width, f_height, f_color, f_vars) {
	document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="' + f_width + '" HEIGHT="' + f_height +'" id="' + f_name + '">\n');
	document.write('<PARAM NAME="movie" VALUE="' + f_path + '">\n');
	document.write('<PARAM NAME="quality" VALUE="high">\n');
	document.write('<PARAM NAME="quality" VALUE="high">\n');
	if(f_color != "") {
		document.write('<PARAM NAME="bgcolor" VALUE="#' + f_color + '">\n');
	}
	document.write('<EMBED src="' + f_path + '" ' + (f_color != "" ? ('bgcolor="#' + f_color):'') + '" quality="high" WIDTH="' + f_width + '" HEIGHT="' + f_height +'" NAME="' + f_name + '" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">\n');
	document.write('</EMBED>\n');
	document.write('</OBJECT>\n');
}

