
function updateFormAction(form) {
    currentAction=form.action;

    if (currentAction.indexOf('://') != -1)
        return;

    form.action='http://'+location.host+currentAction;
}

function writeOb(src){
    document.write(src);
}


function openWnd(url, width,height, name){
    var optionstr = "height=" + height + ",width=" + width + ",menubar=no,toolbar=no,status=no,personalbar=no,resizable=yes,scrollbars=no";
    var wnd = window.open(url,name,optionstr);
    wnd.width=width;
    wnd.height=height;
    wnd.resizeTo(width,height);
    wnd.screenY = (screen.height - height)/2;
    wnd.screenX = (screen.width - width)/2;
    return wnd;
}

function checkclear(what) {
  if(!what._haschanged){  
	what.value=''
  };
  what._haschanged=true;
}

function su_trim( str ) {
  str = str.replace( /^[\s\r\n\t]+/, "" );
  str = str.replace( /[\s\r\n\t]+$/, "" );
  return str;
}
  
function su_alpha( str ) {
  if( !str.match( /[a-z]{2}/i ) ) return false;
  return true;
}

function openGame(gameName) {
	var host = "http://"+window.location.host;
        var width = 800, height = 600;
        var xOffset = 0, yOffset = 0;

        var winPop = window.open(
        	host + "/real/" + gameName + ".jsp",
        	'wnd',
        	'location=no,menubar=no,resizable=yes,scrollbars=no,toolbar=no,width=' + width + ',height=' + height + ',screenX=' + xOffset + ',screenY=' + yOffset + ',top=' + yOffset + ', left=' + xOffset, true);
	if (winPop == null || typeof(winPop) == "undefined") {
		alert("Sorry, the game window has been blocked. Please disable your pop-up blocker.");
	} else {
		winPop.focus();
	}

    return false;
}
