function ShowAddtionalImage(storeurl,itemcode)
{
   page_url = storeurl + 'ShowAdditionalImg.asp?number='+itemcode ;                        
   popupWin = window.open(page_url, '', 'scrollbars,resizable,width=700,height=550');
}                
function displaythis(what)
		{
		
		var baddtocart = document.getElementById('addtocart')
		var bwishlist   = document.getElementById('addtowishlist')
		var bgiftlist   = document.getElementById('addtowishlist')

		 if (what.value =="cart")
		     {	
			   baddtocart.value="addtocart" ;
			   bwishlist.value="" ; 
			 }	
		 if (what.value=="wishlist")
			 {
			   baddtocart.value="" ;
			   bwishlist.value="addtowishlist" ; 
			 }
			  if (what.value=="giftlist")
			 {
			   baddtocart.value="" ;
			   bwishlist.value="addtogiftreg" ; 
			 }

}
function CheckForEmpty(inputstr)
{
  if(inputstr.length == 0)
    return true ;
    
  for( var i = 0 ; i <  inputstr.length ; i++)
  {
   var onechar = inputstr.charAt(i) ;
   if( onechar != " ")
     return false ;
 
  }
  
 return true ;
	
}
 function IsPosInteger(inputval)
 { 
  inputstr = inputval.toString() ;
   for( x = 0 ; x <inputstr.length; x++)
    {
	  var onechar = inputstr.charAt(x) ;
	  if( onechar < "0" || onechar > "9" )	        
	    	return false;	  	
	}
   return true;
 
 }
  
 function isDate(sDate) {
    var scratch = new Date(sDate);
    if (scratch.toString() == "NaN" || scratch.toString() == "Invalid Date") {
        //alert("Not a Date");
        return false;
    } else {
        return true;
    }
}


function GetLength(inputstr)
{
	
  if(inputstr.length == 0)
    return 0 ;
    
	var charcount = 0 
  for( var i = 0 ; i <  inputstr.length ; i++)
  {
   var onechar = inputstr.charAt(i) ;
  // if( (onechar != " ") && (onechar != '\r'))
   if( (onechar != " "))
     charcount = charcount + 1 
	 
	//if( (onechar == '\r'))
   //  charcount = charcount - 2
  }
    
 return charcount ;
	
}
    function GetQ1RadioAnswer()
    {
        //var q1radio = "document.getElementById('Q1').checked"
        //var Q1radioval = 
        var q1radio = prodinfoform.Q1[0].checked ;
        var q2radio = prodinfoform.Q1[1].checked ;
        
        if (q1radio || q2radio)
        {
           var HumanQuestion2sel = document.getElementById('HumanQuestion2') ;
           HumanQuestion2sel.style.display='' ;           
        }
    }
    
 

    function GetQ2RadioAnswer()
    {
        var HumanQuestion3sel = document.getElementById('Q3Text').value ;
        var HumanQuestion4sel = document.getElementById('Q4Text').value ;
        var HumanQuestion5sel = document.getElementById('Q5Text').value ;
        
        if ( (GetLength(HumanQuestion3sel)+GetLength(HumanQuestion4sel)+GetLength(HumanQuestion4sel)) > 0 )
        {
            var HumanQuestion3sel = document.getElementById('HumanQuestion3') ;
           HumanQuestion3.style.display='' ;           
        }
        
    }
    
    function Contchar(entrytxt,exittxt,texto,maxchars) {
          var entrytxtObj=getObject(entrytxt);
          var exittxtObj=getObject(exittxt);
          var longitud=maxchars - entrytxtObj.value.length;
          if(longitud <= 0) {
            longitud=0;
            texto='<span class="disable"> '+texto+' </span>';
            entrytxtObj.value=entrytxtObj.value.substr(0,maxchars);
          }
          exittxtObj.innerHTML = texto.replace("{CHAR}",longitud);
}

