document.write('<div id="habPollPopupBox" style="position:absolute; width: 300px; left: 0; top: -400px; border: ' + popupPollBorder + '; background-color: ' + popupPollBGColor + '; padding: 4px; z-index: 100; visibility:hidden;filter:progid:DXImageTransform.Microsoft.RandomDissolve(duration=1) progid:DXImageTransform.Microsoft.Shadow(color=gray,direction=135); -moz-opacity:0;"></div>');


//== STICKY NOTE SCRIPT FROM DYNAMIC DRIVE  =============================================
/***********************************************
* Sticky Note script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* Visit DynamicDrive.com for hundreds of DHTML scripts
* This notice must stay intact for legal use
* Go to http://www.dynamicdrive.com/ for full source code
***********************************************/

var pollDisplayMode="always"

var pollFadeEnabled="yes"       //("yes" to enable fade in effect, "no" to disable)
var pollAutoHideBox=["no", 5]  //Automatically hide box after x seconds? [yes/no, if_yes_hide_after_seconds]
var pollShowOnScroll="yes"      //Should box remain visible even when user scrolls page? ("yes"/"no)
var pollFadeLengthIE=1          //fade in duration for IE, in seconds
var pollFadeDegreeMoz=0.05      //fade in degree for NS6+ (number between 0 and 1. Recommended max: 0.2)

////////No need to edit beyond here///////////

if (parseInt(pollDisplayMode)!=NaN)
var pollRandomNum=Math.floor(Math.random()*pollDisplayMode)

function displayPollPopupBox(){
  var ie=document.all && !window.opera
  var dom=document.getElementById
  iebody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body
  objrefPoll=(dom)? document.getElementById("habPollPopupBox") : document.all.habPollPopupBox
  var scroll_top=(ie)? iebody.scrollTop : window.pageYOffset
  var docwidth=(ie)? iebody.clientWidth : window.innerWidth
  docheight=(ie)? iebody.clientHeight: window.innerHeight
  var objwidth=objrefPoll.offsetWidth
  objheight=objrefPoll.offsetHeight

  try {
   switch(popupPollPositioning) {
     case 0: { objrefPoll.style.left=docwidth/2-objwidth/2+"px"; objrefPoll.style.top=scroll_top+docheight/2-objheight/2+"px"; break; } 
     case 1: { objrefPoll.style.left="1px"; objrefPoll.style.top="1px"; break; }
     case 2: { objrefPoll.style.left="1px"; objrefPoll.style.top=scroll_top+docheight/2-objheight/2+"px"; break; }
     case 3: { objrefPoll.style.left="1px"; objrefPoll.style.top=scroll_top+docheight-objheight+"px"; break; }
     case 4: { objrefPoll.style.left=docwidth/2-objwidth/2+"px"; objrefPoll.style.top="1px"; break; } 
     case 5: { objrefPoll.style.left=docwidth/2-objwidth/2+"px"; objrefPoll.style.top=scroll_top+docheight-objheight+"px"; break; } 
     case 6: { objrefPoll.style.left=docwidth-objwidth+"px"; objrefPoll.style.top="1px"; break; } 
     case 7: { objrefPoll.style.left=docwidth-objwidth+"px"; objrefPoll.style.top=scroll_top+docheight/2-objheight/2+"px"; break; } 
     case 8: { objrefPoll.style.left=docwidth-objwidth+"px"; objrefPoll.style.top=scroll_top+docheight-objheight+"px"; break; } 
     default: { objrefPoll.style.left=docwidth/2-objwidth/2+"px"; objrefPoll.style.top=scroll_top+docheight/2-objheight/2+"px"; } 
   }
  } catch(er) {
   objrefPoll.style.left=docwidth/2-objwidth/2+"px"
   objrefPoll.style.top=scroll_top+docheight/2-objheight/2+"px"
  }

  if (pollShowOnScroll=="yes") pollShowOnScrollVar=setInterval("pollStaticFadeBox()", 50)

  if (pollFadeEnabled=="yes" && objrefPoll.filters) {
   objrefPoll.filters[0].duration=pollFadeLengthIE
   objrefPoll.filters[0].Apply()
   objrefPoll.filters[0].Play()
  }
  objrefPoll.style.visibility="visible"
  if (objrefPoll.style.MozOpacity){
   if (pollFadeEnabled=="yes")
    mozfadevar=setInterval("pollFadeFxMoz()", 90)
   else {
    objrefPoll.style.MozOpacity=1
    controlledPollHideBox()
   }
  } else
     controlledPollHideBox()
}

