/*
bgscale 1.0
===========

Add the following code right after the <body> tag:

<img id="backgroundImage" class="noJavaScript" src="/images/bg.jpg" alt="" border="0" /><script type="text/JavaScript" src="/bgscale.js"></script>

Use the following CSS to have a scaleable background for browsers where javascript is disabled:

#backgroundImage.noJavaScript{position:fixed;top:0;left:0;width:100%;height:100%;z-index:-1}

*/

<!--
var resizeBgRatio=false;

var resizeBg = function() {
	
	var halign='center'; // left center right
	var valign='center'; // top center bottom
	
  var t=document.getElementById('backgroundImage');
	t.style.position='fixed';
	t.style.zIndex=-1;
	t.className='';
	
	if (!resizeBgRatio) resizeBgRatio=t.width/t.height

  var h = self.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
  var w = self.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;

	if (h<w/resizeBgRatio) {
		t.width = w;
		t.height = w/resizeBgRatio;
		t.style.left=0;
		if (valign=='center') t.style.top=Math.round((h-t.height)/2)+'px';
		if (valign=='bottom') t.style.top=h-t.height+'px';
	} else {
		t.width = h*resizeBgRatio;
		t.height = h;
		t.style.top=0;
		if (halign=='center')	t.style.left=Math.round((w-t.width)/2)+'px';
		if (halign=='right')	t.style.left=w-t.width+'px';
	}
}

document.getElementById('backgroundImage').onload=resizeBg;
window.onload=resizeBg;
window.onresize=resizeBg;
-->
