/*
	QShop E-Commerce Solutions
	Copyright@Visual Technologies inc. 2002 - 2011
	http://qshop.com.pl
	This software is copyrighted, do not attempt to copy without permission
*/
function _login() {
	var cleared_login = false;
	var cleared_pass = false;
	/*
		Clear_field
	*/
	this.clear_field_form = function() {
		if(cleared_login==false) {
			document.getElementById('login_left').value = '';
			cleared_login = true;
		}
		if(cleared_pass==false) {
			document.getElementById('password_left').value = '';
			cleared_pass = true;
		}
	}
	/*
		get_login
	*/
	this.get_login_left = function() {
		if(GE('login_left').value!="Wpisz nazwę") {
			GE('left_login_form_request').innerHTML = '';
			GE('left_login_form_button').style.display = 'none';
			GE('left_login_form_request').style.display = '';
			http_login.open('get',dbv+'login/_login_left_ajax.php?password='+GE('password_left').value+'&username='+GE('login_left').value);
			http_login.onreadystatechange = this.login_left_Response;
			http_login.send(null);
		}
	}
	/*
		login_response
	*/
	this.login_left_Response = function() {
		if(http_login.readyState == 4){
			var response_login = http_login.responseText;
			splited=response_login.split('<script>');
			if(splited[1]!=null) {
				var asd=splited[1];
				var adg=asd.substring(0,asd.length-9);
				eval(adg); 
			}
			GE('left_login_form_request').innerHTML = response_login;
		}
	}
	/*
		show_forms
	*/
	this.show_forms = function() {
		GE('left_login_form_button').style.display = '';
		GE('left_login_form_request').style.display = 'none';	
	}
	/*
		Clear field
	*/
	this.clear_field = function() {
		GE('password_left').value = "";
		GE('login_left').value = "";
		setTimeout(this.show_forms,3000);
	}
	/*
		gotourl
	*/	
	this.goto_url = function(url) {
		document.location.href = dbv+url;
	}
	/*
		key_up
	*/
	this.key_up = function(event) {
		if(event.keyCode==13) {
			this.get_login_left();
		}
	}
}
_login = new _login();
