// JavaScript Document




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);
}



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() {

	minimumorder = 3;	// update for minimum order value
	problem = false;
	
	if (document.orderform.showdetails.checked == false) {
		alert('Please confirm that your customer details are correct');
		document.orderform.showdetails.focus();
		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 == true) {
		return false;
	}
	else {
		alert('*******************************************\r\n\******* IMPORTANT INFORMATION ********\r\n*******************************************\r\n\r\nThank You for your order.\r\n\r\nIf you need to specify any aspect of your product (size, colour etc.), please enter it in the comment section in PayPal.\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 The Rainbow Shop with the full details of your order.\r\n\r\nThanks again for your custom.\r\n\r\n*******************************');
		return true;
	}
		
}

/*

function notconfirmed() {
	
	
	
	
	
	
	
	
	if (document.orderform.showdetails.checked == false) {
		alert('Fuck this for a joke');
		alert('FUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCK');
		return false;
	}
	else {
		return true;
	}
		
}
*/
function size_1() {
	
	x = document.add.s_id.length;
	
	for (i=3; i < x; i++) {
			
		document.add.s_id[i].checked = 0;
		
	}
}

function size_2() {
	
	x = document.add.s_id.length;
	
	for (i=0; i < 3; i++) {
			
		document.add.s_id[i].checked = 0;
		
	}
}

function deletePrompt(url) {
	
	x = confirm("Are you sure you want to delete this?\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) { window.location=url }
	else { return false; }

}


function selectProduct(y) {
	
//	alert("going!");
	
	
	var x = document.edit_item.p_id.value;
	
//	alert(x);
	
	
	var i=1;
	for (i=1; i<=y; i++) {
		if(document.getElementById(i)) {
			document.getElementById(i).style.display="none";
		}
		else {
			y++;
		}
	}
	
	document.getElementById(x).style.display="block";
	
//	document.edit_item.

}


function showcountry() {
		
	if ( document.form1 ) {
		if ( document.form1.country_id.value == 2 ) {
			document.getElementById('country').style.display="block";
			document.getElementById('australia').style.display="none";
		}
		else {
			document.getElementById('country').style.display="none";
			document.getElementById('australia').style.display="block";
		}
	}
	else if ( document.update_customer ) {
		if ( document.update_customer.country_id.value == 2 ) {
			document.getElementById('country').style.display="block";
			document.getElementById('australia').style.display="none";
		}
		else {
			document.getElementById('country').style.display="none";
			document.getElementById('australia').style.display="block";
		}
	
	}
	
}

