// ############################################
// start: adscript.js contents
var axel = Math.random() + "";
var ord = axel * 1000000000000000000;

function place728x90(zone,site,ord)
{
	var ad728HTML = '<iframe src="http://ellen.warnerbros.com/ads/iframeAd.php?adsize=728x90&adzone='+zone+'&ord='+ord+'&site='+site+'&tile=1" width="728" height="90" id="ad728x90f" frameborder="0" scrolling="no"><SCRIPT language="JavaScript1.1" SRC="http://ad.doubleclick.net/adj/f.site185.tmus/momlogic_home;tile=1;dcopt=ist;abr=!ie;sz=728x90;ord=' + ord + '?"></SCRIPT></iframe>';
	var Ad728Div = document.getElementById("ad728x90");
	if( Ad728Div ) {
		Ad728Div.innerHTML = ad728HTML;
	}
}

function place300x250(zone,site,ord)
{
var ad300HTML = '<div id="ad-top">advertisement</div><iframe src="http://ellen.warnerbros.com/ads/iframeAd.php?adsize=300x250&adzone='+zone+'&ord='+ord+'&site='+site+'&tile=2" width="300" height="250" id="ad300x250f" frameborder="0" scrolling="no"></iframe>';
var Ad300Div = document.getElementById("ad300x250");
	if( Ad300Div ) {
		if( typeof adSyncHTML != "undefined" ) {
			if( adSyncHTML != "" ) {
				ad300HTML = adSyncHTML;
			}
		}
		Ad300Div.innerHTML = ad300HTML;
	}
}

function place160x600(zone,site,ord)
{
	var ad160HTML = '<iframe src="http://ellen.warnerbros.com/ads/iframeAd.php?adsize=160x600&adzone='+zone+'&ord='+ord+'&site='+site+'&tile=3" width="160" height="600" id="ad160x600f" frameborder="0" scrolling="no"></iframe>';
	var Ad160Div = document.getElementById("ad160x600");
	if( Ad160Div ) {
		Ad160Div.innerHTML = ad160HTML;
	}
}

function place300x70(zone,site,ord,tile)
{
	var ad300HTML = '<iframe src="http://ellen.warnerbros.com/ads/iframeAd.php?adsize=300x70&adzone='+zone+'&ord='+ord+'&site='+site+'&tile='+tile+'" width="300" height="70" id="ad300x70f" frameborder="0" scrolling="no"></iframe>';
	var Ad300Div = document.getElementById("ad300x70");
	if( Ad300Div ) {
		Ad300Div.innerHTML = ad300HTML;
	}
}

function place88x31(zone,site,ord,tile)
{
	var tile = (tile == null) ? "2" : tile;
	var ad88HTML = '<div style="width: 88px; padding-left: 20px; display: inline;" align="center" class="sponsor_img"><iframe src="http://ellen.warnerbros.com/ads/iframeAd.php?adsize=88x31&adzone='+zone+'&ord='+ord+'&site='+site+'&tile='+tile+'" width="88" height="31" id="ad88x31f" frameborder="0" scrolling="no"></iframe></div>';
	var Ad88Div = document.getElementById("ad88x31");
	if( Ad88Div ) {
		Ad88Div.innerHTML = ad88HTML;
	}
}
// end: adscript.js contents
// ############################################


// ############################################
// start: include.js contents
function include_js( script_filename ) {
    var html_doc = document.getElementsByTagName('head').item(0);
    var js = document.createElement('script');
    js.setAttribute('language', 'javascript');
    js.setAttribute('type', 'text/javascript');
    js.setAttribute('src', script_filename);
    html_doc.appendChild(js);
    return false;
}

function include_dom( script_filename ) {
    var html_doc = document.getElementsByTagName('head').item(0);
    t=script_filename.substring(script_filename.lastIndexOf('.')+1);
    if( t=='js' ){
        var file = document.createElement('script');
        file.setAttribute('language','javascript');
        file.setAttribute('type','text/javascript');
        file.setAttribute('src',script_filename);
    } else if ( t=='css' ) {
        var file = document.createElement('link');
        file.setAttribute('rel','stylesheet');
        file.setAttribute('type','text/css');
        file.setAttribute('href',script_filename);
    }
    html_doc.appendChild(file);
    return false;
}

