
/* WTOV9.com scripts */
// Begin national js scripts


/* QUIGO Text Ads Script */
/* 
 * Copyright 2006, Internet Broadcasting.
 * All Rights Reserved.
 *
 *
 * Author:  lvo
 * Date: 12/01/06
 * Last Updated: 11/10/08 
 *
 * adsonar_placementId is unique for each page
 * adsonar_pid is the same for each section
 *
 * Normal Widget: 10457911 
 * ---------------- 
 * Normal Dimension: 634x225
 * SlideShow: 240x220
 * 
 * 300x190 Widget: 12307031 
 */
var quigo = {	
	atl:{
		Home:{pid:627767,index:1417761},
		News:{pid:627767,index:1417789,detail:1485434},
		Entertainment:{pid:632759,index:1417767,detail:1485438},
		Health:{pid:632762,index:1417787,detail:1485436},
		Others:{pid:632763,index:1417791,detail:1485440},
		Sports:{pid:632760,index:1417949,detail:1485442},
		Travel:{pid:632761,index:1417951,detail:1485444},
		Slideshow:{pid:632763,detail:1270182},
		Weather:{pid:632758,index:1417953,detail:1485446},
		Custom300:{pid:632763, index:1278109, detail:1278109}
	},
	burg:{
		Home:{pid:627764,index:1417647},
		News:{pid:627764,index:1417667,detail:1485415},
		Slideshow:{detail:1270180,pid:627764},
		Others:{pid:627764,index:1418887,detail:1485413},
		Custom300:{pid:627764,index:1278105,detail:1278105}	
	},
	'char':{
		Home:{pid:627763,index:1417733},
		News:{pid:627763,index:1417731,detail:1485430},
		Slideshow:{detail:1270184,pid:627763},
		Others:{pid:627763,index:1418967,detail:1485432},
		Custom300:{pid:627763,index:1278114,detail:1278114}		
	},
	day:{
		Home:{pid:627762,index:1417727},
		News:{pid:627762,index:1417729,detail:1485428},
		Slideshow:{detail:1270176,pid:627762},
		Others:{pid:627762,index:1418947,detail:1485425},
		Custom300:{pid:627762,index:1278097,detail:1278097}	
	},
	elp:{
		Home:{pid:627758,index:1417751},
		News:{pid:627758,index:1417753,detail:1485471},
		Slideshow:{detail:1270168,pid:627758},
		Others:{pid:627758,index:1419007,detail:1485473},
		Custom300:{pid:627758,index:1278052,detail:1278052}		
	},
	fran:{
		Home:{pid:627766,index:1417755},
		News:{pid:627766,index:1417757,detail:1485475},
		Slideshow:{detail:1270172,pid:627766},
		Others:{pid:627766,index:1419027,detail:1485477},
		Custom300:{pid:627766,index:1278089,detail:1278089}
	},
	john:{
		Home:{pid:627761,index:1417687},
		News:{pid:627761,index:1417689,detail:1485417},
		Slideshow:{detail:1270178,pid:627761},
		Others:{pid:627761,index:1418907,detail:1485419},
		Custom300:{pid:627761,index:1278100,detail:1278100}
	},
	orlc:{
		Home:{index:1417763,pid:627765},	
		News:{pid:627765,index:1417809,detail:1485461},
		Entertainment:{pid:632768,index:1417799,detail:1485465},
		Health:{pid:632771,index:1417807,detail:1485463},
		Sports:{pid:632770,index:1417889,detail:1485457},
		Travel:{pid:631761,index:1417891,detail:1485453},
		Slideshow:{detail:1270174,pid:632772},
		Others:{pid:632772,index:1417827,detail:1485459},
		Weather:{pid:632769,index:1417893,detail:1485451},
		Custom300:{pid:632772, index:1278092, detail:1278092}
	},
	reno:{
		Home:{pid:627759,index:1417747},
		News:{pid:627759,index:1417749,detail:1485467},
		Slideshow:{detail:1270166,pid:627759},
		Others:{pid:627759,index:1418987,detail:1485469},
		Custom300:{pid:627759,index:1278049,detail:1278049}
	},
	sea:{
		Home:{pid:628758,index:1417759},
		News:{pid:628758,index:1417929,detail:1485486},
		Entertainment:{pid:632764,index:1417907,detail:1485479},		
		Health:{pid:631760,index:1417909,detail:1485484},
		Sports:{pid:632766,index:1417949,detail:1485490},
		Travel:{pid:632767,index:1417951,detail:1485492},		
		Weather:{pid:633758,index:1417953,detail:1485500},
		Slideshow:{detail:1270170,pid:632765},
		Others:{pid:632765,index:1417947,detail:1485488},
		Custom300:{pid:627760, index:1278113, detail:1278113}
	},
	steu:{
		Home:{pid:627760,index:1417707},
		News:{pid:627760,index:1417709,detail:1485423},
		Slideshow:{detail:1270186,pid:627760},
		Others:{pid:627760,index:1418927,detail:1485421},
		Custom300:{pid:627760,index:1278117,detail:1278117}	
	}
}

