
// initialize default zoom // IE5.5 and up only

CatalogZoom = 1

// CSS button hovering

function flip(obj){

    obj.className = 'flip';
}

function flap(obj){

    obj.className = 'flap';
}

// 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]
}

// switches between tabs

function switchTab(ActiveTab){

    for(i=0;i<Tabs.length;i++){

        document.getElementById(Tabs[i]).style.display='none'
    }

    document.getElementById(ActiveTab).style.display = 'block'
    // Opera bugfix - Opera doesn't handle the display property well
    document.getElementById(ActiveTab).style.display = ''
}

// 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;
    }

}
