﻿/// <reference path="../../Scripts/jquery-1.4.1-vsdoc.js" />

//Extension for aspnet control ids
jQuery.extend ( 
    jQuery.expr[':'], { 
        aspnet: function(elem, i, match) { 
            return $(elem).filter('[id$=' + match[3] + ']').length == 1; 
        } 
    }
);


function TryParseFloat(str, defaultValue) {

    //Replace decimal delimiters
    str = str.replace(',', '.');
    var retValue = defaultValue;

    if (str != null && str.length > 0 && !isNaN(str)) {
        retValue = parseFloat(str);
    }

    return retValue;
}

function ReplaceAll(Source, stringToFind, stringToReplace) {

    var temp = Source;
    var index = temp.indexOf(stringToFind);

    while (index != -1) {
        temp = temp.replace(stringToFind, stringToReplace);
        index = temp.indexOf(stringToFind);
    }

    return temp;
}
