if(window.location.hash.indexOf("||") != -1)
{
	var a=window.location.hash.substring(1).split("||");
	window.location.hash="#/"+a[0]+"/"+a[1]+"/";
}

function followHashLinks(objLink)
{
	objLink.href += window.location.hash;
}

function cleanUrl(url)
{
	var cleanurl = url.replace(/^\s+/g,'').replace(/\s+$/g,'');
	cleanurl = cleanurl.replace(/\s+/g, '-');
	return cleanurl;
}

function hashToGet(objLink)
{
	strGet = '';
	if((window.location.hash.indexOf("CH") != -1) && (window.location.hash.indexOf("BR") != -1))
	{
		arrTitleSplit = document.title.split("/");
		titleChannel = cleanUrl(arrTitleSplit[2]);
		titleBroadcast = cleanUrl(arrTitleSplit[0]);

		arrHashSplit = window.location.hash.split("/");
		strChannel = '';
		strBroadcast = '';
		for(i=0; i<arrHashSplit.length; ++i)
		{
			if(arrHashSplit[i].indexOf("CH") != -1)
				strChannel = arrHashSplit[i]+"-"+titleChannel;
			if(arrHashSplit[i].indexOf("BR") != -1)
				strBroadcast = arrHashSplit[i]+"-"+titleBroadcast;
		}
		if((strChannel != '') && (strBroadcast != ''))
			strGet = strChannel + '/' + strBroadcast + '/';
	}
	objLink.href += strGet;
}

function changeLocale(newlocale)
{
	var newurl = '';
	var url=window.location.href;
	var urlIsReplaced = false;
	if(-1 < url.indexOf('fr_FR'))
	{
		newurl = url.replace(/fr_FR/g, newlocale);
		urlIsReplaced = true;
	}
	if(-1 < url.indexOf('en_EN'))
	{
		newurl = url.replace(/en_EN/g, newlocale);
		urlIsReplaced = true;
	}
	if(-1 < url.indexOf('de_DE'))
	{
		newurl = url.replace(/de_DE/g, newlocale);
		urlIsReplaced = true;
	}
	if(newurl!='' && urlIsReplaced)
	{
		if(newurl!=url)
			window.location.href = newurl;
	}
	else
	{
		if(newlocale != 'fr_FR')
		{
			if(url.indexOf('#') != -1)
			{
				urlSplit = url.split('#');
				newurl = urlSplit[0]+newlocale+"/flash/#"+urlSplit[1];
				window.location.href = newurl;
			}
			else if (-1 != url.indexOf('/index.php'))
			{
				offset = url.indexOf('/index.php');
				newurl = url.substr(0, offset) +"/"+ newlocale +"/flash/"
				window.location.href = newurl;
			}
			else
			{
				newurl = url+newlocale+"/flash/";
				window.location.href = newurl;
			}
		}
	}
}

function gotoHtmlVersion(location)
{
	window.location.href = location;
}

function getHashValue()
{
	if(window.location.href.indexOf('#') != -1)
	{
		var hashValue = window.location.href.split('#');
		if(hashValue.length>0)
			return hashValue[1];
		else
			return "";
	}
	else
		return "";
}