function getObject(obj) {
  var theObj;
  if(document.all) {
    if(typeof obj=="string") {
      return document.all(obj);
    } else {
      return obj.style;
    }
  }
  if(document.getElementById) {
    if(typeof obj=="string") {
      return document.getElementById(obj);
    } else {
      return obj.style;
    }
  }
  return null;
}

	function Process() 
	{	
	
		var hastxtvariant = document.getElementById('txtvariant') ;
		if (hastxtvariant !=null)
		{
			var variantval = hastxtvariant.value;
			if (CheckForEmpty(variantval)==true)
			{
			alertmsg= "Please select one"
			alert(alertmsg);		
			return false;
			}
		}
		
		//Zocor product
		var IsZocor = document.getElementById('IsZocor').value ;
		if (IsZocor == true)
		{
		    var q1_1radio = prodinfoform.Zq1[0].checked ;
            var q1_2radio = prodinfoform.Zq1[1].checked ;
            
             if ((q1_1radio==false) && (q1_2radio==false))
            {
                alert("Please answer question (1)\n\nIs your age under 45 ?");
                return false ;
            }
            
            if (q1_1radio)
            {
                alert("We advise you not purchase this product as you are in a lower risk category");
                return false ;
            }
            
            var q2_1radio = prodinfoform.Zq2[0].checked ;
            var q2_2radio = prodinfoform.Zq2[1].checked ;
            
             if ((q2_1radio==false) && (q2_2radio==false))
            {
                alert("Please answer question (2)\n\n");
                return false ;
            }
            
            if (q2_1radio)
            {
                alert("We advise you not purchase this product and to consult your doctor");
                return false ;
            }
            
            var q3_1radio = prodinfoform.Zq3[0].checked ;
            var q3_2radio = prodinfoform.Zq3[1].checked ;
            
             if ((q3_1radio==false) && (q3_2radio==false))
            {
                alert("Please answer question (3)\n\n");
                return false ;
            }
            
            if (q3_2radio)
            {
                alert("We advise you not purchase this product as you are in a lower risk category");
                return false ;
            }
            
            alertmsg ="Thank you for providing the information requested by your virtual pharmacist." ;
            alertmsg = alertmsg  + "\nThis meets the guidelines for purchase of this product."
            alertmsg = alertmsg  + "\nPlease read and follow the manufacturers instructions " ;
            alertmsg = alertmsg  + "and warnings carefully and contact us if you need more information or have any problems" ;
            alertmsg = alertmsg  + "\nIf appropriate also consider lifestyle modification eg cease smoking, take regular exercise , reduce weight and" ;
            alertmsg = alertmsg  + "\nimprove diabetic control" ;
            alertmsg = alertmsg  + "\n\nNB You should consider having your blood pressure and cholesterol levels checked periodically" ;

            alert(alertmsg) ;
            
            
		    return true ;
		
		}

		//Imigran product
		var IsImigran= document.getElementById('IsImigran').value ;
		if (IsImigran==1)
		{
            var q1_1radio = prodinfoform.PRRq1[0].checked ;
            var q1_2radio = prodinfoform.PRRq1[1].checked ;
            
            if ((q1_1radio==false) && (q1_2radio==false))
            {
                alert("Please answer question 1 (a)\n\nAre you under 18 ");
                return false ;
            }
            if (q1_1radio==true)
            {
                alert("Thank you for providing the information requested by your virtual pharmacist\n\nWE ADVISE YOU TO CONSULT A DOCTOR AND NOT PURCHASE\n\nTHIS PRODUCT AS IT MAY NOT BE ENTIRELY SUITABLE FOR YOU");
                return false ;
            }
		
		    var q2_1radio = prodinfoform.PRRq2[0].checked ;
            var q2_2radio = prodinfoform.PRRq2[1].checked ;
            
            if ((q2_1radio==false) && (q2_2radio==false))
            {
                alert("Please answer question 1 (b)\n\nAre you over 65 ");
                return false ;
            }
            if (q2_1radio==true)
            {
                alert("Thank you for providing the information requested by your virtual pharmacist\n\nWE ADVISE YOU TO CONSULT A DOCTOR AND NOT PURCHASE\n\nTHIS PRODUCT AS IT MAY NOT BE ENTIRELY SUITABLE FOR YOU");
                return false ;
            }
            
            var q3_1radio = prodinfoform.PRRq3[0].checked ;
            var q3_2radio = prodinfoform.PRRq3[1].checked ;
            
            if ((q3_1radio==false) && (q3_2radio==false))
            {
                alert("Please answer question 1 (c)\n\nIf female might you be pregnant ");
                return false ;
            }
            if (q3_1radio==true)
            {
                alert("Thank you for providing the information requested by your virtual pharmacist\n\nWE ADVISE YOU TO CONSULT A DOCTOR AND NOT PURCHASE\n\nTHIS PRODUCT AS IT MAY NOT BE ENTIRELY SUITABLE FOR YOU");
                return false ;
            }
            
            var q4_1radio = prodinfoform.PRRq4[0].checked ;
            var q4_2radio = prodinfoform.PRRq4[1].checked ;
            
            if ((q4_1radio==false) && (q4_2radio==false))
            {
                alert("Please answer question 1 (d)\n\nHave you had fewer than 5 migraines in the past");
                return false ;
            }
            if (q4_1radio==true)
            {
                alert("Thank you for providing the information requested by your virtual pharmacist\n\nWE ADVISE YOU TO CONSULT A DOCTOR AND NOT PURCHASE\n\nTHIS PRODUCT AS IT MAY NOT BE ENTIRELY SUITABLE FOR YOU");
                return false ;
            }
            
            var q5_1radio = prodinfoform.PRRq5[0].checked ;
            var q5_2radio = prodinfoform.PRRq5[1].checked ;
            
            if ((q5_1radio==false) && (q5_2radio==false))
            {
                alert("Please answer question 1 (e)\n\nWas your first ever migraine within the past year ");
                return false ;
            }
            if (q5_1radio==true)
            {
                alert("Thank you for providing the information requested by your virtual pharmacist\n\nWE ADVISE YOU TO CONSULT A DOCTOR AND NOT PURCHASE\n\nTHIS PRODUCT AS IT MAY NOT BE ENTIRELY SUITABLE FOR YOU");
                return false ;
            }
            
            var skipQ345 = false ;
            var q6_1radio = prodinfoform.PRRq6[0].checked ;
            var q6_2radio = prodinfoform.PRRq6[1].checked ;
            
            if ((q6_1radio==false) && (q6_2radio==false))
            {
                alert("Please answer question 2 (a)\n\nHave you used Imigran Recovery before and has nothing changed since");
                return false ;
            }
            
            //var q7_1radio = prodinfoform.PRRq7[0].checked ;
            //var q7_2radio = prodinfoform.PRRq7[1].checked ;
            
            //if ((q7_1radio==false) && (q7_2radio==false))
            //{
            //    alert("Please answer question 2 (b)\n\nIf so please confirm nothing has changed since then");
            //    return false ;
            //}
            
            //if q6_1radio=true and q7_1radio then go question 6.. skip Q3,4,5
            
            //if (q6_1radio==true && q7_1radio==true)
            if (q6_1radio==true)
            {
                skipQ345= true ;
                if (document.getElementById('skipImigranQ345').value==0) 
                {
                    alert("Please answers questions from Question 6 and on");
                }
                document.getElementById('skipImigranQ345').value=1 ;
                
            }
            
            
            
            if (skipQ345==false)
            {
            var q8_1radio = prodinfoform.PRRq8[0].checked ;
            var q8_2radio = prodinfoform.PRRq8[1].checked ;            
            
            if ((q8_1radio==false) && (q8_2radio==false))
            {
                alert("Please answer question (3)\n\nIf this is your fist migraine and you are over 50 has your doctor confirmed the diagnosis");
                return false ;
            }
            if (q8_2radio==true)
            {
                alert("New migraine sufferers over the age of 50 should ask their doctor to confirm diagnosis before buying Imigran");
                return false ;
            }
            
            var q9_1radio = prodinfoform.PRRq9[0].checked ;
            var q9_2radio = prodinfoform.PRRq9[1].checked ;
            
            if ((q9_1radio==false) && (q9_2radio==false))
            {
                alert("Please answer question 4 (a)\n\nIn the last three months has a headache interfered with your activities at least once");
                return false ;
            }
            
            var q10_1radio = prodinfoform.PRRq10[0].checked ;
            var q10_2radio = prodinfoform.PRRq10[1].checked ;
             if ((q10_1radio==false) && (q10_2radio==false))
            {
                alert("Please answer question 4 (b)\n\nDo you feel sick when you have a headache");
                return false ;
            }
            
            var q11_1radio = prodinfoform.PRRq11[0].checked ;
            var q11_2radio = prodinfoform.PRRq11[1].checked ;
             if ((q11_1radio==false) && (q11_2radio==false))
            {
                alert("Please answer question 4 (c)\n\nDoes light bother you when you have a headache");
                return false ;
            }
            
            var countQ3 = 0 ;
            if (q9_2radio==true)
            {
                countQ3 = countQ3 + 1 ;
            }
            if (q10_2radio==true)
            {
                countQ3 = countQ3 + 1 ;
            }
            if (q11_2radio==true)
            {
                countQ3 = countQ3 + 1 ;
            }
            if (countQ3 > 1 )
            {
                alert("Thank you for providing the information requested by your virtual pharmacist\n\nWE ADVISE YOU TO CONSULT A DOCTOR URGENTLY AND NOT TO PURCHASE\n\nTHIS PRODUCT AS IT MAY NOT BE SUITABLE FOR YOU");
                return false ;
            }
            
            var q12_1radio = prodinfoform.PRRq12[0].checked ;
            var q12_2radio = prodinfoform.PRRq12[1].checked ;
             if ((q12_1radio==false) && (q12_2radio==false))
            {
                alert("Please answer question 5 (a)\n\nDo any headaches last for more than 24 hours or happen on 10 days or more days per month");
                return false ;
            }
            if (q12_1radio==true)
            {
                alert("Thank you for answering these questions but you do not meet the guidelines for using Imigran\n\nPlease discuss this with your doctor or pharmacist");
                return false;
            }
            
            var q13_1radio = prodinfoform.PRRq13[0].checked ;
            var q13_2radio = prodinfoform.PRRq13[1].checked ;
             if ((q13_1radio==false) && (q13_2radio==false))
            {
                alert("Please answer question 5 (b)\n\nDo your symptoms fail to go away between attacks");
                return false ;
            }
            if (q13_1radio==true)
            {
                alert("Thank you for answering these questions but you do not meet the guidelines for using Imigran\n\nPlease discuss this with your doctor or pharmacist");
                return false;
            }
            
            var q14_1radio = prodinfoform.PRRq14[0].checked ;
            var q14_2radio = prodinfoform.PRRq14[1].checked ;
             if ((q14_1radio==false) && (q14_2radio==false))
            {
                alert("Please answer question 5 (c)\n\nHas there been a significant change in you migraine attacks");
                return false ;
            }
            if (q14_1radio==true)
            {
                alert("Thank you for answering these questions but you do not meet the guidelines for using Imigran\n\nPlease discuss this with your doctor or pharmacist");
                return false;
            }
            
            } // if skipQ345=false
            
            var q15_1radio = prodinfoform.PRRq15[0].checked ;
            var q15_2radio = prodinfoform.PRRq15[1].checked ;
             if ((q15_1radio==false) && (q15_2radio==false))
            {
                alert("Please answer question (6)\n\nhave you had any of the following");
                return false ;
            }
            if (q15_1radio==true)
            {
                alert("Thank you for providing the information requested by your virtual pharmacist\n\nWE ADVISE YOU TO CONSULT A DOCTOR URGENTLY AND NOT TO PURCHASE\n\nTHIS PRODUCT AS IT MAY NOT BE SUITABLE FOR YOU");
                return false ;
            }
            
            var q16_1radio = prodinfoform.PRRq16[0].checked ;
            var q16_2radio = prodinfoform.PRRq16[1].checked ;
             if ((q16_1radio==false) && (q16_2radio==false))
            {
                alert("Please answer question (7)\n\nHave you taken any other medicines, supplements or herbal remedies (whether prescribed or purchased in the last 14 days");
                return false ;
            }
            if (q16_1radio==true)
            {
               var PRRq17Val = document.getElementById('PRRq17').value ;                
               if (CheckForEmpty(PRRq17Val)==true)
               {
                alert("Please give names of any medicines etc in Q(7) box");
                return false;
               }               
            }
            
            var q18_1radio = prodinfoform.PRRq18[0].checked ;
            var q18_2radio = prodinfoform.PRRq18[1].checked ;
             if ((q18_1radio==false) && (q18_2radio==false))
            {
                alert("Please answer question 8 (a)\n\nHigh blood pressure (This should be checked each year)");
                return false ;
            }
            if (q18_1radio==true)
            {
                alert("Thank you for providing the information requested by your virtual pharmacist\n\nWE ADVISE YOU TO CONSULT A DOCTOR URGENTLY AND NOT TO PURCHASE\n\nTHIS PRODUCT AS IT MAY NOT BE SUITABLE FOR YOU");
                return false ;
            }
            
            var q19_1radio = prodinfoform.PRRq19[0].checked ;
            var q19_2radio = prodinfoform.PRRq19[1].checked ;
             if ((q19_1radio==false) && (q19_2radio==false))
            {
                alert("Please answer question 8 (b)\n\nHeart disease, heart attack, angina (chest pain) , irregular heart beat");
                return false ;
            }
            if (q19_1radio==true)
            {
                alert("Thank you for providing the information requested by your virtual pharmacist\n\nWE ADVISE YOU TO CONSULT A DOCTOR URGENTLY AND NOT TO PURCHASE\n\nTHIS PRODUCT AS IT MAY NOT BE SUITABLE FOR YOU");
                return false ;
            }
            
            var q20_1radio = prodinfoform.PRRq20[0].checked ;
            var q20_2radio = prodinfoform.PRRq20[1].checked ;
             if ((q20_1radio==false) && (q20_2radio==false))
            {
                alert("Please answer question 8 (c)\n\nStroke, mini-stroke or T.I.A");
                return false ;
            }
            if (q20_1radio==true)
            {
                alert("Thank you for providing the information requested by your virtual pharmacist\n\nWE ADVISE YOU TO CONSULT A DOCTOR URGENTLY AND NOT TO PURCHASE\n\nTHIS PRODUCT AS IT MAY NOT BE SUITABLE FOR YOU");
                return false ;
            }
            
            var q21_1radio = prodinfoform.PRRq21[0].checked ;
            var q21_2radio = prodinfoform.PRRq21[1].checked ;
             if ((q21_1radio==false) && (q21_2radio==false))
            {
                alert("Please answer question 8 (d)\n\nPeripheral vascular disease (poor circulation ) eg to legs");
                return false ;
            }
            if (q21_1radio==true)
            {
                alert("Thank you for providing the information requested by your virtual pharmacist\n\nWE ADVISE YOU TO CONSULT A DOCTOR URGENTLY AND NOT TO PURCHASE\n\nTHIS PRODUCT AS IT MAY NOT BE SUITABLE FOR YOU");
                return false ;
            }
            
            var q22_1radio = prodinfoform.PRRq22[0].checked ;
            var q22_2radio = prodinfoform.PRRq22[1].checked ;
             if ((q22_1radio==false) && (q22_2radio==false))
            {
                alert("Please answer question 8 (e)\n\nLiver or kidney problems or Epilepsy or fits");
                return false ;
            }
            if (q22_1radio==true)
            {
                alert("Thank you for providing the information requested by your virtual pharmacist\n\nWE ADVISE YOU TO CONSULT A DOCTOR URGENTLY AND NOT TO PURCHASE\n\nTHIS PRODUCT AS IT MAY NOT BE SUITABLE FOR YOU");
                return false ;
            }
            
            var q23_1radio = prodinfoform.PRRq23[0].checked ;
            var q23_2radio = prodinfoform.PRRq23[1].checked ;
             if ((q23_1radio==false) && (q23_2radio==false))
            {
                alert("Please answer question 8 (f)\n\nA bad reaction or allergy to Imigran or 'sulpha' antibiotics eg Co-Trimoxazole");
                return false ;
            }
            if (q23_1radio==true)
            {
                alert("Thank you for providing the information requested by your virtual pharmacist\n\nWE ADVISE YOU TO CONSULT A DOCTOR URGENTLY AND NOT TO PURCHASE\n\nTHIS PRODUCT AS IT MAY NOT BE SUITABLE FOR YOU");
                return false ;
            }
            
            var q24_1radio = prodinfoform.PRRq24[0].checked ;
            var q24_2radio = prodinfoform.PRRq24[1].checked ;
             if ((q24_1radio==false) && (q24_2radio==false))
            {
                alert("Please answer question 9 (a)\n\nIf female have you reached the menopause");
                return false ;
            }
            
            var q25_1radio = prodinfoform.PRRq25[0].checked ;
            var q25_2radio = prodinfoform.PRRq25[1].checked ;
             if ((q25_1radio==false) && (q25_2radio==false))
            {
                alert("Please answer question 9 (b)\n\nIf male are you over 40 ");
                return false ;
            }
            
            var q26_1radio = prodinfoform.PRRq26[0].checked ;
            var q26_2radio = prodinfoform.PRRq26[1].checked ;
             if ((q26_1radio==false) && (q26_2radio==false))
            {
                alert("Please answer question 9 (c)\n\nHas either you father or brother had a heart attack of angina before age of 55");
                return false ;
            }
            
            var q27_1radio = prodinfoform.PRRq27[0].checked ;
            var q27_2radio = prodinfoform.PRRq27[1].checked ;
             if ((q27_1radio==false) && (q27_2radio==false))
            {
                alert("Please answer question 9 (d)\n\nHas either your mother or sister had a hearty attack or angina before age of 65 ");
                return false ;
            }
            
            var q28_1radio = prodinfoform.PRRq28[0].checked ;
            var q28_2radio = prodinfoform.PRRq28[1].checked ;
             if ((q28_1radio==false) && (q28_2radio==false))
            {
                alert("Please answer question 9 (e)\n\nDo you have diabetes");
                return false ;
            }
            
            var q29_1radio = prodinfoform.PRRq29[0].checked ;
            var q29_2radio = prodinfoform.PRRq29[1].checked ;
             if ((q29_1radio==false) && (q29_2radio==false))
            {
                alert("Please answer question 9 (f)\n\nDo you have high Cholesterol");
                return false ;
            }
            
            var q30_1radio = prodinfoform.PRRq30[0].checked ;
            var q30_2radio = prodinfoform.PRRq30[1].checked ;
             if ((q30_1radio==false) && (q30_2radio==false))
            {
                alert("Please answer question 9 (g)\n\nDo you smoke more than 10 cigarettes per day");
                return false ;
            }
            
            var q31_1radio = prodinfoform.PRRq31[0].checked ;
            var q31_2radio = prodinfoform.PRRq31[1].checked ;
             if ((q31_1radio==false) && (q31_2radio==false))
            {
                alert("Please answer question 9 (h)\n\nAre you considerably overweight (Body Mass Index over 30)");
                return false ;
            }
            
            var CountQ8 = 0 ;
            if (q24_1radio==true)
            {
                CountQ8 = CountQ8 + 1 ;
            }
            if (q25_1radio==true)
            {
                CountQ8 = CountQ8 + 1 ;
            }
            if (q26_1radio==true)
            {
                CountQ8 = CountQ8 + 1 ;
            }
            if (q27_1radio==true)
            {
                CountQ8 = CountQ8 + 1 ;
            }
            
            if (q28_1radio==true)
            {
                CountQ8 = CountQ8 + 1 ;
            }
            if (q29_1radio==true)
            {
                CountQ8 = CountQ8 + 1 ;
            }
            if (q30_1radio==true)
            {
                CountQ8 = CountQ8 + 1 ;
            }
            
            if (q31_1radio==true)
            {
                CountQ8 = CountQ8 + 1 ;
            }
            
            if (CountQ8 > 2 )
            {
                alert("Thank you for providing the information requested by your virtual pharmacist\n\nWE ADVISE YOU TO CONSULT A DOCTOR AND NOT TO PURCHASE\n\nTHIS PRODUCT AS IT MAY NOT BE SUITABLE FOR YOU");
                return false ;
            }

            alert("Thank you for providing the information requested by your virtual pharmacist\n\nYour order has been accepted subject to review by our pharmacists.\n\nPlease ensure that the important information provided with this product is read and followed.\nIf in doubt about any aspect please consult your doctor or a pharmacist");
			return true ;
		}


		
		//Goldened product
		var IsGoldened = document.getElementById('IsGoldened').value ;
		if (IsGoldened==1)
		{
		    var q1_1radio = prodinfoform.PCHq1[0].checked ;
            var q1_2radio = prodinfoform.PCHq1[1].checked ;
		    
		    if ((q1_1radio==false) && (q1_2radio==false))
            {
                alert("Please answer question (1)\n\nIs the person using the product aged 2 or over ");
                return false ;
            }
		
		   if (q1_2radio==true)
		   {
		        alert("We advise you to consult a doctor and not purchase\n\nthis product as it may not be entirely suitable");
                return false ;
		   }
		   
		    var q2_1radio = prodinfoform.PCHq2[0].checked ;
            var q2_2radio = prodinfoform.PCHq2[1].checked ;
            if ((q2_1radio==false) && (q2_2radio==false))
            {
                alert("Please answer question (2)\n\nDo they wear contact lenses");
                return false ;
            }
            
            
            var q14_1radio = prodinfoform.PCHq14[0].checked ;
            var q14_2radio = prodinfoform.PCHq14[1].checked ;
            
            if (q2_1radio==true && q14_1radio==false && q14_2radio==false)
            {
                alert("Please answer question (3)\n\nIs this product being used under the advice of an optometrist, contact lens practitioner or doctor?");
                return false ;
            }
            if (q2_1radio && q14_2radio)
            {
                alert("We advise you to consult a doctor and not purchase\n\nthis product as it may not be entirely suitable");
                return false ; 
            }
            
		   
		   var q3_1radio = prodinfoform.PCHq3[0].checked ;
           var q3_2radio = prodinfoform.PCHq3[1].checked ;
           
           if (q3_1radio==false && q3_2radio==false)
           {
             alert("Please answer to (4) (a)\n\nIs there any pain or loss or blurring of vision?");
             return false ;
           }
           
           var q4_1radio = prodinfoform.PCHq4[0].checked ;
           var q4_2radio = prodinfoform.PCHq4[1].checked ;
           
           if (q4_1radio==false && q4_2radio==false)
           {
             alert("Please answer to (4) (b)\n\nAre you already using any other eye drops or ointment?");
             return false ;
           }
           
           
           var q5_1radio = prodinfoform.PCHq5[0].checked ;
           var q5_2radio = prodinfoform.PCHq5[1].checked ;
           
           
            if (q5_1radio==false && q5_2radio==false)
           {
             alert("Please answer to (4) (c)\n\nIs there any foreign object in eye(s) or are they unusually sensitive to light?");
             return false ;
           }
           
           
           var q6_1radio = prodinfoform.PCHq6[0].checked ;
           var q6_2radio = prodinfoform.PCHq6[1].checked ;
           
            if (q6_1radio==false && q6_2radio==false)
           {
             alert("Please answer to (4) (d)\n\nDoes pupil of eye look unusual-ie torn, dilated or not reacting to light?");
             return false ;
           }
           
           var q7_1radio = prodinfoform.PCHq7[0].checked ;
           var q7_2radio = prodinfoform.PCHq7[1].checked ;
           
            if (q7_1radio==false && q7_2radio==false)
           {
             alert("Please answer to (4) (e)\n\nDoes cornea look cloudy or does a yellow-green discharge return quickly after wiping away?");
             return false ;
           }
           
           
           var q8_1radio = prodinfoform.PCHq8[0].checked ;
           var q8_2radio = prodinfoform.PCHq8[1].checked ;
           
           if (q8_1radio==false && q8_2radio==false)
           {
             alert("Please answer to (4) (f)\n\nIs there any inflammation with a rash on scalp or face or eye movement restricted?");
             return false ;
           }
           
           
           var q9_1radio = prodinfoform.PCHq9[0].checked ;
           var q9_2radio = prodinfoform.PCHq9[1].checked ;
           
            if (q9_1radio==false && q9_2radio==false)
           {
             alert("Please answer to (4) (g)\n\nDoes patient suffer from dry eye or had eye surgery in the past 6 months?");
             return false ;
           }
           
           
           var q10_1radio = prodinfoform.PCHq10[0].checked ;
           var q10_2radio = prodinfoform.PCHq10[1].checked ;
           
            if (q10_1radio==false && q10_2radio==false)
           {
             alert("Please answer to (4) (h)\n\nIs the patient pregnant or breast feeding or recently returned from abroad?");
             return false ;
           }
           
           
           var q11_1radio = prodinfoform.PCHq11[0].checked ;
           var q11_2radio = prodinfoform.PCHq11[1].checked ;
           
           if (q11_1radio==false && q11_2radio==false)
           {
             alert("Please answer to (4) (i)\n\nDoes patient have Glaucoma or personal or family history of bone marrow problems?");
             return false ;
           }
           
           
           var q12_1radio = prodinfoform.PCHq12[0].checked ;
           var q12_2radio = prodinfoform.PCHq12[1].checked ;
           
           if (q12_1radio==false && q12_2radio==false)
           {
             alert("Please answer to (4) (j)\n\nHas patient ever had any problems with using Chloramphenicol eye products previously?");
             return false ;
           }
           
           
           var q13_1radio = prodinfoform.PCHq13[0].checked ;
           var q13_2radio = prodinfoform.PCHq13[1].checked ;
           
            if (q13_1radio==false && q13_2radio==false)
           {
             alert("Please answer to (4) (k)\n\nDoes patient feel generally unwell or have any other health problem- if so please contact us?");
             return false ;
           }
           
		   
		   if (q3_1radio || q4_1radio || q5_1radio || q6_1radio || q7_1radio || q8_1radio || q9_1radio || q10_1radio || q11_1radio || q12_1radio || q13_1radio)
		   {
		     alert("We advise you to consult a doctor and not purchase\n\nThis product as it may not be entirely suitable");
             return false ;
		   }
		   
		   if (q2_1radio && q14_1radio)
		   {
		       alert("If this product is being used on advice of an optometrist, contact lens practitioner or doctor,\nlenses should not be worn during treatment and soft lenses not replaced\nfor 24 hours after completion of treatment.");
            }

		}
		
		//Curanail product
		var IsCURANAIL = document.getElementById('IsCURANAIL').value ;
		if (IsCURANAIL==1)
		{		
		    var q1_1radio = prodinfoform.CURq1[0].checked ;
            var q1_2radio = prodinfoform.CURq1[1].checked ;
            
            if ((q1_1radio==false) && (q1_2radio==false))
            {
                alert("Please answer question (1)\n\nIs the person using this product under 18 or (if female)\n pregnant or breast feeding or had an adverse reaction previously to CURANAIL ");
                return false ;
            }
            
            if (q1_2radio==false)
            {
                alert("We advise you to consult a doctor and not purchase\n\nThis product as it may not be entirely suitable");
                return false ;         
            }
            
            q2_1radio = prodinfoform.CURq2[0].checked ;
            q2_2radio = prodinfoform.CURq2[1].checked ;
            if ((q2_1radio==false) && (q2_2radio==false))
            {
                alert("Please answer question (2)\n\nHas the product been recommended by a doctor or podiatrist?");
                return false ;
            }
		    
		    q3_1radio = prodinfoform.CURq3[0].checked ;
            q3_2radio = prodinfoform.CURq3[1].checked ;
            if ((q3_1radio==false) && (q3_2radio==false) && (q2_1radio==false))
            {
                alert("Please answer question (3)\n\nIs this a repeat purchase for ongoing treatment?");
                return false ;
            }
            
            var q4radio = prodinfoform.CURq4.checked ;
            var q5radio = prodinfoform.CURq5.checked ;
            var q6radio = prodinfoform.CURq6.checked ;
            var q7radio = prodinfoform.CURq7.checked ;
            
            //if ((q4radio==true) || (q5radio==true) || (q6radio==true) || (q6radio==true))
            if ((q4radio==false) && (q5radio==false) && (q6radio==false) && (q6radio==false) && (q2_1radio==false))
            {
                alert("At least one answer to question (4) is required to need this product.\n\nIs the nail thickened and yellow/white at tip ?\nAre the changes spreading towards base of nail ?\nHas nail become distorted brittle or purhaps some of it may have broken off ?\nAre no more than two or nails affected ?\n\n");
                //alert("WE ADVISE YOU TO CONSULT A DOCTOR AND NOT TO PURCHASE\nTHIS PRODUCT AS IT MAY NOT BE ENTIRELY SUITABLE FOR YOU");
                return false ;
            }
		}
		
		
		//Orlistate product
		var IsOrliStat = document.getElementById('IsOrliStat').value ;
		if (IsOrliStat==1)
		{
		    var q1radio = prodinfoform.PRq1[0].checked ;
		    var q2radio = prodinfoform.PRq1[1].checked ;
		    
		    if (q1radio==false && q2radio==false)
		    {
		         alert("Please answer question (1)\n\nIs your age 18 or over?");
		         return false ;
		    }
		    if (q1radio==false)
		    {
		        alert("This product may be used only by those who are 18 or over");
		        return false ;
		    }
		    
		    var q3radio = prodinfoform.PRq2[0].checked ;
		    var q4radio = prodinfoform.PRq2[1].checked ;		    
		    
		    if (q3radio == false && q4radio==false)
		    {
		         alert("Please answer question (2)\n\nIs your body mass 28 or over?");
    		     return false ;
    		}
		    
		    if (q3radio==false)
		    {
		        alert("This product is NOT suitable for you as you Body Mass Index(BMI) is less than 28");
		        return false ;		    
		    }
		    
		    //check for agree
		    var q5answer = document.getElementById('PRq3').checked ;
		    
		    if (q5answer==false)
		    {
		        //alert("We advise that this product is not suitable for you");
		        alert("Please answer question (3)\n\nif you do not agree with ANY one of these statements this product is not suitable for you");
		        return false ;		    
		    }
		
		    //check for taking other medication.
		    var q6radio = prodinfoform.PRq4[0].checked ;
		    var q7radio = prodinfoform.PRq4[1].checked ;
		    if (q6radio == false && q7radio==false)
		    {
		        alert("Please answer question (4)\n\nAre you taking any of the following medicines?");
    		    return false ;
		    }
		    if (q6radio == true)
		    {
		      alert("We advise you NOT to purchase this product and to consult your doctor");
    		  return false ;
		    }
		    
		   
		}
		
		
	    //Now check for questions for DRG Products		
		var IsDRGPROD = document.getElementById('IsDRGPROD').value ;
		
		//radiochecked = eval("prodinfoform.Attrib"+i+"["+k+"].checked") ;
				
		if (IsDRGPROD==1)
		{
	     //check Q1Age is filled in
	     
	       var Q1Ageval = document.getElementById('DRGq1').value ;
	       if (GetLength(Q1Ageval)==0 )
                {
                     alert("Please enter Age of person who this medicine is for")
                     return false ;	
                }
                
            if (IsPosInteger(Q1Ageval)==false)
            {
                alert("Please enter Numeric value");
                return false ;
            }
                
           var q2radio = prodinfoform.DRGq2[0].checked ;
           var q3radio = prodinfoform.DRGq2[1].checked ;
           
           if ((q2radio==false) && (q3radio==false))
           {
            alert("Please choose Gender of person");
            return false ;
           }
           
           var q4radio = prodinfoform.DRGq3[0].checked ;
           var q5radio = prodinfoform.DRGq3[1].checked ;
           
            if ((q4radio==false) && (q5radio==false))
           {
            alert("Please choose Has the person used this medicine before?");
            return false ;
           }
           
           if (q4radio== true)
           {
             var Q4val = document.getElementById('DRGq4').value ;
             if (GetLength(Q4val)==0 )
                {
                     alert("Please state side-effects ")
                     return false ;	
                }
           
           }
           
           var q6radio = prodinfoform.DRGq8[0].checked ;
           var q7radio = prodinfoform.DRGq8[1].checked ;
            if ((q6radio==false) && (q7radio==false))
           {
            alert("Please choose Are you the person using this medicine?");
            return false ;
           }
            
            
	     /*
	        var q2radio = prodinfoform.DRGq2[0].checked ;
            var q3radio = prodinfoform.DRGq2[1].checked ;
                        
            if (q1radio)
            {
                var Q1Ageval = document.getElementById('Q1Age').value ;
                if (GetLength(Q1Ageval)==0 )
                {
                     alert("Please Give your age in Years ")
                     return false ;	
                }
                
               if (IsPosInteger(Q1Ageval)==false)
               {
                alert("Please Give your age in Years ")
                return false ;	
                
               }
            }
            
             if (q2radio)
            {
                var Q2Ageval = document.getElementById('Q2Age').value ;
                if (GetLength(Q2Ageval)==0 )
                {
                     alert("Please Give age in Years of person using this medicine(s) ")
                     return false ;	
                }
                
               if (IsPosInteger(Q2Ageval)==false)
               {
                alert("Please Give age in Years of person using this medicine(s) ")
                return false ;	
                
               }
            }
             
             
            //Now got question # 2
              var HumanQuestion3sel = document.getElementById('Q3Text').value ;
              var HumanQuestion4sel = document.getElementById('Q4Text').value ;
              var HumanQuestion5sel = document.getElementById('Q5Text').value ;
               if ( (GetLength(HumanQuestion3sel)+GetLength(HumanQuestion4sel)+GetLength(HumanQuestion4sel)) == 0 )
              {
                alert("Plese answer the following Question\n\nWhat condition(s) are these products being used to treat ")
                return false ;	
                
               }
               
               //Now got question # 3
               
               var q6radio = prodinfoform.Q6[0].checked ;
               var q7radio = prodinfoform.Q6[1].checked ;
            
                if ( q6radio==false && q7radio==false)
                {
                     alert("Please select one from\n\nAre you/they taking any other medicines or have any serious allergies etc ")
                     return false ;	
                
                }
                
                if (q7radio)                
                {
                    var HumanQuestion7sel = document.getElementById('Q7Text').value ;
                    if (GetLength(HumanQuestion7sel)==0)
                    {
                        alert("Please Give details\n\nAre you/they taking any other medicines or have any serious allergies etc ")     
                        return false ;	         
                    }
                
                }
               
	            */
	    }
	    	
	
	    //check for Pet products.
	    
	    
	    var IsPetProd = document.getElementById('IsPetProd').value ;
	    
	    if (IsPetProd==1)
	    {
	        var sPetq4Sel = document.getElementById('Petq4').selectedIndex ;   		
		    var sPetq4Selvalue = document.getElementById('Petq4').options[sPetq4Sel].value ;
		    if (sPetq4Selvalue==0)
		    {
		        alert("please select number to be treated");
		        return false ;	 		    
		    }
		    
		     //make sure some of the questions are answered
	       
	        
	        var sPetq5Sel = document.getElementById('Petq5').selectedIndex ;   
	        var sPetq5Selvalue = document.getElementById('Petq5').options[sPetq5Sel].value ;
	        
	        var sPetq8Sel = document.getElementById('Petq8').selectedIndex ;   
	        var sPetq8Selvalue = document.getElementById('Petq8').options[sPetq8Sel].value ;
	        
	         var sPetq3Sel = document.getElementById('Petq3').selectedIndex ;   		
             var sPetq3Selvalue = document.getElementById('Petq3').options[sPetq3Sel].value ;
	         
	        
	         //if (GetLength(Petq5Sel)==0)
	         if ( (sPetq5Selvalue==0 & sPetq8Selvalue==0))
                    {
                    
                        alert("Please enter the age of the youngest "+ sPetq3Selvalue+" to be treated");
                        return false ;	         
                    }
	         
	         var sNeedAdditionWeight = document.getElementById('NeedToRecordWeight').value ;
                
            if (sNeedAdditionWeight==0)
            {
	        var sPetq6Sel = document.getElementById('Petq6').selectedIndex ;   		
		    var sPetq6Selvalue = document.getElementById('Petq6').options[sPetq6Sel].value ;
		    if (GetLength(sPetq6Selvalue)==0)
		    {
		        alert("Please enter a size for these animals");
		        return false ;	 		    
		    }
		    }
		    
		    //check quest9 and 10 are filled in when cattle, sheep or pigs is selected from q3
		    
		   // var sPetq3Sel = document.getElementById('Petq3').selectedIndex ;   
	       // var sPetq3Selvalue = document.getElementById('Petq3').options[sPetq3Sel].value ;
	        if ( (sPetq3Selvalue=="Cattle") || (sPetq3Selvalue=="Sheep") || (sPetq3Selvalue=="Pigs") )
	        {
	            
	            var sPetq9Sel = document.getElementById('Petq9').value ;  
	                if (GetLength(sPetq9Sel)==0)
	                {
	                    alert("Please enter Herd number for " + sPetq3Selvalue );
	                    return false ;
	                }
	            
	            var sPetq10Sel = document.getElementById('Petq10').value ;  
	                if (GetLength(sPetq10Sel)==0)
	                {
	                    alert("Please enter Holding number for " + sPetq3Selvalue );
	                    return false ;
	                }
	        }
	        
	        //if current_stocknumber="FLU9008079" or current_stocknumber="FLUBMP1" and radio is unchecked.. Decline the sale
	        var sItemNumber = document.getElementById('additem').value ;
	        if (sItemNumber == "FLU9008079" || sItemNumber == "FLUBMP1" )
	        {
	        
	         var q11radio = prodinfoform.Petq11[0].checked ;
             var q12radio = prodinfoform.Petq11[1].checked  ;

             if (q12radio == true)
             {
                alert("Domestic poultry keepers cannot use this product if they are selling eggs or meat to third parties, please contact us for further details") ;
                return false ;             
             }
             
	        
	        }
		    
	    
	    }
	    
	   
	
		
	    var dropdownnum = document.getElementById('MaxAttriboption').value ;
	    
	    var NonSkuinputtxt = document.getElementById('maxNONSkuOption').value ;
		
		
		
	    
	    if (NonSkuinputtxt>0)
	    {
	    
	        for( var i = 1 ; i <= NonSkuinputtxt ; i++)
	        {
	        
	         var attribtype = "NonSkuslopttype"+i ;
	            attribtype = "document.getElementById('"+attribtype+"').value" ;	
	            attribtypeval = eval(attribtype) 
	            //alert(attribtypeval)    
	           
			   
	           if (attribtypeval=="T")
	           {
	            var NonSkuText = "NonSkusvaltype"+i ; 
	                NonSkuTextType = "document.getElementById('"+NonSkuText+"').value" ;	
	                NonSkuTextTypeVal = eval(NonSkuTextType) 
	                //alert(NonSkuTextTypeVal)  
					/* 
	                if (NonSkuTextTypeVal=="N")
	                {
	                 //check for integer value
	                 var NONSkuInput = "NonSkuAttribtext"+i ;
	                    NONSkuInputVal = "document.getElementById('"+NONSkuInput+"').value" ;	
	                    NONSkuInputValue = eval(NONSkuInputVal) 	                    
	                    //alert(NONSkuInputValue)
	                    if (CheckForEmpty(NONSkuInputValue)==false)
	                    {
	                        if (IsPosInteger(NONSkuInputValue)==false)
	                        {
	                            var NOnSkutitle = "NonSkuAttribTitle"+i ;
	                            NOnSkutitleVal = "document.getElementById('"+NOnSkutitle+"').value" ;	
	                            NOnSkutitleValue = eval(NOnSkutitleVal) 
	                            
	                            alert("Enter Integer Value for '" + NOnSkutitleValue +"'") ;
	                            return false ;
	                        }
	                    }
	                	} //if (NonSkuTextTypeVal=="N")
					*/
					
	                
	               if (NonSkuTextTypeVal=="D")
	               {
	                //check for Date value
	                var NONSkuInput = "NonSkuAttribtext"+i ;
	                NONSkuInputVal = "document.getElementById('"+NONSkuInput+"').value" ;
	                NONSkuInputValue = eval(NONSkuInputVal) 
	                //alert(NONSkuInputValue)
	                if (CheckForEmpty(NONSkuInputValue)==false)
	                {
	                    if (isDate(NONSkuInputValue)==false)
	                    {
                           var NOnSkutitle = "NonSkuAttribTitle"+i ;
                               NOnSkutitleVal = "document.getElementById('"+NOnSkutitle+"').value" ;	
	                           NOnSkutitleValue = eval(NOnSkutitleVal) 

	                           alert("Must Enter Date for '" + NOnSkutitleValue +"'") ;
	                           return false ;
	                    }
	                }
	               
	               } //if (NonSkuTextTypeVal=="D")
	           }
	              
	        
	        }
	    
	    }
	    
	    
	    if (dropdownnum > 0)
	    {
	        alertstring =""
	        var notallselected = false ;	
	        var notallradioselected=false ;       
	        for( var i = 1 ; i <= dropdownnum ; i++)
	        {
	            var attribtype = "slopttype"+i ;
	            attribtype = "document.getElementById('"+attribtype+"').value" ;	
	            attribtypeval = eval(attribtype)            
	            if (attribtypeval=="D")
	                {
	                    var Prodattribname = "Attrib"+i ;
	                    var Prodattribevalname = "document.getElementById('"+Prodattribname+"').selectedIndex" ;
	                    selIndex= eval(Prodattribevalname) ;	        	                   
	                    if (selIndex==0)
	                    {
	                         var Skutitle = "SkuAttribTitle"+i ;
                               SkutitleVal = "document.getElementById('"+Skutitle+"').value" ;	
	                           SkutitleValue = eval(SkutitleVal) 
	                           notallselected=true 	
	                           alertstring = alertstring + "Select Option for '" + SkutitleValue + "'\n"
	                           //alert("Select Option for '" + SkutitleValue +"'") ;
	                           //return false ;    
	                                   
	                           
	                       
	                    }
    	        } //if (attribtypeval=="D")
    	        
    	        
    	        if (attribtypeval=="R")
    	        {
    	            var checkforradio = "noradio"+i ;
    	            var checkforradio = "document.getElementById('"+checkforradio+"').value" ;
    	            var checkforradioval = eval(checkforradio)
    	            //alert(checkforradioval)
    	            if (checkforradioval==0)
    	            {
    	                notallradioselected=true ;
    	            }
    	            if (checkforradioval==1)
    	            {
    	                notallradioselected=true
    	                attribradio = eval("prodinfoform.Attrib"+i+".length") ;
    	                j = attribradio ;
    	               
    	                for (k=0; k<j; k++)
                        {
                            radiochecked = eval("prodinfoform.Attrib"+i+"["+k+"].checked") ;
                            if (radiochecked)
                            {
                                notallradioselected=false
                                
                            }		                                                           
	                    }	
	                    
	                    if (notallradioselected==true)
	                    {
	                      var Skutitle = "SkuAttribTitle"+i ;
                               SkutitleVal = "document.getElementById('"+Skutitle+"').value" ;	
	                           SkutitleValue = eval(SkutitleVal) 
	                           notallselected=true 	
	                           alertstring = alertstring + "Select Option for '" + SkutitleValue + "'\n"
	                    }      	            
    	              }
    	                  	              
    	            
    	        } //if (attribtypeval=="R")
	        
	        } // if dropdown > 0
	        
	       if (notallselected)
	       {
	         alert(alertstring) ;
	         return false ;
	       }
	        //if (notallselected || notallradioselected)
	        if (notallradioselected)	    	        
	            {
	                alert("Please select all options");
	                //alert(alertstring) ;
	                return false ;
	            }
	          //return true ;
	          //return false ;
	    }

	   
	   
	   
	    return true ;
	
	}
	
