var sBasePath = "";

var nPageIndex = 1;
var nPageCounter = 1;



function start()
{
	if(window.attachEvent)
	{
	    window.attachEvent("onload", onloadStart);
	} 
	else 
	{
	    if(document.addEventListener || window.addEventListener)
	    {
	        if(document.addEventListener) document.addEventListener("load", onloadStart, false);    
	        if(window.addEventListener) window.addEventListener("load", onloadStart, false);
	    }
	    else 
	    {
	        if(typeof window.onload == "function")
	        {
	            var fOld = window.onload;
	            window.onload = function(){ fOld(); onloadStart(); };
	        } else {
	            window.onload = onloadStart;
	        }
	    }
	}
}

function Init()
{
	if (navigator.userAgent.indexOf("MSIE") < 0)
	{
		document.getElementById('NavigationLeft_').style.backgroundImage="url('" + sBasePath + "images/NavigationLeft2.png')";
	}
	
	SetPaging();
}

function SetPaging()
{   
    if (nPageCounter > 1)
    {
        if (nPageIndex > 1)
            document.getElementById("arrowLeft").style.visibility = "visible";
        else
            document.getElementById("arrowLeft").style.visibility = "hidden";
            
        if (nPageIndex < nPageCounter)
            document.getElementById("arrowRight").style.visibility = "visible";
        else
            document.getElementById("arrowRight").style.visibility = "hidden";
    }
}

function MovePage(nIndex)
{
    
    var nNewPageIndex = nPageIndex + nIndex;
    
    if (nNewPageIndex > 0 && nNewPageIndex <= nPageCounter)
    {
        var elm = document.getElementById("page" + nNewPageIndex);
        if (typeof(elm) != "undefined" && elm != null)
        {
            var elmOld = document.getElementById("page" + nPageIndex);
            elmOld.style.visibility = "hidden";
                                    
            elm.style.visibility = "visible";
            nPageIndex = nNewPageIndex;
            
            SetPaging();
        }
    }
}

function SetNaviBG(elm, bOver)
{
    if (typeof(elm) != "undefined" && elm != null)
    {
        if (bOver)
            elm.style.backgroundImage="url('" + sBasePath + "images/naviitem_bg2.gif')";
        else
            elm.style.backgroundImage="";        
    }
}

function ShowSubNavi(nIndex, bShow)
{
    window.setTimeout("ShowSubNaviAfterWait(" + nIndex + ", " + bShow + ")", 300);
}

function ShowSubNaviAfterWait(nIndex, bShow)
{
    var elm = document.getElementById('subNavi' + nIndex);
    
    if (typeof(elm) != "undefined" && elm != null)
    {
        document.getElementById('subNaviOuter' + nIndex).style.visibility = (bShow)? "visible" : "hidden";
        elm.style.visibility = (bShow)? "visible" : "hidden";
    }
}
