var winW = 630, winH = 460;

if (parseInt(navigator.appVersion)>3) {
 if (navigator.appName=="Netscape") {
  winW = window.innerWidth;
  winH = window.innerHeight;
 }
 if (navigator.appName.indexOf("Microsoft")!=-1) {
  //winW = document.body.offsetWidth;
  winW = document.documentElement.offsetWidth;
  winH = document.documentElement.offsetHeight;
 }
}

if (winW <= 1060){
   document.write('<style type="text\/css"><!--')
  //if (winW <= 930){
  // document.write('html { overflow: auto;}')
  //}
   document.write('#q_banner { width: 1000px;}')
   document.write('--><\/style>')
}

var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
if(cookie != null) {
  setActiveStyleSheet(title);
}

function setActiveStyleSheet(title) {
  var i, a;
  var aFont = document.getElementById(title);
  var s = document.getElementById("small");
  var b = document.getElementById("big");
    
  if(aFont != null) {
	
	  s.className = l.className.replace(" active","");
	  b.className = n.className.replace(" active","");
	  aFont.className+=" active";
  }
  
  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 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+"; 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;
}

//DHTML functions for styling
$(document).ready(function(){
 $("img.img_shadow").wrap("<div class='img_shadow_wrap'><span class='img_shadow'></span></div>");
 $("div#q_content h2").wrap("<div class='content_h2_wrap'></div>");
 $("div#q_content h1").wrap("<div class='content_h1_wrap'></div>");
});