function extractNumber(obj, decimalPlaces, allowNegative,beforedecimal)
{
	var temp = obj.value;
	
	// avoid changing things if already formatted correctly
	var reg0Str = '[0-9]*';
	if (decimalPlaces > 0) {
		reg0Str += '\\.?[0-9]{0,' + decimalPlaces + '}';
	} else if (decimalPlaces < 0) {
		reg0Str += '\\.?[0-9]*';
	}
	reg0Str = allowNegative ? '^-?' + reg0Str : '^' + reg0Str;
	reg0Str = reg0Str + '$';
	var reg0 = new RegExp(reg0Str);
	if (reg0.test(temp)) return true;

	// first replace all non numbers
	var reg1Str = '[^0-9' + (decimalPlaces != 0 ? '.' : '') + (allowNegative ? '-' : '') + ']';
	var reg1 = new RegExp(reg1Str, 'g');
	temp = temp.replace(reg1, '');

	if (allowNegative) {
		// replace extra negative
		var hasNegative = temp.length > 0 && temp.charAt(0) == '-';
		var reg2 = /-/g;
		temp = temp.replace(reg2, '');
		if (hasNegative) temp = '-' + temp;
	}
	
	if (decimalPlaces != 0) {
		var reg3 = /\./g;
		var reg3Array = reg3.exec(temp);
		if (reg3Array != null) {
			// keep only first occurrence of .
			//  and the number of places specified by decimalPlaces or the entire string if decimalPlaces < 0
			var reg3Right = temp.substring(reg3Array.index + reg3Array[0].length);
			reg3Right = reg3Right.replace(reg3, '');
			reg3Right = decimalPlaces > 0 ? reg3Right.substring(0, decimalPlaces) : reg3Right;
			temp = temp.substring(0,reg3Array.index) + '.' + reg3Right;
		}
	}
	
	//temp = temp.substring(0,3) ;
	obj.value = temp ;
}
function blockNonNumbers(obj, e, allowDecimal, allowNegative,maxbeforedecimal)
{
	var key;
	var isCtrl = false;
	var keychar;
	var reg;
		
	if(window.event) {
		key = e.keyCode;
		isCtrl = window.event.ctrlKey
	}
	else if(e.which) {
		key = e.which;
		isCtrl = e.ctrlKey;
	}
	
	if (isNaN(key)) return true;
	
	keychar = String.fromCharCode(key);
	
	// check for backspace or delete, or if Ctrl was pressed
	if (key == 8 || isCtrl)
	{
		return true;
	}

	
	reg = /\d/;
	var isFirstN = allowNegative ? keychar == '-' && obj.value.indexOf('-') == -1 : false;
	var isFirstD = allowDecimal ? keychar == '.' && obj.value.indexOf('.') == -1 : false;
	
	retval = true ;
	if (maxbeforedecimal > 0)
	{
		temp = obj.value ;
		
		var hasNegative = temp.length > 0 && temp.charAt(0) == '-';
		var reg2 = /-/g;
		temp = temp.replace(reg2, '');
		
		if (temp.length >= maxbeforedecimal)
		{
			retval=false ;
			return retval ;				
		}
	}

	return isFirstN || isFirstD || reg.test(keychar);

}
function ConvertAllFields(bClearFormIfNecessary)
{
    //modifyTextField(document.custinfoform.txtsfirstname, bDisabled)
    
    var chkcheck = document.getElementById('SamePetInfo').checked
    
    if (chkcheck)
    {
        
        modifyTextField(document.getElementById('Petq1'), true);
        modifyTextField(document.getElementById('Petq2'), true)
        modifyTextField(document.getElementById('Petq3'), true)
        modifyTextField(document.getElementById('Petq4'), true)
        modifyTextField(document.getElementById('Petq5'), true)
        modifyTextField(document.getElementById('Petq6'), true)
    }
    else
    {
        modifyTextField(document.getElementById('Petq1'), false);
        modifyTextField(document.getElementById('Petq2'), false)
        modifyTextField(document.getElementById('Petq3'), false)
        modifyTextField(document.getElementById('Petq4'), false)
        modifyTextField(document.getElementById('Petq5'), false)
        modifyTextField(document.getElementById('Petq6'), false)
    
    }


}

