// AJAX CODE
function updatepage(whichdiv,str,whichone,morecode){
    if (whichone=='1') {
        document.getElementById(whichdiv).value = str;
        eval(morecode);
    } else  {
        document.getElementById(whichdiv).innerHTML = str;
        eval(morecode);
    }
}

function xmlhttpPost(whichdiv,strURL,whichone,morecode) {
	
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
            updatepage(whichdiv,self.xmlHttpReq.responseText,whichone,morecode);
        }
    };
    self.xmlHttpReq.send("w=1");
}
// AJAX CODE


// CHECK EMAIL FUNCTION FOR POPUP WINDOW
function is_email_ok(email) {
    AtPos = email.indexOf("@");
    StopPos = email.lastIndexOf(".");

    if (email == "") {
        return false;
    }

    if (AtPos == -1 || StopPos == -1) {
        return false;
    }

    if (StopPos < AtPos) {
        return false;
    }

    if (StopPos - AtPos == 1) {
        return false;
    } 
    
    return true;
}
// CHECK EMAIL FUNCTION FOR POPUP WINDOW

// CLEAR A DIV
function clear_html(nameofdiv){
	document.getElementById(nameofdiv).innerHTML='';
}
// CLEAR A DIV
