function chngaolBtnmover(obj) {
	var spanObj = obj.getElementsByTagName("span");
	for(var i=0; i<spanObj.length; i++) {
		if(spanObj[i].className == "lft")
			spanObj[i].className = "lfthvr";
		else if(spanObj[i].className == "txt")
			spanObj[i].className = "txthvr";
		else if(spanObj[i].className == "rht")
			spanObj[i].className = "rhthvr";
	}
}

function chngaolBtnmout(obj) {
	var spanObj = obj.getElementsByTagName("span");
	for(var i=0; i<spanObj.length; i++) {
		if(spanObj[i].className == "lfthvr")
			spanObj[i].className = "lft";
		else if(spanObj[i].className == "txthvr")
			spanObj[i].className = "txt";
		else if(spanObj[i].className == "rhthvr")
			spanObj[i].className = "rht";
	}	
}

function changeFrame() {
    var oIframe = document.getElementById("tvmini");
    var oDoc = oIframe.contentWindow || oIframe.contentDocument;
	if (oDoc.document) {
        oDoc = oDoc.document;
    }

	var obj = oDoc.body.getElementsByTagName("div");

	for(i=0; i<obj.length; i++){
		if(obj[i].className=="holder")
			obj[i].style.border="0px none transparent";
		}
		
    return true;
}


function togShareMenu(e, state, oLnk) 
{
    if (state == "show") 
    {
	var oDiv = oLnk.nextSibling.getElementsByTagName("div")[0];        
	posShare(e, oDiv, oLnk);
        oDiv.style.display = 'block';
    } 
    else 
    {
	oLnk.style.display = 'none';
    }

    return false;
}


function posShare(e, oDiv, oLnk)
{
	posY = findMousePos(e);
	oDiv.style.left = (ai_posX(oLnk) + 15)+'px';
	oDiv.style.top = (posY + oLnk.offsetHeight / 2)+'px';
}


function findMousePos(e) 
{
	var posY = 0;
	if (!e) var e = window.event;

	if (e.pageX || e.pageY) 
	{
		posY = e.pageY;
	}
	else if (e.clientX || e.clientY) 
	{
		posY = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
	}
	return posY;
}

function ai_posX(obj)
{
	var left = 0;
	if(obj.offsetParent)
	{
		while(obj.offsetParent)
		{
			left += obj.offsetLeft;
			obj = obj.offsetParent;
		}
	}
		else if(obj.x)	left += obj.x;
	return left;
}

function ai_posY(obj)
{
	var top = 0;
	if(obj.offsetParent)
	{
		while(obj.offsetParent)
		{
			top += obj.offsetTop;
			obj = obj.offsetParent;
		}
	} 
	else 
		if(obj.x)	top += obj.y;
	return top;
}

function setSearchTarget(url, newWindow, newTarget) 
{
	// Set the target for the form
	//document.bb_topform.action = url;
	var forms = document.getElementsByTagName('form');
	for (var i = 0; i < forms.length; i++)
		if (forms[i].name == 'bb_topform')
			forms[i].action = url;
	if (newWindow) 
	{
		document.bb_topform.target = '_blank';
	} 
	else 
	{
		document.bb_topform.target = '';
	}

	// Update the tabs classes to allow highlighting of the selected
	var arrElements = getElementsByClassName ('searchCatBg', 'li');
	for (var i=0; i<arrElements.length; i++) 
	{
		arrElements[i].className = '';
	}
	var newTargetHeader;
	var newTargetFooter;
	if (newTarget.indexOf('footer') == -1)
	{
		newTargetHeader = newTarget;
		newTargetFooter = 'footer-' + newTarget;
	}
	else
	{
		newTargetHeader = newTarget.replace('footer-', '');
		newTargetFooter = newTarget;
	}
	document.getElementById(newTargetHeader).className = 'searchCatBg';
	document.getElementById(newTargetFooter).className = 'searchCatBg';
	return false;
}


function imgAlign() 
{
	var obj = document.getElementById("center-rail");
	var divObj = obj.getElementsByTagName("div");
	for(var i=0; i<divObj.length; i++) 
	{
		if(divObj[i].className == "post") 
		{
			var imgObj = divObj[i].getElementsByTagName("img");
			for(var j=0; j<imgObj.length; j++) 
			{
				if(imgObj[j].align == "left") 
				{
					imgObj[j].className = "imgLeft";
				}
				else if(imgObj[j].align == "right") 
				{
					imgObj[j].className = "imgRight";				
				}
			}
		}
	}
}




