/*var message="Function Disabled!";

function clickIE4(){ if(event.button==2){ return false;	} }

function clickNS4(e){ if (document.layers||document.getElementById&&!document.all){
	if (e.which==2||e.which==3){ return false; } } }

if (document.layers){ document.captureEvents(Event.MOUSEDOWN); 
	document.onmousedown=clickNS4;	}
else if (document.all&&!document.getElementById){
	document.onmousedown=clickIE4;	}

document.oncontextmenu=new Function("return false")

function keyWhat(e){
   if (navigator.appName == 'Microsoft Internet Explorer'){
       	 //For shift, ctrl and alt keys  event.keyCode == 16 ||event.keyCode == 18 
     if(event.keyCode == 17 ){  return false;  }   }
} document.onkeydown=keyWhat;*/

//Above it is no code.

function createRequestObject(){
	var request_o; //declare the variable to hold the object.
	var browser = navigator.appName; //find the browser name
	if(browser == "Microsoft Internet Explorer"){
		/* Create the object using MSIE's method */
		request_o = new ActiveXObject("Microsoft.XMLHTTP");
	}else{
		/* Create the object using other browser's method */
		request_o = new XMLHttpRequest();
	}
	return request_o; //return the object
}

var https = createRequestObject();

function submitlogin(pressbutton) { 
	var form = document.loginform;
	var uflag = true; var eflag = true; 

	if(form.login.value == '' ) { uflag = false; }
	if(form.password.value == ''  ) { eflag = false; }	

	if (uflag == false) {	alert( "You must provide a User Name of atleast six characters." ); }
	else if (eflag == false) { alert( "You must provide a Password of atleast six characters." ); }
	else {	
			var type = form.type.options[form.type.selectedIndex].text;
			var ind = 'pg='+pressbutton+'&uid=' + form.login.value + '&upass=' + form.password.value ;
			ind += '&type=' + type ;
			login(ind);
	}
}

function login(Index){
	/* Create the request. The first argument to the open function is the method (POST/GET),and the second argument is the url... 
		document contains references to all items on the page We can reference document.form_category_select.select_category_select and we will
		be referencing the dropdown list. The selectedIndex property will give us the index of the selected item. 
	*/
	https.open('get', 'phpinc/login.php?'+ Index +'&rand='+Math.random(1));
	/* Define a function to call once a response has been received. This will be our handleProductCategories function that we define below. */
	https.onreadystatechange = handleLogin; 
	/* Send the data. We use something other than null when we are sending using the POST method. */
	https.send(null);
}

function handleLogin(){
	/* Make sure that the transaction has finished. The XMLHttpRequest object has a property called readyState with several states:
		0: Uninitialized		1: Loading		2: Loaded		3: Interactive		4: Finished */
	if(https.readyState == 1){ 
			document.getElementById('divlogin').style.display = '';
			document.getElementById('loginone').style.display = '';
			document.getElementById('logintwo').style.display = 'none';
			document.getElementById('loginthr').style.display = 'none';
			document.getElementById('loginfor').style.display = 'none';
			document.getElementById('loginfiv').style.display = 'none';
			document.getElementById('loginsix').style.display = 'none';
	}
	if(https.readyState == 4){ 	//Finished loading the response
		/* We have got the response from the server-side script,let's see just what it was. using the responseText property of 
			the XMLHttpRequest object. */
		if (https.status == 200) {
            // ...processing statements go here...
        	
			var response = https.responseText;
			if(response == '1') {	
				document.getElementById('loginone').style.display = 'none';
				document.getElementById('divlogin').style.display = 'none';				
				document.getElementById('logintwo').style.display = '';
				resetloginform();
			}
			else if(response == '2') {
				document.getElementById('loginone').style.display = 'none';
				document.getElementById('logintwo').style.display = 'none';				
				document.getElementById('loginthr').style.display = '';
				document.getElementById('loginfor').style.display = 'none';
				document.getElementById('loginfiv').style.display = 'none';
				document.getElementById('loginsix').style.display = 'none';
				
			}
			else if(response == '3') {
				document.getElementById('divlogin').style.display = '';
				document.getElementById('loginone').style.display = 'none';
				document.getElementById('logintwo').style.display = 'none';				
				document.getElementById('loginthr').style.display = 'none';
				document.getElementById('loginfor').style.display = 'none';
				document.getElementById('loginfiv').style.display = 'none';				
				document.getElementById('loginsix').style.display = 'none';				
			}
			else if(response == '4') {
				document.getElementById('loginone').style.display = 'none';
				document.getElementById('divlogin').style.display = 'none';
				document.getElementById('loginfor').style.display = '';
				resetloginform();
			}
			else if(response == '5') {
				document.getElementById('loginone').style.display = 'none';
				document.getElementById('loginfiv').style.display = '';
				document.getElementById('loginthr').style.display = 'none';
				document.getElementById('loginsix').style.display = 'none';
			}
			else if(response == '6') {
				document.getElementById('loginone').style.display = 'none';
				document.getElementById('loginsix').style.display = '';
				document.getElementById('loginthr').style.display = 'none';
				document.getElementById('loginfiv').style.display = 'none';
			}
			else if(response == '7') {
				window.open('index.php','_self');
			}
			else  {
				document.getElementById('loginone').style.display = 'none';				
			}
		} else {
            alert("There was a problem retrieving the data:\n" +
                https.statusText);
        }
	}
}