/**
 * @author Mojtaba Najafzadeh
 * @email mojtaba@cyberical.net
 * @project WebProcessor
 * @version 1.0
 * @copyright 2008
 */
 
<!--
function updatepage(str, alertsdiv){
	if (str == "loginok"){
		alert("خوش آمدید، ورود شما موفقیت آمیز بود.");
		window.location.reload(); 
	} else if(str == "registerok"){
		alert("خوش آمدید، عضویت شما موفقیت آمیز بود.");
		window.location.reload(); 
	} else {
        if (alertsdiv == "alert"){
            alert(str);
        } else {
            document.getElementById(alertsdiv).innerHTML = str;
        }
	}
}

// call login
function call_login(form, alertsdiv){
    var strURL = createQuery(form);
	var url = config["site_url"] + "login/ajax/" + strURL;
    createRequest();
    xmlHttp.open("POST", url, true);
    xmlHttp.setRequestHeader("Content-Type", contentType);
    xmlHttp.onreadystatechange = function(){
        if (xmlHttp.readyState == 4){
            if(xmlHttp.status == 200){
                updatepage(xmlHttp.responseText, alertsdiv);
            }
        }
    }
    xmlHttp.send(null);
}

// call register
function call_register(form, alertsdiv){
    var strURL = createQuery(form);
	var url = config["site_url"] + "register/ajax/" + strURL;
    createRequest();
    xmlHttp.open("POST", url, true);
    xmlHttp.setRequestHeader("Content-Type", contentType);
    xmlHttp.onreadystatechange = function(){
        if (xmlHttp.readyState == 4){
            if(xmlHttp.status == 200){
                updatepage(xmlHttp.responseText, alertsdiv);
            }
        }
    }
    xmlHttp.send(null);
}
//-->