function __TABBLO_TPT_LOAD(){
	Tabblo.embedded.sites.SettingsObject.preprocess.apply({Properties:{template:'television'},FixedContent:{'logo':'http://www.aolcdn.com/ch_tv/hdrlogo_tv'},Content:{'pagetitle':{ match: 'css', selector:'h1' }, 'text':{ match: 'css', selector:'div#center-rail div.post', outputTagToo: true, recurse: true }, 'image': { match: 'css', selector:'div#center-rail div.post img', nodeContentType: 'image' }} }, []); Tabblo.embedded.printabulous();
}
function MakePDF() { var tpS = document.createElement('script');tpS.setAttribute('type','text/javascript');tpS.setAttribute('charset','utf-8'); tpS.setAttribute('src','http://h30405.www3.hp.com/edit/tptboot/1.0');document.getElementsByTagName('body').item(0).appendChild(tpS);}
function pdfPrint(url){MakePDF();}
function showHpPop(iShow){
    if (iShow == 1) {
        document.getElementById("hpPopCnt").innerHTML = "<p>With HP wireless printers, you could have printed this from any room in the house. Live wirelessly. Print wirelessly.</p>";
        document.getElementById("hpPopCnt").style.display = "block";
    } else {
        document.getElementById("hpPopCnt").style.display = "none";
    }
}
function showHpPop2(iShow){
    if (iShow == 1) {
        document.getElementById("hpPopCnt2").innerHTML = "<p>With HP wireless printers, you could have printed this from any room in the house. Live wirelessly. Print wirelessly.</p>";
        document.getElementById("hpPopCnt2").style.display = "block";
    } else {
        document.getElementById("hpPopCnt2").style.display = "none";
    }
}

