function SubmitSearch(){
	
	var the_frm=document.getElementById("search_frm");
	//var keywords=document.getElementById("keywords");
	var keywords=the_frm.keywords;
	//alert (keywords.value);
	
	if(keywords.value.length==0)
		location.href='categories.php';
		//the_frm.submit();
	else 
		if(keywords.value=="Search")
			location.href='categories.php';
			//the_frm.submit();
		else 
			the_frm.submit();
		
}

function RemoveConditionalValue(obj,txt)
{

	if(obj.value==txt)
		obj.value="";
}

function removeBasketItem(item) {
    document.getElementById(item).value="0";
    document.basketForm.submit();
}

function basketUpdate() {
    document.getElementById('basketAction').value="basketUpdate";
    document.basketForm.submit();
}

$(document).ready(function(){
	CalendarPopup();
})

function CalendarPopup(){
	var _holder = $('.calendar-holder td');
	_holder.each(function(){
		var _this =$(this);
		_this.link = _this.find('a:eq(0)');
		_this.popupClose = _this.find('.popup .btn-close');
		_this.popupClose.click(function(){
			_this.removeClass('show-popup');
			return false;
		})
		_this.link.click(function(){
			if (_this.hasClass('show-popup')){
				_this.removeClass('show-popup');
			}else{
				_holder.removeClass('show-popup');
				_this.addClass('show-popup');
				_this.find('.popup:eq(0)').css({
					top: _this.position().top + _this.height()/2 - 30 + 'px',
					left: _this.position().left + _this.width() + 'px'
				})
			}
			return false;
		})
	})
}

function viewOrderDetails(orderid)
{
	location.href="orderdetails.php?orderid="+orderid;
}


function testfunction(){

	if (document.getElementById("chooseaddress").checked == true){
  		document.getElementById("WhichAddress").value = "UseBilling";
	} else {
  		document.getElementById("WhichAddress").value = "UseDelivery";
  	}
	
}