function validateEmail(email)  { 
	validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;

	if (email.search(validRegExp) == -1)  {
		return false;
	} 

	return true; 
}

function popupAuthToggle(){
	var popup = document.getElementById('popupAuth');
	if(popup.style.display == 'block') {
		popup.style.display = 'none';
	} else {
		popup.style.display = 'block';
	}
}

function add_basket(id) {
	var d = new Date();
	$.ajax({
		url: "index.php?remote_service=cms_rs_minishop&action=add_basket&id=" + id + "&faker=" + d.getTime(),
		cache: false,
		context: document.body,
		success: function(data){
			get_basket();
		}
	});
}

function remove_basket(id) {
	var d = new Date();
	$.ajax({
		url: "index.php?remote_service=cms_rs_minishop&action=remove_basket&id=" + id + "&faker=" + d.getTime(),
		cache: false,
		context: document.body,
		success: function(data){
			get_basket();
		}
	});
}

function get_basket() {
	var d = new Date();
	$.ajax({
		url: "index.php?remote_service=cms_rs_minishop&action=get_basket&faker=" + d.getTime(),
		cache: false,
		context: document.body,
		success: function(data){
			$('#basket_content').html(data);
		}
	});
}

function get_basket_payment() {
	var d = new Date();
	$.ajax({
		url: "index.php?remote_service=cms_rs_minishop&action=get_basket_payment&faker=" + d.getTime(),
		cache: false,
		context: document.body,
		success: function(data){
			$('#basket_content_payment').html(data);
		}
	});
}

function submit_order(data) {
	var d = new Date();
	$.ajax({
		url: "index.php?remote_service=cms_rs_minishop&action=submit_order&faker=" + d.getTime(),
		cache: false,
		params: data,
		context: document.body,
		success: function(data){
		}
	});
}
