// Create tabs

$(document).ready(function() { 
    $('#tabs').tabs();
    var obj = document.getElementById('language_chooser');

    if(obj != null){
        $('#language_chooser').msDropDown();
        $('#language_chooser').fadeIn("1000");
    }
    
    $(".imagebox").fancybox({
	'hideOnContentClick': false,
            'autoScale': true,
            'autoDimensions': false,
            'width': 580,
            'height': 450
    });
});

function disable(text){
    $.blockUI({message:text});
}
function enable(text){
    $.unblockUI();
}
Number.prototype.FormatNumber= function(c, d, t){
    var n = this, c = isNaN(c = Math.abs(c)) ? 2 : c, d = d == undefined ? "," : d, t = t == undefined ? "." : t, s = n < 0 ? "-" : "", i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0;
    return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
};

function formatCurrency(n, c, d, t){
    c = isNaN(c = Math.abs(c)) ? 2 : c, d = d == undefined ? "," : d, t = t == undefined ? "." : t, s = n < 0 ? "-" : "", i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0;
    return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
}
/**
 * used to aplyimage on and best for using swap image
 * DOM id of tag
 * src url of image/icon
 */
function swapimage(id, src){
    id.src=src;
}
/**
 * XML Parser for
 * Sometimes xml strgin return gives error in IE when try to parse XML string through JQuery
 * so 
 */
function parseXML(xml) {
//    alert('Here in parseXML');
    if (window.ActiveXObject && window.GetObject) {
        var dom = new ActiveXObject('Microsoft.XMLDOM');
        dom.loadXML(xml);
        return dom;
    }
    return xml;
//    if (window.DOMParser){
//        return new DOMParser().parseFromString(xml, 'text/xml');
//    }
//    alert('some error');
//    throw new Error('No XML parser available');
}