function findWidgetID(el)
{
	if ((typeof el) !='object') {
		el = document.getElementById(el);
	}
	if(el == null) return null;
	var p = el.parentNode;
	while(p)
	{
		if(p.id && p.id.match(/sw[0-9]+/))
			return p.id.replace(/sw/,"");
		p = p.parentNode;
	}
	return null;
}

/*
	pageProps fix in case it doesn't transform
*/

if ((typeof pageProps) == 'undefined') {
	var pageProps = { sectionname: 'Other' };
}

var qRandomID = 'q' + Math.floor(Math.random()*1000000);
document.write('<span id="' + qRandomID + '"></span>');
var qWidgetID = findWidgetID(qRandomID);

var qSitekey = siteinfo.sitekey.lc;
var qSiteversion = siteinfo.version;
var qSectionname = pageProps.sectionname;
(location.href.indexOf('detail.html')>0)? qPage = 'detail' : qPage = 'index'; 

// not defined section, assign it to Others
if (qWidgetID == '12307031') {
	qSectionname = 'Custom300';
} else if (!quigo[qSitekey][qSectionname]) {	
	qSectionname = 'Others';
}

adsonar_placementId=quigo[qSitekey][qSectionname][qPage];
adsonar_pid=quigo[qSitekey][qSectionname].pid;
adsonar_ps=-1;
adsonar_jv='ads.adsonar.com';

if (qSiteversion == 3) {
	switch (qSectionname) {
		case 'Custom300':
			adsonar_zw=300;
			adsonar_zh=190;
			break;	
		default:
			switch (qPage) {
				case 'index':
					adsonar_zw=300;
					adsonar_zh=250;
					break;
				case 'detail':
					adsonar_zw=300;
					adsonar_zh=250;
					break;
				default:
					adsonar_zw=634;
					adsonar_zh=225;
					break;
			}
	}
} else {
	switch (qSectionname) {
		case 'Home':
				adsonar_zw=500;
				adsonar_zh=300;
				break;
		case 'News':
				adsonar_zw=300;
				adsonar_zh=190;
				break;
		case 'Custom300':
				adsonar_zw=300;
				adsonar_zh=190;
				break;	
		case 'Slideshow':
				adsonar_zw=240;
				adsonar_zh=220;
				break;	
		default:
				adsonar_zw=500;
				adsonar_zh=160;
	}
}

qDebug = "Sitekey: "+qSitekey+"\n Version: "+qSiteversion+"\n Section: '" + qSectionname + "'\n Page: " + qPage + "\n Placement " + adsonar_placementId + "\n pid " +adsonar_pid + "\n height: " + adsonar_zh + " width: " + adsonar_zw;
if (adsonar_placementId>0) {  
	document.write('<scr' + 'ipt language="JavaScript" src="http://js.adsonar.com/js/adsonar.js"></scr' + 'ipt>');
}


// End national_js scripts

