function $(id)
{
	return document.getElementById(id);
}

function redirect(url)
{
	window.location = url;
}

function resizeBgImage()
{
	var winW = 0;
	var winH = 0;
	
	if ( !window.innerWidth )
	{
		if ( document.documentElement.clientWidth != 0 )
		{
			winW = document.documentElement.clientWidth;
			winH = document.documentElement.clientHeight;
		}
		else
		{
			winW = document.body.clientWidth;
			winH = document.body.clientHeight;
		}
	}
	else
	{
		winW = window.innerWidth;
		winH = window.innerHeight;
	}	
	
	//$('bgImageHolder').style.width = winW + 'px';
	//$('bgImageHolder').style.height = winH + 'px';
	
	var imgW = $('bgImage').width;
	var imgH = $('bgImage').height;
	
	var widthRatio = imgW / winW;
	var heightRatio = imgH / winH;
	
	if ( widthRatio > heightRatio )
	{
		$('bgImage').style.width = 'auto';
		$('bgImage').style.height = '100%';
	}
	else
	{
		$('bgImage').style.width = '100%';
		$('bgImage').style.height = 'auto';
	}
	
	//alert("winW = " + winW + "\nwinH = " + winH + "\nimgW = " + imgW + "\nimgH = " + imgH + "\nwidthRatio = " + widthRatio + "\nheightRatio = " + heightRatio + "\n");
}

window.onresize = resizeBgImage;
