function e(el){
	return document.getElementById(el);
}

function c_menuButton(topicNum){
    
    if (isNaN(topicNum))
    {
        if (topicNum != "next" && topicNum != "back")
        {
            e("contentFrame").src = topicNum + ".htm";
        }
        else
        {                     
        
            var pagesplit = e("contentFrame").src.split("page");          
            var currpage = pagesplit[1].split("_");
            
            if (topicNum == "next")
            {
                if (currpage.length <= 1 || currpage == "undefined")
                {
                    e("contentFrame").src = "page" + pagesplit[1].split(".htm")[0] + "_1.htm";
                }
                else
                {
                    var basepage = pagesplit[1].split(".htm")[0].split("_")[0];
                    var nextpage = currpage[1].split(".htm")[0];
                    nextpage++;
                    
                    e("contentFrame").src = "page" + basepage + "_" + nextpage + ".htm";
                }
            }
            else
            {
            
                var basepage = pagesplit[1].split(".htm")[0].split("_")[0];
                var nextpage = currpage[1].split(".htm")[0];   
                         
                if (nextpage == 1)
                {
                    e("contentFrame").src = "page" + basepage + ".htm";
                }
                else
                {
                    nextpage--;
                    
                    e("contentFrame").src = "page" + basepage + "_" + nextpage + ".htm";
                }            
            }
        }
    }
    else
    {            
    	e("contentFrame").src = "page" + topicNum + ".htm";
    }
    
    for (i=1; i<=11; i++)
    {
        if (i == topicNum)
        {
            e("im"+ i).style.display = "block";
        }
        else
        {
            e("im"+ i).style.display = "none";
        }
    }
    
    showNeither()

    if (Right(e("contentFrame").src,9) == "page2.htm")
    {
        showNext();
    }
    
    if (Right(e("contentFrame").src,11) == "page2_1.htm")
    {
        showBack();
    }  
    
    if (Right(e("contentFrame").src,9) == "page4.htm")
    {
        showNext();
    }
    
    if (Right(e("contentFrame").src,11) == "page4_1.htm")
    {
        showBack();
    }      
       
}

function Left(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}
function Right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}

function showNeither()
{
    e("next").style.display = "none";
    e("back").style.display = "none";
}

function showNext()
{
    e("next").style.display = "block";
    e("back").style.display = "none";
}

function showBack()
{
    e("back").style.display = "block";
    e("next").style.display = "none";
}

function showBoth()
{
    e("next").style.display = "block";
    e("back").style.display = "block";    
}

function c_mOver(s){v_mOver(s);}

function c_mOff(s){v_mOff(s);}

function v_mOver(s)
{
    if (s != "next" && s != "back")
    {
	    e("ls"+s).style.backgroundImage = "url(interface/bt_" + s + "_ovr.jpg)";
	}
	else
	{
	    e(s).style.backgroundImage = "url(interface/bt_" + s + "page_on.jpg)";
	}

}
function v_mOff(s)
{
    if (s != "next" && s != "back")
    {
	    e("ls"+s).style.backgroundImage = "url(interface/bt_" + s + "_std.jpg)";
	}
	else
	{
	    e(s).style.backgroundImage = "url(interface/bt_" + s + "page_off.jpg)";
	}

}

function openWin(sFileName, iHeight, iWidth, sName, iScroll)
{

	iHpos = (((screen.availHeight-200)/2)-(iHeight/2));
	iWpos = ((screen.availWidth/2)-(iWidth/2));
	
	if (navigator.appName == "Microsoft Internet Explorer")	
	{
		objWin = window.open(sFileName,sName,"top=" + iHpos + ", left=" + iWpos + ", height=" + iHeight + ",width=" + iWidth + ",status=no,toolbar=no,menubar=no,location=no,scrollbars=" + iScroll + "");
	}	
	else
	{
		objWin = window.open(sFileName,sName,"height=" + iHeight + ",width=" + iWidth + ",status=no,toolbar=no,menubar=no,location=no,scrollbars=" + iScroll + "");	
		objWin.moveTo(iWpos, iHpos);
	}
	objWin.opener = parent;
}				
