
var bandwidth;
var timer;
var curTime = 0;
var duration = 0;
var NP;

var _mypn;
var _mymlc;
var _mydl;

function _myhbPageView(){
	//alert("Jcall: " + _mypn + ", " + _mymlc + " : " + _hbPageView);
	_hbPageView(_mypn,_mymlc);
}

function _myhbDownload(){
	//alert("Jcall: " +  _mydl);
	_hbDownload(_mydl);
}

//
// Client-side access to querystring name=value pairs
// Usage:
//	var qs = new Querystring();
// qs.get(name[, default_value])
//
function Querystring(qs) { // optionally pass a querystring to parse
	this.params = new Object()
	this.get=Querystring_get

	if (qs == null)
		qs=location.search.substring(1,location.search.length)

	if (qs.length == 0) return

// Turn <plus> back to <space>
// See: http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13.4.1
	qs = qs.replace(/\+/g, ' ')
	var args = qs.split('&') // parse out name/value pairs separated via &

// split out each name=value pair
	for (var i=0;i<args.length;i++) {
		var value;
		var pair = args[i].split('=')
		var name = unescape(pair[0])

		if (pair.length == 2)
			value = unescape(pair[1])
		else
			value = name

		this.params[name] = value
	}
}

function Querystring_get(key, default_) {
	// This silly looking line changes UNDEFINED to NULL
	if (default_ == null) default_ = null;

	var value=this.params[key]
	if (value==null) value=default_;

	return value
}

function popup(url, w, h, name) {

	screenw = screen.availWidth;
	screenh = screen.availHeight;

	if ((w == "") || (w == null)) {
		// change the width and height of popup here, if those arguments are left out
		if (name == "Chat") {
			w = 735;
			h = 500;
		} else if (name == "Live") {
			w = 782;
			h = 500;
		}
	}

	var leftPos = (screenw-w)/2, topPos = (screenh-h)/2;
	var params = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=" + w + ",height=" + h + ",top=" + topPos + ",left=" + leftPos;
	newWindow=window.open(url,name, params);
	if (newWindow.opener == null) newWindow.opener = self;
	newWindow.focus();

	//return (newWindow);
}

function popupScroll(url, w, h, name) {

	screenw = screen.availWidth;
	screenh = screen.availHeight;

	if ((w == "") || (w == null)) {
		// change the width and height of popup here, if those arguments are left out
		if (name == "Chat") {
			w = 735;
			h = 500;
		} else if (name == "Live") {
			w = 782;
			h = 500;
		}
	}

	var leftPos = (screenw-w)/2, topPos = (screenh-h)/2;
	var params = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=" + w + ",height=" + h + ",top=" + topPos + ",left=" + leftPos;
	newWindow=window.open(url,name, params);
	if (newWindow.opener == null) newWindow.opener = self;
	newWindow.focus();

	//return (newWindow);
}

function popupfull(url) {
	newWindow=window.open(url);
	if (newWindow.opener == null) newWindow.opener = self;
		newWindow.focus();
}

// ---------------------------------------------------------------------------------------
// NAME: replace
// PARAMETERS: string, text, by
// DESCRIPTION: Searches "string" for "text" and replace it by "by"
// LIMITATIONS: none
// ---------------------------------------------------------------------------------------

function replace(string,text,by) {
// Replaces text with by in string
    var strLength = string.length, txtLength = text.length;
    if ((strLength == 0) || (txtLength == 0)) return string;

    var i = string.indexOf(text);
    if ((!i) && (text != string.substring(0,txtLength))) return string;
    if (i == -1) return string;

    var newstr = string.substring(0,i) + by;

    if (i+txtLength < strLength)
        newstr += replace(string.substring(i+txtLength,strLength),text,by);

    return newstr;
}

function writeSWF(fullPath) {

	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,65,0" width="980" height="715" id="amd_05e2" align="middle">');
	document.write('<param name="allowScriptAccess" value="always" />');
	document.write('<param name="movie" value="' + fullPath + '" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="bgcolor" value="#000000" />');
	document.write('<embed src="'  + fullPath + '" quality="high" bgcolor="#000000" width="980" height="715" name="amd_05e2" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');

}

