/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ~ ©2011 ClickBank All Rights Reserved                                                                                ~
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

function underscorePropertyFilter(key, value) {
    if (/^_.*/.test(key)) {
        return undefined;
    } else {
        return value;
    }
}

function showDialog(divId, title, width, height, closeText) {
    var btns = {};
    btns[closeText] = function(){ $(this).dialog("destroy"); };
	$(divId).dialog({
        width: width,
        height: height,
        bgiframe: true,
        dialogClass: 'infoBoxContent',
        title: title,
        modal: true,
        close: function(){
            $(this).dialog('destroy');
        },
        buttons: btns
    });return false;
}

function newPage2(url, name, w, h){
    wind = window.open(url, name, 'menubar=no, toolbar=no, status=no, resizable=yes, location=no, directories=no, width=' + w + ', height=' + h);
    if (wind.focus) { wind.focus(); }
}

function newPage(url, name){
    wind = window.open(url, name, 'menubar=no, toolbar=no, status=no, resizable=yes, location=no, directories=no');
    if (wind.focus) { wind.focus(); }
}

//Removes leading whitespaces
function LTrim( value ) {
    var re = /\s*((\S+\s*)*)/;
    return value.replace(re, "$1");
}

// Removes ending whitespaces
function RTrim( value ) {
    var re = /((\s*\S+)*)\s*/;
    return value.replace(re, "$1");
}

// Removes leading and ending whitespaces
function trim( value ) {
    return LTrim(RTrim(value));
}

