/*******************************************************************
 * Create the page object
 *******************************************************************/
var pageObj = {
	color1:"#004C73",	//theme color.
	color2:"#666666",	//showtime color.  On most shows it is #666666 (gray), but on some it is theme color.

	init:function(){
		//Load sIFR
		pageObj.sifr();
		pageObj.toggleFavorites();
	},
	applyButton:function(){
		applyButton('thisWeekMovies_', 1);
		applyButton('allMovies_', 1);
	},
	sifr:function(){
		if(typeof sIFR == "function"){
//signin
				sIFR.replaceElement(named({sSelector:"#signin h1", sFlashSrc: globalObj.mediaServer + "/abcfamily/images/flash/abc.swf", sColor:"#666666", sLinkColor:"#666666", sBgColor:"#FFFFFF", sHoverColor:"#666666", nPaddingTop:0, nPaddingBottom:0, sFlashVars:"textalign=left", sWmode:"transparent" }));
				sIFR.replaceElement(named({sSelector:"#signin h3", sFlashSrc: globalObj.mediaServer + "/abcfamily/images/flash/abc-bold.swf", sColor:"#333333", sLinkColor:"#666666", sBgColor:"#FFFFFF", sHoverColor:"#666666", nPaddingTop:0, nPaddingBottom:0, sWmode:"transparent", sFlashVars:"textalign=left"}));
				sIFR.replaceElement(named({sSelector:"#signoutlinks .hi", sFlashSrc: globalObj.mediaServer + "/abcfamily/images/flash/abc.swf", sColor:"#333333", sLinkColor:"#666666", sBgColor:"#FFFFFF", sHoverColor:"#666666", nPaddingTop:0, nPaddingBottom:0, sFlashVars:"textalign=left"}));
				sIFR.replaceElement(named({sSelector:"#signoutlinks .username", sFlashSrc: globalObj.mediaServer + "/abcfamily/images/flash/abc.swf", sColor:"#cc5522", sLinkColor:"#666666", sBgColor:"#FFFFFF", sHoverColor:"#666666", nPaddingTop:0, nPaddingBottom:0, sFlashVars:"textalign=left"}));

				sIFR.replaceElement(named({sSelector:" #shows h1", sFlashSrc: globalObj.mediaServer + "/abcfamily/images/flash/abc.swf", sColor:"#666666", sLinkColor:"#666666", sBgColor:"#FFFFFF", sHoverColor:"#666666", nPaddingTop:0, nPaddingBottom:0, sFlashVars:"textalign=left", sWmode:"transparent" }));
				sIFR.replaceElement(named({sSelector:"body .showscapsule h2", sFlashSrc: globalObj.mediaServer + "/abcfamily/images/flash/abc.swf", sColor:"#DE200C", sLinkColor:"#DE200C", sBgColor:"#FFFFFF", sHoverColor:"#DE200C", nPaddingTop:0, nPaddingBottom:0, sFlashVars:"textalign=left", sWmode:"transparent"}));

		};
	},


	toggleFavorites:function () {
		var container = document.getElementById("twocolumnholder");
		
		if(!container) container = document.getElementById("mainpane");
		
		if (container) {
			var tags = container.getElementsByTagName('ul');

			for(i=0; i<tags.length; i++) {
				if (tags[i].className == 'favorites') {

					tags[i].onclick = function () {
						var li = this.getElementsByTagName('li');
						for (x=0; x<li.length; x++) {
							if (li[x].className == "add on") {
								li[x].className = "add off";
								loadXMLDoc('/abcfamily/_global/modules/general/favorites?type=show&id='+this.id.replace('fav','')+'&action=add');
							}
							if (li[x].className == "del off") {
								li[x].className = "del on";
							}
						}

					};
				}
			}
		}
	}

};



/*******************************************************************
 * Attach events to the document load
 *******************************************************************/
addEvent(document,"readystatechange",pageObj.init);