var included_files = new Array();

function include_once(script_filename) {
    if (!in_array(script_filename, included_files)) {
        included_files[included_files.length] = script_filename;
        include_dom(script_filename);
    }
}

function in_array(needle, haystack) {
    for (var i = 0; i < haystack.length; i++) {
        if (haystack[i] == needle) {
            return true;
        }
    }
    return false;

}

function afterload(){
    var which_script = Math.floor(Math.random() * 2) + 1 + '.js';
    include_dom(which_script);

}

// usage:
// include_once( "http://www.momlogic.com/js/jquery-1.2.3.js" );
// end: include.js contents
// ############################################


// ############################################
// start: ellen.js contents
// Copyright (c) 1996-1997 Athenia Associates.
// http://www.webreference.com/js/
// License is granted if and only if this entire
// copyright notice is included. By Tomer Shiran.

function addEvent( obj, type, fn ) {
    if (obj.addEventListener) {
        obj.addEventListener( type, fn, false );
        EventCache.add(obj, type, fn);
    } else if (obj.attachEvent) {
        obj["e"+type+fn] = fn;
        obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
        obj.attachEvent( "on"+type, obj[type+fn] );
        EventCache.add(obj, type, fn);
    } else {
        obj["on"+type] = obj["e"+type+fn];
    }
}

var EventCache = function(){
    var listEvents = [];
    return {
        listEvents : listEvents,
        add : function(node, sEventName, fHandler){
            listEvents.push(arguments);
        },
        flush : function(){
            var i, item;
            for(i = listEvents.length - 1; i >= 0; i = i - 1){
                item = listEvents[i];
                if(item[0].removeEventListener){
                    item[0].removeEventListener(item[1], item[2], item[3]);
                };
                if(item[1].substring(0, 2) != "on"){
                    item[1] = "on" + item[1];
                };
                if(item[0].detachEvent){
                    item[0].detachEvent(item[1], item[2]);
                };
                item[0][item[1]] = null;
            };
        }
    };
}();
addEvent(window,'unload',EventCache.flush);

function setCookie (name, value, expires, path, domain, secure) {
    var curCookie = name + "=" + escape(value) + (expires ? "; expires=" + expires : "") +
        (path ? "; path=" + path : "") + (domain ? "; domain=" + domain : "") + (secure ? "secure" : "");
    document.cookie = curCookie;
}

function getCookie (name) {
    var prefix = name + '=';
    var c = document.cookie;
    var nullstring = '';
    var cookieStartIndex = c.indexOf(prefix);
    if (cookieStartIndex == -1)
        return nullstring;
    var cookieEndIndex = c.indexOf(";", cookieStartIndex + prefix.length);
    if (cookieEndIndex == -1)
        cookieEndIndex = c.length;
    return unescape(c.substring(cookieStartIndex + prefix.length, cookieEndIndex));
}

function deleteCookie (name, path, domain) {
    if (getCookie(name))
        document.cookie = name + "=" + ((path) ? "; path=" + path : "") +
            ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
}

function fixDate (date) {
    var base = new Date(0);
    var skew = base.getTime();
    if (skew > 0)
        date.setTime(date.getTime() - skew);
}

function rememberMe (f) {
    var now = new Date();
    fixDate(now);
    now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000);
    now = now.toGMTString();
    if (f.author != undefined)
       setCookie('mtcmtauth', f.author.value, now, '/', '', '');
    if (f.email != undefined)
       setCookie('mtcmtmail', f.email.value, now, '/', '', '');
    if (f.url != undefined)
       setCookie('mtcmthome', f.url.value, now, '/', '', '');
}

function forgetMe (f) {
    deleteCookie('mtcmtmail', '/', '');
    deleteCookie('mtcmthome', '/', '');
    deleteCookie('mtcmtauth', '/', '');
    f.email.value = '';
    f.author.value = '';
    f.url.value = '';
}

function hideDocumentElement(id) {
    var el = document.getElementById(id);
    if (el) el.style.display = 'none';
}

function showDocumentElement(id) {
    var el = document.getElementById(id);
    if (el) el.style.display = 'block';
}

var commenter_name;

