﻿function CheckPrice(minPrice, maxPrice){	
    var minValue = minPrice.selectedIndex;
    var maxValue = maxPrice.selectedIndex;
	
    if(maxValue==0)
    {
	    maxPrice.selectedIndex=1;
	    maxValue=1;
    }
    
    if(maxValue<=minValue)
    {
	    maxPrice.selectedIndex = minValue+1;
    }
}
function modelToMake(makeDropDownName, modelDropDownName, selectedModel) {
    var makeDropDown = document.getElementById(makeDropDownName);
    var modelDropDown = document.getElementById(modelDropDownName);
    var selectedModel = document.getElementById(selectedModel);
    
    var makeSelIndex = makeDropDown.selectedIndex
   
    //Remove any old models
    for(i=0;i<modelDropDown.length;i++)
    {
        modelDropDown.options[i] = null;
    }   
    
    if(CarModelList[makeSelIndex].length>0){
        for(mod=0;mod < CarModelList[makeSelIndex].length; mod++)
        {
            modelDropDown.options[mod] = new Option(CarModelList[makeSelIndex][mod].ModelName, CarModelList[makeSelIndex][mod].ModelID);
        }
    }
    else
    {
        modelDropDown.options[mod] = new Option("Any Model", -1);
    }
        //CC 14/05/2010 need to reset the model selected value
        selectedModel.value = "-1,";
    
}
function validatePrice(minPrice, maxPrice){            
    if (minPrice.selectedIndex > maxPrice.selectedIndex)
        {
            maxPrice.selectedIndex = minPrice.selectedIndex;
        }
    }
function CheckPriceJobs(wSCMinPrice,wSCMaxPrice){
	var maxPrice = document.getElementById(wSCMaxPrice);
	var minPrice = document.getElementById(wSCMinPrice);	
	var maxValue = maxPrice.selectedIndex;
	var minValue = minPrice.selectedIndex;

	if(maxValue < minValue){
		maxPrice.selectedIndex = minValue;
	}	
}    
