$(document).load(function() {
    repos();
    var ua=navigator.userAgent.toLowerCase();
    var sf=(ua.indexOf('safari')!=-1);var ge=(ua.indexOf('gecko')!=-1);
    i=ua.indexOf('msie');var ie6up=(i!=-1&&(parseInt(ua.charAt(i+5)))>=6)?true:false;
    i=ua.indexOf('opera');var o7up=(i!=-1&&(parseInt(ua.charAt(i+6))>=7))?true:false;

}).resize(function(){
    repos();
});

var currImage = 1;
var copyStatus = 0;

var currOffset = 0;

function repos() {
    var tb = $('div#top-bar').get(0);
    var bb = $('div#bottom-bar').get(0);
    var la = $('div#left-area').get(0);
	var co = $('div#left-area div#content').get(0);

    var ma = $('div#mid-area').get(0);
    var ra = $('div#right-area').get(0);

    var cw = xClientWidth();
    var ch = xClientHeight();

    tb.style.width = (cw-105)+'px';
    bb.style.width = (cw-300-75-20)+'px';
	co.style.bottom = 'auto';
	co.style.top = '0px';

    highestRatio = 1.65;
	
	neww = xClientWidth()-320;
	newh = Math.round(neww/highestRatio);
	
	if (newh >= (xClientHeight()-130)) {
    	newh = xClientHeight()-130;
    	neww = Math.round(newh*highestRatio);	    
	}
	
	var brownWidth = xClientWidth()-50; //total width available to the brown
	var contentWidth = neww+225; //viewing area for image + width of subnav bar

	tb.style.width = contentWidth+'px'; 
	
	var nl = Math.round((brownWidth-contentWidth)/2)+50; //+50 to position things inside the brown area as the white is 50 px wide


	ma.style.left = '290px';//(nl+300-75-20)+'px';
	ra.style.left = '530px';//(nl+448)+'px';

	bb.style.width = (neww+20)+'px';
	bb.style.left = '287px';//(nl+300-20-75)+'px';	
	tb.style.left = '85px';//(nl+5)+'px';
	la.style.left = '80px';//nl+'px';
	
	bb.style.display = 'block';
	tb.style.display = 'block';
	ma.style.display = 'block';
	la.style.display = 'block';
	ra.style.display = 'block';
	
	if(typeof sIFR == "function"){
		 sIFR.replaceElement(" div#left-area li.active", "/assets/swfs/centaur_bold4.swf", "#FFFFFF", null, null, "#280D0D", 0, 0, 0, 0);
	}	
}

var xOp7Up,xOp6Dn,xIE4Up,xIE4,xIE5,xNN4,xUA=navigator.userAgent.toLowerCase();
if(window.opera){
    var i=xUA.indexOf('opera');
    if(i!=-1){
        var v=parseInt(xUA.charAt(i+6));
        xOp7Up=v>=7;
        xOp6Dn=v<7;
    }
}
else 
    if(navigator.vendor!='KDE' && document.all && xUA.indexOf('msie')!=-1){
        xIE4Up=parseFloat(navigator.appVersion)>=4;
        xIE4=xUA.indexOf('msie 4')!=-1;
        xIE5=xUA.indexOf('msie 5')!=-1;
    }
    else 
        if(document.layers){
            xNN4=true;
        }

xMac=xUA.indexOf('mac')!=-1;

function xDef()
{
  for(var i=0; i<arguments.length; ++i){if(typeof(arguments[i])=='undefined') return false;}
  return true;
}

function xClientHeight()
{
  var h=0;
  if(xOp6Dn) h=window.innerHeight;
  else if(document.compatMode == 'CSS1Compat' && !window.opera && document.documentElement && document.documentElement.clientHeight)
    h=document.documentElement.clientHeight;
  else if(document.body && document.body.clientHeight)
    h=document.body.clientHeight;
  else if(xDef(window.innerWidth,window.innerHeight,document.width)) {
    h=window.innerHeight;
    if(document.width>window.innerWidth) h-=16;
  }
  return h;
}

function xClientWidth()
{
  var w=0;
  if(xOp6Dn) w=window.innerWidth;
  else if(document.compatMode == 'CSS1Compat' && !window.opera && document.documentElement && document.documentElement.clientWidth)
    w=document.documentElement.clientWidth;
  else if(document.body && document.body.clientWidth)
    w=document.body.clientWidth;
  else if(xDef(window.innerWidth,window.innerHeight,document.height)) {
    w=window.innerWidth;
    if(document.height>window.innerHeight) w-=16;
  }
  return w;
}

function checkForm() {
    var check = true;
    $('#error').get(0).innerHTML = '';
    $('input.required').each(function(){
        if (this.value == "") {
            check = false;
            $('#error').get(0).innerHTML += this.id+' is a required field.<br/>';
        }
    })
    if (check)
        document.forms[0].submit();
}
