﻿// JScript File
function _validatedefault()
{
    var hLblMonth1v=document.getElementById("hLblMonth1");
    var hLblMonth2v=document.getElementById("hLblMonth2");
    var hLblMonth3v=document.getElementById("hLblMonth3");
    var hLblMonth4v=document.getElementById("hLblMonth4");

    var chkVar;
    chkVar=false;
    chkVar = isFilledText(document.getElementById("txtemail"), '', 'Invalid emailid.')
    var chkGndr=document.getElementById("hidchkgender").value;
    
    if((chkVar==true) && (chkGndr == '1'))
    {
        var missinginfo = "";
        var chkactnext = document.getElementById ("SM1");
        var arrayOfCheckBoxes = chkactnext.getElementsByTagName("input");
	    var u = arrayOfCheckBoxes.length;
    		
		    for(var i=0;i<u;i++)
			    {
			    if (arrayOfCheckBoxes[i].checked)
				    {
					    missinginfo += "\n - You must agree to the terms";
				    }
			     }
			    if (missinginfo == "") 
				    {
				        alert("Please specify which all of the following products are you likely to buy in next one month?");
				        document.getElementById ("SM1").focus();
				        return false;   
				    }
				    
    }
    
    if((chkVar==true) && (chkGndr == '2'))
    {
        var missinginfo = "";
        var chkactnext = document.getElementById ("SF1");
        var arrayOfCheckBoxes = chkactnext.getElementsByTagName("input");
	    var u = arrayOfCheckBoxes.length;
    		
		    for(var i=0;i<u;i++)
			    {
			    if (arrayOfCheckBoxes[i].checked)
				    {
					    missinginfo += "\n - You must agree to the terms";
				    }
			     }
			    if (missinginfo == "") 
				    {
				        alert("Please specify which all of the following products are you likely to buy in next one month?");
				        document.getElementById ("SF1").focus();
				        return false;   
				    }
				    
    }
    
    if((chkVar==true) && (chkGndr == '1'))
    {  
            var missinginfo = "";
            var chkactcurrent = document.getElementById ("SM3");
	        var arrayOfCheckBoxes = chkactcurrent.getElementsByTagName("input");
	        var u = arrayOfCheckBoxes.length;
	        for(var i=0;i<u;i++)
		        {
			        if (arrayOfCheckBoxes[i].checked)
				        {
    				        missinginfo += "\n - You must agree to the terms";
				        }
		        }
			        if (missinginfo == "") 
			            {
				            alert("Please specify which all of the following products did you buy in last one month?");
					        document.getElementById ("SM3").focus();
					        return false;
				        }
            
    }
    
     if((chkVar==true) && (chkGndr == '2'))
    {  
            var missinginfo = "";
            var chkactcurrent = document.getElementById ("SF3");
	        var arrayOfCheckBoxes = chkactcurrent.getElementsByTagName("input");
	        var u = arrayOfCheckBoxes.length;
	        for(var i=0;i<u;i++)
		        {
			        if (arrayOfCheckBoxes[i].checked)
				        {
    				        missinginfo += "\n - You must agree to the terms";
				        }
		        }
			        if (missinginfo == "") 
			            {
				            alert("Please specify which all of the following products did you buy in last one month?");
					        document.getElementById ("SF3").focus();
					        return false;
				        }
            
    }
    
    
    
   if((chkVar==true) && (chkGndr == '1'))
    {  
        var missinginfo = "";
        var chkactcurrent = document.getElementById ("SM2");
	    var arrayOfCheckBoxes = chkactcurrent.getElementsByTagName("input");
	    var u = arrayOfCheckBoxes.length;
    		
	    for(var i=0;i<u;i++)
		    {
			    if (arrayOfCheckBoxes[i].checked)
				    {
    				    missinginfo += "\n - You must agree to the terms";
				    }
		    }
			    if (missinginfo == "") 
			        {
				        alert("Please specify which all of the following products do you use/own/wear currently?");
					    document.getElementById("SM2").focus();
					    return false;
				    }
				    
     }     
     
      if((chkVar==true) && (chkGndr == '2'))
    {  
        var missinginfo = "";
        var chkactcurrent = document.getElementById ("SF2");
	    var arrayOfCheckBoxes = chkactcurrent.getElementsByTagName("input");
	    var u = arrayOfCheckBoxes.length;
    		
	    for(var i=0;i<u;i++)
		    {
			    if (arrayOfCheckBoxes[i].checked)
				    {
    				    missinginfo += "\n - You must agree to the terms";
				    }
		    }
			    if (missinginfo == "") 
			        {
				        alert("Please specify which all of the following products do you use/own/wear currently?");
					    document.getElementById("SF2").focus();
					    return false;
				    }
				    
     }     
     
    return chkVar;
    
   }

