function showpassword() {
	document.getElementById('forgot_pass').style.display='block';	
	document.getElementById('login').style.display='none';	
}

function showlogin() {
	document.getElementById('forgot_pass').style.display='none';	
	document.getElementById('login').style.display='block';	
}

function callTotal() {
	alert('enter');
	alet(document.getElementById('varTotal').value);	

}

function getAddreesValue()
{
	 if(document.viewcart1.sameAddress.checked)
	  {
		
	 document.viewcart1.varShipFname.value = document.viewcart1.varBillFname.value ;
	 document.viewcart1.varShipLname.value = document.viewcart1.varBillLname.value ;
	document.viewcart1.varShipAddress.value = document.viewcart1.varBillAddress.value ;
	document.viewcart1.varShipPostcode.value = document.viewcart1.varBillPostcode.value ;
	 document.viewcart1.varShipCity.value = document.viewcart1.varBillCity.value ;
	 document.viewcart1.varShipState.value = document.viewcart1.varBillState.value ;
	 document.viewcart1.varShipCountry.value = document.viewcart1.varBillCountry.value ;
	 document.viewcart1.varShipEmail.value = document.viewcart1.varBillEmail.value ;
	  }
	  else
	   {
	 document.viewcart1.varShipFname.value = "" ;
	 document.viewcart1.varShipLname.value =  "" ;
	  document.viewcart1.varShipAddress.value = "" ;
	   document.viewcart1.varShipPostcode.value = "" ;
	 document.viewcart1.varShipCity.value =  "" ;
	 document.viewcart1.varShipState.value =  "" ;
	 document.viewcart1.varShipCountry.value =  "" ;
	 document.viewcart1.varShipEmail.value =  "" ;
	   }
}


function addRowTotable2()
{
	
	ext = (document.frm_hotel.uploadno2.value);
	ext++;

  var tbl = document.getElementById('tab3');
  var lastRow = tbl.rows.length;
  // if there's no header row in the table, then iteration = lastRow + 1
  var iteration = lastRow;

  
  
  var row = tbl.insertRow(lastRow);
  
  var cell0 = document.createElement('td');
 // cell0.innerHTML = '<div>&nbsp;</div>';
 
  var el = document.createElement('input');
  el.type = 'file';
  el.name = 'varImage'+ext;
  el.id =  'varImage'+ext;
  el.size = 20;
  cell0.appendChild(el);
  
   row.appendChild(cell0);
 
  document.frm_hotel.uploadno2.value = ext;
}

function addRowTotable3()
{
	
	ext = (document.frm_userinfo.uploadno2.value);
	ext++;

  var tbl = document.getElementById('tab3');
  var lastRow = tbl.rows.length;
  // if there's no header row in the table, then iteration = lastRow + 1
  var iteration = lastRow;

  
  
  var row = tbl.insertRow(lastRow);
  
  var cell0 = document.createElement('td');
 // cell0.innerHTML = '<div>&nbsp;</div>';
 
  var el = document.createElement('input');
  el.type = 'file';
  el.name = 'varImage'+ext;
  el.id =  'varImage'+ext;
  el.size = 20;
  cell0.appendChild(el);
  
   row.appendChild(cell0);
 
  document.frm_userinfo.uploadno2.value = ext;
}





