// define the _param(value, default, type) function
function _param(v, d, t){
	// if no default value is present, use an empty string
	if( typeof d == "undefined" ) d = "";
	// if no type value is present, use "string"
	if( typeof t == "undefined" ) t = "string";
	// get the value to return, if the v param is not equal to the type, use default value
	var value = (typeof v != "undefined" && typeof v == t.toLowerCase()) ? v : d;
	return value;
}

function include(sTemplate){
	return document.write("<script language=\"JavaScript\" type=\"text/javascript\" src=\"" + sTemplate + "\"></script>");
}

// pop up a new window
function popup(u, _w, _h, _n, _r, _s){
	var w = (typeof _w == "string" || typeof _w == "number") ? parseInt(_w) : 600;
	var h = (typeof _h == "string" || typeof _h == "number") ? parseInt(_h) : 400;

	var n = (typeof _n == "string") ? _n : "wndPopup";
	var r = (typeof _r == "string") ? _r : "yes";
	var s = (typeof _s == "string") ? _s : "yes";

	// calculate the center of the screen for positioning window there
	var x = Math.round( (screen.width/2) - (w/2) );
	var y = Math.round( (screen.height/2) - (h/2) );

	// create a new window that should appear centered in the screen
	var w = window.open(u, n, "status=yes,location=no,menubar=no,toolbar=no,resizable=" + r + ",scrollbars=" + s + ",width=" + w + ",height=" + h + ",left=" + x + ",top=" + y + ",screenX=" + x + ",screenY=" + y, true);
	if( !!w && !!w.focus ) w.focus();
	return false;
}

