// JavaScript Document


function deletePrompt(thing) {
	
	x = confirm("--------------------------------------\r\n\r\nAre you sure you want to delete this?\r\n\r\n" + thing + "\r\n\r\n--------------------------------------\r\n--------------------------------------\r\n\r\nClick OK to continue deleting. \r\n\r\bClick Cancel to go back to where you were.\r\n\r\n--------------------------------------");
	
	if (x) { return true }
	else { return false; }

}


function logoutPrompt() {
	x = confirm("Are you sure you want to logout?");
	if (x) { return true }
	else { return false; }
}
	


function setimg(img, title, description, rangeid) {	
	
	var bigimg = "url(" + img + ")";
	
	if (rangeid != 0) var inshop = '<a href="?p=shopping#' + rangeid + '">This item is available in our online shop</a>';
	else var inshop = '';
	
	document.getElementById("bigimg").style.backgroundImage = bigimg;
	
	document.getElementById("itemtitle").innerHTML = title;
	document.getElementById("itemdescription").innerHTML = description;
	document.getElementById("inshop").innerHTML = inshop;
//	alert(id);

}





function getprice(pr, sid) {
	document.sid.price.value = pr;
}


function notsame() {
	
	document.form1.delivery_sameaddress.checked = false;
	
	
}

function blank_address() {
	document.form1.delivery_line_1.value = '';
	document.form1.delivery_line_2.value = '';
	document.form1.delivery_town.value = '';
	document.form1.delivery_state_id.value = 0;
	document.form1.delivery_pcode.value = '';
}


function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
  return false;
}



function toggleVis(me){
	if (document.orderform.showdetails.checked == true){
		me.style.display="none";
	}
	else {
		me.style.display="block";
	}
}



function toggleVisibility(me){
	if (me.style.display=="none"){
		me.style.display="block";
	}
	else {
		me.style.display="none";
	}
}

function toggleVisibilityCollapse(me){
	if (me.style.visibility=="collapse"){
		me.style.visibility="visible";
	}
	else {
		me.style.visibility="collapse";
	}
}





function notconfirmed(paypal) {

	if (!paypal) paypal = false;

//	minimumorder = 3;	// update for minimum order value//
	problem = false;
	
	if (document.orderform.showdetails.checked == false) {

		alert('Please confirm that your customer details are correct');
		problem = true;
	}
	else if (document.orderform.toomany) {
		
		alert('You have too many items in your cart to accurately calculate postage. Please either limit yourself to 12 items per sale, or contact us via our contact page to arrange a special order.\r\n\r\nWe apologise for the inconvenience.');
		problem = true;
		
	}

	//	if (document.orderform.pretotal.value < minimumorder) {
	//		alert("Sorry, our minimum order for internet orders is $" + minimumorder + ".\r\n\r\nPlease shop more or contact us for more info. Thanks!");
	//		problem = true;
	//	}
		
	if (problem) {
		return false;
	}
	else {
		
		if (paypal == 1) {
		alert('*******************************\r\n\r\nThank You for your order.\r\n\r\nTo complete your order properly it is \r\nVERY IMPORTANT that you return to this website and receive confirmation following your PayPal transaction.\r\n\r\nOnce your transaction is approved it will take approximately 10 seconds for PayPal to redirect you to the site.\r\n\r\nPlease be patient and ensure you return to our site. Once your order is complete you should receive 2 emails, one from PayPal with a confirmation of your transaction and another from us with the full details of your order.\r\n\r\nThanks again for your custom.\r\n\r\n*******************************');
		}
		else {
			alert('*******************************\r\n\r\nThank You for your order.\r\n\r\nPlease send your cheque or money order to the address shown on the following page.\r\n\r\nFor Bank Deposit or Direct Debit please use the bank details shown on the following page.\r\n\r\nThanks again for your custom.\r\n\r\n*******************************');
		}
		
		
		return true;
	}
		
}