function SecondPageV()
{
    chkVar = false;
    var cate2 = document.getElementById("catg2V").value;
	chkVar = isFilledText(document.getElementById("A1"), '', 'Please tell which is the first brand that comes to your mind?');
	
	if(chkVar==true)
    {
        var missinginfo = "";
        var option=document.getElementById("A2_Other");   
	    var chkassembcmp = document.getElementById ("A2");
		var arrayOfCheckBoxes = chkassembcmp.getElementsByTagName("input");
		var u = arrayOfCheckBoxes.length;
		    for(var i=0;i<u;i++)
			    {
				    if (arrayOfCheckBoxes[i].checked)
					    {
							missinginfo += "\n - You must agree to the terms";
					    }
			    }
					if ((missinginfo == "") && (option.value ==''))
						{
						    alert("Please tell how did you come to know of this brand?");
						    document.getElementById ("A2_0").select();
						    document.getElementById ("A2_0").focus();
						    return false;
						}
    }

    if(chkVar == true)
		    chkVar = isFilledText(document.getElementById("A5_1"), '', 'Please specify Apart from the first brand you mentioned earlier which are the other First brand that come to your mind easily?');
    if(chkVar == true)
		chkVar = isFilledText(document.getElementById("A5_2"), '', 'Please specify Apart from the first brand you mentioned earlier which are the other Second brand that come to your mind easily?');
	if(chkVar == true)
		chkVar = isFilledText(document.getElementById("A3"), '', 'Please specify Which is the first brand ad that comes to your mind?');

	if(chkVar==true)
    {
         var missinginfo = "";
         var option=document.getElementById("A4_Other");
			        var chkassembcmp = document.getElementById ("A4");
			        var arrayOfCheckBoxes = chkassembcmp.getElementsByTagName("input");
			        var u = arrayOfCheckBoxes.length;
			        for(var i=0;i<u;i++)
			        {
				        if (arrayOfCheckBoxes[i].checked)
					    {
							missinginfo += "\n - You must agree to the terms";
					    }
			        }
						if ((missinginfo == "") && (option.value ==''))
							{
								alert("Please specify where do you remember seeing this ad?");
								 document.getElementById ("A4_0").select();
						         document.getElementById ("A4_0").focus();
								return false;
							}
    }

if(document.getElementById("divnotapplicableA4").style.display == 'block')
    {
        if(chkVar == true)
               chkVar = isFilledText(document.getElementById("A5"), '', 'Please mention much do you like this ad?');  

        if(chkVar == true)
               chkVar = isFilledText(document.getElementById("A6"), '', 'Please mention you towards the advertised brand');  
    }  
         
 if(chkVar==true)
    {
         var missinginfo = "";
         var option=document.getElementById("A7_Other");
			        var chkassembcmp = document.getElementById ("A7");
			        var arrayOfCheckBoxes = chkassembcmp.getElementsByTagName("input");
			        var u = arrayOfCheckBoxes.length;
			        for(var i=0;i<u;i++)
			        {
				        if (arrayOfCheckBoxes[i].checked)
					    {
							missinginfo += "\n - You must agree to the terms";
					    }
			        }
						if ((missinginfo == "") && (option.value ==''))
							{
								alert("Please specify which all are you aware of from the following list?");
								 document.getElementById ("A7_0").select();
						         document.getElementById ("A7_0").focus();
								return false;
							}
    }
    
    if(chkVar==true && document.getElementById("showquotes").style.display == 'block')
    {
      chkVar = isFilledText(document.getElementById("A8"), '', 'Which fit do you prefer in your jeans'); 
      
    }
    if(chkVar==true && document.getElementById("showquotes").style.display == 'block')
    {
      chkVar = isFilledText(document.getElementById("A9"), '', 'Which of the following do you prefer the most'); 
    } 


 if(chkVar==true && document.getElementById("shownextdetail1").style.display == 'block')
    {
         var missinginfo = "";
         //var option=document.getElementById("A7_Other");
			        var chkassembcmp = document.getElementById ("ProductType1");
			        var arrayOfCheckBoxes = chkassembcmp.getElementsByTagName("input");
			        var u = arrayOfCheckBoxes.length;
			        for(var i=0;i<u;i++)
			        {
				        if (arrayOfCheckBoxes[i].checked)
					    {
							missinginfo += "\n - You must agree to the terms";
					    }
			        }
						if (missinginfo == "")
							{
								alert("Please Specify for what purpose will you do so and which brand are you likely to use for each of these purpose?");
								document.getElementById ("ProductType1").focus();
								return false;
							}
    }

 if(chkVar==true && document.getElementById("showCurrdetail1").style.display == 'block')
    {

                    var missinginfo = "";
                    //var option=document.getElementById("A9_other");
			        var chkassembcmp = document.getElementById ("ProductType2");
			        var arrayOfCheckBoxes = chkassembcmp.getElementsByTagName("input");
			        var u = arrayOfCheckBoxes.length;
			        for(var i=0;i<u;i++)
			        {
				        if (arrayOfCheckBoxes[i].checked)
					    {
							missinginfo += "\n - You must agree to the terms";
					    }
			        }
						if (missinginfo == "")
							{
								alert("Please specify for what purpose you do so and which brand do you use for each of these purpose?");
								document.getElementById ("ProductType2").focus();
								return false;
							}
							
    }
    

if(chkVar == true)
 {
    if(cate2 != "")
    {
	            chkVar = isFilledText(document.getElementById("B1"), '', 'Please tell which is the first brand that comes to your mind?');
	            if(chkVar==true)
                {
                var missinginfo = "";
                var option=document.getElementById("B2_Other");   
	            var chkassembcmp = document.getElementById ("B2");
		        var arrayOfCheckBoxes = chkassembcmp.getElementsByTagName("input");
		        var u = arrayOfCheckBoxes.length;
		            for(var i=0;i<u;i++)
			            {
				            if (arrayOfCheckBoxes[i].checked)
					            {
							        missinginfo += "\n - You must agree to the terms";
					            }
			            }
					        if ((missinginfo == "") && (option.value ==''))
						        {
						            alert("Please Specify how did you come to know of this brand ?");
						            document.getElementById ("B2_0").focus();
						            document.getElementById ("B2_0").focus();
						            return false;
						        }
                }
    
    if(chkVar == true)
		chkVar = isFilledText(document.getElementById("B5_1"), '', 'Please Specify Apart from the first brand you mentioned earlier which are the other First brand that come to your mind easily?');
	if(chkVar == true)
		chkVar = isFilledText(document.getElementById("B5_2"), '', 'Please Specify Apart from the first brand you mentioned earlier which are the other Second brand that come to your mind easily?');
	if(chkVar == true)
			chkVar = isFilledText(document.getElementById("B3"), '', 'Please Which is the first brand ad that comes to your mind?');

	if(chkVar==true)
    {
         var missinginfo = "";
         var option=document.getElementById("B4_Other");
			        var chkassembcmp = document.getElementById ("B4");
			        var arrayOfCheckBoxes = chkassembcmp.getElementsByTagName("input");
			        var u = arrayOfCheckBoxes.length;
			        for(var i=0;i<u;i++)
			        {
				        if (arrayOfCheckBoxes[i].checked)
					    {
							missinginfo += "\n - You must agree to the terms";
					    }
			        }
						if ((missinginfo == "") && (option.value ==''))
							{
								alert("Please mention Where do you remember seeing this ad ?");
								 document.getElementById ("B4_0").focus();
						         document.getElementById ("B4_0").focus();
								return false;
							}
    }

if(document.getElementById("divnotapplicableB4").style.display == 'block')
    {
    
        if(chkVar == true)
               chkVar = isFilledText(document.getElementById("B5"), '', 'Please mention much do you like this ad');  

        if(chkVar == true)
               chkVar = isFilledText(document.getElementById("B6"), '', 'Please mention you towards the advertised brand');  

    }       
            if(chkVar==true)
              {
                    var missinginfo = "";
                    var option=document.getElementById("B7_Other");
			        var chkassembcmp = document.getElementById ("B7");
			        var arrayOfCheckBoxes = chkassembcmp.getElementsByTagName("input");
			        var u = arrayOfCheckBoxes.length;
			        for(var i=0;i<u;i++)
			        {
				        if (arrayOfCheckBoxes[i].checked)
					    {
							missinginfo += "\n - You must agree to the terms";
					    }
			        }
						if ((missinginfo == "") && (option.value ==''))
							{
								alert("Please mention which all are you aware of from the following list?");
								 document.getElementById ("B7_0").focus();
						         document.getElementById ("B7_0").focus();
								return false;
							}
              }


            if(chkVar==true && document.getElementById("shownextdetail2").style.display == 'block')
                {
                    var missinginfo = "";
                    //var option=document.getElementById("A7_Other");
			        var chkassembcmp = document.getElementById ("ProductType3");
			        var arrayOfCheckBoxes = chkassembcmp.getElementsByTagName("input");
			        var u = arrayOfCheckBoxes.length;
			        for(var i=0;i<u;i++)
			        {
				        if (arrayOfCheckBoxes[i].checked)
					    {
							missinginfo += "\n - You must agree to the terms";
					    }
			        }
						if (missinginfo == "")
							{
								alert("Please mention what purpose will you do so and which brand are you likely to use for each of these purpose for next month?");
								document.getElementById ("ProductType3").focus();
								return false;
							}
                }

       
                if(chkVar==true && document.getElementById("showCurrdetail2").style.display == 'block')
                    {
                    var missinginfo = "";
			        var chkassembcmp = document.getElementById ("ProductType4");
			        var arrayOfCheckBoxes = chkassembcmp.getElementsByTagName("input");
			        var u = arrayOfCheckBoxes.length;
			        for(var i=0;i<u;i++)
			        {
				        if (arrayOfCheckBoxes[i].checked)
					    {
							missinginfo += "\n - You must agree to the terms";
					    }
			        }
						if (missinginfo == "")
							{
								alert("Please mention what purpose will you do so and which brand are you likely to use for each of these purpose?");
								document.getElementById ("ProductType4").focus();
								return false;
							}
                   }
    

	       }  
  }
    
  return chkVar;
 }
 
