// JavaScript Document

function Search(){
	if ((document.Search.Search.value == "")||(document.Search.Search.value == "Search")||(document.Search.Search.value.length<3))
	{
		alert("Enter at least 3 Characters.");
		document.Search.Search.focus();
		return ;
	}
}
function NewsLetter(){
	if ((document.NewsLetter.NewsLetter.value == "")||(document.NewsLetter.NewsLetter.value.length<2)||(document.NewsLetter.NewsLetter.value.indexOf ('@', 0) == -1)||(document.NewsLetter.NewsLetter.value.indexOf ('.', 0) == -1))
	{
		alert("Enter Your Correct Email please.");
		document.NewsLetter.NewsLetter.focus();
		return ;
	}
}
function validContact(){
	if (document.contactform.FullName.value == "")
	{
		alert("Please enter a value for the \"Name\" field.");
		document.contactform.FullName.focus();
		return ;
	}
	if (document.contactform.LastName.value == "")
	{
		alert("Please enter a value for the \"Last Name\" field.");
		document.contactform.LastName.focus();
		return ;
	}
	if ( document.contactform.Email.value.indexOf ('@', 0) == -1 || document.contactform.Email.value.indexOf ('.', 0) == -1 )
	{
		alert("please enter a valid e-mail");
		document.contactform.Email.focus();
		return;
	}
	else document.contactform.submit();
}

