if (document.all) {
//IE 5.+
document.oncontextmenu =
	function () {
	//return false;
	};
document.onkeydown =
	function () {
		if ((window.event.keyCode == 78 && window.event.ctrlKey == true) || window.event.keyCode == 93) {
	 	window.event.keyCode = 0;
	 	window.event.cancelBubble = true;
	 	window.event.returnValue = false;
	 	return false;
	 	}
	};
} else if (document.layers) {	 		
//NS 4.x
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown =
	function (evt) {
	 	if (evt.which >= 2)
	 	return false;
	 	};
} else if (parseInt(navigator.appVersion) >= 5 && navigator.appName == "Netscape") {
//NS 6.+
document.oncontextmenu =
	function () {
	return false;
	};
}

function chloc(x,y){

setCookie('chlocal', 'true');
temp = x + ".aspx"

temp += '?' + replaceQuery(y);

document.location = temp
delCookie('chlocal');
}

function chSong(href, title, artist, album, author){

setCookie('chlocal', 'true');
temp = "playnow.aspx"

var q;

q = replaceQuery('href=' + href);
q = replaceQuery('title=' + title, q);

if (typeof artist != "undefined")
	q = replaceQuery('artist=' + artist, q);

if (typeof album != "undefined")
	q = replaceQuery('album=' + album, q);
	
if (typeof author != "undefined")
	q = replaceQuery('author=' + author, q);

temp += '?' + q;

document.location = temp
delCookie('chlocal');

}

function replaceQuery(newValue, query)
{

if (typeof query == "undefined")
	query = document.location.search.substring(1);
	
var newQuery;

if (query.lastIndexOf('&') != query.length - 1){
query += '&';
}

if (typeof newValue != "undefined"){
variable = newValue.substr(0, newValue.indexOf('='))

while (query.indexOf(variable) != -1)
query = query.replace(query.substring(query.indexOf(variable), query.indexOf('&', query.indexOf(variable))+1),'')

newQuery = query
newQuery += newValue
} else {
newQuery = query
}

return newQuery;
}

function getCookie(NameOfCookie)
{
if (document.cookie.length > 0) 
{ 
begin = document.cookie.indexOf(NameOfCookie+"="); 
if (begin != -1) // Note: != means "is not equal to"
{ 
begin += NameOfCookie.length+1; 
end = document.cookie.indexOf(";", begin);
if (end == -1) end = document.cookie.length;
return unescape(document.cookie.substring(begin, end)); } 
}
return null; 
}

function setCookie(NameOfCookie, value, expiredays) 
{
var ExpireDate = new Date ();
ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
document.cookie = NameOfCookie + "=" + escape(value) + 
((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());
}

function delCookie (NameOfCookie) 
{
if (getCookie(NameOfCookie)) {
document.cookie = NameOfCookie + "=" +
"; expires="+ new Date();
}
}