function ThirdPageV()
{
    chkVar = false;
    var cate2 = document.getElementById("catg2V").value;
	chkVar = isFilledText(document.getElementById("C1"), '', 'Please tell which is the first brand that comes to your mind?');
	if(chkVar==true)
    {
        var missinginfo = "";
        var option=document.getElementById("C2_Other");   
	    var chkassembcmp = document.getElementById("C2");
		var arrayOfCheckBoxes = chkassembcmp.getElementsByTagName("input");
		var u = arrayOfCheckBoxes.length;
		    for(var i=0;i<u;i++)
			    {
				    if (arrayOfCheckBoxes[i].checked)
					    {
							missinginfo += "\n - You must agree to the terms";
					    }
			        }
					if ((missinginfo == "") && (option.value ==''))
						{
						    alert("Please Specify how did you come to know of this brand?");
						     document.getElementById ("C2_0").focus();
						     document.getElementById ("C2_0").focus();
						    return false;
						}
    }

    if(chkVar == true)
		chkVar = isFilledText(document.getElementById("C5_1"), '', 'Please Specify Apart from the first brand you mentioned earlier which are the other First brand that come to your mind easily?');
    if(chkVar == true)
		chkVar = isFilledText(document.getElementById("C5_2"), '', 'Please Specify Apart from the first brand you mentioned earlier which are the other Second brand that come to your mind easily?');
	if(chkVar == true)
		chkVar = isFilledText(document.getElementById("C3"), '', 'Please Which is the first brand that comes to your mind?');

	if(chkVar==true)
    {
         var missinginfo = "";
         var option=document.getElementById("C4_Other");
			        var chkassembcmp = document.getElementById ("C4");
			        var arrayOfCheckBoxes = chkassembcmp.getElementsByTagName("input");
			        var u = arrayOfCheckBoxes.length;
			        for(var i=0;i<u;i++)
			        {
				        if (arrayOfCheckBoxes[i].checked)
					    {
							missinginfo += "\n - You must agree to the terms";
					    }
			        }
						if ((missinginfo == "") && (option.value ==''))
							{
								alert("Please mention Where do you remember seeing this ad ?");
								 document.getElementById ("C4_0").focus();
						         document.getElementById ("C4_0").focus();
								return false;
							}
    }

if(document.getElementById("divnotapplicableC4").style.display == 'block')
    {
        if(chkVar == true)
               chkVar = isFilledText(document.getElementById("C5"), '', 'Please mention much do you like this ad');  

        if(chkVar == true)
               chkVar = isFilledText(document.getElementById("C6"), '', 'Please mention you towards the advertised brand');  

    }       
    if(chkVar==true)
    {
         var missinginfo = "";
         var option=document.getElementById("C7_Other");
			        var chkassembcmp = document.getElementById ("C7");
			        var arrayOfCheckBoxes = chkassembcmp.getElementsByTagName("input");
			        var u = arrayOfCheckBoxes.length;
			        for(var i=0;i<u;i++)
			        {
				        if (arrayOfCheckBoxes[i].checked)
					    {
							missinginfo += "\n - You must agree to the terms";
					    }
			        }
						if ((missinginfo == "") && (option.value ==''))
							{
								alert("Please mention which all  are you aware of from the following list?");
								 document.getElementById ("C7_0").focus();
						         document.getElementById ("C7_0").focus();
								return false;
							}
    }


 if(chkVar==true && document.getElementById("shownextdetail1").style.display == 'block')
    {
         var missinginfo = "";
         //var option=document.getElementById("A7_Other");
			        var chkassembcmp = document.getElementById ("ProductType5");
			        var arrayOfCheckBoxes = chkassembcmp.getElementsByTagName("input");
			        var u = arrayOfCheckBoxes.length;
			        for(var i=0;i<u;i++)
			        {
				        if (arrayOfCheckBoxes[i].checked)
					    {
							missinginfo += "\n - You must agree to the terms";
					    }
			        }
						if (missinginfo == "")
							{
								alert("Please mention what purpose will you do so and which brand are you likely to use for each of these purpose for next month?");
								document.getElementById ("ProductType5").focus();
								return false;
							}
    }

 if((chkVar==true) && (document.getElementById("showCurrdetail1").style.display == 'block'))
    {
         var missinginfo = "";
         //var option=document.getElementById("A9_other");
			        var chkassembcmp = document.getElementById ("ProductType6");
			        var arrayOfCheckBoxes = chkassembcmp.getElementsByTagName("input");
			        var u = arrayOfCheckBoxes.length;
			        for(var i=0;i<u;i++)
			        {
				        if (arrayOfCheckBoxes[i].checked)
					    {
							missinginfo += "\n - You must agree to the terms";
					    }
			        }
						if (missinginfo == "")
							{
								alert("Please mention what purpose you do so and which brand do you use for each of these purpose?");
								document.getElementById ("ProductType6").focus();
								return false;
							}
							
    }
    

if(chkVar == true)
 {
    if(cate2 != "")
	    {
	            chkVar = isFilledText(document.getElementById("D1"), '', 'Please tell which is the first brand that comes to your mind?');
	            if(chkVar==true)
                {
                var missinginfo = "";
                var option=document.getElementById("D2_Other");   
	            var chkassembcmp = document.getElementById ("D2");
		        var arrayOfCheckBoxes = chkassembcmp.getElementsByTagName("input");
		        var u = arrayOfCheckBoxes.length;
		            for(var i=0;i<u;i++)
			            {
				            if (arrayOfCheckBoxes[i].checked)
					            {
							        missinginfo += "\n - You must agree to the terms";
					            }
			                }
					        if ((missinginfo == "") && (option.value ==''))
						        {
						            alert("Please Specify how did you come to know of this brand?");
						             document.getElementById ("D2_0").focus();
						             document.getElementById ("D2_0").focus();
						            return false;
						        }
                        }
                        
    if(chkVar == true)
		chkVar = isFilledText(document.getElementById("D5_1"), '', 'Please Specify Apart from the first brand you mentioned earlier which are the other First brand that come to your mind easily?');
    if(chkVar == true)
		chkVar = isFilledText(document.getElementById("D5_2"), '', 'Please Specify Apart from the first brand you mentioned earlier which are the other Second brand that come to your mind easily?');
	if(chkVar == true)
		chkVar = isFilledText(document.getElementById("D3"), '', 'Please Which is the first brand that comes to your mind?');

	if(chkVar==true)
    {
         var missinginfo = "";
         var option=document.getElementById("D4_Other");
			        var chkassembcmp = document.getElementById ("D4");
			        var arrayOfCheckBoxes = chkassembcmp.getElementsByTagName("input");
			        var u = arrayOfCheckBoxes.length;
			        for(var i=0;i<u;i++)
			        {
				        if (arrayOfCheckBoxes[i].checked)
					    {
							missinginfo += "\n - You must agree to the terms";
					    }
			        }
						if ((missinginfo == "") && (option.value ==''))
							{
								alert("Please mention Where do you remember seeing this ad ?");
								 document.getElementById ("D4_0").focus();
						         document.getElementById ("D4_0").focus();
								return false;
							}
    }

if(document.getElementById("divnotapplicableD4").style.display == 'block')
    {
        if(chkVar == true)
               chkVar = isFilledText(document.getElementById("D5"), '', 'Please mention much do you like this ad');  

        if(chkVar == true)
               chkVar = isFilledText(document.getElementById("D6"), '', 'Please mention you towards the advertised brand');  

    }
    
            if(chkVar==true)
              {
                    var missinginfo = "";
                    var option=document.getElementById("D7_Other");
			        var chkassembcmp = document.getElementById ("D7");
			        var arrayOfCheckBoxes = chkassembcmp.getElementsByTagName("input");
			        var u = arrayOfCheckBoxes.length;
			        for(var i=0;i<u;i++)
			        {
				        if (arrayOfCheckBoxes[i].checked)
					    {
							missinginfo += "\n - You must agree to the terms";
					    }
			        }
						if ((missinginfo == "") && (option.value ==''))
							{
								alert("Please mention which all  are you aware of from the following list?");
								 document.getElementById ("D7_0").focus();
						         document.getElementById ("D7_0").focus();
								return false;
							}
            }


            if(chkVar==true && document.getElementById("shownextdetail2").style.display == 'block')
                {
                    var missinginfo = "";
                    //var option=document.getElementById("A7_Other");
			        var chkassembcmp = document.getElementById ("ProductType7");
			        var arrayOfCheckBoxes = chkassembcmp.getElementsByTagName("input");
			        var u = arrayOfCheckBoxes.length;
			        for(var i=0;i<u;i++)
			        {
				        if (arrayOfCheckBoxes[i].checked)
					    {
							missinginfo += "\n - You must agree to the terms";
					    }
			        }
						if (missinginfo == "")
							{
								alert("Please mention what purpose will you do so and which brand are you likely to use for each of these purpose for next month");
								document.getElementById ("ProductType7").focus();
								return false;
							}
                }

 
                if(chkVar==true && document.getElementById("showCurrdetail2").style.display == 'block')
                    {
                    var missinginfo = "";
         	        var chkassembcmp = document.getElementById ("ProductType8");
			        var arrayOfCheckBoxes = chkassembcmp.getElementsByTagName("input");
			        var u = arrayOfCheckBoxes.length;
			        for(var i=0;i<u;i++)
			        {
				        if (arrayOfCheckBoxes[i].checked)
					    {
							missinginfo += "\n - You must agree to the terms";
					    }
			        }
						if (missinginfo == "")
							{
								alert("Please mention what purpose will you do so and which brand are you likely to use for each of these purpose");
								document.getElementById ("ProductType8").focus();
								return false;
							}
                        }
    

	        }  
 }
 
 return chkVar;
 }
 
