// horizontal menu code for index page
window.addEvent('domready', function() {

	//  this is the title fade-in effect
	var f = new Hash.Cookie('sess',{duration : 0});
	if (f.get('visited') != true) { //  if the user hasn't visited before
		f.set('visited',true); // they have now.
		var el = $('type-title'); // grab the title png
		el.setStyle('opacity',1); // make it invisible
		el.set('fade',{ duration : 300 });
		el.fade.delay(1000, el, 'in');  //  fade it in after a delay
		}
});


//  set the pagewrapper offset by the width of the viewport

function setOffset(id) {  // passes the id of the content div
var test1,test2,width,offset;
var wrapper = document.getElementById(id);  //  this is the page wrapper div

var test1 = document.body.scrollWidth;
var test2 = document.body.offsetWidth;
if (test1 > test2) // all but Explorer Mac
{
	width = document.body.scrollWidth;
}
else // Explorer Mac;
     //would also work in Explorer 6 Strict, Mozilla and Safari
{
	width = document.body.offsetWidth;
}

var nomOffset = -120; 
//  this is the bg offset for small window width
var minWidth = 900;  
//  this is the content height threshold for background image movement; 
//  less than this, the background image is all the way to the left
if(width >= minWidth) {
	offset = nomOffset + (width - minWidth)
    offset = offset * (offset <= 0); // don't let it be more than 0
	wrapper.style.marginLeft = offset + "px";
  } else {
    wrapper.style.marginLeft = nomOffset + "px";
  }
}
