// Kelvin Owers - Feb 2006         //
// identify browsers and platform //

var isSafari =  !(navigator.appVersion.match('Safari')==null);
var isOpera = !(window.opera==null);
var isIE =  !((navigator.appVersion.match('MSIE')==null) && !(isOpera));
var isFox =  !((navigator.appName.match('Netscape')==null) && !(isSafari||isOpera));

var browserVersion = parseInt(navigator.appVersion);

var agent = navigator.userAgent.toLowerCase();
var isWindows = !(agent.match('win')==null);
var isMac = !(agent.match('mac')==null);
var isMobileX = !(agent.match('Mobile')==null); // iPhone and iPod //

// functions to modify layout based on window size //
function getWindowWidth() {
    var adjustWidth = 0;
    if (isIE) {adjustWidth = 7};
    if (isWindows && isFox) {adjustWidth = -12};
    if (isMac && isFox) {adjustWidth = -5};
    if (isSafari) {adjustWidth = -7};
    if (typeof( window.innerWidth ) == 'number' ) {
      // W3C and others
      return (window.innerWidth + adjustWidth );
    } else if (document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
      // IE 6 in 'standards compliant mode'
      return (document.documentElement.clientWidth + adjustWidth) ;
    } else if (document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
      // IE 4
      return (document.body.clientWidth + adjustWidth);
    } else { return 750;}
} // getWindowWidth

function getWindowHeight() {
    var adjustHeight = 0;
//    if (isIE) {adjustHeight = -30};
//   if (isWindows && isFox) {adjustHeight = -12};
//    if (isMac && isFox) {adjustHeight = -5};
//    if (isSafari) {adjustHeight = -7};
    if (typeof( window.innerHeight ) == 'number' ) {
      // W3C and others
      return (window.innerHeight + adjustHeight );
    } else if (document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
      // IE 6 in 'standards compliant mode'
      return (document.documentElement.clientHeight + adjustHeight) ;
    } else if (document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
      // IE 4
      return (document.body.clientHeight + adjustHeight);
    } else { return 550;}
} // getWindowHeight

function setWindow() {
    var windowWidth = getWindowWidth()
    var windowHeight = getWindowHeight()
    document.getElementById("wrapper").className = "window_normal"; 
    document.getElementById("intro").className = "window_normal"; 
	if (windowWidth > 1170) {
        document.getElementById("wrapper").className = "window_wide"} 
	if (windowWidth > 1350) {
        document.getElementById("wrapper").className = "window_wider"} 
	if (windowWidth > 1650) {
        document.getElementById("wrapper").className = "window_superwide"}
	if (windowHeight < 815) {
        document.getElementById("intro").className = "window_short"}
	if (windowHeight < 750) {
        document.getElementById("intro").className = "window_shorter"}
	if (windowHeight < 620) {
        document.getElementById("intro").className = "window_veryshort"}
} //setWindow

$(document).ready(function() {
    setWindow();
	$('#navigation').localScroll();
	$('#view').localScroll();    
	$('#footer').localScroll();
	$('#critera').localScroll();
});

$(window).resize(function() {
    setWindow();   
});

