function getNrOfSubLevelsInCurrentURL()
{

	var preSiteURL = "antula";
	var siteName = "";

	var host = window.location.host.toLowerCase();
	var pathName = window.location.pathname.toLowerCase();
	//host = "www.sb12.se";
	//pathName = "/letsdance/";

	var newURL = window.location.protocol + "//" + (host + "/" + pathName).replace("//", "/");
	newURL = newURL.replace("update/", "");
	pathName = pathName.replace("update/", "");

	//alert(newURL);


	var newPathname = "";
	// Remove any page.???-things from the url.
	lastPartOfURL = newURL.substr(newURL.lastIndexOf("/")+1);
	directoryPartOfURL = pathName.substr(0, newURL.lastIndexOf("/")+1);


	//alert(lastPartOfURL);
	if( lastPartOfURL.indexOf(".") > 0 )
		directoryPartOfURL = directoryPartOfURL;
	else
	{
		directoryPartOfURL = directoryPartOfURL + "/"
		directoryPartOfURL = directoryPartOfURL.replace("//", "/");
		//alert(directoryPartOfURL);
	}

	var pathArray = directoryPartOfURL.split( '/' );

	if( host == "localhost" )
	{
		for ( i = 0; i < pathArray.length; i++ ) 
		{
			if( pathArray[i].toLowerCase() == preSiteURL )
			{
				siteName = pathArray[i+1].toLowerCase();
				nrOfSubLevels = pathArray.length - (i+3);
			}
		}	
	}
	else
	{
		nrOfSubLevels = pathArray.length-2;
		//window.location.pathname
	}

	return nrOfSubLevels
}


function getURLOffset()
{
	var nrOfSubLevelsInURL = getNrOfSubLevelsInCurrentURL();
	var retStr = "";
	for( i=0; i<nrOfSubLevelsInURL; i++)
	{
		retStr = retStr + "../";
	}
	
	return retStr;
}
