
// initialize default zoom // IE5.5 and up only

CatalogZoom = 1

// prints currently displayed catalog page

function printPage(){

    top.window.frames['mainFrame'].document.body.style.zoom = '60%';
    top.window.frames['mainFrame'].focus()
    top.window.frames['mainFrame'].print()
    top.window.frames['mainFrame'].document.body.style.zoom = '100%';
    return false

}

// retrieves current catalog page

function getCurrentPage(){
    
    var tmp;

    tmp = top.window.frames['mainFrame'].location.toString()
    tmp = tmp.split("/")
    i = tmp.length
    i--
    return tmp[i]
}

// zooms content accordin parameter // IE5.5 and up only

function zoomContent(Val){

    if(Val=='in'){CatalogZoom = CatalogZoom + .1}
    if(Val=='out'){CatalogZoom = CatalogZoom - .1}
    if(Val=='default'){CatalogZoom = 1 }

    if(CatalogZoom>0 && CatalogZoom <2){
    document.getElementById('mainFrame').style.zoom = CatalogZoom
    } else{
        CatalogZoom = 1;
    }

    return true;
}

// displays a catalog page according parameter
// pages are defined by cat_items array

function displayPage(ListDirection){

    if(ListDirection=='rew'){
        aa = -1;
        msg='First page';
    }else if(ListDirection=='fwd'){
        aa = 1;
        msg='Last page';
    }else if(ListDirection=='first'){
        top.window.frames['mainFrame'].location.href = cat_items[1][0];
        return true;
    }else if(ListDirection=='last'){
        top.window.frames['mainFrame'].location.href = cat_items[(cat_items.length - 1)][0];
        return true;
    }else{
        return false;
    }
    

    cp = getCurrentPage();

    if(cat_items.length>0){

        for(ii=0;ii<cat_items.length;ii++){
        
            if(cat_items[ii][0]==cp && ((ii+aa)<cat_items.length && (ii+aa)>0)){
                bb = ii+aa
                top.window.frames['mainFrame'].location.href = cat_items[bb][0];
                return true;
            }
        
        }
        alert(msg);
        return false;

    }else{
        return false;
    }

}

// This function displays or hides the tree index according current status

function displayTreeTable(){

    CurrentTreeTableStatus = document.getElementById('TreeTable').style.display;

    switch (CurrentTreeTableStatus) {
        case 'none':
            document.getElementById('TreeTable').style.display = 'block';
            break;
        case 'block':
            document.getElementById('TreeTable').style.display = 'none';
            break;
        default:
            document.getElementById('TreeTable').style.display = 'block';
    }

}

// this function loads a image from the cache to the current object reference
// its used for onmouseover and onmouseout efects

function loadImage(Obj, ImageName){

    if(cat_images[ImageName]!=null){
    
        Obj.src = cat_images[ImageName].src;
    }


}