/* DL Module*/
Function.prototype.debounce = function (threshold, execAsap) {
 
    var func = this, timeout;
 
    return function debounced () {
        var obj = this, args = arguments;
        function delayed () {
            if (!execAsap)
                func.apply(obj, args);
            timeout = null; 
        };
 
        if (timeout)
            clearTimeout(timeout);
        else if (execAsap)
            func.apply(obj, args);
 
        timeout = setTimeout(delayed, threshold || 100); 
    };
 
}
var DL = new Class({
	Implements: [Options, Events, Chain],
	
	options : {
		fadeDelay : 600,
		slideDelay : 2400,
		slideHeight : "275px",
		slideWidth : "440px",
		slideContentHeight : "66px"
	},
	
	initialize: function (parentDiv, options) {
		this.setOptions(options);
		this.dlData = [];
		this.slideContent = [];
		this.slideDrawer = [];	
		this.slideCredit = [];
		this.autoPlay = true;
		this.currentIndex = 0;		
		this.maxIndex = 0;	
		this.playing = false;
		this.parentDiv = parentDiv;
		this.sliderOpacity = "0.5";
		this.dlSlideDiv = ".dlSlide";							
		this.collectSlideData();					
		this.constructSlideButtons ();		
		this.parentDiv.style.display="block";
		this.doPlay();
	},		

	collectSlideData : function() {
		var dlData = [];
		var slideDivs = this.parentDiv.getElements(this.dlSlideDiv);
		for(var i=0; i<slideDivs.length; i++) {	
			dlData[i] = {						
				img : slideDivs[i].getElements("img")[0].getProperty('src'),
				link : slideDivs[i].getElement('div.slideAction').getElements('a')[0].href,				
				title: slideDivs[i].getElement('h2').get('text'),
				subTitle: slideDivs[i].getElement('h3').get('text'),
				action: slideDivs[i].getElement('div.slideAction').get('html'),
				credit: slideDivs[i].getElement('div.slideCredit').get('text')					
			};	
			this.constructSlideContent(dlData[i], i);			
		};				
		this.maxIndex = dlData.length;			
		slideDivs.destroy();				
	},

	constructSlideContent : function(dataObj, iter) {								
		this.slide = new Element('div', {					
			'class' :'slide',
			'id' : 'dl' + iter

		}).inject(this.parentDiv);
		this.slideImageDiv = new Element('div', {
			'class' : 'slideImageDiv',
			'opacity' : 0
		}).inject(this.slide);
		var slideImgA = new Element('a', {
			'href' : dataObj.link
		}).inject(this.slideImageDiv);
		var slideImg = new Element('img', {
			'src': dataObj.img
		}).inject(slideImgA);		
		this.slideContentDiv = new Element('div', {
			'class' : 'slideContent'
		}).inject(this.slide);
		var slideContentOpacity = new Element('div', {
			'class' : 'slideContentOpacity',
			'opacity' : this.sliderOpacity		
		}).inject(this.slideContentDiv);
		this.slideTitle = new Element('h2', {
			'html' : dataObj.title
		}).inject(this.slideContentDiv);
		this.slideSubTitle = new Element('h3',{
			'html' : dataObj.subTitle
		}).inject(this.slideContentDiv);
		this.slideAction = new Element('div', {
			'class' : 'slideAction',
			'html' : dataObj.action
		}).inject(this.slideContentDiv);
		this.slideCreditDiv = new Element('div', {
			'class' : 'slideCredit',
			'opacity' : 0,
			'html' : dataObj.credit
		}).inject(this.slide);
		
		this.slideContent[iter] = new Fx.Morph(this.slideImageDiv, {
			transition: Fx.Transitions.linear,
			duration : this.options.fadeDelay
		});
		this.slideDrawer[iter] = new Fx.Morph(this.slideContentDiv, {
			transition: Fx.Transitions.linear,
			duration : this.options.fadeDelay
		});
		this.slideCredit[iter] = new Fx.Morph(this.slideCreditDiv, {
			transition: Fx.Transitions.linear,
			duration : 0
		});
		this.slideDrawer[0].start({
    	'height': [0, '66px'],
    	'display': 'block'
		});
		this.slideContent[this.currentIndex].start({'opacity': 1});
		this.slideCredit[this.currentIndex].start({'opacity': 1});
	},		
	
	constructSlideButtons: function () {
		var slideButtons = new Element('div', {
			'class' : 'slideButtons'		
		}).inject(this.parentDiv);		

		var nextPhoto = function (){
			this.noFx = true; 
			this.next();
		}.bind(this).debounce(250);
		
		var prevPhoto = function (){
			this.noFx = true; 
			this.previous();
		}.bind(this).debounce(250);
		
		this.previousButton = new Element('h5', {
			'class' : 'previous',
			'html'	: 'previous',
			events	: {
				click : prevPhoto
			}
		}).inject(slideButtons);

		this.pauseButton = new Element('h5', {
			'class' : 'pause',
			'html' : 'pause',
			events	: {
				click : this.pause.bind(this)
			}
		}).inject(slideButtons);
		
		this.nextButton = new Element('h5', {
			'class' : 'next',
			'html' : 'next',
			events	: {
				click : nextPhoto
			}
		}).inject(slideButtons);
	},
	
	doPlay: function(noFx) {
		this.nextDelay = this.next.delay(this.options.slideDelay, this);	
		this.noFx = false;
		this.playing = true;	
	},	

	next: function() {		
		if (this.pauseButton.get('class', 'play')) {this.pauseButton.set('class', 'pause');};	
		this.nextIndex = this.currentIndex+1;
		if (this.nextIndex >= this.maxIndex) {this.nextIndex = 0;}		
		$clear(this.nextDelay);
		this.changeSlide(this.nextIndex);		
	},

	previous: function() {
		if (this.pauseButton.get('class', 'play')) {this.pauseButton.set('class', 'pause');};
		this.nextIndex = this.currentIndex-1;		
		if (this.nextIndex <= -1) {this.nextIndex = this.maxIndex - 1;};
		$clear(this.nextDelay);
		this.changeSlide(this.nextIndex);			
	},
	
	changeSlide: function(newIndex) {
		this.loop = true;
		if (this.currentIndex != newIndex) {
			if (this.noFx){
				this.slideContent[this.currentIndex].cancel();
				this.slideDrawer[this.currentIndex].cancel();
				this.slideContent[this.currentIndex].options.duration=0;
				this.slideContent[newIndex].options.duration=0;
				this.slideDrawer[this.currentIndex].options.duration=0;
				this.slideDrawer[newIndex].options.duration=0;
			} else {
				this.slideContent[this.currentIndex].options.duration=this.options.fadeDelay;
				this.slideContent[newIndex].options.duration=this.options.fadeDelay;
				this.slideDrawer[this.currentIndex].options.duration=this.options.fadeDelay;
				this.slideDrawer[newIndex].options.duration=this.options.fadeDelay;	
			}
			this.slideContent[this.currentIndex].start({'opacity': 0});
			this.slideDrawer[this.currentIndex].start({
    			'height': ['66px', '0'],
    			'display': 'none'
			});
			this.slideCredit[this.currentIndex].start({'opacity': 0});
			
			this.slideContent[newIndex].start({'opacity': 1});		
			this.slideDrawer[newIndex].start({
    			'height': [0, '66px'],
    			'display': 'block'
			});	
			this.slideCredit[newIndex].start({'opacity': 1});
			$('dl' + this.currentIndex).style.zIndex = 1; 
			$('dl' + this.nextIndex).style.zIndex = 9 ; 		
			this.currentIndex = newIndex;			
		}			
		this.doPlay();
		this.loop = false;
	},
	
	pause: function(){
		if(this.playing){
			$clear(this.nextDelay);
			this.pauseButton.set('class', 'play');
			this.playing = false;
			return;
		}
		if(!(this.playing)){
			$clear(this.nextDelay);
			this.pauseButton.set('class', 'pause');
			this.playing = true;
			this.next();
			return;
		}
	}

});