function modifyTextField(field, bDisabled) {
	field.disabled = bDisabled
	if (bDisabled) {
		field.onfocus = function() {this.blur(); };	
	}
	else {
		field.onfocus = function() {};			
	}
}

function PetQuestion7(vpagename ) 
{ //v2.0

 var sPetq3Sel = document.getElementById('Petq3').selectedIndex ;  
 var sPetq3Selvalue = document.getElementById('Petq3').options[sPetq3Sel].value ;
  
 
 var sPetq4Sel = document.getElementById('Petq4').selectedIndex ;  
 var sPetq34elvalue = document.getElementById('Petq4').options[sPetq4Sel].value ;
 
 if (sPetq34elvalue==0)
 {
    alert("please select the number of animals before using the multi size grid") ;
    return ;
 }

 var sPetq6Sel = document.getElementById('Petq6').selectedIndex ;   		
 //var sPetq6Selvalue = document.getElementById('Petq6').options[sPetq6Sel].value ;
 
 var sNeedAdditionWeight = document.getElementById('NeedToRecordWeight')
     sNeedAdditionWeight.value=1 ;
		    
 // var chkcheck = document.getElementById('SamePetInfo').checked
  var pagename = vpagename + "OpenQuestion6.asp?petname=" + sPetq3Selvalue + "&num=" + sPetq34elvalue + "&sel=" + sPetq6Sel ;
  
  window.open(pagename,'estship','scrollbars=yes,width=550,height=400');
 
 //alert(pagename)
}
function PRq2Question(vpagename ) 
{

    var pagename = vpagename + "OpenPRq2Question.asp";
     window.open(pagename,'estship','scrollbars=yes,width=550,height=400');
}