function fixPNG( element )
{
	if ( /MSIE (5\.5|6).+Win/.test( navigator.userAgent ) ) {
		var src;
		if ( element.tagName == 'IMG' ) {
			if ( /\.png$/.test( element.src ) ) {
				src = element.src;
				element.src = "/i/1x1.gif";  /* transparent gif */
			}
		}
		else {
			src = element.currentStyle.backgroundImage.match( /url\("(.+\.png)"\)/i );
			if (src) {
				src = src[1];
				element.runtimeStyle.backgroundImage = "none";
			}
		}
		if (src) {
			element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='crop')";
		}
	}
}

function removeClass( objNode, strCurrClass )
{
	replaceClass( objNode, '', strCurrClass );
}

function addClass( objNode, strNewClass )
{
	replaceClass( objNode, strNewClass, '' );
}

function replaceClass( objNode, strNewClass, strCurrClass )
{
	var strOldClass = strNewClass;
	if ( strCurrClass && strCurrClass.length ) {
		strCurrClass = strCurrClass.replace( /\s+(\S)/g, '|$1' );
		if ( strOldClass.length ) strOldClass += '|';
		strOldClass += strCurrClass;
	}
	objNode.className = objNode.className.replace( new RegExp('(^|\\s+)(' + strOldClass + ')($|\\s+)', 'g'), '$1' );
	objNode.className += ( (objNode.className.length)? ' ' : '' ) + strNewClass;
}

function winResize()
{
	document.getElementById("page").style.height = "auto";
	var bodyHeight = document.documentElement.clientHeight;
	var pageHeight = document.getElementById("page").offsetHeight;
	if (pageHeight < bodyHeight) {
		document.getElementById("page").style.height = bodyHeight + "px";
	}
}

if ( /MSIE (7).+Win/.test( navigator.userAgent ) ) {
	window.attachEvent("onresize", winResize);
}

