﻿//TODO: remove this and use jquery's trim()
String.prototype.trim = function() {
    return this.replace( /^\s+|\s+$/g , "");
};

String.prototype.format = function () {
    var args = arguments;
    return this.replace(/{(\d+)}/g, function (match, number) {
        return typeof args[number] != 'undefined'
      ? args[number]
      : match
    ;
    });
};

String.prototype.parseJSONDate = function () {
    return new Date(parseInt(this.substr(6)));
};

$(document).ready(function() {
    initCheckboxes();
    initUnsupportedBrowserBlock();
    if ($.cookie("unsupportedBrowserBlock") == "0") {
        $('#hideUnsupportedBrowserBlock').click();
    } else {
        $('#showUnsupportedBrowserBlock').click();
    }
    $('#bigTabs .active').gradient({ from: 'FFE7AB', to: 'FFB400' });
});

function initUnsupportedBrowserBlock() {
	$('#hideUnsupportedBrowserBlock').live('click', function (evt) {
		$('#unsupportedBrowserBlock').hide();
		$('#unsupportedBrowserMsg').fadeIn();
		$.cookie("unsupportedBrowserBlock", "0", { expires: 30 });
	});
	$('#showUnsupportedBrowserBlock').live('click', function (evt) {
		$('#unsupportedBrowserMsg').hide();
		$('#unsupportedBrowserBlock').fadeIn();
		$.cookie("unsupportedBrowserBlock", "1", { expires: 30 });
	});
}

function newwin(url, height, width, move) {
	var mywindow;
	mywindow = window.open(url, '_blank', 'status=0,scrollbars=1,resizable=1,toolbar=0,location=0,height=' + height + ',width=' + width + '');
	if (move == 'y') mywindow.moveTo(0, 0);
}


