/*****************************************************
 * Common Javascript functions
 *****************************************************/

function np() {
 return void(0)
}

function openWin(x,width,height) {
 window.open(x,null,"width="+width+",height="+height+",menubar=0,toolbar=0,resizable=0,scrollbars=1");
}

function $RF(reid) {
 return $$('input[type=radio][name=' + $(reid).name + ']').find(function(el) { return el.checked }).value;
}

function $CF(formId,reid) {
 return Form.getInputs(formId, "checkbox", reid).findAll(function(item){return item.checked; }).pluck("value");
}

function getTopIssues(sex) {
 new Ajax.Updater('topIssuesBox', '../process/home.box.top.issues.asp', {method: 'post', evalScripts: true, parameters: {typ: sex}})
}

function goHome(typ) {
 new Ajax.Updater('splashHome', 'process/home.splash.asp', {method: 'post', evalScripts: true, parameters: {typ: typ}})
}

function getTestimonial() {
 new Ajax.Updater('testimonialBox', 'process/home.testimonials.asp')
}

function chkLogin() {
 login = document.formLogin.login
 pwd = document.formLogin.pwd

 if (login.value == "") {
  alert("Please enter your Registration Number");
  login.focus();
  return false;
 }

 if (pwd.value == "") {
  alert("Please enter your password");
  pwd.focus();
  return false;
 }
 document.formLogin.submit();
}

function submitEnter(myfield,e) {
 var keycode;
 if (window.event) keycode = window.event.keyCode;
 else if (e) keycode = e.which;
 else return true;

 if (keycode == 13) {
  chkLogin()
 }

 else
  return true;
}

function chkRegister() {
 fName = document.formRegister.fName
 lName = document.formRegister.lName
 age = document.formRegister.age
 pwd = document.formRegister.pwd
 confirmPwd = document.formRegister.confirmPwd
 address1 = document.formRegister.address1
 city = document.formRegister.city
 state = document.formRegister.state
 country = document.formRegister.country
 phone = document.formRegister.phone
 heightVal = document.formRegister.heightVal
 weightVal = document.formRegister.weightVal
 diseaseId = document.formRegister.diseaseId

 if (fName.value == "") {
  alert("Please enter your First Name");
  fName.focus();
  return false;
 }

 if (lName.value == "") {
  alert("Please enter your Last Name");
  lName.focus();
  return false;
 }

 if (age.value == "") {
  alert("Please enter your age");
  age.focus();
  return false;
 }

 if (pwd.value.length < 5) {
  alert("Please enter a minimum 5 characters as your password");
  pwd.focus();
  return false;
 }

 if (pwd.value.indexOf(' ') != -1) {
  alert("You cannot have spaces in your password");
  pwd.focus();
  return false;
 }

 if ((confirmPwd.value != '') && (pwd.value != confirmPwd.value)) {
  alert("The retyped password does not match your password");
  confirmPwd.focus();
  return false;
 }

 if (address1.value == "") {
  alert("Please enter your Address Line 1");
  address1.focus();
  return false;
 }

 if (city.value == "") {
  alert("Please enter your City");
  city.focus();
  return false;
 }

 if (state.value == "") {
  alert("Please enter your State");
  state.focus();
  return false;
 }

 if (country.selectedIndex <= 0) {
  alert("Please select your Country");
  country.focus();
  return false;
 }

 if (phone.value == "") {
  alert("Please enter your Phone");
  phone.focus();
  return false;
 }

 if (heightVal.value == "") {
  alert("Please enter your height");
  heightVal.focus();
  return false;
 }

 if (weightVal.value == "") {
  alert("Please enter your weight");
  weightVal.focus();
  return false;
 }

 if (diseaseId.selectedIndex <= 0) {
  alert("Please select your Primary disease");
  diseaseId.focus();
  return false;
 }
 document.formRegister.submit();
}

function chkRegisterUpdate() {
 address1 = document.formRegister.address1
 city = document.formRegister.city
 state = document.formRegister.state
 country = document.formRegister.country
 phone = document.formRegister.phone

 if (address1.value == "") {
  alert("Please enter your Address Line 1");
  address1.focus();
  return false;
 }

 if (city.value == "") {
  alert("Please enter your City");
  city.focus();
  return false;
 }

 if (state.value == "") {
  alert("Please enter your State");
  state.focus();
  return false;
 }

 if (country.selectedIndex <= 0) {
  alert("Please select your Country");
  country.focus();
  return false;
 }

 if (phone.value == "") {
  alert("Please enter your Phone");
  phone.focus();
  return false;
 }
 document.formRegister.submit();
}