function individualArchivesOnLoad(commenter_name) {
    hideDocumentElement('trackbacks-info');
    var mtcmtauth;
    var mtcmthome;
    if (document.comments_form) {
        if (!commenter_name && (document.comments_form.email != undefined) &&
            (mtcmtmail = getCookie("mtcmtmail")))
            document.comments_form.email.value = mtcmtmail;
        if (!commenter_name && (document.comments_form.author != undefined) &&
            (mtcmtauth = getCookie("mtcmtauth")))
            document.comments_form.author.value = mtcmtauth;
        if (document.comments_form.url != undefined && 
            (mtcmthome = getCookie("mtcmthome")))
            document.comments_form.url.value = mtcmthome;
        if (document.comments_form["bakecookie"]) {
            if (mtcmtauth || mtcmthome) {
                document.comments_form.bakecookie.checked = true;
            } else {
                document.comments_form.bakecookie.checked = false;
            }
        }
    }
}

function writeTypeKeyGreeting(commenter_name, entry_id) {

}

/* Ticket validation */
// <!-- Begin
var expDays = 1;
// <!-- THIS CODE GETS COUNTDOWN TO MIDNITE IN NYC -->
var millisecs_per_hour = 3600000;

var now = new Date();
var tomorrow = new Date();
tomorrow.setDate(now.getDate()+1);
tomorrow.setHours(0);
tomorrow.setMinutes(0);
tomorrow.setSeconds(0);
var offset = now.getTimezoneOffset();
var offset_hours = offset / 60;
var nyc_offset = 4;
var nyc_time_hrs_offset = 0-(offset_hours - nyc_offset);
var tomorrow_ms = tomorrow.valueOf();
var nyc_ms_offset = nyc_time_hrs_offset * millisecs_per_hour;
var nyc_midnite_ms = tomorrow_ms + nyc_ms_offset;
var nyc_midnite = new Date(nyc_midnite_ms);
var countdown = nyc_midnite_ms - now.valueOf();
// <!-- END NYC COUNTDOWN CODE -->
var exp = new Date(); 
// <!--exp.setTime(exp.getTime() + (expDays*24*60*60*1000));-->
exp.setTime(nyc_midnite_ms);


