﻿/// <reference path="jquery-1.7.1-vsdoc.js" />

jQuery.noConflict();

/// Functions  /////


function getUrlParts()
{
	var a = document.createElement('a');
	a.href = document.URL;

	return {
		href: a.href,
		host: a.host,
		hostname: a.hostname,
		port: a.port,
		pathname: a.pathname,
		protocol: a.protocol,
		hash: a.hash,
		search: a.search
	};
}




function Init()
{
	theId = jQuery('#SelectedLinkId').val();
	if (theId == undefined || theId == null || theId == "")
	{
		return;
	}


	var path = getUrlParts().pathname;
	var paths = path.split('/');
	url =  "images/leftnav/leftnav_item_1.png";	
	url2 = "images/leftnav/leftnav_bt_level1_slice.png";
	directories = paths.length - 1;

	for (var i = 0; i < directories; i++)
	{
		url = "../" + url;
		url2 = "../" + url2;
	}

	
	theId = '#' + theId;
	jQuery(theId).css('background-image', 'url(' + url + ')');
	theLink = jQuery(theId).children().first();
	jQuery(theLink).css('color', 'white');
	jQuery(theLink).css('background-color', 'rgba(255,255,255,0)');
	//jQuery(theLink).css('background-color', 'transparent');
	jQuery(theLink).focus();

	jQuery('#SelectedLinkId').focus();



	jQuery('.CollapsiblePanel').each
	(
		function ()
		{
			jQuery(this).removeClass('');
			jQuery(this).css('background-image', 'url(' + url2 + ')');
			jQuery(this).css('background-repeat', 'repeat-x');
		}
	)


}


jQuery(document).ready
(
	function ()
	{
		Init();
	}
);



