function ST() {
}
ST.prototype.getGetParams= function(name) {
    var getST = new String(window.location);
    var parseGetSt = getST.split('?');
    if(parseGetSt.length==2){
        var paramValuesST=parseGetSt[1].split('&');
        for(i in paramValuesST){
            var get = paramValuesST[i].split('=');
            if( get[0]==name){
                return  get[1];
            }
        }
    }
    return '';
}
ST.prototype.getCookie= function(name) {
        var prefix = name + "=";
        var cookieStartIndex = document.cookie.indexOf(prefix);
        if (cookieStartIndex == -1)
                return null;
        var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length);
        if (cookieEndIndex == -1)
                cookieEndIndex = document.cookie.length;
        return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex));
}
ST.prototype.init=function(id){
    var thisRefferer=(window.document.referrer)?window.document.referrer:"not";
    if(thisRefferer!="not"){
        var imageDiv=document.getElementById("counter-st-image-box");
        if(document.location.hash.split("#fromEverytell")!=document.location.hash){
            var imageSrc=document.createElement("img");
            imageSrc.setAttribute("src", "http://count."+thisHostParent+"/?url="+window.location.href.replace("&","amp;")+"&site="+thisHost+"&site_id="+id+"&referer=1")
            imageDiv.appendChild(imageSrc);
            var today = new Date();
            today.setTime( today.getTime() );
            expires = 1000 * 60 * 60 * 24;
            var expires_date = new Date( today.getTime() + (expires) );
            window.document.cookie='fromST=1;expires='+ expires_date.toGMTString();
        }
        else if(this.getCookie('fromST')){
            var imageSrc=document.createElement("img");
            imageSrc.setAttribute("src", "http://count."+thisHostParent+"/?url="+window.location.href.replace("&","amp;")+"&site="+thisHost+"&site_id="+id+"&referer=2")
            imageDiv.appendChild(imageSrc);
        }
    }
}