function CWE()
{
    
	drpVal1 = document.getElementById("D8").value;
	
	if(drpVal1 == "2")
	{
		document.getElementById("eduocp1").style.display = 'block';
		document.getElementById("eduocp").style.display = 'none';
	}
	if(drpVal1 == "1")
	{
		document.getElementById("eduocp").style.display = 'block';
		document.getElementById("eduocp1").style.display = 'none';
	}
}

function showVillTown()
{
	drpVal1 =  document.getElementById("D7").value;
	if(drpVal1 == "1")
	{
		document.getElementById("landHouse").style.display = 'block';
	}
	if(drpVal1 == "2")
	{
	  document.getElementById("landHouse").style.display = 'none';
	} 
}


function _A2_Dontrember(vari)         
{     
     var chkBrands = document.getElementById(vari);
     var arrayOfCheckBoxes = chkBrands.getElementsByTagName("input");
     var u = arrayOfCheckBoxes.length;
     
     for(var i=0;i<u;i++)
     {    
        if(i != (u-1))  
        {
             if((document.getElementById(vari+"_" + i).checked) && (document.getElementById(vari+"_" + (u-1)).checked))
             {
                alert('You Can Not Select Do not remember Option, With other Options');
                  document.getElementById(vari+"_" +(u-1)).focus();
                  document.getElementById(vari+"_" +(u-1)).checked=false;
                  return false;
             }
        } 
     }
} 

