// JavaScript Document
function delete_item(item_id){
	document.location.href='index.php?option=basket&action=remove&basket_item_id='+item_id;		
}

function delete_checkout_item(item_id){
	if(confirm("Do you really want to delete this item from shopping basket?")){
		document.location.href='index.php?option=checkout1&action=remove&basket_item_id='+item_id;		
	}
}

function empty_basket(){
	if(confirm("Do you really want to delete this shopping basket?")){
		document.location.href='index.php?option=basket&action=clear';		
	} 
}

var public_category_big_id = "";
function display_cat_img(cat_id){
	
	if(cat_id == public_category_big_id) return;
	
	if(public_category_big_id != ""){
		document.getElementById('cat_overview_'+public_category_big_id).style.display = "none";
		public_category_big_id = "";
	}
	
	if(cat_id != ""){
		document.getElementById('cat_overview_'+cat_id).style.display = "block";
		public_category_big_id = cat_id;
	}
	
}


var public_product_big_id = "";
function display_product_img(product_id){
	
	if(product_id == public_product_big_id) return;
	
	if(public_product_big_id != ""){
		document.getElementById('product_overview_'+public_product_big_id).style.display = "none";
		public_product_big_id = "";
	}
	
	if(product_id != ""){
		document.getElementById('product_overview_'+product_id).style.display = "block";
		public_product_big_id = product_id;
	}
	
}


function checkemail(objId){
    var str=document.getElementById(objId).value;
    var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
    if (filter.test(str))
        return true;
    else{
        alert("Enter valid email address.")
        return false;
    }
}