/*
Screen Size Redirect script (By Robert @ http://members.tripod.com/technological_tinker/)
Submitted to Dynamicdrive.com to feature script in archive
For full source, usage terms, and 100's more DHTML scripts, visit http://dynamicdrive.com
*/

/*function checkSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement &&
      ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  if (myWidth>820) {
  change('bigTable','show');
  change('smallTable','hide');
  }
else {
  change('bigTable','hide');
  change('smallTable','show');
  }
  }


function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);*/


/* Side menu stuff */

var SHOW = 'show';
var HIDE = 'hide';
var numberOfSections = 10;
var newVisibilities = new Array(numberOfSections);
var imageIndex = 9;
var visibilities = new createStyleArray(numberOfSections);

//page resize
function change(id, newClass) {
identity=document.getElementById(id);
identity.className=newClass;
}

function createStyleArray(n) {
 this.size = n;  //This initialization is absolutely necessary
 this['Index'] = getVisibilityArray(0);
 this['Posts'] = getVisibilityArray(1);
 this['Story'] = getVisibilityArray(2);
 this['Articles'] = getVisibilityArray(3);
 this['Dls'] = getVisibilityArray(4);
 this['Dl24'] = getVisibilityArray(5);
 this['Faqs'] = getVisibilityArray(6);
 this['Search'] = getVisibilityArray(7);
 this['Links'] = getVisibilityArray(8);
 this['Image'] = getVisibilityArray(9);
 return this;         //Return the  array object to the caller
}

//Returns a visibility array with show options populated into the specified index
function getVisibilityArray(arrayIndex) {
 var visibilityArray = getDummyArray();
 visibilityArray[arrayIndex] = SHOW;
 if (arrayIndex == 0 || arrayIndex == 7 || arrayIndex == 8) { //special cases.  Set images to SHOW also
   visibilityArray[imageIndex] = SHOW;
 }
 return visibilityArray;
}

//Returns a visibility array with all options et to HIDE
function getDummyArray() {
  var dummyArray  = new Array(numberOfSections);
  var i = 0;
  for (i=0; i<dummyArray.length; i++) {
    dummyArray[i] = HIDE;
  }
  return dummyArray;
}

function getCookie(Name) {
 var search = Name + "=";
 if (document.cookie.length > 0) {
   // if there are any cookies
   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;

     return unescape(document.cookie.substring(offset, end))
   }
 }
}

////// side menu stuff //////
function changeToVisibility(visibilityIndex) {
 if (visibilityIndex >= '0') {
    var visibility = visibilities[visibilityIndex];
    change('showIndex',visibility[0]);
    change('showPosts',visibility[1]);
    change('showStories',visibility[2]);
    change('showArticles',visibility[3]);
    change('showDls',visibility[4]);
    change('showDl24',visibility[5]);
    change('showFaqs',visibility[6]);
    change('showSearch',visibility[7]);
    change('showLinks',visibility[8]);
    change('showImage',visibility[9]);
    document.cookie = "sideIndex=" + visibilityIndex;
  }
}

///////// poll stuff ///////
  function viewList() {
  change('pollIndex','show');
  change('showPoll','hide');
  document.cookie = "pollView=viewList()";
}
  function viewPoll() {
  change('pollIndex','hide');
  change('showPoll','show');
  document.cookie = "pollView=viewPoll()";
}

