
function showElement(element, maxOpacity) {
    Appear(element, 0, maxOpacity);
    document.getElementById("flash").style.display='none';
}

function hideElement(element) {
    document.getElementById(element).style.display='none';
    document.getElementById("flash").style.display='';
	if(document.getElementById('thumb')!=null)dd.elements.thumb.show();
}

function setLocation()
{
	window.open(path+'shop/setshippinglocation.aspx', '', 'dependent,modal=yes,height=250,width=450,status=yes,toolbar=no,menubar=no,location=no');
}

function showCart()
{
	try{
		showElement('shoppingcart',80);
		showElement('shoppingcart_overlay',100);
		showElement('shoppingcart_content',100);
	} catch(ex) {
		document.getElementById('shoppingcart').style.display='';
		document.getElementById('shoppingcart_overlay').style.display='';
		document.getElementById('shoppingcart_content').style.display='';
	}
	if(document.getElementById('thumb')!=null)dd.elements.thumb.hide();
	document.getElementById('shoppingcart_overlay').style.height=itemHeight()+'px';
	document.getElementById('ShoppingCart').style.height=itemHeight()+'px';
}

function updateCart()
{
    document.getElementById("frm_cart").submit();
}

function removeVoucher(voucherId)
{
    document.getElementById("VoucherId").value = voucherId;
    document.getElementById("btnRemoveVoucher").click();
}

function refresh()
{
    document.getElementById("frm_refresh").submit();
}

function recalculateShipping(billingordelivery)
{
	if(document.getElementById('ddl' + billingordelivery + 'Country').value == '')return null;	
	if(!document.getElementById('chkSameAsBilling').checked && billingordelivery == 'Billing')return null;
	
	if(document.getElementById('txt' + billingordelivery + 'PostCode').value == '')
	{
		alert('Please enter your post code before selecting your country so that we can calculate the delivery cost to your location');
		document.getElementById('ddl' + billingordelivery + 'Country').value = '';
		return null;
	}
	
	//alert('We are about to recalculate the shipping cost for your order. Please review your order total before completing checkout.');
    document.getElementById('btnCalcShipping').click();
}

function swapImage(image) {
	if (document.images) {
		if(image.src.match(/_over/) != null)
		{
			image.src=image.src.replace('_over.png','.png');
		}
		else
		{
			image.src=image.src.replace('.png','_over.png');
		}
	}
}