/**
 * This fixes the cutting off of the header when a hash is in the url.
 * @author: Tizian Schmidlin <st@cabag.ch>
 */

function fixHash() {
	// As some browsers may not support regular expressions, catch it if an error is thrown, else it could kill everything else
	try {
		if(/[^#]*#.*/.test(window.location.href) && (navigator.appName != 'Microsoft Internet Explorer'  || navigator.userAgent.indexOf('MSIE 8') != -1)) {
			hashEl = window.location.href.substring(window.location.href.indexOf('#')+1);
			//window.alert($$('a [name="'+hashEl+'"]'));
			if($$('a [name='+hashEl+']')) {
				ctArea = $$('#midCol .ctArea')[0];
				ctArea.style.marginTop="0px";
				ctArea.style.paddingTop="35px";
				if(navigator.vendor == 'Apple Computer, Inc.') {
					ctArea.style.paddingTop="33px";
				}
			}else if(document.getElementById(hashEl) && !$$('a [name='+hashEl+']')) {
				ctArea = $$('#midCol .ctArea')[0];
				ctArea.style.marginTop="0px";
				ctArea.style.paddingTop="35px";
				if(navigator.vendor == 'Apple Computer, Inc.') {
					ctArea.style.paddingTop="33px";
				}
			}
		}
	}catch(e) {}
}

//document.observe('domready',fixHash);

