function resizeOffice()
{
	var thewidth = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth;
	var theheight = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight;

	var office = $('bg');

	if (document.height > theheight)
		thewidth += 15;
		
	office.setStyles({
		height:theheight,
		width:thewidth+20
	});




}


window.addEvent('resize',function() {
	resizeOffice();
	
	if (pageResize)
		pageResize();

});


var theopentab="-1";

	
	
window.addEvent('load',function() {

	if (window.pageLoad)
		pageLoad();
	
}); 
	
	
function showsignup()
{
	var target = $('bottomtext');
	var fx = new Fx.Morph(target, {duration: 200, wait: false});

	target.setStyles({
		opacity:1
	});		

	fx.options.transition = Fx.Transitions['Quart']['easeOut'];
	fx.start({
		opacity:.05
	});

	var target = $('signup');
	var fx = new Fx.Morph(target, {duration: 200, wait: false});

	target.setStyles({
		opacity:0,
		'visibility':'visible'
	});		

	fx.options.transition = Fx.Transitions['Quart']['easeIn'];
	fx.start.delay(200, fx, {opacity:1});
	
	$('address').focus();
}

var hidesignup = function()
{
	var target = $('signup');
	var fx = new Fx.Morph(target, {duration: 200, wait: false});

	fx.options.transition = Fx.Transitions['Quart']['easeIn'];
	fx.start({
		opacity:0
	});

	var target = $('signupthanks');
	var fx = new Fx.Morph(target, {duration: 200, wait: false});

	fx.options.transition = Fx.Transitions['Quart']['easeIn'];
	fx.start({
		opacity:0
	});

	var target = $('bottomtext');
	var fx = new Fx.Morph(target, {duration: 200, wait: false});

	fx.options.transition = Fx.Transitions['Quart']['easeOut'];
	fx.start({
		opacity:1
	});
	
}

function showsignupthanks()
{
	var target = $('signup');
	var fx = new Fx.Morph(target, {duration: 200, wait: false});

	fx.options.transition = Fx.Transitions['Quart']['easeIn'];
	fx.start({
		opacity:0
	});


	var target = $('signupthanks');
	var fx = new Fx.Morph(target, {duration: 200, wait: false});

	target.setStyles({
		opacity:0,
		'visibility':'visible'
	});		

	fx.options.transition = Fx.Transitions['Quart']['easeIn'];
	fx.start.delay(200, fx, {opacity:1});
	
	hidesignup.delay(2000);
}

	
window.addEvent('domready',function() {

	if (window.setupZoom)
		setupZoom();

	var target = $('bg');
	target.setStyles({
		'visibility':'visible'
	});		

	resizeOffice();	

	
	$each($$('.bottombarlink'), function(el) {
		el.addEvents({
			'mouseenter' : function() { el.setStyles({  'text-shadow':'#666 0px 0px 15px' }) },
			'mouseleave' : function() { el.setStyles({  'text-shadow': '#000 0px 0px 15px' }) }
		});
		});
	
	$('addressForm').addEvent( 'submit', function(evt){
		new Event(evt).stop();
	
		var myform = $('addressForm');
		var url = myform.getProperty('action') + "?" + myform.toQueryString(); 
		new Request({ 
		 url: url, 
		 method: 'get', 
		 onSuccess: function(result){ 
		 	$('signupthanks').innerHTML = result;
		 	document.addressForm.address.value="";
			showsignupthanks();
		   } 
		}).send(); 
		
	} );	

}); 