function pollFadeFxMoz(){
  if (parseFloat(objrefPoll.style.MozOpacity)<1)
   objrefPoll.style.MozOpacity=parseFloat(objrefPoll.style.MozOpacity)+pollFadeDegreeMoz
  else {
   clearInterval(mozfadevar)
   controlledPollHideBox()
  }
}

function pollStaticFadeBox(){
  var ie=document.all && !window.opera
  var scroll_top=(ie)? iebody.scrollTop : window.pageYOffset
  try {
   switch(popupPollPositioning) {
     case 1: { objrefPoll.style.top=scroll_top; break;}
     case 4: { objrefPoll.style.top=scroll_top; break;}
     case 6: { objrefPoll.style.top=scroll_top; break;}
     case 3: { objrefPoll.style.top=scroll_top+docheight-objheight+"px"; break; }
     case 5: { objrefPoll.style.top=scroll_top+docheight-objheight+"px"; break; }
     case 8: { objrefPoll.style.top=scroll_top+docheight-objheight+"px"; break; }
     default: { objrefPoll.style.top=scroll_top+docheight/2-objheight/2+"px"; }
   }
  } catch(er) {
   objrefPoll.style.top=scroll_top+docheight/2-objheight/2+"px"
  }
}

function hidePollFadeBox(){
  objrefPoll.style.visibility="hidden"
  if (typeof pollShowOnScrollVar!="undefined")
  clearInterval(pollShowOnScrollVar)
}

function controlledPollHideBox(){
  if (pollAutoHideBox[0]=="yes"){
   var delayvar=(pollFadeEnabled=="yes" && objrefPoll.filters)? (pollAutoHideBox[1]+objrefPoll.filters[0].duration)*1000 : pollAutoHideBox[1]*1000
   setTimeout("hidePollFadeBox()", delayvar)
  }
}

function initPollFunction(){
  setTimeout("displayPollPopupBox()", 100)
}
//== END DYNAMIC DRIVE SCRIPT=====================


function getHabPollCookie(Name) {
  var search = Name + "="
  var returnvalue = "";
  if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
    if (offset != -1) { // if cookie exists
      offset += search.length
      // set index of beginning of value
      end = document.cookie.indexOf(";", offset);
      // set index of end of cookie value
      if (end == -1)
         end = document.cookie.length;
      returnvalue=unescape(document.cookie.substring(offset, end))
      }
   }
  return returnvalue;
}


function getHabPollPopupCookie(Name) {
   var cookieExists = getHabPollCookie(Name);
   if(cookieExists=="") return false; else return true;
}

function setHabPollPopupCookie() {
  var cookieName = 'habPollPopup_' + league_id + franchise_id;

  var today = new Date();
  var expire = new Date();

  switch (popupPollFrequency) {
   case 0: { document.cookie=cookieName+"=;";                      // clear cookie
                   break; }
   case 1: { document.cookie=cookieName+"=session;";               // expire on window close
                   break; }
   case 2: { expire.setTime(today.getTime() + 1000*60*60*24);      // expire in one day
                   document.cookie=cookieName+"=24;expires="+expire.toGMTString();
                   break; }
   case 3: { expire.setTime(today.getTime() + 1000*60*60*24*7);    // expire in one week
                   document.cookie=cookieName+"=week;expires="+expire.toGMTString();
                   break; }
  }
}

if(franchise_id==undefined) var franchise_id;

if(franchise_id!=undefined&&franchise_id!=''&&franchise_id!='0000') {
 try {
  var tempHTML = "";
  if(popupPollFrequency==0) {  //Show each visit so clear all cookies
    setHabPollPopupCookie();
  }

  if(leagueAttributes['PollsToVoteIn']>0&&!getHabPollPopupCookie('habPollPopup_' + league_id + franchise_id)) {
    tempHTML += '<li>' + leagueAttributes['PollsToVoteIn'] + ' poll(s) requiring your vote&nbsp;&nbsp;';
    tempHTML += '</li>';
    setHabPollPopupCookie();
  }
  if(tempHTML!="") {
     var tableHTML = '<br /><table align="center" cellspacing="1" class="homepagemodule report" id="poll_board_summary"><caption><span>League Polls</span></caption><tbody>';
     tableHTML += '<tr class="oddtablerow"><td><br /><ul>' + tempHTML + '</ul><br /><br /></td></tr>';
     tableHTML += '<tr class="eventablerow"><td style="text-align: center;"><br />[<a href="' + baseURLDynamic + '/' + year + '/options?L=' + league_id + '&O=69">View polls now</a>] [<a href="#1" onClick="hidePollFadeBox(); return false">Close</a>]<br /><br /></td></tr>';
     tableHTML += '</table>';
     document.getElementById('habPollPopupBox').innerHTML = tableHTML;
     displayPollPopupBox();
  }

 } catch(er) {
  //Do Nothing
 }
}
