topclankyskurl = 'http://www.topclanky.sk/'
//topclankyskurl = 'http://topclanky/'

function topclanky_generate(object, doc)
{
    var url = doc.URL;
    
    if(typeof(topclankysk_url) == 'string')
        if(topclankysk_url != "")
            url = topclankysk_url;
    
    var div = document.createElement('img');
    div.setAttribute('title', 'www.topclanky.sk');
    div.setAttribute('border', '0');
    if(typeof(tp_obr) == 'undefined'){
        div.src = topclankyskurl + "rankPicture.aspx?page=" + encodeURIComponent(url);
        div.style.width = '53px';
        div.style.height = '15px';
    }
    else{
        if(typeof(tp_ob) != undefined && tp_ob == true){
            div.src = topclankyskurl + "rankPicture2.aspx?page=" + encodeURIComponent(url) + "&picture=" + tp_obr;
            div.style.width = 'auto';
            div.style.height = 'auto';
        }
        else{
            div.src = topclankyskurl + "/images/rank/" + tp_obr;    
        }
    }

    div.style.borderWidth = '0px';
    div.style.cursor = 'hand';
    div.style.backgroundRepeat = 'no-repeat';
    
    if(typeof(object.innerText) != "undefined")
        object.innerText = '';
    else
        object.innerHTML = '';    
        
    div.onclick = function(e)
    {
        open_win(doc.URL, doc.title)
        
        if (!e) var e = window.event;
	    e.cancelBubble = true;
	    if (e.stopPropagation) e.stopPropagation();
    };
    object.appendChild(div);
}
function open_win(url, title)
{
     url = url.substring(url.length-1, url.length) == '#' ? url.substring(0, url.length-1) : url;

    if(typeof(topclankysk_url) == 'string')
        if(topclankysk_url != "")
            url = topclankysk_url;

    if(typeof(topclankysk_title) == 'string')
        if(topclankysk_title != "")
            title = topclankysk_title;
            
    body = '';        
    if(typeof(topclankysk_body) == 'string')
        if(topclankysk_body != "")
            body = topclankysk_body;
          
    document.getElementById('topclankysk').href = '#';                       
    window.open(topclankyskurl + "getRank.aspx?title=" + encodeURIComponent(title) + "&body=" + encodeURIComponent(body) + "&page="+encodeURIComponent(url), "Nove", "resizable, scrollbars, width=800, height=600");
    return false;
}

topclanky_generate(document.getElementById('topclankysk'), document)