function _A4_Notapplicable(vari)         
{     
     var chkBrands = document.getElementById(vari);
     var arrayOfCheckBoxes = chkBrands.getElementsByTagName("input");
     var u = arrayOfCheckBoxes.length;

     var tt=vari.split('4');
     if((document.getElementById(vari+"_" + (u-1)).checked))
     {
         document.getElementById("divnotapplicable"+vari).style.display = 'none';
         document.getElementById(tt[0]+"5").selectedIndex=0;
         document.getElementById(tt[0]+"6").selectedIndex=0;
     }
     
     else
     {
        document.getElementById("divnotapplicable"+vari).style.display = 'block';
     }
}

function _A4_Cannotrecall(vari)         
{     
     var chkBrands = document.getElementById(vari);
     var arrayOfCheckBoxes = chkBrands.getElementsByTagName("input");
     var u = arrayOfCheckBoxes.length;
     
     for(var i=0;i<u;i++)
     {    
        if(i != (u-2))  
        {
             if((document.getElementById(vari+"_" + i).checked) && (document.getElementById(vari+"_" + (u-2)).checked))
             {
                alert('You Can Not Select Can not recall Option, With other Options');
                  document.getElementById(vari+"_" +(u-2)).focus();
                  document.getElementById(vari+"_" +(u-2)).checked=false;
                  return false;
             }
        } 
     }
} 
/*******************First Most1*****************/
var noOfBrand1=0;
function _addToMostBuyBrandGP1(cId, cVal, cTitle)
{
    //var noOfBrand;
    //alert(noOfBrand);
    var usetxtGP=document.getElementById("lblmostGP1");
    var mosttext= document.getElementById("hidmostv1");
    var currBrandSelected = document.getElementById(cId);
    var mBuy = document.getElementById("GP10");
    if(currBrandSelected.checked == true)
    {   
        addOption(mBuy, cVal, cTitle);
        noOfBrand1++;
        //alert(cTitle);
        //usetxtGP.innerHTML=cTitle.toLowerCase();
        usetxtGP.innerHTML=cTitle;
        mosttext.value=cTitle;
    }
    else
    {
        removeOption(mBuy,cVal);
        noOfBrand1--;
    }
    if(noOfBrand1 <= 0)
    {
        noOfBrand1++;
    }
    if(noOfBrand1 <= 1)
        document.getElementById("mostGP1").style.display = 'none';
    else
        document.getElementById("mostGP1").style.display = 'block';
}


