if (document.location.protocol == "https:" && !window.location.href.match("([Ss]hopping[Cc]art|[Rr]egister|[Ll]ogin|[Ll]ogout|[Cc]heckout|[Aa]dmin|[Mm]y[Aa]ccount|[Dd]onate[Nn]ow|[Aa]utomatic[Gg]iving)")) {
    window.location = window.location.href.replace(/https/, "http");
}
else if (document.location.protocol == "http:" && window.location.href.match("([Ss]hopping[Cc]art|[Rr]egister|[Ll]ogin|[Ll]ogout|[Cc]heckout|[Aa]dmin|[Mm]y[Aa]ccount|[Dd]onate[Nn]ow|[Aa]utomatic[Gg]iving)")) {
    window.location = window.location.href.replace(/http/, "https");
}

function AudioPlayerByType(Type, ID) {
    var link = '/MediaPlayer/' + Type + '/' + ID;
    var ua = navigator.userAgent.toLowerCase();
    if (ua.indexOf('chrome') != -1 || ua.indexOf('safari') != -1)
        window.open(link, 'MediaPlayer', 'width=697,height=345,directories=no,location=0,menubar=no,resizable=0,scrollbars=0,status=no,toolbar=no');
    else
        window.open(link, 'MediaPlayer', 'width=697,height=300,directories=no,location=0,menubar=no,resizable=0,scrollbars=0,status=no,toolbar=no');
    return false;
}
function ToggleDownloadLinks(id) {
    if (document.getElementById(id).style.display == "none")
        document.getElementById(id).style.display = "inline";
    else
        document.getElementById(id).style.display = "none";
}

function ToggleFields(checked) {
    if (checked)
        $get("billingaddress").className = "hiddenElement";
    else
        $get("billingaddress").className = "showElement";
}

// mobile browsers detect
//browserPlatform = {
//    platforms: [
//		{
//		    // Blackberry <5
//		    uaString: ['BlackBerry', 'midp'],
//		    cssFile: 'blackberry.css'
//		},
//		{
//		    // Symbian phones
//		    uaString: ['symbian', 'midp'],
//		    cssFile: 'symbian.css'
//		},
//		{
//		    // Opera Mobile
//		    uaString: ['opera', 'mobi'],
//		    cssFile: 'opera.css'
//		},
//		{
//		    // IE Mobile <6
//		    uaString: ['msie', 'ppc'],
//		    cssFile: 'ieppc.css'
//		},
//		{
//		    // IE Mobile 6+
//		    uaString: 'iemobile',
//		    cssFile: 'iemobile.css'
//		},
//		{
//		    // Palm WebOS
//		    uaString: 'webos',
//		    cssFile: 'webos.css'
//		},
//		{
//		    // Android
//		    uaString: 'Android',
//		    cssFile: 'android.css'
//		},
//		{
//		    // Blackberry 6+
//		    uaString: ['BlackBerry', '6.0', 'mobi'],
//		    cssFile: 'blackberry6.0.css'
//		},
//		{
//		    // iPad
//		    uaString: 'ipad',
//		    cssFile: 'ipad.css',
//		    miscHead: ''
//		},
//		{
//		    // iPhone and other webkit browsers
//		    uaString: ['safari', 'mobi'],
//		    cssFile: 'safari.css',
//		    miscHead: ''
//		}
//	],
//    options: {
//        cssPath: 'css/',
//        mobileCSS: 'allmobile.css'
//    },
//    init: function () {
//        this.checkMobile();
//        this.parsePlatforms();
//        return this;
//    },
//    checkMobile: function () {
//        if (this.uaMatch('mobi') || this.uaMatch('midp') || this.uaMatch('ppc') || this.uaMatch('webos')) {
//            this.attachStyles({ cssFile: this.options.mobileCSS });
//        }
//    },
//    parsePlatforms: function () {
//        for (var i = 0; i < this.platforms.length; i++) {
//            if (typeof this.platforms[i].uaString === 'string') {
//                if (this.uaMatch(this.platforms[i].uaString)) {
//                    this.attachStyles(this.platforms[i]);
//                    break;
//                }
//            } else {
//                for (var j = 0, allMatch = true; j < this.platforms[i].uaString.length; j++) {
//                    if (!this.uaMatch(this.platforms[i].uaString[j])) {
//                        allMatch = false;
//                    }
//                }
//                if (allMatch) {
//                    this.attachStyles(this.platforms[i]);
//                    break;
//                }
//            }
//        }
//    },
//    attachStyles: function (platform) {
//        if (platform.cssFile) {
//            document.write('<link rel="stylesheet" href="' + this.options.cssPath + platform.cssFile + '" type="text/css"/>');
//        }
//        if (platform.miscHead) {
//            document.write(platform.miscHead);
//        }
//    },
//    uaMatch: function (str) {
//        if (!this.ua) {
//            this.ua = navigator.userAgent.toLowerCase();
//        }
//        return this.ua.indexOf(str.toLowerCase()) != -1;
//    }
//}.init();
