var siteWindow = null;
var popupArray = new Array();
var pop;


/// Disable rightclicking ///
var message="";
function clickIE() {
	if (document.all) {
		(message);return false;}
	}
function clickNS(e) {
	if (document.layers||(document.getElementById&&!document.all)) {
		if (e.which==2||e.which==3) {
			(message);return false;}
		}
	}
if (document.layers) {
	document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else {
	document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
document.oncontextmenu=new Function("return false")



/// Site launch functions ///
function launchHuwtopia(url) {
	if (siteWindow && !siteWindow.closed) {
		siteWindow.focus();
	} else {
		popW = 800;
		popH = 600;
		siteWindow = window.open(url,"Huwtopia", "width="+popW+", height="+popH+", top="+calcTop(popH)+", left="+calcLeft(popW)+", toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no");
		siteWindow.focus();
		}
}



/// Utility functions ///
function calcLeft( popW ) {
	return Math.round(( screen.width - popW ) / 2);
}
function calcTop( popH ) {
	return Math.round(( screen.height - popH ) / 2);
}



/// Other functions ///
function openPop(pg,wt,ht) {
	var str="toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, width="+wt+", height="+ht+", top="+calcTop( ht )+", left="+calcLeft( wt )+"";
	pop=window.open(pg,"Huwtopia",str);
	pop.focus();
}



/// FS Command function ///
function huwtopia1_DoFSCommand(command, args) { 
  if (command == "commtest") { 
    alert("This is a comm test between Flash and the browser via Javascript: " + args);
  }
}

