function toggle(obj) {

	var el = document.getElementById(obj);
	if ( el.style.display != 'none' ) {
		el.style.display = 'none';
	}
	else {
		el.style.display = '';
	}
}

function getCookie( name ) {
	var start = document.cookie.indexOf( name + "=" );
	var len = start + name.length + 1;
	if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) {
		return null;
	}
	if ( start == -1 ) return null;
	var end = document.cookie.indexOf( ";", len );
	if ( end == -1 ) end = document.cookie.length;
	return unescape( document.cookie.substring( len, end ) );
}

function setCookie( name, value, expires, path, domain, secure ) {
	var today = new Date();
	today.setTime( today.getTime() );
	if ( expires ) {
		expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );
	document.cookie = name+"="+escape( value ) +
		( ( expires ) ? ";expires="+expires_date.toGMTString() : "" ) + //expires.toGMTString()
		( ( path ) ? ";path=" + path : "" ) +
		( ( domain ) ? ";domain=" + domain : "" ) +
		( ( secure ) ? ";secure" : "" );
}
	
function deleteCookie( name, path, domain ) {
	if ( getCookie( name ) ) document.cookie = name + "=" +
			( ( path ) ? ";path=" + path : "") +
			( ( domain ) ? ";domain=" + domain : "" ) +
			";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

function NewWindow(mypage,myname,w,h,scroll){
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable=false'
	win = window.open(mypage,myname,settings)
}

window.onload = function(){

		if (navigator.platform == "Win32" && navigator.appName == "Microsoft Internet Explorer" && window.attachEvent) {
			window.attachEvent("onload", fnLoadPngs);
		}

		function fnLoadPngs() {
			
			var rslt = navigator.appVersion.match(/MSIE (\d+\.\d+)/, '');
			var itsAllGood = (rslt != null && Number(rslt[1]) >= 5.5);
		
			for (var i = document.images.length - 1, img = null; (img = document.images[i]); i--) {

				if (itsAllGood && img.src.match(/\.png$/i) != null) {
					var src = img.src;
					
					var div = document.createElement("DIV");
					div.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizing='scale')"
					div.style.width = img.width + "px";
					div.style.height = img.height + "px";
					if( img.style.position ) div.style.position = img.style.position;
					if( img.style.right ) div.style.right = img.style.right;
					if( img.style.top ) div.style.top = img.style.top;
					if( img.style.left ) div.style.left = img.style.left;
					if( img.style.bottom ) div.style.bottom = img.style.bottom;
					if( img.style.cursor ) div.style.cursor = img.style.cursor;
					if( img.onclick ) div.onclick = img.onclick;
					//if( img.id ) div.id = img.id;
					
					img.replaceNode(div);
				}
			}
		}
}

