function HighlightHeader(index,value)
{
	var headerId='SidebarHeaderCell'+index;
	var textId='SidebarTextCell'+index;
	
	if (value)
	{
		document.getElementById(headerId).className='leftheaderbluehighlight';
	}
	else
	{
		document.getElementById(headerId).className='leftheaderblue';
	}
}

function HiliteText(obj,value)
{
	if (value)
	{
		obj.style.fontWeight='bold';
	}
	else
	{
		obj.style.fontWeight='';
	}
}

function playSound(fileName)
{	
	document.getElementById('SoundBlock').src=fileName;
}

function playHoverSound()
{
	return;
	playSound('sounds/hover.mp3');
}

function playClickSound()
{
	return;
	playSound('sounds/click.mp3');
}

function playConnectSound()
{
	playSound('sounds/connect.mp3');
}

function OpenPicture(fileName,title)
{
	/*
	fileName='http://'+location.hostname+'/'+fileName;
	var buffer=10;
	var obj=document.createElement("img");
	obj.src = fileName;
	var width=parseInt(obj.width)+(buffer*2);
	var height=parseInt(obj.height)+(buffer*2);
	*/

	fileName='http://'+location.host+'/'+fileName;
	alert(location.host);
	alert(location.pathname);
	var buffer=10;
	var obj=document.createElement("img");
	obj.src = fileName;

	var width=screen.width*0.8;
	var height=screen.height*0.8;
	var left=(screen.width-width)/2;
	var top=(screen.height-height)/2;
	
	if (title=='')
		title='Gravitybox Software';
	
	window.open('/showpicture.htm?picture='+fileName+'&buffer='+buffer+'&title='+title, '_blank', 'height='+height+', width='+width+', resizable=no, status=no, toolbar=no, menubar=no, location=no, top='+top+', left='+left);
}

function GetQueryString( key ) 
{ 
	var retObj = new Object(); 
	str = unescape( ( self.location.search ).substring( 1 ) ); 
	var pairs = str.split( '&' ); 
	var pair; 
	for ( x in pairs ) 
	{ 
		pair = pairs[x].split( '=' ); 
		if ( pair.length == 2 ) 
		{ 
			retObj[pair[0]] = pair[1]; 
		}      
	} 
	return retObj[key]; 
}

function GetAbsPathFromRelPath(relativePath)
{
	// Get a server-based, absolute path to the current page and parse it
	var path = Request.ServerVariables("PATH_INFO").item;
	var cpNodes = path.split("/");	
	
	// The first node is empty, so throw it out
	cpNodes = cpNodes.slice(1);	
	
	// Parse the relative path
	var rpNodes = relativePath.split("/");	
	
	// Find the 'slice point' in the relative path array
	n = rpNodes.length;
	for (i = 0; i < n; i++)
	{
		if (rpNodes[i] != "..")
		{
			var rpStart = i
			break;
		}
	}	
	
	// Find the 'slice point' in the absolute path
	var cpEnd = (rpNodes.length - rpStart) - 1;
	if (cpEnd < 0)
	{
		var errMsg = "Function: getAbsPathFromRelPath; Error: Can't resolve relative path passed in.";
		throw new Error(999, errMsg);
	}	
	
	// Slice off the back of the current page path-- de-parse what's left
	var temp = cpNodes.slice(0, cpEnd);
	var result1 = temp.join("/");	
	
	// Slice off the front of the current page path-- de-parse what's left
	var temp = rpNodes.slice(rpStart);
	var result2 = temp.join("/");	
	
	// Splice the two results
	var resultPath = "/" + result1 + "/" + result2;
	
	
	// Return the resulting path
	return resultPath;
}

function getCurrentDirBackwardSlash(URL)
{
	var result = unescape(URL.substring(1,(URL.lastIndexOf("\\")) + 1));
	// note: extract from index 1 in order to remove the '/' char. at index 0.
	return result;
}


function ShowFlash()
{
	window.open(
		'http://www.gravitybox.com/enterprise/flashmovie.htm', 'EnterpriseServer',
		'width=800,height=600,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,directories=no,status=no'
	);
}