/*******************First Most2*****************/
var noOfBrand2=0;
function _addToMostBuyBrandGP2(cId, cVal, cTitle)
{
    //var noOfBrand;
    //alert(noOfBrand);
    var usetxtGP=document.getElementById("lblmostGP2");
    var mosttext= document.getElementById("hidmostv3");
    var currBrandSelected = document.getElementById(cId);
    var mBuy = document.getElementById("GP14");
    if(currBrandSelected.checked == true)
    {   
        addOption(mBuy, cVal, cTitle);
        noOfBrand2++;
        //alert(cTitle);
        //usetxtGP.innerHTML=cTitle.toLowerCase();
        usetxtGP.innerHTML=cTitle;
        mosttext.value=cTitle;
    }
    else
    {
        removeOption(mBuy,cVal);
        noOfBrand2--;
    }
    if(noOfBrand2 <= 0)
    {
        noOfBrand2++;
    }
    if(noOfBrand2 <= 1)
        document.getElementById("mostGP2").style.display = 'none';
    else
        document.getElementById("mostGP2").style.display = 'block';
}
/*******************Close*****************/

//function _ShowusageGP()
//{
//  var missinginfo = "";
//  var chkassembcmp = document.getElementById ("GP8");
//  var arrayOfCheckBoxes = chkassembcmp.getElementsByTagName("input");
//  var u = arrayOfCheckBoxes.length;
//	for(var i=0;i<u;i++)
//		{
//			if (arrayOfCheckBoxes[i].checked)
//				{
//					missinginfo += "\n - You must agree to the terms";
//				}
//		}
//	if (missinginfo == "")
//		{
//		    document.getElementById("divUsageGP").style.display = 'none';
//		    return false;
//		}
//		else
//		{
//		    document.getElementById("divUsageGP").style.display = 'block';
//		    return false;
//		}
//}