$(document).ready(function() {
						   
						   
$("#comments").validate({
	rules: {
		name: {
			required: true
		},
		mail: {
			required: true
		},
		website: {
			required: true
		},
		comments: {
			required: true
		}
	},
	messages: {
		name: '<br /><span style="width:255px; line-height:30px;text-align:left;  color:#ff0000; font-size:11px;">'+"Please enter the Name"+'</span>',
		mail: '<br /><span style="width:255px; line-height:30px;text-align:left;  color:#ff0000; font-size:11px;">'+"Please enter the Mail Id"+'</span>',
		website: '<br /><span style="width:255px; line-height:30px;text-align:left;  color:#ff0000; font-size:11px;">'+"Please enter website"+'</span>',
		comments: '<br /><span style="width:255px; line-height:30px;text-align:left;  color:#ff0000; font-size:11px;">'+"Please enter comments"+'</span>'
	}
});							   

	$("#frm_registration").validate({
	rules: {
		varFname: {
			required: true
		},
		varLname: {
			required: true
		},
		
		VarEmailid: {
			required: true,
			email:true
		},
		
		varPassword: {
			required: true
		},
		VarConfirmPassword: {
			required:true,
			equalTo: "#varPassword"
	    },
		varAboutme: {
			required: true
			
		},
		varCity: {
			required: true
			
		},
		varCountry: {
			required: true
		},
		varcheck: {
			required: true
		}
	},
	messages: {
		varFname: '<br><span style="width:255px; line-height:30px;text-align:left;  color:#ff0000; font-size:11px;">'+"Please enter First Name"+'</span>',
		varLname: '<br><span style="width:255px; line-height:30px;text-align:left;  color:#ff0000; font-size:11px;">'+"Please enter Last Name"+'</span>',
		VarEmailid: '<br><span style="width:255px; line-height:30px;text-align:left;  color:#ff0000; font-size:11px;">'+"Please enter Valid Email Address"+'</span>',
		varPassword: '<br><span style="width:255px; line-height:30px;text-align:left;  color:#ff0000; font-size:11px;">'+"Please enter Password"+'</span>',
	VarConfirmPassword: '<br><span style="width:255px; line-height:30px;text-align:left;  color:#ff0000; font-size:11px;">'+"Please enter the same Password again"+'</span>',
	varAboutme: '<br><span style="width:255px; line-height:30px;text-align:left;  color:#ff0000; font-size:11px;">'+"Please enter Date of Birth"+'</span>',
		varCity: '<br><span style="width:255px; line-height:30px;text-align:left;  color:#ff0000; font-size:11px;">'+"Please enter city"+'</span>',
		varCountry: '<br><span style="width:255px; line-height:30px;text-align:left;  color:#ff0000; font-size:11px;">'+"Please select country"+'</span>',
		varcheck: '<span style="width:auto; line-height:30px;text-align:left;  color:#ff0000; font-size:11px; position:absolute; margin-top:15px;  ">'+"Please check only if you are legally above 18<br><br>"+'</span>'
	
	}
});
	
	
	$("#frm_contact").validate({
	rules: {
		contact_name: {
			required: true
		},
		contact_email: {
			required: true,
			email:true
		},
		contact_comments: {
			required: true
		}
	},
	messages: {
		contact_name: '<br><span style="width:255px; line-height:30px;text-align:left;  color:#ff0000; font-size:11px;">'+"Please enter Name"+'</span>',
		contact_email: '<br><span style="width:255px; line-height:30px;text-align:left;  color:#ff0000; font-size:11px;">'+"Please enter Valid Email Address"+'</span>',
		contact_comments: '<br><span style="width:255px; line-height:30px;text-align:left;  color:#ff0000; font-size:11px;">'+"Please Enter Your Comments"+'</span>'
	}
	});



$("#frm_login").validate({
	rules: {
		
		login_email: {
			required: true,
			email:true
		},
		login_password: {
			required: true
		}
	},
	messages: {
		
		login_email: '<br><span style="width:255px; line-height:30px;text-align:left;  color:#ff0000; font-size:11px;">'+"A valid email will help us get in touch with you."+'</span>',
		login_password: '<br><span style="width:255px; line-height:30px;text-align:left;  color:#ff0000; font-size:11px;">'+"Please enter your password"+'</span>'
	}
	});

$("#viewcart1").validate({
	rules: {
		
		varBillFname: {
			required: true
			
		},
		varBillLname: {
			required: true
		},
		varBillAddress: {
			required: true
		},
		
		varBillCity: {
			required: true
		},
		varBillCountry: {
			required: true
		},
		varBillEmail: {
			required: true,
			email:true
		},
		
		varShipFname: {
			required: true
			
		},
		varShipLname: {
			required: true
		},
		varShipAddress: {
			required: true
		},
		
		varShipCity: {
			required: true
		},
		varShipCountry: {
			required: true
		},
				
		varShipEmail: {
			required: true,
			email:true
		}
		
		
		
	},
	messages: {
		
		varBillFname: '<br><span style="width:255px; line-height:30px;text-align:left;  color:#ff0000; font-size:11px;">'+"Please enter your First Name. "+'</span>',
		varBillLname: '<br><span style="width:255px; line-height:30px;text-align:left;  color:#ff0000; font-size:11px;">'+"Please enter your Last Name"+'</span>',
		varBillAddress: '<br><span style="width:255px; line-height:30px;text-align:left;  color:#ff0000; font-size:11px;">'+"Please enter your Address"+'</span>',
		varBillCity: '<br><span style="width:255px; line-height:30px;text-align:left;  color:#ff0000; font-size:11px;">'+"Please enter your City Name"+'</span>',
		varBillCountry: '<br><span style="width:255px; line-height:30px;text-align:left;  color:#ff0000; font-size:11px;">'+"Please enter your Country Name"+'</span>',
		varBillEmail: '<br><span style="width:255px; line-height:30px;text-align:left;  color:#ff0000; font-size:11px;">'+"A valid email will help us get in touch with you."+'</span>',
		
		varShipFname: '<br><span style="width:255px; line-height:30px;text-align:left;  color:#ff0000; font-size:11px;">'+"Please enter your First Name. "+'</span>',
		varShipLname: '<br><span style="width:255px; line-height:30px;text-align:left;  color:#ff0000; font-size:11px;">'+"Please enter your Last Name"+'</span>',
		varShipAddress: '<br><span style="width:255px; line-height:30px;text-align:left;  color:#ff0000; font-size:11px;">'+"Please enter your Address"+'</span>',
		varShipCity: '<br><span style="width:255px; line-height:30px;text-align:left;  color:#ff0000; font-size:11px;">'+"Please enter your City Name"+'</span>',
		varShipCountry: '<br><span style="width:255px; line-height:30px;text-align:left;  color:#ff0000; font-size:11px;">'+"Please enter your Country Name"+'</span>',
		varShipEmail: '<br><span style="width:255px; line-height:30px;text-align:left;  color:#ff0000; font-size:11px;">'+"A valid email will help us get in touch with you."+'</span>'
		
		
	}
	});


$("#frm_Changepassword").validate({
	rules: {
		
	    old_password: {
			required: true
		},
		new_password: {
			required: true
		},
		re_password: {
			required: true,
			equalTo: "#new_password"
		}
	},
	messages: {
		
		old_password: '<span style="width:255px; line-height:30px;text-align:left;  color:#ff0000; font-size:11px;">'+"Please enter your Old password."+'</span>',
		new_password: '<span style="width:255px; line-height:30px;text-align:left;  color:#ff0000; font-size:11px;">'+"Please enter your New password"+'</span>',
		re_password: '<span style="width:255px; line-height:30px;text-align:left;  color:#ff0000; font-size:11px;">'+"Please enter the same value again"+'</span>'
	}
	});





$("#frm_hotel").validate({
	rules: {
		varHotelName: {
			required: true
		},
		varCity: {
			required: true
		},
		varcountry: {
			required: true
		}
		
	},
	messages: {
		varHotelName: '<span style="width:255px; line-height:30px;text-align:left;  color:#ff0000; font-size:11px;">'+"Please enter Hotel Name"+'</span>',
		
		varCity: '<span style="width:255px; line-height:30px;text-align:left;  color:#ff0000; font-size:11px;">'+"Please enter City"+'</span>',
		
		varcountry: '<span style="width:255px; line-height:30px;text-align:left;  color:#ff0000; font-size:11px;">'+"Please enter Country"+'</span>'
		
		
	}
	});

$("#frm_userinfo").validate({
	rules: {
		
	    intHotelId: {
			required: true
		},
		varDesc: {
			required: true
		}
		
	},
	messages: {
		
		intHotelId: '<span style="width:255px; line-height:30px;text-align:left;  color:#ff0000; font-size:11px;">'+"Please Select Hotel Name."+'</span>',
		varDesc: '<span style="width:255px; line-height:30px;text-align:left;  color:#ff0000; font-size:11px;">'+"Please enter your Idea"+'</span>'
		
	}
	});

/*$("#member").validate({
	rules: {
		
		varCmpname: {
			required: true
		},
		varContact: {
			required: true
		},
		
		varEmail: {
			required: true,
			email:true
		},
			
		varMobile: {
			required: true
		},
		varLandline: {
			required: true
		},
		varCmpaddress: {
			required: true,
		},
		
		varPostal: {
			required: true
			
		},
		varRegion: {
			required: true
		},
		varTonnage: {
			required: true
		},
		varPay: {
			required: true
		},
		varExpire_month: {
			required: true
			
		},
		varExpire_year: {
			required: true
			
		},
		varName: {
			required: true
		
		}
	},
	errorElement: "div",
        wrapper: "div",  // a wrapper around the error message
        errorPlacement: function(error, element) {
            offset = element.offset();
            error.insertBefore(element)
            error.addClass('message');  // add a class to the wrapper
            error.css('position', 'absolute');
            error.css('left', offset.left + element.outerWidth());
            error.css('top', offset.top);
        }

	 messages: {
		
		varCmpname: '<br><span style="width:auto; line-height:30px; color:#ff0000; font-size:11px; position:absolute;">'+"Please enter your Wine Company Name. "+'</span>',
		varContact: '<br><span style="width:255px; line-height:30px;  color:#ff0000; font-size:11px;">'+"Please enter your Best Contact"+'</span>',
		varEmail: '<br><span style="width:255px; line-height:30px;  color:#ff0000; font-size:11px;">'+"Please enter your Email id"+'</span>',
		varMobile: '<br><span style="width:255px; line-height:30px;  color:#ff0000; font-size:11px;">'+"Please enter your Mobile Number"+'</span>',
		varLandline: '<br><span style="width:255px; line-height:30px; color:#ff0000; font-size:11px;">'+"Please enter your Landline Number"+'</span>',
		
		varCmpaddress: '<br><span style="width:255px; line-height:30px; color:#ff0000; font-size:11px;">'+"Please enter your Wine Company Address. "+'</span>',
		varPostal: '<br><span style="width:255px; line-height:30px; color:#ff0000; font-size:11px;">'+"Please enter your Postal Code. "+'</span>',
		varRegion: '<br><span style="width:255px; line-height:30px; color:#ff0000; font-size:11px;">'+"Please enter your Region"+'</span>',
		varTonnage: '<br><span style="width:255px; line-height:30px;  color:#ff0000; font-size:11px;">'+"Please enter your Annual Tonnage"+'</span>',
		varPay: '<br><span style="width:255px; line-height:30px;  color:#ff0000; font-size:11px;">'+"Please enter your Mode of Payment"+'</span>',
		varExpire_month: '<br><span style="width:255px; line-height:30px; color:#ff0000; font-size:11px; position:absolute; margin-top:15px;">'+"Please enter your Card Expiration Month"+'</span>',
		varExpire_year: '<br><span>'+"Please enter your Card Expiration Year"+'</span>',
		varName: '<br><span style="width:255px; line-height:30px; color:#ff0000; font-size:11px;">'+"Please enter your Name as per in Card"+'</span>'			
	}
	});*/


});

