
function showmore(id)
{
    var clickable = document.getElementById("morelink" + id);
    var cities = document.getElementById("morecont" + id);
    
    clickable.style.display = "none";
    cities.style.display = "block";
}

function hidemore(id)
{
    var clickable = document.getElementById("morelink" + id);
    var cities = document.getElementById("morecont" + id);
    
    clickable.style.display = "block";
    cities.style.display = "none";
}


function getTextOf(id)
{
    var text;
    switch (id)
    {
        case 'aboutus': text = 'Detta &auml;r texten f&ouml;r \'Om oss\''; break;
        default: text = "Information saknas...";
    }
    return text;
}

function getpos(obj)
{
    var currleft = currtop = 0;
    
    if (obj.offsetParent)
    {
        do
        {
            currleft += obj.offsetLeft;
            currtop += obj.offsetTop;
        } while (obj = obj.offsetParent);
    }
    return [currleft,currtop];
}

function hideinfobox(id)
{
    var parentdiv = document.getElementById('infoparentdiv');
    var infodiv = document.getElementById(id);
    
    parentdiv.removeChild(infodiv);
}

function showinfobox(id)
{
    var linkid = document.getElementById(id);
    var parentdiv = document.getElementById('infoparentdiv');    
    var infodiv = document.createElement('div');
    
    var oldibox = document.getElementById('infoboxid');
    if (oldibox)
        parentdiv.removeChild(oldibox);

    infodiv.setAttribute('id','infoboxid');
    infodiv.setAttribute('class','infobox');
    infodiv.setAttribute('style','position: absolute; left: ' + getpos(linkid)[0] + '; top: ' + (getpos(linkid)[1]+15) + ';');
    
    var ihead = document.createElement('div');
    ihead.setAttribute('class','ibhead');
    ihead.innerHTML = '<a href=\'javascript:void(0);\' onclick=\'hideinfobox(\"infoboxid\");\' class=\'ibclose\'>x</a>';
    
    var ibody = document.createElement('div');
    ibody.setAttribute('class','ibbody');
    ibody.innerHTML = getTextOf(id);
    
    infodiv.appendChild(ihead);
    infodiv.appendChild(ibody);

    parentdiv.appendChild(infodiv);
}

function setfs()
{
    var c = document.getElementById("selectcounty");
    var m = document.getElementById("selectmethod");
    var s = document.getElementById("selectsortby");
    
    window.location = "./?c=" + c.value + "&m=" + m.value + "&s=" + s.value;
}

function setcounty()
{
    var id = document.getElementById("selectcounty");
    window.location = "./setparam.php?county=" + id.value;
}

function setmethod()
{
    var id = document.getElementById("selectmethod");
    window.location = "./setparam.php?method=" + id.value;
}

function setsortby()
{
    var id = document.getElementById("selectsortby");
    window.location = "./setparam.php?sortby=" + id.value;
}

function highlightprow(id)
{
    document.getElementById("prow" + id).bgColor = "#EFEFEF";
    document.getElementById("prow" + id + ".1").bgColor = "#EFEFEF";
}

function unlightprow(id)
{
    document.getElementById("prow" + id).bgColor = "#FFFFFF";
    document.getElementById("prow" + id + ".1").bgColor = "#FFFFFF";
}

function gotourl(group,product,supplier)
{
    window.location = "./click.php?group=" + group + "&product=" + product + "&supplier=" + supplier;
}

function autoIframe(frameId)
{
    try
    {
        frame = document.getElementById(frameId);
        innerDoc = (frame.contentDocument) ? frame.contentDocument : frame.contentWindow.document;
        objToResize = (frame.style) ? frame.style : frame;
        objToResize.height = innerDoc.body.scrollHeight + 10;
    }
    catch(err)
    {
        window.status = err.message;
    }
}