function chkPasswordUpdate() {
 oldPwd = document.formPassword.oldPwd
 newPwd = document.formPassword.newPwd
 confirmPwd = document.formPassword.confirmPwd

 if (oldPwd.value == "") {
  alert("Please enter your current password");
  oldPwd.focus();
  return false;
 }

 if (newPwd.value.length < 5) {
  alert("Please enter a minimum 5 characters as your new password");
  newPwd.focus();
  return false;
 }

 if (newPwd.value.indexOf(' ') != -1) {
  alert("You cannot have spaces in your password");
  newPwd.focus();
  return false;
 }

 if ((confirmPwd.value != '') && (newPwd.value != confirmPwd.value)) {
  alert("The retyped password does not match your new password");
  confirmPwd.focus();
  return false;
 }
 document.formPassword.submit();
}

function chkRegisterAdmin() {
 fName = document.formRegister.fName
 lName = document.formRegister.lName
 pwd = document.formRegister.pwd
 confirmPwd = document.formRegister.confirmPwd
 regNum = document.formRegister.regNum
 dateBirthMM = document.formRegister.dateBirthMM
 dateBirthDD = document.formRegister.dateBirthDD
 dateBirthYY = document.formRegister.dateBirthYY
 placeBirth = document.formRegister.placeBirth
 address1 = document.formRegister.address1
 city = document.formRegister.city
 state = document.formRegister.state
 country = document.formRegister.country
 phone = document.formRegister.phone
 heightVal = document.formRegister.heightVal
 weightVal = document.formRegister.weightVal
 diseaseId = document.formRegister.diseaseId

 if (fName.value == "") {
  alert("Please enter your First Name");
  fName.focus();
  return false;
 }

 if (lName.value == "") {
  alert("Please enter your Last Name");
  lName.focus();
  return false;
 }

 if (dateBirthMM.selectedIndex <= 0 || dateBirthDD.selectedIndex <= 0 || dateBirthYY.selectedIndex <= 0) {
  alert("Please enter your Date of Birth");
  dateBirthDD.focus();
  return false;
 }

 if (placeBirth.value == "") {
  alert("Please enter your place of Birth");
  placeBirth.focus();
  return false;
 }

 if (pwd.value.length < 5) {
  alert("Please enter a minimum 5 characters as your password");
  pwd.focus();
  return false;
 }

 if (pwd.value.indexOf(' ') != -1) {
  alert("You cannot have spaces in your password");
  pwd.focus();
  return false;
 }

 if ((confirmPwd.value != '') && (pwd.value != confirmPwd.value)) {
  alert("The retyped password does not match your password");
  confirmPwd.focus();
  return false;
 }

 if (regNum.value == "") {
  alert("Please enter the Preallocated Reg number");
  regNum.focus();
  return false;
 }

 if (address1.value == "") {
  alert("Please enter your Address Line 1");
  address1.focus();
  return false;
 }

 if (city.value == "") {
  alert("Please enter your City");
  city.focus();
  return false;
 }

 if (state.value == "") {
  alert("Please enter your State");
  state.focus();
  return false;
 }

 if (country.selectedIndex <= 0) {
  alert("Please select your Country");
  country.focus();
  return false;
 }

 if (phone.value == "") {
  alert("Please enter your Phone");
  phone.focus();
  return false;
 }

 if (heightVal.value == "") {
  alert("Please enter your height");
  heightVal.focus();
  return false;
 }

 if (weightVal.value == "") {
  alert("Please enter your weight");
  weightVal.focus();
  return false;
 }

 if (diseaseId.selectedIndex <= 0) {
  alert("Please select your Primary disease");
  diseaseId.focus();
  return false;
 }
 document.formRegister.submit();
}

function chkFormSection() {
 testType = $CF('formTestVikriti','testType')
 if (testType == '') {
  alert("You have to select atleast one section to proceed")
  return false;
 }
}