function isValid()
{
	if(document.inbox_form.cnt.value == 1) {
			if(document.inbox_form.inboxid.checked==true)
				document.inbox_form.inboxid.checked=false;
				else
				document.inbox_form.inboxid.checked=true;
		
	}else {
		for(var i=0;i<document.inbox_form.cnt.value;i++)
		{
				if(document.inbox_form.inboxid[i].checked==true)
				document.inbox_form.inboxid[i].checked=false;
				else
				document.inbox_form.inboxid[i].checked=true;
		}
	}
}


function validate(form) {
  var varCmpname = document.form.varCmpname.value;
  var varContact = document.form.varContact.value;
  var varEmail = document.form.varEmail.value;
  var varMobile = document.form.varMobile.value;
  var varLandline = document.form.varLandline.value;
  var varCmpaddress = document.form.varCmpaddress.value;
  var varPostal = document.form.varPostal.value;
  var varRegion = document.form.varRegion.value;
  var varTonnage = document.form.varTonnage.value;
  var varPay = document.form.varPay.value;
  var varExpire_month = document.form.varExpire_month.value;
  var varExpire_year = document.form.varExpire_year.value;
  var varName = document.form.varName.value;
   
  
  var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;
  var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
  var messageRegex = new RegExp(/<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>/gim);
  if(varCmpname == "") {
 		alert('Please enter your Wine Company name.');
		document.form.varCmpname.focus();
    	return false;
  }
  if(!varCmpname.match(nameRegex)) {
    alert('Please enter valid Wine Company name.');
			document.form.varCmpname.focus();

    return false;
  }
  if(varContact == "") {
  alert('Please enter your Best Contact.');
  		document.form.varContact.focus();

  return false;
  }  
  if(varEmail == "") {
    alert('Please enter your Email.');
			document.form.varEmail.focus();

    return false;
  }
  if(!varEmail.match(emailRegex)) {
    alert('Please enter your valid Email.');
			document.form.varEmail.focus();

    return false;
  }
  if(varMobile == "") {
    alert('Please enter your Mobile Number.');
			document.form.varMobile.focus();

    return false;
  }
  if(varLandline == "") {
    alert('Please enter your Land Line Number.');
			document.form.varLandline.focus();

    return false;
  }
  if(varCmpaddress == "") {
    alert('Please enter your Wine Company Address.');
			document.form.varCmpaddress.focus();

    return false;
  }
  if(varPostal == "") {
    alert('Please enter your Post Code.');
			document.form.varPostal.focus();

    return false;
  }
  if(varRegion == "") {
    alert('Please enter your Region.');
			document.form.varRegion.focus();

    return false;
  }
  if(varTonnage == "") {
    alert('Please enter your Annual Tonnage.');
			document.form.varTonnage.focus();

    return false;
  }
  if(varPay == "") {
    alert('Please enter your Payment Mode.');
			document.form.varPay.focus();

    return false;
  }
  if(varExpire_month == "") {
    alert('Please enter your Card Expiration Month.');
			document.form.varExpire_month.focus();

    return false;
  }
  if(varExpire_year == "") {
    alert('Please enter your Card Expiration Year.');
			document.form.varExpire_year.focus();

    return false;
  }
  if(varName == "") {
    alert('Please enter your Name on card.');
			document.form.varName.focus();

    return false;
  }
  return true;
}

