function Anthem_Error(result) {
	alert('Anthem_Error was invoked with the following error message: ' + result.error);
}

function toggleItem(id){
	Element.toggle(id);
}


function productImageChange(imageObj, largeImageId){
  $(largeImageId).src = imageObj.src.replace("/medium/", "/large/");
}

function toggleImages(containerID){
	var images = $(containerID).select('img');
	images.each(function(image) {
		if (image.id.indexOf('largeImage')!=-1 && image.visible()){
			$(containerID).setStyle({
				marginLeft:'5px',
				float: 'right'
			});
		}
		else if (image.id.indexOf('largeImage')!=-1 && !image.visible()) {
			$(containerID).setStyle({
				marginLeft:'0px',
				float: 'left'
			});
		}
		image.toggle();
	});
}

function updateDeliveryCountry(obj){
	obj = Element.extend(obj);
	$('deliveryCountry').innerHTML = obj.options[obj.selectedIndex].text;
}

function changePaymentOption(input){
	
	
	
	$('paymentDiv').select("div.creditpopup").each(Element.hide);
	$('paymentDiv').select("div.creditsecure").each(Element.hide);
	$('paymentDiv').select("div.bank").each(Element.hide);
	$('paymentDiv').select("div.cod").each(Element.hide);
	$('paymentDiv').select("div.account").each(Element.hide);
	
	
	
	var paymentOption = input.value;
		
	switch(paymentOption){
		case "1":
			$('paymentDiv').select("div.creditpopup").each(Element.show);
			$('paymentDiv').select("div.creditsecure").each(Element.show);
			break;
		case "2":
			$('paymentDiv').select("div.bank").each(Element.show);
			break;
		case "3":
			$('paymentDiv').select("div.cod").each(Element.show);
			break;
		case "4":
			$('paymentDiv').select("div.account").each(Element.show);
			break;
	}
}

    function followLink(obj){ 
        document.location.href=Element.extend(obj).select('a')[0].href;
    }
    
    function followNewItemLink(obj){
        document.location.href=Element.extend(obj).previous('a').href;
    }
    
    function followDownloadLink(obj){
        document.location.href=Element.extend(obj).next('a').href;
    }
    function followSearchLink(obj){
        document.location.href=Element.extend(obj).up('td').previous().down('a').href;
    }
