var g_target;
g_target = "mainFrame";

function LeftFillZero(str,iLen){
    iCount = iLen-str.length;
    for(iPos=0;iPos<iCount;iPos++){
    	str="0"+str;
    }
    return str;
}
function NavOnMouseOver(){
    if( window.parent.oa_frame.cols=="0,*" ){
        btnNav.src='images/hidden1.gif';
        btnNav.title='to show navigation window';
    }else{
        btnNav.src='images/display1.gif';
        btnNav.title='to close navigation window';
    }
}
function NavOnMouseOut(){
    if( window.parent.oa_frame.cols=="0,*" ){
        btnNav.src='images/hidden.gif';
        btnNav.title='to show navigation window';
    }else{
        btnNav.src='images/display.gif';
        btnNav.title='to close navigation window';
    }
}
function NavOnClick(){
    if( window.parent.oa_frame.cols=="0,*" ){
        btnNav.src='images/display1.gif';
        btnNav.title='to close navigation window';
        window.parent.oa_frame.cols="160,*";
    }else{
        btnNav.src='images/hidden1.gif';
        btnNav.title='to show navigation window';
        window.parent.oa_frame.cols="0,*"
    }
}
function ChangeDispMode(iMode){
    if( iMode == 1 ){
    	document.all.V_DispMethod.value="1";
    	document.all.V_CurrentPage.value = "1";
    	document.all.selPages.selectedIndex=0;
    	
    	window.open("left_pg.htm","leftFrame");
    	window.open("page00001.htm","mainFrame");
    	
    	DispTitleObj = parent.leftMenuFrame.document.getElementById("nav_title");
    	DispTitleObj.innerHTML = "&nbsp;Pages List";
    }else if( iMode == 2 ){
    	document.all.V_DispMethod.value="2";
    	parent.leftFrame.window.open("left_mk.htm","leftFrame");
    	DispTitleObj = parent.leftMenuFrame.document.getElementById("nav_title");
    	DispTitleObj.innerHTML = "&nbsp;Bookmarks List";
    }
}
function ChangeZoom(){
    iNewZoom = document.all.selZoom.options[selZoom.selectedIndex].value;
    parent.mainFrame.document.body.style.zoom=iNewZoom/100;
}
function ChangePage(){
    //marker list mode
    if( document.all.V_DispMethod.value != "1" ){
        return;
    }
    
    iPage=document.all.selPages.options[selPages.selectedIndex].value;
    GotoPage(iPage);
}
function GotoPreviousPage(){
    //marker list mode
    if( document.all.V_DispMethod.value != "1" ){
        return;
    }
    
    m_CurrPage = parseInt(document.all.V_CurrentPage.value);
    if( --m_CurrPage <= 0 ){
    	GotoPage(1);
    }else{
        GotoPage(m_CurrPage);
    }
}
function GotoNextPage(){
    //marker list mode
    if( document.all.V_DispMethod.value != "1" ){
        return;
    }
    
    m_CurrPage = parseInt(document.all.V_CurrentPage.value);
    m_LastPage = parseInt(document.all.V_TotalPages.value);

    if( ++m_CurrPage > m_LastPage ){
    	GotoPage(m_LastPage);
    }else{
        GotoPage(m_CurrPage);
    }
}
function GotoFirstPage(){
    //marker list mode
    if( document.all.V_DispMethod.value != "1" ){
        return;
    }
    GotoPage(1);
}
function GotoLastPage(){
    //marker list mode
    if( document.all.V_DispMethod.value != "1" ){
        return;
    }
    
    m_LastPage = parseInt(document.all.V_TotalPages.value);
    GotoPage(m_LastPage);
}
function GotoPage(iPage){
    m_CurrPage = document.all.V_CurrentPage.value;
    
    PrevImgObj = parent.leftFrame.document.getElementById("img_"+m_CurrPage);
    CurrImgObj = parent.leftFrame.document.getElementById("img_"+iPage);
    PrevImgObj.src="images/doc1.gif";
    CurrImgObj.src="images/arrow1.gif";
    
    PrevDivObj = parent.leftFrame.document.getElementById("div_"+m_CurrPage);
    CurrDivObj = parent.leftFrame.document.getElementById("div_"+iPage);
    PrevDivObj.innerHTML='<span class="general_unselected">PAGE '+m_CurrPage+'</span>';
    CurrDivObj.innerHTML='<span class="general_selected">PAGE '+iPage+'</span>';;
    
    document.all.V_CurrentPage.value=iPage;
    document.all.selPages.selectedIndex=iPage-1;
    window.open("page"+LeftFillZero(iPage+"",5)+".htm", g_target);
}
function DoPrint(){
    parent.mainFrame.document.execCommand("print");
    //parent.mainFrame.window.print();
}     