// Handset Detection mobile redirection script 1.1a
var HandsetDetection = {
	ismobile : false,
	istablet : false,
	isconsole : false,
	width :	"0",
	height : "0",
	vendor : "",
	model : "", 
	xhtmllevel : "0",
	os : "",
	osversion : "",
	browser : "", 
	browserversion : "",
	urls : ["24-7ministries.org","m.24-7ministries.org"],
	
	redirect: function() {
		// Smart Redirection - if referrer domain is in url list then do nothing - its internal.
		if ("1" == "1") {
			var refurl = "";
			if (document.referrer) {
				refurl = document.referrer.toString();
			} else if (window.opener && !window.opener.closed && window.opener.location) {
				try {
					refurl = window.opener.location.toString();
				} catch (err) {
					refurl = "";
				}
			}
			if (refurl.length > 0) {
				refurl = refurl.toLowerCase().replace(/http:\/\//i, "").split("/", 1);
				for(var i in this.urls) {
					if (this.urls[i].toLowerCase().indexOf(refurl) > -1) {
						// Found match - quit.
						return 1;
					}
				}
			}
		}
		
		// Redirection rules.
// Default
if (   (this.ismobile == true ) ) { window.location = "http://m.24-7ministries.org"; return 1; }
		
	}
}

HandsetDetection.redirect();