function Reset(forme){
	document.getElementById(forme).reset();
	;}

	function validMember(){
		if ((document.member.Username.value == "")||(document.member.Username.value == "Username"))
		{
			alert("Enter UserName.");
			document.member.Username.focus();
			return ;
		}
		if ((document.member.Password.value == "")||(document.member.Password.value == "Password"))
		{
			alert("Enter Password.");
			document.member.Password.focus();
			return ;
		}
	}
	function validCareer(){
		if (document.careerform.FullName.value == "")
		{
			alert("Please enter a value for the \"Name\" field.");
			document.careerform.FullName.focus();
			return ;
		}
		if (document.careerform.LastName.value == "")
		{
			alert("Please enter a value for the \"Last Name\" field.");
			document.careerform.LastName.focus();
			return ;
		}
		if ( document.careerform.Email.value.indexOf ('@', 0) == -1 || document.careerform.Email.value.indexOf ('.', 0) == -1 )
		{
			alert("please enter a valid e-mail");
			document.careerform.Email.focus();
			return;
		}
		else document.careerform.submit();
	}
	var img1="";
	var PanelSlideOut = "";
	function revelerCacherSousNav_2(LienId,x,img,flag){
		var LI = document.getElementById (LienId).parentNode;
		var Sub = document.getElementById (LienId+"_sub");
		if(flag==true){
			document.getElementById (x).src = img;
			//alert(document.getElementById (x).src);
			//document.getElementById (x).className= "portal";
			//document.getElementById ('span').innerHTML="&nbsp;-";
			//document.getElementById (LienId).className= "test";
			//LI.className = "bgtdleft2";
			Sub.style.display = "";
			if (PanelSlideOut != "") revelerCacherSousNav_2(PanelSlideOut,x1,img1);
			PanelSlideOut = LienId;
			x1=x;
			img1=img;
		}
		else
		{
			document.getElementById (x).src = img;
			//document.getElementById ('span').innerHTML="+";
			//document.getElementById (x).className= "conslistfinal";
			//document.getElementById (LienId).className= "test";
			//LI.className = "bgtdleft";
			Sub.style.display = "none";
			PanelSlideOut = "";
			x1="";
			img1="";
		}
	}

	function validChars(e,goods,itemId) {

		var key, keychar;

		key = (window.event) ? window.event.keyCode : ((e) ? e.which : null);
		if(key==48){
			var qty=eval('document.add_item.qty_'+itemId+'.value');
			if(qty == ''){
				return false;
			}
		}
		if (key == null) return true;



		keychar = String.fromCharCode(key);
		keychar = keychar.toLowerCase();
		goods = goods.toLowerCase();
		if (goods.indexOf(keychar) != -1)
		return true;

		if (key==null || key==0 || key==8 || key==9 || key==13 || key==27){
			return true;
		}

		return false;

	}

	function validateContact(){
		root = document.contact;

		if(root.name.value==''){
			alert('Please specify a name');
			root.name.focus();
			return false;
		}
		if(root.email.value==''){
			alert('Please specify an email address');
			root.email.focus();
			return false;
		}
		var pattern = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
		flag=root.email.value.match(pattern);
		if(!flag){
			alert('Please insert a valid email address.');
			root.email.select();
			return false;
		}


		if(root.subject.value==''){
			alert('Please specify a subject');
			root.subject.focus();
			return false;
		}
		if(root.message.value==''){
			alert('Please specify a message');
			root.message.focus();
			return false;
		}
		return true;
	}

	function clearContactForm(){
		var root=document.contact;
		if(confirm('Are you sure you want to clear all the form?')){
			root.name.value='';
			root.email.value='';
			root.subject.value='';
			root.message.value='';
			
			return true;
		}
		return false;

	}

	function validateRegistration(){
		root = document.regForm;

		if(root.Type.value==''){
			alert('Please specify a type');
			root.Type.focus();
			return false;
		}

		if(root.FirstName.value==''){
			alert('Please specify your first name');
			root.FirstName.focus();
			return false;
		}
		if(root.LastName.value==''){
			alert('Please specify your last name');
			root.LastName.focus();
			return false;
		}
		if(root.Username.value==''){
			alert('Please specify your username');
			root.Username.focus();
			return false;
		}
		if(root.Password.value==''){
			alert('Please specify your password');
			root.Password.focus();
			return false;
		}
		if(root.Confirm.value==''){
			alert('Please Confirm your password');
			root.Confirm.focus();
			return false;
		}

		if(root.Confirm.value!=root.Password.value){
			alert('The password and its confirmation do not match');
			root.Confirm.focus();
			return false;
		}

		if(root.Email.value==''){
			alert('Please specify an email address');
			root.Email.focus();
			return false;
		}
		var pattern = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
		flag=root.Email.value.match(pattern);
		if(!flag){
			alert('Please insert a valid email address.');
			root.Email.select();
			return false;
		}


		return true;
	}

	function validateAddVirtual(){
		root = document.virtual;


		if(root.FirstName.value==''){
			alert('Please specify your first name');
			root.FirstName.focus();
			return false;
		}
		if(root.LastName.value==''){
			alert('Please specify your last name');
			root.LastName.focus();
			return false;
		}



		if(root.Email.value==''){
			alert('Please specify an email address');
			root.Email.focus();
			return false;
		}
		var pattern = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
		flag=root.Email.value.match(pattern);
		if(!flag){
			alert('Please insert a valid email address.');
			root.Email.select();
			return false;
		}


		return true;
	}


	function clearRegistration(){
		if(confirm('Are you sure you want to clear all the form?')){
			root = document.regForm;

			root.Type.value='';
			root.FirstName.value='';
			root.LastName.value='';
			root.Username.value='';
			root.Password.value='';
			root.Confirm.value='';
			root.Email.value='';
			root.Nationality.value='';
			root.Gender.value='';
			root.Fax.value='';
			root.Telephone.value='';
			root.Billingaddress.value='';
			root.Homeaddress.value='';
			return true;
		}return false;
	}

	function clearVirtual(){
		if(confirm('Are you sure you want to clear all the form?')){
			root = document.virtual;

			root.FirstName.value='';
			root.LastName.value='';
			root.Email.value='';
			root.Nationality.value='';
			root.Gender.value='';
			root.Fax.value='';
			root.Telephone.value='';
			root.Billingaddress.value='';
			root.Homeaddress.value='';
			return true;

		}return false;
	}

	function validateRegistration(){
		root = document.regForm;

		if(root.Type.value==''){
			alert('Please specify a type');
			root.Type.focus();
			return false;
		}

		if(root.FirstName.value==''){
			alert('Please specify your first name');
			root.FirstName.focus();
			return false;
		}
		if(root.LastName.value==''){
			alert('Please specify your last name');
			root.LastName.focus();
			return false;
		}
		if(root.Username.value==''){
			alert('Please specify your username');
			root.Username.focus();
			return false;
		}
		if(root.Password.value==''){
			alert('Please specify your password');
			root.Password.focus();
			return false;
		}
		if(root.Confirm.value==''){
			alert('Please Confirm your password');
			root.Confirm.focus();
			return false;
		}

		if(root.Confirm.value!=root.Password.value){
			alert('The password and its confirmation do not match');
			root.Confirm.focus();
			return false;
		}

		if(root.Email.value==''){
			alert('Please specify an email address');
			root.Email.focus();
			return false;
		}
		var pattern = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
		flag=root.Email.value.match(pattern);
		if(!flag){
			alert('Please insert a valid email address.');
			root.Email.select();
			return false;
		}


		return true;
	}


	function clearRegistration(){
		if(confirm('Are you sure you want to clear all the form?')){
			root = document.regForm;

			root.Type.value='';
			root.FirstName.value='';
			root.LastName.value='';
			root.Username.value='';
			root.Password.value='';
			root.Confirm.value='';
			root.Email.value='';
			root.Nationality.value='';
			root.Gender.value='';
			root.Fax.value='';
			root.Telephone.value='';
			root.Billingaddress.value='';
			root.Homeaddress.value='';
			return true;
		}return false;
	}

	function validateCareers(){
		root = document.app;

		if(root.FirstName.value==''){
			alert('Please specify your first name');
			root.FirstName.focus();
			return false;
		}
		if(root.LastName.value==''){
			alert('Please specify your last name');
			root.LastName.focus();
			return false;
		}

		if(root.Email.value==''){
			alert('Please specify an email address');
			root.Email.focus();
			return false;
		}
		var pattern = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
		flag=root.Email.value.match(pattern);
		if(!flag){
			alert('Please insert a valid email address.');
			root.Email.select();
			return false;
		}

		if(root.Cv.value==''){
			alert('Please specify a cv to upload');
			root.Cv.focus();
			return false;
		}
		return true;

	}


	function popImage(imageURL,imageTitle){
		//alert(imageURL);
		defaultWidth  = 500;
		defaultHeight = 500;
		//alert(imageURL);
		var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left=100,top=100';
		var optIE='scrollbars=no,width=150,height=100,left=100,top=100';

		var AutoClose = true;

		if (parseInt(navigator.appVersion.charAt(0))>=4){
			var isNN=(navigator.appName=="Netscape")?1:0;
			var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
			var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left=100,top=100';
			var optIE='scrollbars=no,width=150,height=100,left=100,top=100';

			//if (isNN){imgWin=window.open('about:blank','',optNN);}
			if (isNN){imgWin=window.open('about:blank','',optNN);}
			if (isIE){imgWin=window.open('about:blank','',optIE);}
			with (imgWin.document){
				writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');
				writeln('<sc'+'ript>');
				writeln('var isNN,isIE;');
				writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
				writeln('isNN=(navigator.appName=="Netscape")?1:0;');
				writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
				writeln('function reSizeToImage(){');
				writeln('if (isIE){');
				writeln('window.resizeTo(100,100);');
				writeln('width=100-(document.body.clientWidth-document.images[0].width);');
				writeln('height=100-(document.body.clientHeight-document.images[0].height);');
				writeln('window.resizeTo(width,height);}');
				writeln('if (isNN){');
				writeln('window.innerWidth=document.images["Image"].width;');
				writeln('window.innerHeight=document.images["Image"].height;}}');
				writeln('function doTitle(){document.title="'+imageTitle+'";}');
				writeln('</sc'+'ript>');
				if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
				else writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
				writeln('<img name="Image" src='+imageURL+' style="display:block"></body></html>');
				close();
			}
	}


	function checkMembershipType(){
		var memType=document.getElementById('membershipType');
		var cert=document.getElementById('certificates');

		if(memType.value=='s'){
			cert.innerHTML="<br><table border='0' cellpadding='1' cellspacing='1' width='350'><tr><td class='normal_text' colspan='3'><b>Certificates</b></td></tr><tr>	<td class='normal_text' width='100'><i>ISO 9001</i></td><td class='normal_text'><label><input type='radio' name='ISO9001' value='1'>&nbsp;Yes</label></td><td class='normal_text'><label><input type='radio' name='ISO9001' value='0' checked>&nbsp;No</label></td></tr><tr>	<td class='normal_text' width='100'><i>ISO 22000</i></td>	<td class='normal_text'><label><input type='radio' name='ISO22000' value='1'>&nbsp;Yes</label></td>	<td class='normal_text'><label><input type='radio' name='ISO22000' value='0' checked>&nbsp;No</label></td></tr><tr>	<td class='normal_text' width='100'><i>HACCP</i></td>	<td class='normal_text'><label><input type='radio' name='HACCP' value='1'>&nbsp;Yes</label></td>	<td class='normal_text'><label><input type='radio' name='HACCP' value='0' checked>&nbsp;No</label></td></tr><tr><td colspan='3'><table border='0' cellpadding='1' cellspacing='1' width='340'><tr><td class='normal_text' width='60'><i>EUROGAP</i></td><td class='normal_text' width='65'><label><input type='radio' name='EUROGAP' name='EUROGAP' id='EUROGAP' value='1' onchange=\"return checkEUROGAP('1');\">&nbsp;Complete</label></td><td class='normal_text' width='70'><label><input type='radio' name='EUROGAP' id='EUROGAP' value='0' onchange=\"return checkEUROGAP('0');\">&nbsp;In Progress</label></td><td class='normal_text' width='50'><label><input type='radio' name='EUROGAP' id='EUROGAP' value='-1' checked onchange=\"return checkEUROGAP('-1');\">&nbsp;None</label></td></tr><tr><td colspan='4'><table border='0' cellpadding='0' cellspacing='0' width='300' class='normal_text'><tr><td width='30'><input type='checkbox' name='1' id='chk1' value='1' disabled></td><td>Traceability</td></tr><tr><td width='30'><input type='checkbox' name='2' id='chk2' value='1' disabled></td>									<td>Record keeping and internal self-inspection </td></tr><tr><td width='30'><input type='checkbox' name='3' id='chk3' value='1' disabled></td><td>Varieties and rootstocks </td></tr><tr><td width='30'><input type='checkbox' name='4' id='chk4' value='1' disabled></td>										<td>Site history and site management </td>									</tr>									<tr>										<td width='30'><input type='checkbox' name='5' id='chk5' value='1' disabled></td>										<td>Soil and substrate management </td>									</tr>									<tr>										<td width='30'><input type='checkbox' name='6' id='chk6' value='1' disabled></td>										<td>Fertilizer use </td>									</tr>									<tr>										<td width='30'><input type='checkbox' name='7' id='chk7' value='1' disabled></td>										<td>Irrigation and fertigation </td>									</tr>									<tr>										<td width='30'><input type='checkbox' name='8' id='chk8' value='1' disabled></td>										<td>Crop protection program</td>									</tr>									<tr>										<td width='30'><input type='checkbox' name='9' id='chk9' value='1' disabled></td>										<td valign='top'>Waste and pollution management, recycling and reuse </td>									</tr>									<tr>										<td width='30'><input type='checkbox' name='10' id='chk10' value='1' disabled></td>										<td>Workers health , safety and welfare </td>									</tr>									<tr>										<td width='30'><input type='checkbox' name='11' id='chk11' value='1' disabled></td>										<td>Environmental issues </td>									</tr>									<tr>										<td width='30'><input type='checkbox' name='12' id='chk12' value='1' disabled></td><td>Complaints form </td></tr></table></td></tr></table></td></tr></table>";
		}
		else{
			cert.innerHTML="";
		}



	}

	function checkEUROGAP(num){
		var EUROGAP = document.getElementById('EUROGAP');
		var chk1 = document.getElementById('chk1');
		var chk2 = document.getElementById('chk2');
		var chk3 = document.getElementById('chk3');
		var chk4 = document.getElementById('chk4');
		var chk5 = document.getElementById('chk5');
		var chk6 = document.getElementById('chk6');
		var chk7 = document.getElementById('chk7');
		var chk8 = document.getElementById('chk8');
		var chk9 = document.getElementById('chk9');
		var chk10 = document.getElementById('chk10');
		var chk11 = document.getElementById('chk11');
		var chk12 = document.getElementById('chk12');

		if(num=='1'){
			chk1.disabled = true;
			chk2.disabled = true;
			chk3.disabled = true;
			chk4.disabled = true;
			chk5.disabled = true;
			chk6.disabled = true;
			chk7.disabled = true;
			chk8.disabled = true;
			chk9.disabled = true;
			chk10.disabled = true;
			chk11.disabled = true;
			chk12.disabled = true;

			chk1.checked = true;
			chk2.checked = true;
			chk3.checked = true;
			chk4.checked = true;
			chk5.checked = true;
			chk6.checked = true;
			chk7.checked = true;
			chk8.checked = true;
			chk9.checked = true;
			chk10.checked = true;
			chk11.checked = true;
			chk12.checked = true;
		}
		else if(num=='0'){
			chk1.checked = false;
			chk2.checked = false;
			chk3.checked = false;
			chk4.checked = false;
			chk5.checked = false;
			chk6.checked = false;
			chk7.checked = false;
			chk8.checked = false;
			chk9.checked = false;
			chk10.checked = false;
			chk11.checked = false;
			chk12.checked = false;

			chk1.disabled = false;
			chk2.disabled = false;
			chk3.disabled = false;
			chk4.disabled = false;
			chk5.disabled = false;
			chk6.disabled = false;
			chk7.disabled = false;
			chk8.disabled = false;
			chk9.disabled = false;
			chk10.disabled = false;
			chk11.disabled = false;
			chk12.disabled = false;
		}
		else{
			chk1.checked = false;
			chk2.checked = false;
			chk3.checked = false;
			chk4.checked = false;
			chk5.checked = false;
			chk6.checked = false;
			chk7.checked = false;
			chk8.checked = false;
			chk9.checked = false;
			chk10.checked = false;
			chk11.checked = false;
			chk12.checked = false;

			chk1.disabled = true;
			chk2.disabled = true;
			chk3.disabled = true;
			chk4.disabled = true;
			chk5.disabled = true;
			chk6.disabled = true;
			chk7.disabled = true;
			chk8.disabled = true;
			chk9.disabled = true;
			chk10.disabled = true;
			chk11.disabled = true;
			chk12.disabled = true;
		}

		return false;
	}


	function validateChangePassword(){
		var root=document.change_password;

		var oldPass=root.old_pass;
		var newPass=root.new_pass;
		var confirm=root.confirm;

		if(oldPass.value==''){
			alert('Please enter your old password.');
			oldPass.focus();
			return false;
		}
		if(newPass.value==''){
			alert('Please enter your new password.');
			newPass.focus();
			return false;
		}
		if(confirm.value==''){
			alert('Please enter your new password\'s confirmation.');
			confirm.focus();
			return false;
		}

		if(newPass.value.length<6){
			alert('Your password must be at least 6 characters long.');
			newPass.select();
			return false;
		}
		if(newPass.value!=confirm.value){
			alert('The new password and its confirmation do not match');
			confirm.select();
			return false;
		}
	}

	function checkAddDemand(){
		var root=document.postDemand;

		var name=root.name;
		var description=root.description;
		var quantity=root.quantity;
		var conditioning=root.conditioning;
		var packing=root.packing;

		if(name.value==''){
			alert('Please enter the name.');
			name.focus();
			return false;
		}
		if(description.value==''){
			alert('Please enter the description.');
			description.focus();
			return false;
		}
		if(quantity.value==''){
			alert('Please enter the quantity.');
			quantity.focus();
			return false;
		}
		if(conditioning.value==''){
			alert('Please fill the conditioning field.');
			conditioning.focus();
			return false;
		}
		if(packing.value==''){
			alert('Please fill the packing field.');
			packing.focus();
			return false;
		}

	}

	function checkAddSupply(){
		var root=document.postSupply;

		var name=root.name;
		var description=root.description;
		var quantity=root.quantity;
		var price=root.price;
		var life=root.life;
		var conditioning=root.conditioning;
		var packing=root.packing;

		if(name.value==''){
			alert('Please enter the name.');
			name.focus();
			return false;
		}
		if(description.value==''){
			alert('Please enter the description.');
			description.focus();
			return false;
		}
		if(quantity.value==''){
			alert('Please enter the quantity.');
			quantity.focus();
			return false;
		}
		if(price.value==''){
			alert('Please enter the price.');
			price.focus();
			return false;
		}
		if(isNaN(price.value)){
			alert('The price must be a number.');
			price.select();
			return false;
		}
		if(life.value==''){
			alert('Please enter the shelf life.');
			life.focus();
			return false;
		}
		if(conditioning.value==''){
			alert('Please fill the conditioning field.');
			conditioning.focus();
			return false;
		}
		if(packing.value==''){
			alert('Please fill the packing field.');
			packing.focus();
			return false;
		}

	}


	function validateSearch(){
		var root=document.search;
		var keyword= root.keyword;

		if(keyword.value==''){
			alert('Please enter the keyword you wish to search for.');
			keyword.focus();
			return false;
		}
		if(keyword.value.length<3){
			alert('The keyword should be greater than 3 characters long.');
			keyword.select();
			return false;
		}

	}

	function validateForgotPassword(){
		var root=document.forgot_password;

		var username=root.username;
		var email=root.email;

		if(username.value==''){
			alert('Please enter your username.');
			username.focus();
			return false;
		}
		if(email.value==''){
			alert('Please enter your email address.');
			email.focus();
			return false;
		}

	}

	function validateNewsletter(){
		var root=document.newsletter;

		var name=root.name;
		var email=root.email;


		if(name.value==''){
			alert('Please enter your full name.');
			name.focus();
			return false;
		}
		if(email.value==''){
			alert('Please enter your email address.');
			email.focus();
			return false;
		}

	}

	function validateEditProfile(){
		var root = document.editProfile;

		if(root.FirstName.value==''){
			alert('Please specify your first name');
			root.FirstName.focus();
			return false;
		}
		if(root.LastName.value==''){
			alert('Please specify your last name');
			root.LastName.focus();
			return false;
		}
		if(root.Email.value==''){
			alert('Please specify an email address');
			root.Email.focus();
			return false;
		}
		var pattern = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
		flag=root.Email.value.match(pattern);
		if(!flag){
			alert('Please insert a valid email address.');
			root.Email.select();
			return false;
		}


		return true;

	}

	function validateApplyToServices(){
		root = document.add_review;

		if(root.name.value==''){
			alert('Please specify a name');
			root.name.focus();
			return false;
		}
		if(root.email.value==''){
			alert('Please specify an email address');
			root.email.focus();
			return false;
		}
		var pattern = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
		flag=root.email.value.match(pattern);
		if(!flag){
			alert('Please insert a valid email address.');
			root.email.select();
			return false;
		}


		if(root.subject.value==''){
			alert('Please specify a subject');
			root.subject.focus();
			return false;
		}
		if(root.message.value==''){
			alert('Please specify a message');
			root.message.focus();
			return false;
		}
		return true;
	}

	function validateMemberSignIn(){
		var root = document.signin;
		var username = root.username.value;
		var password = root.password.value;
		if (username == ''){
			alert('Please enter your username.');
			root.username.focus();
			return false;
		}
		if (password == ''){
			alert('Please enter your password.');
			root.password.focus();
			return false;
		}
		password = hex_md5(password);
		root.password.value = password;
		root.hashed.value = 'yes';
		return true;
	}

	function validateShippingAddress(){
		var root = document.shipping;

		var prev=root.previousAddress;

		var address=root.address;
		var city=root.city;
		var country=root.country;
		var newShipping=document.getElementById('shippingNew');
		var shippingPrev=document.getElementById('shippingPrev');

		if(!shippingPrev.checked && !newShipping.checked){
			alert('Please select an old shipping address or add a new one.');
			return false;
		}
		
		if(shippingPrev.checked){
			if(prev.value==''){
				alert('Please select a previous shipping address.');
				prev.focus();
				return false;
			}
		}

		if(newShipping.checked){
			if(root.address.value==''){
				alert('Please specify the shipping address.');
				address.focus();
				return false;
			}
			if(root.city.value==''){
				alert('Please specify the city.');
				city.focus();
				return false;
			}
			if(root.country.value==''){
				alert('Please specify select a country.');
				country.focus();
				return false;
			}
		}
	}