//Cach Busting Ram
var time = new Date();
randnum = (time.getTime());

var zflag_nid=172; var zflag_cid="2"; var zflag_sz=15;

// COOKIE CODE
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;
}

// END: check for Cookie 

function FixCookieDate (date) {
var base = new Date(0);
var skew = base.getTime(); 
if (skew > 0)  
date.setTime (date.getTime() - skew);
}
// Set a cookie
function SetCookie (name,value,expires,path,domain,secure) {
document.cookie = name + "=" + escape (value) +
((expires) ? "; expires=" + expires.toGMTString() : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
}

// news
var filltext1 = '';
var filltext1A = '';
var filltext1C = '';
// business
var filltext2 = '';
// sports
var filltext3 = '';
var filltext3A = '';

function openWin(url) {
popupWin = window.open(url,'','scrollbars=yes,resizable=no,toolbar=no,location=no,directories=no,status=no,menubar=no,copyhistory=no,width=467,height=400,top=40,left=40')
}

function Certify() {
popupWin = window.open('http:\/\/www.bbbonline.org/cks.asp?id=6101999032344', 'Participant', 'location,scrollbars,width=450,height=300')
window.name = 'opener';
}

window.name = 'homepage';
function launchWindow(url, name, width, height) {
	var x = 0;
	var y = 0;
	if(navigator.appVersion.length > 0 && navigator.appVersion.charAt(0) > '3' && navigator.appVersion.charAt(0) <= '9') {
		if(width > screen.availWidth - 12) {
			width = screen.availWidth - 12;
		}
		if(height > screen.availHeight - 48) {
			height = screen.availHeight - 48;
		}
		x = (screen.availWidth - 12 - width) / 2;
		y = (screen.availHeight - 48 - height) / 2;
	}
	var params =  "status=0,scrollbars=1,resizable=1,screenX=" + x + ",screenY=" + y + ",width=" + width + ",height=" + height + ")";
	var windowvar = window.open(url, name, params);
}

//Show / Hide Layers Script 
function getElement(id) {
return document.getElementById ? document.getElementById(id):
document.all ? document.all(id):
document.layers ? document.layers[id] : null;
}

function hidelayer() {
for (var el, a=0; arguments[a]; ++a) {
el = getElement(arguments[a]);
if (el) {
if (el.style) el.className = "hide";
else if (typeof el.className != 'undefined') el.className = "hide";
}
}
}

function showlayer() {
for (var el, a=0; arguments[a]; ++a) {
el = getElement(arguments[a]);
if (el) {
if (el.className) el.className = "show";
else if (typeof el.className != 'undefined') el.className = "show";
}
}
}

randnum = 20;
d = new Array(
"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
m = new Array(
"January","February","March","April","May","June","July","August","September","October","November","December");
today = new Date();
day = today.getDate();
year = today.getYear();
if (year < 2000)    
year = year + 1900; 
function writeDate() {document.write(d[today.getDay()]+", "+m[today.getMonth()]+" " + day+", "+year);}
//function writeDate() {document.write("" + d[today.getDay()]+", "+m[today.getMonth()]+" "+"\n");
//document.write(day);}
function writeDay() {document.write("" + m[today.getMonth()] + " "  + day + " - ");}

function dtsearch() {
sendflag = "false";	
if (document.kwsearchform.kwquery.value == '') {
alert('Please enter a keyword.');
return;
}
else {	
if (document.kwsearchform.kwquery.value != '') { 
location.href='http:\/\/att.dealtime.com/BannerIn/1,2844,,00.html?linkin_id=2048102&path=/GSE/GseWrapCache&nFormID=0&uid=4252787951&keyword='+ document.kwsearchform.kwquery.value;
}
}
}

function checkRequired(formobj) {
if (formobj.zip.value == "") {
alert("Please enter a search ZIP Code...");
return false;
}
return true;
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function addBookmark(title,url) {
if (window.sidebar) { 
window.sidebar.addPanel(title, url,""); 
} else if( document.all ) {
window.external.AddFavorite( url, title);
} else if( window.opera && window.print ) {
return true;
}
}


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 move_in(img_name,img_src) {
document[img_name].src=img_src;
}
function move_out(img_name,img_src) {
document[img_name].src=img_src;
}

//Begin code for Email This page
var document_url=escape(document.URL);
//End code for Email This page

//  Code for Print This Page
var document_url_orig = document.URL;
var document_url_clean =
  (document_url_orig.charAt(document_url_orig.length - 1) == "#") ?
  document_url_orig.substring(0, document_url_orig.length - 1) :
  document_url_orig;
//End code for Print This page


function ext_poll_files () {

	var time = new Date();
	randnum = (time.getTime());

	document.write('<SCR'+'IPT language="JavaScript" src="http://wn.att.net/poll/poll_other/poll_question_' + poll_type + '.js?' + randnum + '"></SCR'+'IPT>');
	document.write('<SCR'+'IPT language="JavaScript" src="http://wn.att.net/poll/poll_other/poll_answers_' + poll_type + '.js?' + randnum + '"></SCR'+'IPT>');
	document.write('<SCR'+'IPT language="JavaScript" src="http://wn.att.net/poll/poll_other/poll_results_' + poll_type + '.js?' + randnum + '"></SCR'+'IPT>');
}


// DAILY POLL cookie functions
//  Function to correct for 2.x Mac date bug.
//  IMPORTANT:  This function should only be
//  called *once* for any given date object!
function FixCookieDate (date) {
  var base = new Date(0);
  var skew = base.getTime(); // dawn of (Unix) time - should be 0
  if (skew > 0)  // Except on the Mac - ahead of its time
    date.setTime (date.getTime() - skew);
}

// Check to see if user accepts cookies warn if no
// (also checks to see if poll is current)
function PollCheckCookie ( pdate ) {

	var expdate = new Date ();
	var polldate = new Date ();
	var test_exp = new Date ();
	var poll_exp = new Date ();

	FixCookieDate (expdate); // Correct for Mac date bug - call only once for given Date object!
	FixCookieDate (polldate); // Correct for Mac date bug - call only once for given Date object!
	FixCookieDate (test_exp); // Correct for Mac date bug - call only once for given Date object!
	FixCookieDate (poll_exp); // Correct for Mac date bug - call only once for given Date object!

	expdate.setTime (expdate.getTime() - (7 * 24 * 60 * 60 * 1000)); // 1 week ago
	// get some of the date objects
        var yr = expdate.getYear();
        var mon = expdate.getMonth();
        var day = expdate.getDate();

	// check to see if the poll is current
	var week_ago=0;
        week_ago += yr*10000;
        week_ago += (mon+1)*100;
        week_ago += day;

        var int_pdate=parseInt(pdate,10);
        if(int_pdate <= week_ago) {
                alert("Your poll isn't current so the page will be refreshed... please vote again after the refresh.");
                window.location.reload(true);
                return false;
        }

	var domain2_index = document.domain.lastIndexOf(".");
	var domain2 = document.domain.substr(domain2_index);
	var shortened_domain_name = document.domain.substr(0,domain2_index);
	var domain1_index = shortened_domain_name.lastIndexOf(".");
	var domain1 = shortened_domain_name.substr(domain1_index);
	var cookie_domain = domain1 + domain2;

        // set up the expiration date of the real cookie, 1 week from the poll start

	poll_year = pdate.substr(0,4);
	poll_month = pdate.substr(4,2);
	poll_day = pdate.substr(6,2);
	polldate.setYear(poll_year);
	polldate.setMonth(poll_month-1);
	polldate.setDate(poll_day);
	polldate.setHours(23,59,59);
	poll_exp.setTime (polldate.getTime() + (6 * 24 * 60 * 60 * 1000));

        // set the test cookie, to expire 1 min from now
	test_exp.setTime (test_exp.getTime() + (60 * 1000));
	test_cookie_name = "WN_test_" + poll_type;
	cookie_name = "POLL_" + poll_type;
	SetCookie(test_cookie_name,'1',test_exp,'/',cookie_domain);

	// After you've set it, try to read it
	if (GetCookie(test_cookie_name) != "1") {
		alert("Sorry!  You've chosen not to accept cookies and therefore we can't register your vote.");
		return false;
	}
	else {
		SetCookie(cookie_name,'TAKEN',poll_exp,'/',cookie_domain);
        }
}

//Slideshow Popup Window
function showSlides() {
popupWin = window.open('http://dailynews.att.net/features/slideshow/slideshow.html', 'SlideShow', 'status,width=650,height=470');
window.name = 'opener';
}

//-->

