function quest2ShowTable(action){
         table=document.getElementById('quest2Table');
         table1=document.getElementById('quest2xTable');  
    if (action=='yes'){
        table.style.display='block';
        table1.style.display='block';
    }else{
        table.style.display='none';
        table1.style.display='none'; 
    }
}
function quest21ShowTable(action){
    table2=document.getElementById('quest21TableNO');
        
    if (action=='yes'){
            table2.style.display='none';  
    }else{
            table2.style.display='block';
    }
}
function q6ShowTable(action){
    
    table=document.getElementById('q6Table');
    diffValue=document.getElementById('parkingDifficulty').value;
    
    if ((diffValue=='1') || (diffValue=='2') || (diffValue=='3') ){
        table.style.display='block';
    }else{
        table.style.display='none';
    }
}

function quest7ShowTable(action){
    table=document.getElementById('quest7Table');
    if (action=='yes'){
        table.style.display='block';
    }else{
        table.style.display='none';        
    }    
}
function quest13ShowTable(action){
    table=document.getElementById('quest13Table');
    if (action=='yes'){
        table.style.display='block';
    }else{
        table.style.display='none';        
    }    
}

function drawVehicleTypeFields1(){
		 var num = document.getElementById('question9').value;
		 
		 for(i=1; i <= 12; i++){
				  document.getElementById('vehicle'+i).style.display='none';
				  document.getElementById('pvehicle'+i).style.display='none';
		 }
		 
		 for(i=1; i <= (num*1); i++){
				  document.getElementById('vehicle'+i).style.display='block';
				  document.getElementById('pvehicle'+i).style.display='block';
		 }
}

function drawVehicleTypeFields(){
	var newHTML = "<table border='0' width='100%' celpadding='0' cellspacing='0'>";
    var num = document.getElementById('question9').value;
    
    var i=(i*1)
    if (num <= 10){
    for (i=1;i<=(num*1);i=i+1){
            newHTML += "<tr><td class='content1' width='104' style='padding-top:5px; padding-bottom:5px;'>Vehicle "+i+"</td><td class='content1'><select name='vehicleType[]'><option value='n/a'>Please select type of vehicle</option><option value='car'>Car</option><option value='motorcycle'>Motorcycle</option><option value='light van'>Light Van</option><option value='psv'>PSV</option></select></td></tr>";
        }
        newHTML += "<tr><td class='content1'><input type='text' name='otherVehicle' value='Other (Please Specify)'></td></tr>";
    }else{
        newHTML += "<tr><td class='content1'>Please enter value between 1-10.</td></tr>";
    }
     newHTML += "</table>";
	document.getElementById('vehicleFields').innerHTML = newHTML;
 
document.createElement('select');
}

function drawVehicleParkingFields(){
	var newHTML = "<table border='0' width='100%' celpadding='0' cellspacing='0'>";
    var num = document.getElementById('vehicleNum').value;
    
    var i=(i*1)
    if (num <= 10){
    for (i=1;i<=(num*1);i=i+1) 
        {
            newHTML += "<tr><td class='content1' width='104' style='padding-top:5px; padding-bottom:5px;'>Vehicle "+i+"</td><td class='content1'><select name='vehicleParking[]'><option value='n/a'>Please Select</option><option value='garage_driveway'>Driveway/garage</option><option value='street'>street</option><option value='oher'>Other</option></select></td></tr>";
        }
        newHTML += "<tr><td class='content1'><input type='text' name='otherParking' id='otherParking' onClick='javascript: document.getElementById(\'otherParking\').value=\'\'; onBlur='javascript: fillBack(\'otherParking\');'  value='Other (Please Specify)'></td></tr>";
    }else{
        newHTML += "<tr><td class='content1'>Please enter value between 1-10.</td></tr>";
    }
     newHTML += "</table>";
	document.getElementById('parkingFields').innerHTML = newHTML;
 
}

function checkMaxChars(){
         var num = document.getElementById('charNum');
         var otherV = document.getElementById('otherViews');
         
         if ((num.value*1) >= '40'){
                 // alert('maximum number reached');
                  
         }
         num.value = otherV.value.length;
         otherV.value=otherV.value.substr(0,40);
         document.getElementById('charCounter').value = num.value;
}

function checkMaxChars2(id){
         var textar = document.getElementById(id);
         textar.value=textar.value.substr(0,40);
}

function checkMaxChars3(id){
         var textar = document.getElementById(id);
         textar.value=textar.value.substr(0,200);
}

function fillBack(id){
         var textField = document.getElementById(id);
         if (textField.value == ''){
                  textField.value="Other (Please Specify)";
         }
}

/*NEW VEHICLE FUNCTIONS*/

