// JavaScript Document
// Controls entire site width, if browser width is below 960px, width adjusts to fit into 800 x 600 rez



/*Cookie stuff*/
	
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 var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}


/* /Cookie stuff */


wraphandler = {
  init: function() {
    if (!document.getElementById) return;
    // set up the appropriate wrapper
    wraphandler.setWrapper();
    // and make sure it gets set up again if you resize the window
//    wraphandler.addEvent(window,"resize",wraphandler.setWrapper);
  },

  setWrapper: function() {

	

    // width stuff from ppk's evolt.org/article/document_body_doctype_switching_and_more/17/30655/index.html


var theWidth = 0;


if (window.innerWidth) {
	theWidth = window.innerWidth
    } else if (document.documentElement &&
                document.documentElement.clientWidth) {
	theWidth = document.documentElement.clientWidth
    } else if (document.body) {
	theWidth = document.body.clientWidth
    }

if (theWidth !=0) {


      if (theWidth < 960) {
document.getElementById('aspnetForm').className = 'small';


createCookie("pagewidth", "small");		
      } else {
document.getElementById('aspnetForm').className = 'wide';
	createCookie("pagewidth", "wide");		
      }



}


  },

// addEvent stuff from John Resig's ejohn.org/projects/flexible-javascript-events
  addEvent: function( obj, type, fn ) {
    if ( obj.attachEvent ) {
      obj['e'+type+fn] = fn;
      obj[type+fn] = function(){obj['e'+type+fn]( window.event );}
      obj.attachEvent( 'on'+type, obj[type+fn] );
    } else {
      obj.addEventListener( type, fn, false );
    }
  }
}



function newload(){
var theWidth = 0;


if (window.innerWidth) {
	theWidth = window.innerWidth
    } else if (document.documentElement &&
                document.documentElement.clientWidth) {
	theWidth = document.documentElement.clientWidth
    } else if (document.body) {
	theWidth = document.body.clientWidth
    }

if (theWidth != 0){
	if(theWidth < 960){
		createCookie("pagewidth", "small");
	}
	else {
		createCookie("pagewidth", "wide");
	}
}
wraphandler.setWrapper();
}

wraphandler.addEvent(window,"resize",wraphandler.init);
//window.onload = newload;

