	function show_itext()
		{
				var radio_choice = false;
				var selected_size = null;
				
				for (counter = 0; counter < window.document.main_page.pshape.length; counter++)
				{
				// If a radio button has been selected it will return true
				// (If not it will return false)
				if (window.document.main_page.pshape[counter].checked)
					radio_choice = true; 
				}
				if (radio_choice)
					{
						window.document.getElementById('inscriptiontext').style.display = '';
					}else
						{
							alert('You need to select a Pendant Shape before you can enter an inscription');
							main_page.inscription[1].checked = true;
						}
		}
	function change_itext(len)
		{
			var box = document.getElementById('itext');
		 	if (box.maxChars > len && window.document.main_page.inscription[0].checked == true )
				{
					alert("You will need to re-enter your inscription since the character max for this size is smaller than the previous selection");
					window.document.main_page.inscription[1].checked = true;
					window.document.getElementById('inscriptiontext').style.display = 'none';
					box.value = '';					
				}
		  	box.setAttribute('maxlength', len);
			box.maxChars = len;
		}
	function limitMe(evt, txt){
	   if (evt.which && evt.which == 8) return true; // allow Netscape backspace
	   else return txt.value.length < txt.maxChars ;
	}
	function limitTextarea(evt, txt,char_limit){
	   if (evt.which && evt.which == 8) return true; // allow Netscape backspace
	   else return txt.value.length < char_limit ;
	}
	
	function add_shape_item()
		{
				var shape = false;
				var chain = false;
				var txt = false;
				for (counter = 0; counter < window.document.main_page.pshape.length; counter++)
				{
				// If a radio button has been selected it will return true
				// (If not it will return false)
				if (window.document.main_page.pshape[counter].checked)
					shape = true; 
				}
				for (counter = 0; counter < window.document.main_page.chain.length; counter++)
				{
				// If a radio button has been selected it will return true
				// (If not it will return false)
				if (window.document.main_page.chain[counter].checked)
					chain = true; 
				}
				if (window.document.main_page.inscription[0].checked)
					{
						if (window.document.getElementById('itext').value.length >= 1)
							{
								txt = true;
							}
					} else
						{
							txt = true;
						}
				if (shape == false)
					{
						alert("You need to select a Pendant Shape");
					} else if (chain == false )
						{
							alert("You need to select a Chain Length");
						} else if (txt == false)
							{
								alert("You have chosen to add an inscription but have not entered the text. Please enter the inscription in the box provided.");
							} else
								{
									window.document.getElementById('form_step').value = "add_new_item_to_cart";
									window.document.main_page.submit();
								}
		}
	function add_tile_item()
		{
				var shape = false;
				var chain = false;
				var txt = false;
				var crystal = false;
				for (counter = 0; counter < window.document.main_page.pshape.length; counter++)
				{
				// If a radio button has been selected it will return true
				// (If not it will return false)
				if (window.document.main_page.pshape[counter].checked)
					shape = true; 
				}
				for (counter = 0; counter < window.document.main_page.ccolor.length; counter++)
				{
				// If a radio button has been selected it will return true
				// (If not it will return false)
				if (window.document.main_page.ccolor[counter].checked)
					crystal = true; 
				}
				for (counter = 0; counter < window.document.main_page.chain.length; counter++)
				{
				// If a radio button has been selected it will return true
				// (If not it will return false)
				if (window.document.main_page.chain[counter].checked)
					chain = true; 
				}
				if (window.document.main_page.inscription[0].checked)
					{
						if (window.document.getElementById('itext').value.length >= 1)
							{
								txt = true;
							}
					} else
						{
							txt = true;
						}
				if (shape == false)
					{
						alert("You need to select a Tile Direction");
					} else if (chain == false )
						{
							alert("You need to select a Chain Length");
						} else if (txt == false)
							{
								alert("You have chosen to add an inscription but have not entered the text. Please enter the inscription in the box provided.");
							} else if (crystal == false)
								{
									alert("You need to select a Crystal/Stone color.");
								} else
									{
										window.document.getElementById('form_step').value = "add_new_item_to_cart";
										window.document.main_page.submit();
									}
		}
	function add_bracelet_item()
		{
				var shape = false;
				var chain = false;
				var crystal = false;
				for (counter = 0; counter < window.document.main_page.pshape.length; counter++)
				{
				// If a radio button has been selected it will return true
				// (If not it will return false)
				if (window.document.main_page.pshape[counter].checked)
					shape = true; 
				}
				for (counter = 0; counter < window.document.main_page.ccolor.length; counter++)
				{
				// If a radio button has been selected it will return true
				// (If not it will return false)
				if (window.document.main_page.ccolor[counter].checked)
					crystal = true; 
				}
				for (counter = 0; counter < window.document.main_page.chain.length; counter++)
				{
				// If a radio button has been selected it will return true
				// (If not it will return false)
				if (window.document.main_page.chain[counter].checked)
					chain = true; 
				}
				if (shape == false)
					{
						alert("You need to select the amount of Tiles");
					} else if (chain == false )
						{
							alert("You need to select a Chain Length");
						} else if (crystal == false)
							{
								alert("You need to select a Bead color.");
							} else
								{
									window.document.getElementById('form_step').value = "add_new_item_to_cart";
									window.document.main_page.submit();
								}
		}
	function add_christmas_ornament()
		{
				var txt = false;
				if (window.document.main_page.inscription[0].checked)
					{
						if (window.document.getElementById('itext').value.length >= 1)
							{
								txt = true;
							}
					} else
						{
							txt = true;
						}
					if (txt == false)
						{
							alert("You have chosen to add an inscription but have not entered the text. Please enter the inscription in the box provided.");
						} else
							{
								window.document.getElementById('form_step').value = "add_new_item_to_cart";
								window.document.main_page.submit();
							}
		}
		function change_big_pic(file_name)
			{
				window.document.getElementById('bigpicbox').style.background = 'url(images/' + file_name + ') no-repeat';
			}
		function remove_cart_item(item_no)
			{
				window.document.getElementById('form_step').value = "remove_cart_item";
				window.document.getElementById('item_no').value = item_no;
				window.document.main_page.submit();
			}
		function update_quantity()
			{
				window.document.getElementById('form_step').value = "update_cart_quantity";
				window.document.main_page.submit();
			}
		function checkout(step)
			{
				window.document.getElementById('form_step').value = "checkout" + step;
				window.document.main_page.submit();
			}
		function copy_shipping()
			{
				if (window.document.getElementById('same_ship').checked)
					{
						window.document.getElementById('ship_name').value = window.document.getElementById('bill_name').value;
						window.document.getElementById('ship_addr1').value = window.document.getElementById('bill_addr1').value;
						window.document.getElementById('ship_addr2').value = window.document.getElementById('bill_addr2').value;
						window.document.getElementById('ship_city').value = window.document.getElementById('bill_city').value;
						window.document.getElementById('ship_zip').value = window.document.getElementById('bill_zip').value;
						window.document.getElementById('ship_name').value = window.document.getElementById('bill_name').value;
						window.document.getElementById('ship_state').selectedIndex = window.document.getElementById('bill_state').selectedIndex;
						window.document.getElementById('ship_province').value = window.document.getElementById('bill_province').value;
						window.document.getElementById('shipping_country').selectedIndex = window.document.getElementById('billing_country').selectedIndex;
				    	shipping_country_change(window.document.getElementById('shipping_country'));
					} else
						{
							return;
						}
			}
	function validate_ship_and_bill()
		{
			var empty_field = false;
			oInputs = document.getElementsByTagName( 'input' ) // store collection of all <input/> elements
			for ( i = 0; i < oInputs.length; i++ ) 
				{ // loop through and find <input type="text"/>
					oInputs[i].style.borderColor = '';
				}
			window.document.getElementById('ship_state').style.borderColor = '';
			window.document.getElementById('bill_state').style.borderColor = '';
			for ( i = 0; i < oInputs.length; i++ ) 
				{ // loop through and find <input type="text"/>
					if ( oInputs[i].type == 'text' ) 
						{
							if (oInputs[i].name != 'ship_zip' && oInputs[i].name != 'bill_zip' && oInputs[i].name != 'ship_addr2' && oInputs[i].name != 'bill_addr2' && oInputs[i].name != 'bill_province' && oInputs[i].name != 'ship_province')
								{
									if (oInputs[i].value == '')
										{
											oInputs[i].style.borderColor = 'red';
											empty_field = true;
//											alert('in here');
										}
								}
						}
				}
			if (window.document.getElementById('shipping_country').selectedIndex == 0)
				{
					if (window.document.getElementById('ship_state').selectedIndex == 0 ) 
						{
							empty_field = true;
							window.document.getElementById('ship_state').style.borderColor = 'red';
						}
				}else
					{
						if (window.document.getElementById('ship_province') == '')
							{
								empty_field = true;
								window.document.getElementById('ship_province').style.borderColor = 'red';
							}
					}
			if (window.document.getElementById('billing_country').selectedIndex == 0)
				{										
					if (window.document.getElementById('bill_state').selectedIndex == 0) 
						{
							empty_field = true;
							window.document.getElementById('bill_state').style.borderColor = 'red';
						}
				}else
					{
						if (window.document.getElementById('bill_province') == '')
							{
								empty_field = true;
								window.document.getElementById('bill_province').style.borderColor = 'red';
							}
					}
			if (empty_field)
				{
					alert('All fields in red must be completed.');
				} else
					{
						if (window.document.getElementById('bill_zip').value.length < 5)
							{
								alert('Zip/Postal code must be atleast 5 digits.')
								window.document.getElementById('bill_zip').style.borderColor = 'red';
							}else if (window.document.getElementById('ship_zip').value.length < 5 )
								{
									alert('Zip/Postal code must be atleast 5 digits.')
									window.document.getElementById('ship_zip').style.borderColor = 'red';
								} else
									{
										checkout(3);
									}
					}
		}
			function billing_country_change(country_select)
			{
				if (country_select.value == "United States")
					{
						window.document.getElementById('bill_state_label').innerHTML = "State:";
						window.document.getElementById('bill_zip_label').innerHTML = "Zip:";
						window.document.getElementById('bill_province_input').style.display = 'none';
						window.document.getElementById('bill_state_input').style.display = '';
					}else
						{
							window.document.getElementById('bill_state_label').innerHTML = "Province:";
							window.document.getElementById('bill_zip_label').innerHTML = "Postal Code:";
							window.document.getElementById('bill_province_input').style.display = '';
							window.document.getElementById('bill_state_input').style.display = 'none';
						}
			}
			function shipping_country_change(country_select)
			{
				if (country_select.value == "United States")
					{
						window.document.getElementById('ship_state_label').innerHTML = "State:";
						window.document.getElementById('ship_zip_label').innerHTML = "Zip:";
						window.document.getElementById('ship_province_input').style.display = 'none';
						window.document.getElementById('ship_state_input').style.display = '';
					}else
						{
							window.document.getElementById('ship_state_label').innerHTML = "Province:";
							window.document.getElementById('ship_zip_label').innerHTML = "Postal Code:";
							window.document.getElementById('ship_province_input').style.display = '';
							window.document.getElementById('ship_state_input').style.display = 'none';
						}
			}


		function verify_payment()
			{
				if(window.document.main_page.shipping_type)
					{
//						if (main_page.payment[0].checked)
	//						{
								alert('You are about to be re-directed to Paypal.com.  After you have made your payment, there will be a button that says RETURN TO J WOODS JEWELRY. You need to click that button to go back to the website and upload your photos. If for some reason you are not redirected after payment please email us at orders@jwoodsjewelry.com.');
								window.document.getElementById('form_step').value = "paypal_one";
								window.document.main_page.submit();
		
		//					}else
			//					{
					//				alert('credit');
				//				}
					}else
						{
							alert('You must select a shipping type. Please contact us at info@jwoodsjewelry.com for assistance.');
						}

			}
		function verify_cert_payment()
			{
				if(window.document.main_page.shipping_type)
					{
						window.document.getElementById('form_step').value = "cert_payment";
						window.document.main_page.submit();
					}else
						{
							alert('You must select a shipping type. Please contact us at info@jwoodsjewelry.com for assistance.');
						}

			}
			function verify_email(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    return false
		 }

 		 return true					
	}
			function check_friend_email()
			{
				if (!verify_email(window.document.getElementById('email').value))
					{
						alert('You must enter a valid email address.');
					}else if (window.document.getElementById('name').value == '')
						{
							alert('You must enter your name.');
						}else
							{
								window.document.getElementById('form_step').value = "send_friend_email";
								window.document.main_page.submit();
							}
			}
		function check_certificate()
			{
				if (window.document.getElementById('gift_to').value == '')
					{
						alert("You must fill in the to box.");
					}else if (window.document.getElementById('gift_amount').value=='' || isNaN(window.document.getElementById('gift_amount').value) )
						{
							alert("Amount of gift certificate must be a number.");
						}else if (window.document.getElementById('gift_from').value == '')
							{
								alert("You must fill in the from box.")
							}else
								{
									window.document.getElementById('form_step').value = "add_cert_to_cart";
									window.document.main_page.submit();
								}
			}
		function upload_image(itemno,payment,image)
			{
				orderid= window.document.getElementById('order_id').value;
				if (window.document.getElementById('file' + itemno) == "" )
					{
						alert("Click the browse button to locate the file you would like to upload on your computer.");
					}else
						{
							window.document.main_page.encoding = "multipart/form-data";
							window.document.main_page.action = "default.asp?form_step=upload_image&item_no=" + itemno + "&order_id=" + orderid + "&payment=" + payment + "&image=" + image;
							window.document.main_page.submit();
						}
							
			}