function paginateBlogger(){
	if(document.getElementById("nextBlgr")){
		var slugStr = document.location.href;
		var slug = slugStr.split("/");
		var newslug = slug[3]+"/"+slug[4];
		var nextLink = document.getElementById("nextBlgr").href;
		nextLink = nextLink.replace("/page/", "/"+newslug+"/page/");
		document.getElementById("nextBlgr").href=nextLink;
	}
	if(document.getElementById("prevBlgr")){
		var slugStr = document.location.href;
		var slug = slugStr.split("/");
		slug = slug[3]+"/"+slug[4];
		var prevLink = document.getElementById("prevBlgr").href;
		if(prevLink=="http://www.aoltv.ca/"){
			document.getElementById("prevBlgr").href=prevLink+slug;
		}else if(prevLink=="http://insidetv.aol.com/"){
			document.getElementById("prevBlgr").href=prevLink+slug;
		}else{
			prevLink = prevLink.replace("/page/", "/"+slug+"/page/");
			document.getElementById("prevBlgr").href=prevLink;
		}
	}
}

function getBio(id,height){
	if(height==44){
		document.getElementById("bloggerBio"+id).style.height = document.getElementById("bloggerPar"+id).offsetHeight+"px";
		document.getElementById("bioBox"+id).style.height = 260+"px"; 
		document.getElementById("moreBio"+id).className = "moreBioUp"; 
	}else{ 
		document.getElementById("bloggerBio"+id).style.height = 44+"px";
		document.getElementById("bioBox"+id).style.height = 176+"px"; 
		document.getElementById("moreBio"+id).className = "moreBioDown"; 
	}
}

function checkEmptyBio(id){
	if((document.getElementById("portrait"+id).src==document.location) || (document.getElementById("portrait"+id).src=="http://qa.sandbox.insidetv.aol.com/") || (document.getElementById("portrait"+id).src=="http://")){
		document.getElementById("portrait"+id).src="http://o.aolcdn.com/dims-commerce/dims/MOVS/5/132/176/100/http://www.aolcdn.com/ch_celebrity/celeb_noimage";
	}
	
	if(document.getElementById("bloggerPar"+id).innerHTML==''){
		document.getElementById("bloggerBio"+id).style.display="none";
		document.getElementById("moreBio"+id).style.display="none";
	}
}

/* Omninture reference variable to prevent bots and crawlers from indexing values */ 
var extLinkFilterTV = "seenon.com,tv.com,oxygen.com,bravo.com,msntv.com,tv.yahoo.com,trutv.com,buddytv.com,tvguide.com,tnt.com,tbs.com,amazon.com,netflix.com,imdb.com,hulu.com,cbs.com,televisionwithoutpity.com,zap2it.com,thefutoncritic.com,hitfix.com,popsugar.com,buzzsugar.com,thewrap.com,huffingtonpost.com,avclub.com,askmen.com,askmen.com";