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{
		if(skin == 'popup')
				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");	
		else
			video_popup("width=" + width);
	}
}

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) {
	if(skin == 'popup')	
	{
		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")
	}
	else
		video_popup(id, true);
	
}

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 ie8 = (navigator.userAgent.indexOf("MSIE 8.") != -1) ? true : false;
	var firefox = (navigator.userAgent.indexOf("Firefox") != -1) ? true : false;
	var firefox3 = (navigator.userAgent.indexOf("Firefox/3") != -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);
		if(firefox)
			newHeight += 43;
	}
	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 || ie8) {
		newHeight = Number(height);
		newWidth = Number(width);

		newHeight += 90;
		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 || ie)
		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, prot) {
	try {
		if(prot == null)
			prot = document.location.protocol;
		if(f_color != null) {
			if(f_color.substring(0,1) != "#")
				f_color = "#" + f_color;
		}
		
		if(f_color == "#trans") {
			f_wmode = 'transparent';	
		} else {
			f_wmode = 'window';	
		}
		
		if(!f_vars) {
			f_vars = ""
		}	
	
		f_path = f_path.substring(0, f_path.length - 4);
		return AC_FL_RunContent(
				'codebase', prot + '://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0',
				'width', f_width,
				'height', f_height,
				'flashvars', f_vars,
				'src', f_path,
				'quality', 'high',
				'pluginspage', prot + '://www.macromedia.com/go/getflashplayer',
				'align', 'middle',
				'play', 'true',
				'loop', 'true',
				'scale', 'showall',
				'wmode', f_wmode,
				'devicefont', 'false',
				'id', f_name,
				'bgcolor', f_color,
				'name', f_name,
				'menu', 'true',
				'allowFullScreen', 'false',
				'allowScriptAccess','sameDomain',
				'movie', f_path,
				'salign', ''
		); //end AC code
	} catch(err) {}
}

function toggleCaption() {
	if(document.getElementById('myCapt').style.visibility == "hidden") {
		document.getElementById('myCapt').style.visibility = "visible";
	} else {
		document.getElementById('myCapt').style.visibility = "hidden";
	}
}