// JavaScript Document

$(document).ready(function() {
	/*setUpSifr();*/
	setUpNavSelection();
});

function setUpNavSelection(){
	/*var otestURL1 = parseUrl2("http://www.thephysioroom.co.uk/dev/");
	var otestURL2 = parseUrl2("http://www.thephysioroom.co.uk/index.php");
	
	var testPathFile1 = new String(otestURL1.path + otestURL1.file);
	var testPathFile2 = new String(otestURL2.path + otestURL2.file);*/
	
	var oCurrentURL = parseUrl2(window.location.href);
	var currentPathFile = new String(oCurrentURL.path + oCurrentURL.file);
	$('#navDiv ul li a').addClass('nonSelectedNav');
	$('#navDiv ul li a[href*=' + currentPathFile + ']').removeClass('nonSelectedNav').addClass('selectedNav');
	
	/*var htmlHolder = $('.selectedNav').html();
	$('.selectedNav').parent().html(htmlHolder);*/
	
	if(window.location.href == "http://www.thephysioroom.co.uk/"){
		$('#navDiv ul li a').addClass('nonSelectedNav');
		$('#navDiv ul li a[href*=/index.php]').removeClass('nonSelectedNav').addClass('selectedNav');
	}
	
}

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:""};
    }
}

/*function setUpSifr(){
	var chaparral_pro = {
		src: 'chaparral_pro.swf'
	};
			
	sIFR.activate(chaparral_pro);
			
	sIFR.replace(chaparral_pro, {
		selector: '.contentTitle',
			css: [
				'.sIFR-root { font-size:22px; font-weight:normal; color: #67BEE7; margin-bottom: 20px; }'
			],
			wmode: 'transparent'
	});
	
	
	sIFR.replace(chaparral_pro, {
		selector: '#navDiv ul li',
		forceSingleLine: true,
			css: [
				'.sIFR-root {background-color:transparent; font-size:16px; color: #000099; margin-bottom: 10px;}',
				'a{color: #FFFFFF; text-decoration:none;}',
				'a:hover{color:#000099; text-decoration:none;}',
			],
			wmode: 'transparent',
			fitExactly:true,
    		forceClear:true,
    		forceSingleLine:true,
	});
	
}*/
