﻿function debug(what) {
    if (typeof (console) != "undefined") console.log(what)
}

function getURLParam(strParamName) {
    var strReturn = "";
    var strHref = window.location.href;
    if (strHref.indexOf("?") > -1) {
        var strQueryString = strHref.substr(strHref.indexOf("?"));
        var aQueryString = strQueryString.split("&");
        for (var iParam = 0; iParam < aQueryString.length; iParam++) {
            if (aQueryString[iParam].indexOf(strParamName + "=") > -1) {
                var aParam = aQueryString[iParam].split("=");
                strReturn = aParam[1];
                break;
            }
        }
    }
    return decodeURI(strReturn);
} 

function cloneObject(o) {
	function c(o) {
		for (var i in o) {
			this[i] = o[i]
		}
	}
	return new c(o);
}

    
/*
**  HELPER
*/
String.prototype.parseNumber = function() {
    return this.replace(/,/,'.')
}

String.prototype.parse = function(variables) {
    var html = this
    for (var pattern in variables) {
        html = html.replace(RegExp('{'+pattern+'}', 'g'), variables[pattern])
    }
    
    // F*!?K IE 6 fix! Spent 6 hours on it ...
    html = html.replace(RegExp(' jQuery[^=]+="null"', 'g'), '')
    return html
}