function get_param(param) {
    var str,keyword = null;
    var url = document.URL;
    if ((url.indexOf(param)>0) ) {

        str=url.substr(url.indexOf(param)+param.length + 1,url.length);
        if ( str.indexOf('&')>0 ) {
             keyword = url.substr(url.indexOf(param) +
                       param.length + 1,str.indexOf('&'));
        }
        else {
            keyword = url.substr(url.indexOf(param)+param.length +1,str.length);
        }
    }
    return keyword;
}

function get_domain() {
    myregexp = new RegExp("(?:http://)?[^.]*.([^/?&]*)");
    var m = myregexp.exec(document.URL);
    if (m == null)
        return "";
    else
        return m[1];
}

function setCookie (name, value, expires, path, domain, secure) {
      document.cookie = name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}

var uid = get_param("uid");

if (getCookie("uid") != uid && uid != null) {
	setCookie("uid",uid,86400,"/",get_domain());
}

function getCookie(name) {

var cookie = " " + document.cookie;
var search = " " + name + "=";
var setStr = null;
var offset = 0;
var end = 0;
if (cookie.length > 0) {
        offset = cookie.indexOf(search);
        if (offset != -1) {
                offset += search.length;
                end = cookie.indexOf(";", offset)
                if (end == -1) {
                        end = cookie.length;
                }
                setStr = unescape(cookie.substring(offset, end));
        }
}

return(setStr);
}


function preview(trackid) {

	var uid = getCookie("uid"); 

	window.open("http://www.yourscriptinghelp.com/spawn/out.php?cl=77528&t=preview&d=6&id=" + trackid + "&uid=" + uid,null,
            "height=480,width=640,status=no,toolbar=no,menubar=no,location=no,resizable=no");
	return false;
}

function album(id) {

	var uid = getCookie("uid"); 

	window.open("http://www.yourscriptinghelp.com/spawn/out.php?cl=77528&t=album&d=6&id=" + id + "&uid=" + uid);
	return false;
}
    
var ref = document.referrer;
var url = document.URL;
var str = 'http://www.yourscriptinghelp.com/spawn/count.php?cl=77528&r=' + escape(ref) + '&u=' + escape(url) + '&uid=' + getCookie("uid");
var scr = '\074script language=javascript src=' + str + '\076\074\057script\076';
document.write(scr);