function validationPage4()
{
	chkVar = false;
	chkVar = isFilledText(document.getElementById("GP1"), '', 'Please tell which is the first brand that comes to your mind?');
	
	if(chkVar==true)
	    {
        var missinginfo = "";
        var option=document.getElementById("GP2_Other");   
	    var chkassembcmp = document.getElementById ("GP2");
		var arrayOfCheckBoxes = chkassembcmp.getElementsByTagName("input");
		var u = arrayOfCheckBoxes.length;
		    for(var i=0;i<u;i++)
			    {
				    if (arrayOfCheckBoxes[i].checked)
					    {
							missinginfo += "\n - You must agree to the terms";
					    }
			    }
					if ((missinginfo == "") && (option.value ==''))
						{
						    alert("Please tell how did you come to know of this brand?");
						    document.getElementById ("GP2_0").select();
						    document.getElementById ("GP2_0").focus();
						    return false;
						}
    }

    if(chkVar == true)
		    chkVar = isFilledText(document.getElementById("GP3_1"), '','Please specify Apart from the first brand you mentioned earlier which are the other First brand that come to your mind easily?');
    if(chkVar == true)
		chkVar = isFilledText(document.getElementById("GP3_2"), '','Please specify Apart from the first brand you mentioned earlier which are the other Second brand that come to your mind easily?');
	if(chkVar == true)
		chkVar = isFilledText(document.getElementById("GP4"), '','Please specify Which is the first brand ad that comes to your mind?');

	if(chkVar==true)
	{
         var missinginfo = "";
         var option=document.getElementById("GP5_Other");
			        var chkassembcmp = document.getElementById ("GP5");
			        var arrayOfCheckBoxes = chkassembcmp.getElementsByTagName("input");
			        var u = arrayOfCheckBoxes.length;
			        for(var i=0;i<u;i++)
			        {
				        if (arrayOfCheckBoxes[i].checked)
					    {
							missinginfo += "\n - You must agree to the terms";
					    }
			        }
						if ((missinginfo == "") && (option.value ==''))
							{
								alert("Please specify where do you remember seeing this ad?");
								 document.getElementById ("GP5_0").select();
						         document.getElementById ("GP5_0").focus();
								return false;
							}
    }

if(document.getElementById("divnotapplicableA4").style.display == 'block')
    {
        if(chkVar == true)
               chkVar = isFilledText(document.getElementById("GP6"), '', 'Please mention much do you like this ad?');  

        if(chkVar == true)
               chkVar = isFilledText(document.getElementById("GP7"), '', 'Please mention you towards the advertised brand');  
    }  
         
 if(chkVar==true && document.getElementById("showdvAwrAns1").style.display == 'block')
    {
			        var missinginfo = "";
			        var option=document.getElementById("GP8_Other");
			        var chkassembcmp = document.getElementById ("GP8");
			        var arrayOfCheckBoxes = chkassembcmp.getElementsByTagName("input");
			        var u = arrayOfCheckBoxes.length;
			        for(var i=0;i<u;i++)
			        {
				        if (arrayOfCheckBoxes[i].checked)
					    {
							missinginfo += "\n - You must agree to the terms";
					    }
			        }
						if ((missinginfo == "") && (option.value ==''))
							{
								alert("Please specify which all are you aware of from the following list?");
								 document.getElementById ("GP8_0").select();
						         document.getElementById ("GP8_0").focus();
								return false;
							}
    }
    
    if(chkVar==true && document.getElementById("showdvUseAns1").style.display == 'block')
    {
	 
				var missinginfo = "";
				var chkassembcmp = document.getElementById ("GP9");
			        var arrayOfCheckBoxes = chkassembcmp.getElementsByTagName("input");
			        var u = arrayOfCheckBoxes.length;
			        for(var i=0;i<u;i++)
			        {
				        if (arrayOfCheckBoxes[i].checked)
					    {
							missinginfo += "\n - You must agree to the terms";
					    }
			        }
				if (missinginfo == "")
					{
						alert("Please specify which all generic brand are you likely to use?");
						document.getElementById("GP9_0").select();
						document.getElementById("GP9_0").focus();
						return false;
					}
   }

    
      if((chkVar==true) && (document.getElementById("mostGP1").style.display == 'block'))
	    { 
		    chkVar = isFilledText(document.getElementById("GP10"), '0', 'Which one brand of all these brands have you used the most in the last one month?');  
	    }
    
    
  if(chkVar==true)
    {
	 
				var missinginfo = "";
				var option=document.getElementById("GP11_other");
				var chkassembcmp = document.getElementById ("GP11");
			        var arrayOfCheckBoxes = chkassembcmp.getElementsByTagName("input");
			        var u = arrayOfCheckBoxes.length;
			        for(var i=0;i<u;i++)
			        {
				        if (arrayOfCheckBoxes[i].checked)
					    {
							missinginfo += "\n - You must agree to the terms";
					    }
			        }
				if ((missinginfo == "") && (option.value ==''))
					{
						alert("Please specify For what all purpose do you visit?");
						document.getElementById ("GP11_0").select();
						document.getElementById ("GP11_0").focus();
						return false;
					}
	 } 
    
    if((chkVar==true) && (document.getElementById("showdvUseAns2").style.display == 'block'))
    {
	 
				var missinginfo = "";
				var option=document.getElementById("GP13_other");
				var chkassembcmp = document.getElementById ("GP13");
			        var arrayOfCheckBoxes = chkassembcmp.getElementsByTagName("input");
			        var u = arrayOfCheckBoxes.length;
			        for(var i=0;i<u;i++)
			        {
				        if (arrayOfCheckBoxes[i].checked)
					    {
							missinginfo += "\n - You must agree to the terms";
					    }
			        }
				if ((missinginfo == "") && (option.value ==''))
					{
						alert("Please specify which all of the following brands are you likely to use in next one month?");
						document.getElementById ("GP13_0").select();
						document.getElementById ("GP13_0").focus();
						return false;
					}
	 } 
    
    if((chkVar==true) && (document.getElementById("mostGP2").style.display == 'block'))
	    { 
		    chkVar = isFilledText(document.getElementById("GP14"), '0', 'Which one brand of all these brands have you used the most in next one month?');  
	    }
	    
       
    if(chkVar==true)
    {
	 
				var missinginfo = "";
				var option=document.getElementById("GP15_other");
				var chkassembcmp = document.getElementById ("GP15");
			        var arrayOfCheckBoxes = chkassembcmp.getElementsByTagName("input");
			        var u = arrayOfCheckBoxes.length;
			        for(var i=0;i<u;i++)
			        {
				        if (arrayOfCheckBoxes[i].checked)
					    {
							missinginfo += "\n - You must agree to the terms";
					    }
			        }
				if ((missinginfo == "") && (option.value ==''))
					{
						alert("Please specify For what all purposes are you likely to visit in next one month?");
						document.getElementById ("GP15_0").select();
						document.getElementById ("GP15_0").focus();
						return false;
					}
	 } 
	
	if(chkVar==true)
    {
	    chkVar = isFilledText(document.getElementById("GP12"), '', 'Usually, how frequently do you use generic brands');  
    }
     
    return chkVar;
}




 function _showdvallcat()
     {
                    var nfilctrf1=document.getElementById("GP7");     
                    var nfilctr1=document.getElementById("GP1");
                    var nfilctr2=document.getElementById("GP3_1");
                    var nfilctr3=document.getElementById("GP3_2");
                    var nfilctr4=document.getElementById("GP4");
                    var nfilctr5=document.getElementById("GP5");
                    var nfilctr6=document.getElementById("GP6");
                    
                    var missinginfo1 = "";
         	        var chkassembcmp1 = document.getElementById ("GP2");
			        var arrayOfCheckBoxes1 = chkassembcmp1.getElementsByTagName("input");
			        var u = arrayOfCheckBoxes1.length;
			        for(var i=0;i<u;i++)
			        {
				        if (arrayOfCheckBoxes1[i].checked)
					    {
							missinginfo1 += "\n - You must agree to the terms";
					    }
			        }
						if (missinginfo1 == "")
							{
								document.getElementById ("GP2").focus();
								return false;
							}
                    
                    var missinginfo2 = "";
         	        var chkassembcmp2 = document.getElementById ("GP5");
			        var arrayOfCheckBoxes2 = chkassembcmp2.getElementsByTagName("input");
			        var u = arrayOfCheckBoxes2.length;
			        for(var i=0;i<u;i++)
			        {
				        if (arrayOfCheckBoxes2[i].checked)
					    {
							missinginfo2 += "\n - You must agree to the terms";
					    }
			        }
						if (missinginfo2 == "")
							{
								document.getElementById ("GP5").focus();
								return false;
							}
					
	    if ((nfilctrf1.selectedIndex != '0') && (nfilctr6.selectedIndex != '0') && (nfilctr1.value!="") && (missinginfo1 !="") && (nfilctr2.value !="") && (nfilctr3.value !="") && (nfilctr4.value !="") && (missinginfo2 !=""))
		{
			 document.getElementById("showdvAwrAnscommt1").style.display='block'
			 document.getElementById("showdvAwrAns1").style.display='block'
			 document.getElementById("showdvUseAnscommt1").style.display='block'
		     document.getElementById("showdvUseAns1").style.display='block'   	 
		     document.getElementById("showdvUseAns2").style.display='block'
		     document.getElementById("spmcmtlikely").style.display='block'
        }
	else
        {
            document.getElementById("showdvAwrAnscommt1").style.display='none'
			 document.getElementById("showdvAwrAns1").style.display='none'
			 document.getElementById("showdvUseAnscommt1").style.display='none'
		     document.getElementById("showdvUseAns1").style.display='none'   	 
		     document.getElementById("showdvUseAns2").style.display='none'
		     document.getElementById("spmcmtlikely").style.display='none'
        }

     }