	var http;
    
	http = createRequestObject();
			
	function requestData( username , password ){
		var urlAddress = "request_login.php?username=" + username + "&password=" + password  ;
        //alert( urlAddress );

		http.open('get', urlAddress); 
        http.onreadystatechange = handleCommand;
	    http.send(null);
	}
 
	function handleCommand(){
    
		if (http.readyState == 4 && http.status == 200){ 		
			var response = http.responseText;
            

            //alert( response );
            if( response == "INVALID" ){
                alert( 'Please enter a valid username and password.' );
                document.all.username.focus();
                return;
            }else if( response == "EXPIRES" ){
                alert( 'The account you are using is already expired. Please contact our hotline numbers.' );
                return;
            }else{

                var temp = response.split("||");
                var status = temp[0];
                var id = temp[1];
                var country = temp[2];

                //alert( status );
                if( status  == 'VALID' ){

                    var height = 355;
                    var width = 895;
                    var top = (screen.height - height) / 2; 
                    var left = (screen.width - width) / 2;     
                    var winProps = "status=no, menubar=no, location=no, resizable=yes, dependent=no, scrollbars=no, titlebar=no ,  height="+height+", width="+width+", top="+top+", left="+left;
                    //alert( winProps );
                    var loc = "handler.php?status=" + status + "&id=" + id + "&country=" + country;

                    newwindow = window.open( loc , "webview" , winProps );
                 
                    if (window.focus) {
                        newwindow.focus();
                    }
                    return false;

                }
            
            }
            
            


 
           
                
        }  
	}				

