ADTUtil = {

    isNull: function(object) {
        return typeof object == "undefined" || object === null || object === '';
    },

    isValidEmail: function(email) {
        var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
        return pattern.test(email);
    },

    DateDeserialize: function(dateStr) {
        return eval('new' + dateStr.replace(/\//g, ' '));
    },

    ConvertTimeToUTC: function(localtime) {
            return new Date(localtime.getUTCFullYear(), localtime.getUTCMonth(), localtime.getUTCDate(), localtime.getUTCHours(), localtime.getUTCMinutes(), localtime.getUTCSeconds());
    },

    formatTime: function(date) {
        if (date < Date.today()) {
            return "n/a"
        }
        return date.toString("ddd dd MMM yyyy, HH:mm"); // uses http://code.google.com/p/datejs/
    },

    formatFlightTime: function(date) {
        if (date < Date.today()) {
            return "n/a"
        }
        return date.toString("ddd dd MMM yyyy") + " at " + date.toString("HH:mm"); // uses http://code.google.com/p/datejs/
    },


    formatPrice: function(price) {
        return Number(price).toFixed(2);
    },

    formatPrice: function(price, currencyCode, includeDecimal) {
        if (currencyCode == null || currencyCode == "") currencyCode = currencySymbol;

        var ie = (navigator.appName == "Microsoft Internet Explorer");

        switch (jQuery.trim(currencyCode).toUpperCase()) {  // //this mapping also exists in WebConfigManager.GetCurrencySymbol
            case "GBP": currencyCode = "&pound;"; break;
            case "AUD": currencyCode = "A&dollar;"; break;
            case "USD": currencyCode = "&dollar;"; break;
        }

        var price = includeDecimal ? Number(price).toFixed(2) : Number(price);
        if (currencyFormat != null && currencyFormat != "") return currencyFormat.replace("%%", price);
        return currencyCode + price;
    },

    formatLocalPrice: function(price, currencyexchange, priceformat) {
        return priceformat.replace("%%", (Number(price) * currencyexchange).toFixed(2));
    },

    formatDate: function(date) {
        if (date < Date.today()) {
            return "n/a"
        }
        return date.toString("ddd dd MMM yyyy"); // uses http://code.google.com/p/datejs/
    },

    formatDateSummary: function(date) {
        if (date < Date.today()) {
            return "n/a"
        }
        return date.toString("dS MMM yyyy"); // uses http://code.google.com/p/datejs/
    },

    checkFlightNo: function(no) {
        if (no !== null) {
            return no;
        }
        return "n/a"
    },

    getVisibleItem: function(str) {
        return $("[id^=ADT-" + str + "]:visible");
    }



};



 
    
   
    
   
    
    
 
    
     
 
    
    