function chkConsult() {
 bestTime = $('bestTime')
 consultDateDD = $('consultDateDD')
 consultDateMM = $('consultDateMM')
 consultDateYY = $('consultDateYY')
 consultCity = $('consultCity')
 consultCountry = $('consultCountry')
 consultPhone = $('consultPhone')

 if (bestTime.value == "") {
  alert("Please enter the best time to call you");
  bestTime.focus();
  return false;
 }

 if ((consultDateDD.value == "") || (consultDateMM.value == "") || (consultDateYY.value == "")) {
  alert("Please enter the date to call");
  consultCity.focus();
  return false;
 }

 if (consultCity.value == "") {
  alert("Please enter your current city");
  consultCity.focus();
  return false;
 }

 if (consultCountry.value == "") {
  alert("Please enter your current country");
  consultCountry.focus();
  return false;
 }

 if (consultPhone.value == "") {
  alert("Please enter your Phone number");
  consultPhone.focus();
  return false;
 }
 $('getInfo').submit();
}

function chkTestKundli() {
 dateBirthDD = $('dateBirthDD')
 dateBirthMM = $('dateBirthMM')
 dateBirthYY = $('dateBirthYY')
 timeBirthHH = $('timeBirthHH')
 timeBirthMM = $('timeBirthMM')
 placeCity = $('placeCity')
 placeState = $('placeState')
 placePin = $('placePin')
 placeCountry = $('placeCountry')

 if ((dateBirthDD.value == "") || (dateBirthMM.value == "") || (dateBirthYY.value == "")) {
  alert("Please enter your Date of Birth");
  dateBirthDD.focus();
  return false;
 }

 if ((timeBirthHH.value == "") || (timeBirthMM.value == "")) {
  alert("Please enter your Time of Birth");
  timeBirthHH.focus();
  return false;
 }

 if (placeCity.value == "") {
  alert("Please enter your City of Birth");
  placeCity.focus();
  return false;
 }

 if (placeState.value == "") {
  alert("Please enter your State of Birth");
  placeState.focus();
  return false;
 }

 if (placePin.value == "") {
  alert("Please enter your Pincode of City of Birth");
  placePin.focus();
  return false;
 }

 if (placeCountry.value == "") {
  alert("Please enter your Country of Birth");
  placeCountry.focus();
  return false;
 }
 $('formTest').submit();
}

function chkTestPrakriti() {
 if (confirm("You will not be able to take the test again after you have hit submit.\nAre you sure you want to conitnue?")) {
  $('formTest').submit();
 }
}

function chkTestAhar() {
 mostFav1 = $('mostFav1')
 mostConsume1 = $('mostConsume1')
 notTaken1 = $('notTaken1')
 allergic1 = $('allergic1')

 if (mostFav1.value == "") {
  alert("Please enter atleast one item in this section");
  mostFav1.focus();
  return false;
 }

 if (mostConsume1.value == "") {
  alert("Please enter atleast one item in this section");
  mostConsume1.focus();
  return false;
 }

 if (notTaken1.value == "") {
  alert("Please enter atleast one item in this section");
  notTaken1.focus();
  return false;
 }

 if (allergic1.value == "") {
  alert("Please enter atleast one item in this section");
  allergic1.focus();
  return false;
 }

 if (confirm("You will not be able to take the test again after you have hit submit.\nAre you sure you want to conitnue?")) {
  $('formTest').submit();
 }
}

function chkTestAsthvidh() {
 pulseDirection = $('pulseDirection')
 urineColor = $('urineColor')
 urineOdor = $('urineOdor')
 stoolColor = $('stoolColor')
 stoolOdor = $('stoolOdor')
 stoolTouch = $('stoolTouch')
 tongueColor = $('tongueColor')
 tongueAppearance = $('tongueAppearance')
 eyesColor = $('eyesColor')
 eyesLook = $('eyesLook')
 visualColor = $('visualColor')
 visualAppearance = $('visualAppearance')
 soundClarity = $('soundClarity')
 soundVolume = $('soundVolume')
 touchTemperature = $('touchTemperature')
 touchSoftness = $('touchSoftness')

 


 if (confirm("You will not be able to take the test again after you have hit submit.\nAre you sure you want to conitnue?")) {
  $('formTest').submit();
 }
}

function chkTestVikriti() {
 if (confirm("You will not be able to take the test again after you have hit submit.\nAre you sure you want to conitnue?")) {
  $('formTest').submit();
 }
}

function chkTestVihar() {
 if (confirm("You will not be able to take the test again after you have hit submit.\nAre you sure you want to conitnue?")) {
  $('formTest').submit();
 }
}

function goRegister() {
 alert("We request you to please Register to process your test.")
 window.location.assign('register.asp');
}







