function PriceFilter(form){
    var URLparam;
    var preChar;
    var PriceMin;
    var PriceMax;
    var URLparam;
    var preChar;
    
//Shorten variable in order to have a clear code
    PriceMin = form.PriceMin.value;
    PriceMax = form.PriceMax.value;
    
//Replace comma by point (for some cities like France ;))
    PriceMin = PriceMin.replace(",", ".");
    PriceMax = PriceMax.replace(",", ".");

//The default value of the input is "Price Min." or "Price Max.", if the default values are still there then the variable will be empty
    PriceMin = (PriceMin == "<?php echo Mage::helper('catalog')->__('Price Min.') ?>") ? "" : PriceMin;
    PriceMax = (PriceMax == "<?php echo Mage::helper('catalog')->__('Price Max.') ?>") ? "" : PriceMax;

//if one of the two field is filled then...
    if((PriceMin) || (PriceMax)) {
        //if the one of them is not filled we fill them manually
        //if there is only the Price Max which is filled the Price Min is 0 
        //if there is only the Price Min which is filled the Price Max is 1000000 (changeable below) 
        PriceMin = !(PriceMin) ? 0 : PriceMin;
        PriceMax = !(PriceMax) ? 1000000 : PriceMax; //can be changed
        
        //Verify is there are numbers. Yes, I think we could do this verification before. But here is good for me.
        if(!isNaN(PriceMin) && !isNaN(PriceMax)){
            if(PriceMin >= 0 && PriceMin <= PriceMax) {
                //We look if the URL contains parameter (color, manufacturer...), if Yes we give preChar "&", if No "?" 
                URLparam = location.href.indexOf("?");
                preChar = (URLparam>0) ? "&" : "?";
                location.href += preChar + "price=" + (PriceMax/(PriceMax - PriceMin)) + "," + (PriceMax - PriceMin);
            }
        }
    }
} 