var agent = navigator.userAgent.toLowerCase();
var scrWidth = screen.width;
var scrHeight = screen.height;
// The document.documentElement dimensions seem to be identical to
// the screen dimensions on all the mobile browsers I've tested so far
var elemWidth = document.documentElement.clientWidth;
var elemHeight = document.documentElement.clientHeight;
// We need to eliminate Symbian, Series 60, Windows Mobile and Blackberry
// browsers for this quick and dirty check. This can be done with the user agent.
var otherBrowser = (agent.indexOf("series60") != -1) || (agent.indexOf("symbian") != -1) || (agent.indexOf("windows ce") != -1) || (agent.indexOf("blackberry") != -1);
// If the screen orientation is defined we are in a modern mobile OS
var mobileOS = typeof orientation != 'undefined' ? true : false;
// If touch events are defined we are in a modern touch screen OS
var touchOS = ('ontouchstart' in document.documentElement) ? true : false;
// iPhone and iPad can be reliably identified with the navigator.platform
// string, which is currently only available on these devices.
var iOS = (navigator.platform.indexOf("iPhone") != -1) ||
        (navigator.platform.indexOf("iPad") != -1) ? true : false;
// If the user agent string contains "android" then it's Android. If it
// doesn't but it's not another browser, not an iOS device and we're in
// a mobile and touch OS then we can be 99% certain that it's Android.
var android = (agent.indexOf("android") != -1) || (!iOS && !otherBrowser && touchOS && mobileOS) ? true : false;

if(wng_pageInfo['contentClassification'] == 'Programming') {
	if (navigator.platform=="iPad")
	{ 
		window.location="http://www2.8newsnow.com/video/ipad";
	}
}
if(wng_pageInfo['contentClassification'] == 'Homepage') {
	if ((mobileOS && iOS) || (mobileOS && android)) { 
		if (scrHeight < 900) {
			window.location="http://m.8newsnow.com";
		}
	}
}


document.write('<link type="text/css" rel="stylesheet" media="all" href="http://ftpcontent.worldnow.com/klas/css/klas_all.css">');
document.write('<link type="text/css" rel="stylesheet" media="all" href="http://ftpcontent.worldnow.com/klas/css/userReg.css">');
if (document.getElementsByName) {
var metaArray=document.getElementsByName('WT.cg_n');
var metaContainertype=document.getElementsByName('DCSext.containertype');
if(wng_pageInfo['contentClassification'] =='Chat') {
document.write('<link type="text/css" rel="stylesheet" media="all" href="http://ftpcontent.worldnow.com/klas/css/klas_news.css">');
}else if(wng_pageInfo['contentClassification'] == 'News') {
document.write('<link type="text/css" rel="stylesheet" media="all" href="http://ftpcontent.worldnow.com/klas/css/klas_news.css">');
}else if(metaArray[0].content =='Homepage') {
document.write('<link type="text/css" rel="stylesheet" media="all" href="http://ftpcontent.worldnow.com/klas/css/klas_home.css">');
}else if(metaArray[0].content.indexOf('News - AP') !=-1) {
document.write('<link type="text/css" rel="stylesheet" media="all" href="http://ftpcontent.worldnow.com/klas/css/klas_news.css">');
}else if(metaArray[0].content.indexOf('News - Editorial') !=-1 || metaArray[0].content.indexOf('Sales - Real Estate') !=-1) {
document.write('<link type="text/css" rel="stylesheet" media="all" href="http://ftpcontent.worldnow.com/klas/css/klas_iteam.css">');
}else if(metaArray[0].content.indexOf('Weather') !=-1) {
document.write('<link type="text/css" rel="stylesheet" media="all" href="http://ftpcontent.worldnow.com/klas/css/klas_weather.css">');
}else if(wng_pageInfo['contentClassification'].indexOf('Sport') !=-1) {
document.write('<link type="text/css" rel="stylesheet" media="all" href="http://ftpcontent.worldnow.com/klas/css/klas_sports.css">');
}else if(wng_pageInfo['contentClassification'].indexOf('-Sports') !=-1) {
document.write('<link type="text/css" rel="stylesheet" media="all" href="http://ftpcontent.worldnow.com/klas/css/klas_sports.css">');
}else if(metaArray[0].content.indexOf('Health') !=-1) {
document.write('<link type="text/css" rel="stylesheet" media="all" href="http://ftpcontent.worldnow.com/klas/css/klas_health.css">');
}else if(metaArray[0].content.indexOf('Insurance') !=-1) {
document.write('<link type="text/css" rel="stylesheet" media="all" href="http://ftpcontent.worldnow.com/klas/css/klas_health.css">');
}else if(metaArray[0].content.indexOf('Hospitals') !=-1) {
document.write('<link type="text/css" rel="stylesheet" media="all" href="http://ftpcontent.worldnow.com/klas/css/klas_health.css">');
}else if(metaArray[0].content.indexOf('Station 5') !=-1) {
document.write('<link type="text/css" rel="stylesheet" media="all" href="http://ftpcontent.worldnow.com/klas/css/klas_health.css">');
}else if(metaArray[0].content =='Traffic Cam') {
document.write('<link type="text/css" rel="stylesheet" media="all" href="http://ftpcontent.worldnow.com/klas/css/klas_weather.css">');
}else if(metaArray[0].content =='Ski Conditions') {
document.write('<link type="text/css" rel="stylesheet" media="all" href="http://ftpcontent.worldnow.com/klas/css/klas_traffic.css">');
}else if(metaArray[0].content.indexOf('Community') !=-1) {
document.write('<link type="text/css" rel="stylesheet" media="all" href="http://ftpcontent.worldnow.com/klas/css/klas_community.css">');
}else if(metaArray[0].content.indexOf('IVillage') !=-1) {
document.write('<link type="text/css" rel="stylesheet" media="all" href="http://ftpcontent.worldnow.com/klas/css/klas_women.css">');
}else if(metaArray[0].content.indexOf('Wedding') !=-1) {
document.write('<link type="text/css" rel="stylesheet" media="all" href="http://ftpcontent.worldnow.com/klas/css/klas_women.css">');
}else { 
document.write('<link type="text/css" rel="stylesheet" media="all" href="http://ftpcontent.worldnow.com/klas/css/klas_news.css">');
}
if (metaContainertype[0].content.indexOf('linksplus') !=-1) {
	document.write('<link type="text/css" rel="stylesheet" media="all" href="http://ftpcontent.worldnow.com/klas/css/klas_links.css">');
}
}
function include_dom(script_filename) {
    var html_doc = document.getElementsByTagName('head').item(0);
    var js = document.createElement('script');
    js.setAttribute('language', 'javascript');
    js.setAttribute('type', 'text/javascript');
    js.setAttribute('src', script_filename);
    html_doc.appendChild(js);
    return false;
}
include_dom('http://scripts.verticalacuity.com/vat/mon/vt.js');
