//home page scripts
 function setMake(f, make, region_id, baseUrl) {
       f.model_id.options[0].text="**LOADING**";
       f.make_id.value = make;
       var url = baseUrl + "/index.jsp?make_id=" + make +"&region_id="+ region_id;
       //alert('url - ' + url);
       window.location.href = url;
   }

   function ChangeMake(f) {
      f.model_id.options[0].text='**LOADING**';
      f.action="index.jsp";
      f.submit();
   }


   function ValidateForm(formName){
         if(!priceRangeValidator(formName))
             return false;
         if(!yearRangeValidator(formName))
             return false;
         return true;
   }

   function priceRangeValidator(formName){
           var form=document.forms[formName];
           if(form.price_to.selectedIndex != 0  && (form.price_to.selectedIndex<form.price_from.selectedIndex)){
               alert("Please enter Valid Price Range");
               return false;
           }
           return true;
   }

    function yearRangeValidator(formName){
           var form=document.forms[formName];
        if(form.year_to.selectedIndex == 0 || form.year_from.selectedIndex == 0)
            return true;
        if(form.year_to.selectedIndex>form.year_from.selectedIndex){
               alert("Please enter Valid Year Range");
               return false;
            }
            return true;
    }
    //lend home page script
