
// Geoff Pack
// March 2008

var wtGroup = null;
var wtHost = location.host;

// strip leading www.:
if (location.host.indexOf('www.') == 0) wtHost = location.host.substring(4);

switch (wtHost) {
	case 'search.abc.net.au':
	case 'arts.abc.net.au': 		wtGroup = 'other'; break;
	
	case 'scienceweek.info.au':
	case 'nationalmemorytest.net.au': wtGroup = 'science'; break;

	case 'cnnnn.com':
	case 'summerheightshigh.com':
	case 'thepuredrop.com.au': 		wtGroup = 'tv'; break;

	case 'triplej.abc.net.au': 
	case 'triplej.net.au': 
	case 'triplej.yourevents.com.au': 
	case 'triplejawol.typepad.com':
	case 'triplejunearthed.com': 	wtGroup = 'triplej'; break;

	case 'radioaustralia.net.au': 	wtGroup = 'radioaustralia'; break;
	case 'australianetwork.com': 	wtGroup = 'australianetwork'; break;

	case 'shop.abc.net.au':			wtGroup = 'shop'; break;

	case 'abccommercial.com.au':
	case 'abccontentsales.com.au':
	case 'abccostumes.com.au':
	case 'abcmusicpublishing.com.au':
	case 'countdown.com.au': 		wtGroup = 'commercial'; break;

	case 'zimmertwins.com.au': 		wtGroup = 'rollercoaster'; break;

	//case 'abc.net.au':
	//case 'nmdev.abc.net.au':
	//case 'www2b.abc.net.au':
	//case 'wwwdev.abc.net.au':
	
	default:	
		// top level directory
		var tld = location.pathname.split('/')[1];		
		switch (tld) {

			// abc online / front-page	
			case '':
			case 'default.htm':
			case 'default_800.htm':
			case 'homepage':		wtGroup = 'homepage'; break;

			// abc online / front-page group	
			case 'communities':
			case 'services':
			case 'privacy.htm':
			case 'conditions.htm':
			case 'sitemap.htm':
			case 'subjects.htm':
			case 'help':		wtGroup = 'other'; break;

			// innovation
			case 'bestof':
			case 'mobile':
			case 'upload':
			case 'earth':		wtGroup = 'innovation'; break;

			case 'unleashed':	wtGroup = 'unleashed'; break;
			
			case 'now':			wtGroup = 'abcnow'; break;

			case 'playback':
			case 'playback_':	wtGroup = 'playback'; break;
			
			// science
			case 'science':
			case 'labnotes':
			case 'greenatwork':
			case 'dinosaurs':
			case 'beasts':
			case 'acedayjobs':
			case 'catapult':	wtGroup = 'science'; break;
			
			// health
			case 'health':		wtGroup = 'health'; break;	
	
			// arts
			case 'arts':
			case 'postcode':	wtGroup = 'other'; break;
	
			// religion and ethics
			case 'religion':	wtGroup = 'other'; break;
			
			// news	
			case 'elections':
			case 'netball':
			case 'news':		wtGroup = 'news'; break;
	
			// current affairs		
			case '4corners':
			case '7.30':
			case 'am':
			case 'austory':
			case 'australiawide':
			case 'correspondents':
			case 'foreign':
			case 'insidebusiness':
			case 'insiders':
			case 'landline':
			case 'lateline':
			case 'latelinebusiness':	
			case 'pm':
			case 'sportoffsiders':
			case 'stateline':
			case 'worldtoday': wtGroup = 'currentaffairs'; break;
			
			// find tv sites that do not redirect to /tv/...
			case 'tv':
			case '100years':
			case 'aplacetothink':
			case 'atthemovies':
			case 'catalyst':
			case 'changi':
			case 'cnnnn':
			case 'compass   ':
			case 'dustonmyshoes':
			case 'dynasties':
			case 'ebiz':
			case 'einsteinfactor':
			case 'etimor':
			case 'gameon':
			case 'gardening':
			case 'glasshouse':
			case 'gnt':
			case 'gondola':
			case 'grassroots':
			case 'hotchips':
			case 'http':
			case 'jamescancook':
			case 'jtv':
			case 'juniors ':
			case 'kyliekwong':
			case 'lifeat2':
			case 'longway':
			case 'mda ':
			case 'mediawatch':
			case 'miniseries':
			case 'myfavouritealbum':
			case 'myfavouritebook':
			case 'myfavouritefilm':
			case 'nature':
			case 'occasionalcook':
			case 'pacificstories':
			case 'passions':
			case 'plumpton ':
			case 'quantum':
			case 'rage':
			case 'recovery':
			case 'schoolstv':
			case 'seachange':
			case 'secretrecipes':
			case 'storm':
			case 'stowaways':
			case 'strictlydancing':
			case 'sundayspectrum':
			case 'surfingmenu':
			case 'tasting':
			case 'thingo':
			case 'time ':
			case 'truths ':
			case 'walling':
			case 'wing':		wtGroup = 'tv'; break;
						
			// vod
			case 'vod':			wtGroup = 'videoondemand'; break;
	
			// radio
			case 'radio':
			case 'pipeline':
			case 'streaming':	wtGroup = 'radioother'; break;
	
			case 'rn':			
			case 'comms':			
			case 'money':		wtGroup = 'rn'; break;
		
			case 'classic':		wtGroup = 'classicfm'; break;
			case 'newsradio':	wtGroup = 'newsradio'; break;
			case 'dig':			wtGroup = 'dig'; break;
	
			case 'triplej':
			case 'noise':		wtGroup = 'triplej'; break;

			// radio australia	
			case 'ra':
			case 'power':
			case 'global':
			case 'timetotalk':	wtGroup = 'radioaustralia'; break;
	
		
			// local				
			case 'local':
			case 'backyard':
			case 'rural':
			case 'australiaallover':
			case 'adelaide':
			case 'alicesprings':
			case 'ballarat':
			case 'brisbane':
			case 'brokenhill':
			case 'built':
			case 'canberra':
			case 'capricornia':
			case 'centralcoast':
			case 'centralvic':
			case 'centralwest':
			case 'coodabeens':
			case 'darwin':
			case 'eyre':
			case 'farnorth':
			case 'gippsland':
			case 'goldcoast':
			case 'goldfields':
			case 'goulburnmurray':
			case 'greatsouthern':
			case 'heywire':
			case 'hobart':
			case 'humouraustralia':
			case 'illawarra':
			case 'kimberley':
			case 'melbourne':
			case 'midnorthcoast':
			case 'milduraswanhill':
			case 'newcastle':
			case 'newengland':
			case 'northwest':
			case 'northwestqld':
			case 'nightlife':
			case 'northandwest':
			case 'northcoast':
			case 'northqld':
			case 'northtas':
			case 'northwestwa':
			case 'overnights':
			case 'oztraxs':
			case 'perth':
			case 'profiles':
			case 'riverina':
			case 'riverland':
			case 'snc':
			case 'shepparton':
			case 'shortstories':
			case 'snapshots':
			case 'southcoast':
			case 'southeastnsw':
			case 'southeastsa':
			case 'southqld':
			case 'sundaynights':
			case 'southwestvic':
			case 'southwestwa':
			case 'sundayprofile':
			case 'sunshine':
			case 'sydney':
			case 'torch':
			case 'tropic':
			case 'tropicalnorth':
			case 'upperhunter':
			case 'westernplains':
			case 'westernvic':
			case 'westqld':
			case 'westernqld':
			case 'wheatbelt':
			case 'widebay':
			case 'water':
			case 'wordmap':		wtGroup = 'local'; break;
	
	
			// corporate
			case 'corp':
			case 'tours':
			case 'contact':
			case 'trailer':
			case 'reception':
			case 'archives':	
			case 'jobs':		wtGroup = 'other'; break;	
	
			// commercial
			case 'abccontentsales':
			case 'abcresourcehire':
			case 'programsales':	wtGroup = 'commercial'; break;
	
			// kids
			case 'children':
			case 'abckids':
			case 'parenting':
			case 'broadbandkids':
			case 'bligh':
			case 'chiko':
			case 'dogandcatnews':	wtGroup = 'kids'; break;
	
			// rollercoaster
			case 'rollercoaster':
			case 'creaturefeatures':
			case 'spark':
			case 'silversun': 
			case 'zimmertwins':	wtGroup = 'rollercoaster'; break;
	
			// education
			case 'bloke':
			case 'federation':
			case 'talkitup':
			case 'learn':
			case 'countusin':
			case 'wordmap':
			case 'oceans':
			case 'civics':
			case 'navigators':	wtGroup = 'other'; break;
	
			// indigenous
			case 'dustechoes':
			case 'message':
			case 'messageclub':
			case 'usmob':
			case 'missionvoices': wtGroup = 'indigenous'; break;
	

			case 'grandstand': 	wtGroup = 'grandstand'; break;
			
			default:			wtGroup = 'other';
		}	
		
		// some sites require checking 2nd level folder - this will over-ride above:		
		// switch (location.pathname.split('/')[2]) {	
		//	case 'sport':	if (tld == 'news') wtGroup = 'sport'; break; // should only catch 'news/sport'		
		//}	
}

if (wtGroup) {
	document.write('<scr'+'ipt type="text/javascript" src="/includes/webtrends/'+wtGroup+'1.js"><\/scr'+'ipt>'+
		'<scr'+'ipt type="text/javascript" src="/includes/webtrends/'+wtGroup+'2.js"><\/scr'+'ipt>');
}
