// JavaScript Document

   
$(document).ready(function(){ 
	setUpNavSelection();
	positionFooter();
	$('#headerDiv').pngFix();
});

function positionFooter(){
	/*var mt = (typeof window.innerHeight != 'undefined' ? -21 : -21);
	var tmpPadding = $('#outer').height();
	$('#outer').css("paddding-bottom", tmpPadding);
	$('#footerDiv').css("margin-top", mt);*/
}


function setUpNavSelection(){
	var oCurrentURL = parseUrl2(window.location.href);
	var currentPathFile = new String(oCurrentURL.path + oCurrentURL.file);
	
		$('ul li a').addClass('nonSelectedNav');
		$('ul li a[href*=' + currentPathFile + ']').removeClass('nonSelectedNav').addClass('selectedNav');
		
	if((window.location.href == "http://www.cl-cf.co.uk/")||(window.location.href == "http://www.cl-cf.co.uk/index_DU.php")){
		$('ul li a[href*=' + currentPathFile + ']').removeClass('selectedNav').addClass('nonSelectedNav');
	}
	
}

function parseUrl2(data) {
    var e=/((http|ftp):\/)?\/?([^:\/\s]+)((\/\w+)*\/)([\w\-\.]+\.[^#?\s]+)(#[\w\-]+)?/;

    if (data.match(e)) {
        return  {url: RegExp['$&'],
                protocol: RegExp.$2,
                host:RegExp.$3,
                path:RegExp.$4,
                file:RegExp.$6,
                hash:RegExp.$7};
    }
    else {
        return  {url:"", protocol:"",host:"",path:"",file:"",hash:""};
    }
}
