var browser = new BrowserDetect();

var myHeight = 0;
var myWidth = 0;

var slideTime = 700;
var floatAtBottom = true;
  
function getSizes() {
    if( typeof( window.innerWidth ) == 'number' ) {
        //Non-IE
        myHeight = window.innerHeight;
        myWidth = window.innerWidth;
    } 
    else 
        if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
            //IE 6+ in 'standards compliant mode'
            myHeight = document.documentElement.clientHeight;
            myWidth = document.documentElement.clientWidth;
        } 
        else 
            if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
                //IE 4 compatible
                myHeight = document.body.clientHeight;
                myWidth = document.body.clientWidth;
            }
}

    window.onresize = function() {

    getSizes();
    e = document.getElementById('maincontainer').style;
    e.width = myWidth+'px';
    e.height = myHeight+'px';

    // e = document.getElementById('contactbar').style;
    // e.width = (myWidth-182)+'px';

    // e = document.getElementById('filler').style;
    // x2 = myHeight-700;
    // if (x2>-1) {
    //     e.height = x2 + 'px';
    //     e.width = myWidth+'px';
    // }
    e = document.getElementById('main').style;
    e.width = (myWidth-182)+'px';
   // document.getElementById('contactbg').innerHTML = "<img src=\"images/bar.png\" width=\""+(myWidth-182)+"\" height=\"24\" alt=\"\" title=\"\" />";


    e= document.body.style;
 //   e.backgroundPosition = Math.round((myWidth-780)/2)+'px 0px';

 getSizes();
  e = document.getElementById('maincontainer').style;
  e.width = myWidth+'px';
  e.height = myHeight+'px';

  // e = document.getElementById('contactbar').style;
  // e.width = (myWidth-182)+'px';

  // e = document.getElementById('filler').style;
  // x2 = myHeight-700;
  // if (x2>-1) {
  //     e.height = x2 + 'px';
  //     e.width = myWidth+'px';
  // }
  e = document.getElementById('main').style;
  e.width = (myWidth-182)+'px';
 // document.getElementById('contactbg').innerHTML = "<img src=\"images/bar.png\" width=\""+(myWidth-182)+"\" height=\"24\" alt=\"\" title=\"\" />";


  e = document.getElementById('main').style;
  e.width = (myWidth-182)+'px';
 // document.getElementById('contactbg').innerHTML = "<img src=\"images/bar.png\" width=\""+(myWidth-182)+"\" height=\"24\" alt=\"\" title=\"\" />";

    }
    
    
    window.onload = function() {
    getSizes();

	winOnResize(); // set initial position
 	xAddEventListener(window, 'resize', winOnResize, false);
 	xAddEventListener(window, 'scroll', winOnScroll, false);

   // document.getElementById('contactbg').innerHTML = "<img src=\"images/bar.png\" width=\""+(myWidth-182)+"\" height=\"24\" alt=\"\" title=\"\" />";
         
    // e = document.getElementById('filler').style;
    // x2 = myHeight-700;
    // if (x2>-1) {
    //     e.height = x2 + 'px';
    //     e.width = myWidth+'px';
    // }

    // e = document.getElementById('contactbar').style;
    // e.width = (myWidth-182)+'px';


    e = document.getElementById('maincontainer').style;
    e.width = myWidth+'px';
    e.height = myHeight+'px';
    //e.left = Math.round((myWidth-780)/2)+'px';
    e.backgroundImage = 'url(images/04.jpg)';
    e.backgroundRepeat = 'no-repeat';
	e.backgroundPosition = 'top left';

    
    e = document.getElementById('main').style;
    e.width = (myWidth-182)+'px';
    
    e= document.body.style;
//    e.backgroundPosition = Math.round((myWidth-780)/2)+'px 0px';
    
    xMoveTo(xGetElementById('main'),182, -480, 500);    
    xMoveTo(xGetElementById('logo'),-138, 38, 500);   

   document.getElementById('main').style.visibility = 'visible';
   xMoveTo(xGetElementById('main'),182, 0);
   xMoveTo(xGetElementById('logo'),0, 38);
   document.getElementById('logo').style.visibility = 'visible';


//   sIFR.replaceElement(named({sSelector:"#main h3", sFlashSrc:"flash/garamond.swf", sColor:"#636161", nPaddingTop:0, nPaddingBottom:20}));

   sIFR.replaceElement(named({sSelector:"#main h4", sFlashSrc:"flash/gillallcap.swf", sColor:"#ffffff", sBgColor: "#b68c76", nPaddingBottom:6, nPaddingTop: 6}));
}
	function winOnResize() {
	  winOnScroll(); // initial slide
	}
	function winOnScroll() {
	  // var y = xScrollTop();
	  // if (floatAtBottom) {
	  //   y += xClientHeight() - xHeight('contactbar');
	  // }
	  // xSlideTo(xGetElementById('contactbar'), 182, y, slideTime);
	  // setTimeout("xShow('contactbar')",slideTime+10);
	}
