
//start custom script

function vm_getMetaData (metaName) {
		try {
			var els = document.getElementsByTagName("meta");
			var elsLen = els.length;
			var i = 0;
			for (; i < elsLen; i++) {
				if (metaName == els[i].getAttribute("name"))
					return els[i].getAttribute("content");
					}
		} catch (ex) { 
			// failure in getMetaData
			return "";
		}

		// default
		return "";           
	}

	function vm_wordmatch (source, test) {
		arrS = source.toLowerCase().split (',');
		for (var i=0; i<arrS.length; i++) {
			if (test.indexOf(arrS[i].replace(/^\s+|\s+$/g, '')) != -1) {
				return true;
			}
		}		
		return false;
	}

	// general channel
	var vm_ipid = 25249; // default

	// get page URL and keywords meta data
	var vm_url  = this.location + "";
	var vm_keywords = vm_getMetaData ("keywords").toLowerCase();

	// first check against "known" channels, then check meta data
	if ((vm_url.indexOf('entertainment.gather.com') != -1) || (vm_url.indexOf("celebs.gather.com") != -1)){
		vm_ipid=25240;
	} else if (vm_url.indexOf('food.gather.com') != -1) {
		vm_ipid=25241;
	} else if ((vm_url.indexOf('news.gather.com') != -1) || (vm_url.indexOf("politics.gather.com") != -1)){
		vm_ipid=25242;
	} else if (vm_url.indexOf('health.gather.com') != -1){
		vm_ipid=25243;
	} else if ((vm_url.indexOf('style.gather.com') != -1) || (vm_url.indexOf("moms.gather.com") != -1)){
		vm_ipid=25244;
	} else if ((vm_url.indexOf('money.gather.com') != -1) || (vm_url.indexOf("business.gather.com") != -1)){
		vm_ipid=25245;
	} else if (vm_url.indexOf('sports.gather.com') != -1){
		vm_ipid=25246;
	} else if (vm_url.indexOf('travel.gather.com') != -1){
		vm_ipid=25247;
	} else if (vm_url.indexOf('technology.gather.com') != -1){
		vm_ipid=25248;
	} else if (vm_wordmatch ("entertainment, movies, television, drama, comedy, dvd, video games, gaming, celebrity, gossip", vm_keywords)) {
		vm_ipid = 25240;
	} else if (vm_wordmatch ("food, recipes, cooking, dinner, lunch, breakfast, dessert, chef, food preparation", vm_keywords)) {
		vm_ipid = 25241;
	} else if (vm_wordmatch ("news, current events, politics, political, government, liberal, conservative, republican, democrat", vm_keywords)) {
		vm_ipid = 25242;
	} else if (vm_wordmatch ("health, healthy, fitness, diet, illness, cancer, diabetes, working out, eating better, vegan, organic", vm_keywords)) {
		vm_ipid = 25243;
	} else if (vm_wordmatch ("style, parenting, fashion, clothes, baby, children, school, kids, growing up", vm_keywords)) {
		vm_ipid = 25244;
	} else if (vm_wordmatch ("business, finance, money, investing, retirement, aig, recession, economy, federal reserve", vm_keywords)) {
		vm_ipid = 25245;
	} else if (vm_wordmatch ("sports, football, baseball, basketball, soccer, tennis, world cup, olympics, world series, super bowl", vm_keywords)) {
		vm_ipid = 25246;
	} else if (vm_wordmatch ("travel, vacation, resorts, all inclusive, destinations, luxury", vm_keywords)) {
		vm_ipid = 25247;
	} else if (vm_wordmatch ("technology, consumer electronics, electronics, computers", vm_keywords)) {
		vm_ipid = 25248;
	}


    // we'll always have an vm_ipid at this point, so drop the script
    document.write(
        '<SCR'+'IPT language="javascript" type="text/javascript" ' +
        'src="http://gather.us.intellitxt.com/intellitxt/front.asp?ipid=' + vm_ipid +
        '"' +
        '>' +
        '</SCR'+'IPT>'
    );
