var oAjax = new ajaxObject();
var divName = "mainDiv";
oAjax.OnSuccess = function() {
	var div = document.getElementById(divName);
	div.innerHTML = oAjax.GetResponseText();
}

oAjax.OnLoading = function() {
	var div = document.getElementById(divName);
	div.innerHTML = "";
	div.innerHTML = "<center><table width=200 class=\"table-1\"><tr><td><img src=\"images/loading.gif\" align=\"left\"><b>Please wait... </b></td></tr></table></center>";
}

oAjax.OnFailure = function() {
	var div = document.getElementById(divName);
	div.innerHTML = "Failed!";
}

function showHomeInfo(){
	oAjax.InitXmlHttpRequest("GET", "index.php?act=home");
    oAjax.Commit(null);
}

function showTemplates(){
	oAjax.InitXmlHttpRequest("GET", "index.php?act=temp");
    oAjax.Commit(null);
}

//if (window.attachEvent) window.attachEvent("onload",showHomeInfo);

function showRegisterForm(){
	oAjax.InitXmlHttpRequest("GET", "index.php?act=reg");
    oAjax.Commit(null);
}

function doRegister(){
	if (validate_form("frmRegister")){
		var strForm = buildPOST("frmRegister");
		oAjax.InitXmlHttpRequest("GET", "index.php?act=reg&do=insert&"+strForm);
	    oAjax.Commit(null);
    }
}

function open_popup(url){
	popup_window=window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=390,screenX=50,screenY=50,top=50,left=50');
	popup_window.focus();
	if (!popup_window.opener) popup_basket_window.opener=self;
}
