
function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame
    

    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        $('#'+id).fadeOut('slow');
    }
    else
    {
        $('#'+id).fadeIn('slow');
    }
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}

function hideElement(id){
//    alert(id);
    var object = document.getElementById(id).style;
    //alert(id);
    object.opacity = (.0);
    object.MozOpacity = (.0);
    object.KhtmlOpacity = (.0);
    object.filter = "alpha(opacity=" + 0 + ")";
}

function setFullOpacity(id){
    var object = document.getElementById(id).style;
    object.opacity = (100);
    object.MozOpacity = (100);
    object.KhtmlOpacity = (100);
    object.filter = "alpha(opacity=" + 100 + ")";
    //object.display = "block";
}

var curOp = 1000;
function doHideDescription() {
    curOp -= 4;
    document.getElementById("artistsDescription").style.filter = "Alpha(Opacity=" + curOp + ")";
    if(curOp > 0) setTimeout("doHideDescription()", 50);
    else document.getElementById("artistsDescription").style.visibility = "hidden";
}
function hideDescription() {
    if(document.getElementById) doHideDescription();
    else if(document.all) document.all.artistsDescription.style.visibility = "hidden";
    else if(document.layers) document.layers.artistsDescription.visibility = "hide";
}
function findPosX(obj) {
    var curleft = 0;
    if (obj.offsetParent) {
        while (1) {
            curleft+=obj.offsetLeft;
            if (!obj.offsetParent) {
                break;
            }
            obj=obj.offsetParent;
        }
    } else if (obj.x) {
        curleft+=obj.x;
    }
    return curleft;
}
function findPosY(obj) {
    var curtop = 0;
    if (obj.offsetParent) {
        while (1) {
            curtop+=obj.offsetTop;
            if (!obj.offsetParent) {
                break;
            }
            obj=obj.offsetParent;
        }
    } else if (obj.y) {
        curtop+=obj.y;
    }
    return curtop;
}

function getStyleClass (className) {
    for (var s = 0; s < document.styleSheets.length; s++)
    {
        if(document.styleSheets[s].rules)
        {
            for (var r = 0; r < document.styleSheets[s].rules.length; r++)
            {
                if (document.styleSheets[s].rules[r].selectorText == '.' + className)
                {
                    return document.styleSheets[s].rules[r];
                }
            }
        }
        else if(document.styleSheets[s].cssRules)
        {
            for (var r = 0; r < document.styleSheets[s].cssRules.length; r++)
            {
                if (document.styleSheets[s].cssRules[r].selectorText == '.' + className)
                return document.styleSheets[s].cssRules[r];
            }
        }
    }

    return null;
}

function hideElement(id)
{
    var object = document.getElementById(id).style;
    object.display = "none";
}

function pozicioneElementu(id, topId, leftId)
{
    document.getElementById(id).style.left = findPosX(document.getElementById(leftId))+'px';
    document.getElementById(id).style.top = findPosY(document.getElementById(topId))+'px';
}
function startIntro(){
    //alert('ok');
    setTimeout('showIntro();', 1000);
}
function showIntro()
{
    //alert('ok');
    var millisec = 3000;
    var speed = Math.round(millisec / 100);
    var timer = 0;
    var isIE = navigator.appName.indexOf("Microsoft") != -1;
    //alert('ok');
    if(isIE){topSpace = 250;}else{topSpace = 300;}
    position = findPosX(document.getElementById('logoBig'))-topSpace;
    //alert(topSpace);
    document.getElementById('kAizkars').style.top = position+"px";
    document.getElementById('lAizkars').style.top = position+"px";
    //    pozicioneElementu('kAizkars', 'rightColumn', 'logoBig');
    document.getElementById('kAizkars').style.left = findPosX(document.getElementById('logoBig'))+'px';
    document.getElementById('lAizkars').style.left = findPosX(document.getElementById('logoBig'))+'px';
    //pozicioneElementu('lAizkars', 'rightColumn', 'logoBig');

    setFullOpacity('logoBig');//alert('a');
    //leftL = findPosX(document.getElementById('logoBig'));
    //leftL = 300;
    //alert(leftL);

    for(i = 0; i < 130; i++) {
        marginl = 170+i;
        //marginl = leftL-i;
        //marginr = 130+i;
        marginr = 130+i;
        setTimeout("atvelkKreisoA(" + marginl + ",'kAizkars')",(timer * speed));
        setTimeout("atvelkLaboA(" + marginr + ",'lAizkars')",(timer * speed));
        timer++;
    }
    /*for(i = 0; i < 130; i++) {
    marginr = 130+i;
    setTimeout("atvelkLaboA(" + margin + ",'lAizkars')",(timer * speed));
    timer++;
    }*/
}
function atvelkKreisoA(b, id){
    document.getElementById(id).style.margin = ("0 0 0 -" + b + "px");//("0 0 0 -" + b + "px;");
}
function atvelkLaboA(b, id){
    document.getElementById(id).style.margin = ("0 0 0 " + b + "px");
}