function getCookieVal (offset) {  
    var endstr = document.cookie.indexOf (";", offset);  
    if (endstr == -1)    
        endstr = document.cookie.length;  
    return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name) {  
    var arg = name + "=";  
    var alen = arg.length;  
    var clen = document.cookie.length;  
    var i = 0;  
    while (i < clen) {    
        var j = i + alen;    
        if (document.cookie.substring(i, j) == arg)      
        return getCookieVal (j);    
        i = document.cookie.indexOf(" ", i) + 1;    
        if (i == 0) break;   
    }  
    return null;
}
function SetCookie (name, value) {  
    var argv = SetCookie.arguments;  
    var argc = SetCookie.arguments.length;  
    var expires = (argc > 2) ? argv[2] : null;  
    var path = (argc > 3) ? argv[3] : null;  
    var domain = (argc > 4) ? argv[4] : null;  
    var secure = (argc > 5) ? argv[5] : false;  
    document.cookie = name + "=" + escape (value) + 
    ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
    ((path == null) ? "" : ("; path=" + path)) +  
    ((domain == null) ? "" : ("; domain=" + domain)) +    
    ((secure == true) ? "; secure" : "");
}
function DeleteCookie (name) {  
    var exp = new Date();  
    exp.setTime (exp.getTime() - 1);  
    var cval = GetCookie (name);  
    document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

function validate(the_form) {
     var missing = "";
     var invalid = "-"; // no date
     if (document.the_form.name.value == "")
         missing += "\n Name";
     if (document.the_form.email.value == "" || document.the_form.email.value.indexOf("@") == -1)
         missing += "\n Email";
     if (document.the_form.phone.value == "")
         missing += "\n Daytime Phone Number";
     if (document.the_form.address.value == "")
         missing += "\n Address";
     if (document.the_form.age.checked == false )
         missing += "\n You must be 18 years of age!";
     if (missing != "") {
         alert( "The following must be supplied: " + missing);
         return false;
    }
    return true;
}
// end: ellen.js contents
// ############################################


// ############################################
// start: ellengiveaway.js contents
/*
var favorite = GetCookie('tickets');
if (favorite != null) {
    switch (favorite) {
        case 'got' :    url = 'http://ellen.warnerbros.com/tickets/enter_once.php'; // change these!
    }
    window.location.href = url;
}
*/
// end: ellengiveaway.js contents
// ############################################


// ############################################
// start: popup.js contents
function popTheAd(){

window.open("http://ng3.ads.warnerbros.com/Archive/wbshop/wbshop_popup.shtml","popup","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=340,height=300,left=400,top=300");
}
function Popopen(url) {window.open(url, 'ellenpopup', 'height=530,width=610,resizable=no,status=no,scrollbars=no,location=no,menubar=no,toolbar=no,left=30,top=30');}
function Popopen2(url) {window.open(url, 'ellenpopup', 'height=250,width=400,resizable=no,status=no,scrollbars=no,location=no,menubar=no,toolbar=no,left=30,top=30');}
function Picopen(url) {window.open(url, 'ellenphotos', 'height=580,width=480,resizable=yes,status=no,scrollbars=no,location=no,menubar=no,toolbar=no,left=30,top=10');}
function Vidopen(url) {window.open(url, 'ellenvideo', 'height=400,width=580,resizable=no,status=no,scrollbars=no,location=no,menubar=no,toolbar=no,left=30,top=30');}               
function Thoughtopen(url) {window.open(url, 'ellenthought', 'height=310,width=360,resizable=no,status=no,scrollbars=no,location=no,menubar=no,toolbar=no,left=200,top=120');}
function Infoopen(url) {window.open(url,'elleninfo', 'height=500,width=550,resizable=yes,status=no,scrollbars=yes,location=no,menubar=no,toolbar=no,left=100,top=60');}
function Voteopen(url) {window.open(url,'ellenvote', 'height=250,width=300,resizable=yes,status=no,scrollbars=yes,location=no,menubar=no,toolbar=no,left=100,top=60');}
function Advopen(url) {window.open(url,'ellenad', 'height=240,width=320,resizable=no,status=no,scrollbars=no,location=no,menubar=no,toolbar=no,left=100,top=60');}
function Textopen(url) {window.open(url,'ellencontent', 'resizable=yes,status=yes,scrollbars=yes,location=yes,menubar=yes,toolbar=yes');self.close();}
function Spot(url) {window.open(url,'ellenad', 'height=650,width=1010,resizable=no,status=no,scrollbars=no,location=no,menubar=no,toolbar=no,left=100,top=60');}
function SpotAnswer(url) {window.open(url,'ellenad', 'height=320,width=420,resizable=no,status=no,scrollbars=no,location=no,menubar=no,toolbar=no,left=100,top=60');}
function Popembed(url) {window.open(url, 'embedpopup', 'height=180,width=670,resizable=no,status=no,scrollbars=no,location=no,menubar=no,toolbar=no,left=30,top=30');}
function Flvopen(url) {window.open(url, 'ellenvideo', 'height=345,width=660,resizable=no,status=no,scrollbars=no,location=no,menubar=no,toolbar=no,left=30,top=30');}               
function Promopen(url) {window.open(url, 'ellenvideo', 'height=260,width=590,resizable=no,status=no,scrollbars=no,location=no,menubar=no,toolbar=no,left=30,top=30');}               

function replaceContent() {
 
     document.getElementById("ad").innerHTML = "<iframe src='/includes/adref.html' name='adright' width='180' height='640' scrolling='no' frameborder='0'></iframe>"
 
}
function surfto(form) {
var myindex=form.select1.selectedIndex
if (form.select1.options[myindex].value != "0") {
location=form.select1.options[myindex].value;}
}


//rollover images
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//end rollover


// this is for the drop down menu
startList = function() {
    if (document.all&&document.getElementById) {
        navRoot = document.getElementById("nav");
        for (i=0; i<navRoot.childNodes.length; i++) {
            node = navRoot.childNodes[i];
            if (node.nodeName=="LI") {
                node.onmouseover=function() {
                    this.className+=" over";
                }
                node.onmouseout=function() {
                    this.className=this.className.replace(" over", "");
                }
            }
        }
    }
}

jQuery(function(){
    startList();
});

//change 780x90 ad
function returnObjById( id ) {
    if (document.getElementById)
        var returnVar = document.getElementById(id);
    else if (document.all)
        var returnVar = document.all[id];
    else if (document.layers)
        var returnVar = document.layers[id];
    return returnVar;
}
function load780x90AdSync(imgPath, imgLink) {
    var adSyncElem = returnObjById("adSync728x90");
    if(adSyncElem != null){
        if(imgPath != undefined && imgPath != "undefined"){
            var isSwfAd = imgPath.indexOf(".swf");
            if (imgPath != null && imgPath != "null" && isSwfAd == -1) {
                adSyncElem.innerHTML = "<a href='" + imgLink + "' target='_new'><img src='" + imgPath + "' width='728' height='90' /></a>";
            } else if (imgPath != null && isSwfAd >= 0) {
                adSyncElem.innerHTML = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"728\" height=\"90\" id=\"swfAd\" align=\"middle\"><param name=\"allowScriptAccess\" value=\"sameDomain\" /><param name=\"movie\" value=\""+imgPath+"\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#d0d0d0\" /><embed src=\""+imgPath+"\" quality=\"high\" bgcolor=\"#d0d0d0\" width=\"728\" height=\"90\" name=\"swfAd\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />";
            }
        } else {
            if(iframepath != undefined){
                adSyncElem.innerHTML = iframepath;
            }
        }
    }
}
var adSyncHTML = "";
function load300x250AdSync(imgPath, imgLink) {
    if(imgPath != undefined && imgPath != "undefined"){
        var isSwfAd = imgPath.indexOf(".swf");
        if (isSwfAd == -1) {
            adSyncHTML = "<a href='" + imgLink + "' target='_new'><img src='" + imgPath + "' width='300' height='250' /></a>";
        } else if (imgPath != null && isSwfAd >= 0) {
            adSyncHTML = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"300\" height=\"250\" id=\"swfAd\" align=\"middle\"><param name=\"allowScriptAccess\" value=\"sameDomain\" /><param name=\"movie\" value=\""+imgPath+"\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#d0d0d0\" /><embed src=\""+imgPath+"\" quality=\"high\" bgcolor=\"#d0d0d0\" width=\"300\" height=\"250\" name=\"swfAd\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />";
        }
    }
}
function loadAdSync(imgPath, imgLink) {
    if(imgPath != undefined && imgPath != "undefined"){
        var isSwfAd = imgPath.indexOf(".swf");
        if (isSwfAd == -1) {
            adSyncHTML = "<a href='" + imgLink + "' target='_new'><img src='" + imgPath + "' width='300' height='250' /></a>";
        } else if (imgPath != null && isSwfAd >= 0) {
            adSyncHTML = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"300\" height=\"250\" id=\"swfAd\" align=\"middle\"><param name=\"allowScriptAccess\" value=\"sameDomain\" /><param name=\"movie\" value=\""+imgPath+"\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#d0d0d0\" /><embed src=\""+imgPath+"\" quality=\"high\" bgcolor=\"#d0d0d0\" width=\"300\" height=\"250\" name=\"swfAd\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />";
        }
    }
}

// end

// for the polls
// arg pollform ie: '274'
function pollAnswers(pollid) { 
    var yes = 0; 
    var no = 0; 
    for (var i=1;i<2;i++) { 
        if (eval('document.xlaapmform' + pollid + '_.answer' + i + '.value') !='') { 
                yes++; 
        } 
    } 
    if (yes == 1) { 
        return true; 
    } else { 
        alert('Please answer all the questions before submitting');
        return false; 
    } 
} 

// arg pollform ie: '274'
function pollformSubmit(pollid) { 
    var pollform = 'xlaapmform' + pollid + '_';
    if (pollAnswers(pollid)) { 
        xlaapmxe = window.open('','xlaapmxe','toolbar=0,location=0,status=1,menubar=1,scrollbars=1,resizable=1,width=415,height=300');
        eval('document.' + pollform + '.submit()'); 
        xlaapmxe.focus(); 
    } 
}
// end
// end: popup.js contents
// ############################################