function hpo_toolbox_checkBrowser(){
    this.ver=navigator.appVersion;
    this.dom=document.getElementById?1:0;
    this.ie7=(this.ver.indexOf("MSIE 7")>-1 && this.dom)?1:0;
    this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom)?1:0;
    this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
    this.ie4=(document.all && !this.dom)?1:0;
    this.ns5=(this.dom && parseInt(this.ver, 10) >= 5) ?1:0;
    this.ns4=(document.layers && !this.dom)?1:0;
    this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5);
    return this;
}

var bw=new hpo_toolbox_checkBrowser();

function hpo_toolbox_gotoUrl(url) {
    document.tx_hpotool_form_lstpages.action = url;
    document.tx_hpotool_form_lstpages.submit();
    return false;
}
var win = null;
function hpo_toolbox_imprime(url){
    
    //var url = window.location ;

    //url += '&print=1';
    //alert(url);
    var win = open( url, 'plateform_preview','directories=no,location=no,menubar=no,status=no,toolbar=no');
    
    if (win) {
        if (!bw.ns5){
            win.resizeTo(700, 600);
        }
        win.focus();
        win.setTimeout('print()', 5000);
    }
    
    return false;
}

var hpo_toolbox_countchange = 0;
var hpo_toolbox_items_nr = 0;
var hpo_toolbox_items = [];
function hpo_toolbox_resizeText(element, moveSize)
{
    element = $$(element);
    elementList = element.getChildren();
    if ( elementList.length > 0 )
    {
        elementList.each(function(item) 
        {
            item.each(function(el) 
            {
                size = el.getStyle('fontSize').toInt();
                newSize = eval(size + moveSize);
        
                hpo_toolbox_items[hpo_toolbox_items_nr] = [];
                hpo_toolbox_items[hpo_toolbox_items_nr][0] = el;
                hpo_toolbox_items[hpo_toolbox_items_nr][1] = newSize;
                ++ hpo_toolbox_items_nr;

                hpo_toolbox_resizeText(el, moveSize);
            });
        });
    }
}

function hpo_toolbox_incdecsize(val) {
    
    if ( (hpo_toolbox_countchange <= -4 && val < 0) || 
         (hpo_toolbox_countchange >= 4 && val > 0) ){
        return false;
    }    
    hpo_toolbox_countchange += val;
        
    var container = $$('#CONTENT');
    hpo_toolbox_resizeText(container, val);
    
    hpo_toolbox_items.each(function (item, key)
    {
        item[0].setStyle('fontSize', item[1] +'px');
        hpo_toolbox_items[key] = null;
    });
    hpo_toolbox_items_nr = 0;
}

/*
function hpo_toolbox_incdecsize(val) {
    var li;
    
    for(i=0; li = document.getElementsByTagName("link")[i]; i++){
        if(li.getAttribute("rel").indexOf("style") != -1 && li.getAttribute("title")) {
            if(li.getAttribute("title").indexOf("tx_hpotoolbox_article") !=-1){
                var myStyleSheet = document.styleSheets[i];
                if (bw.ns5 == 1)
                    var myStyleSheetRules = myStyleSheet.cssRules;
                else
                    var myStyleSheetRules = myStyleSheet.rules;
                    
                var bIsOk = 1;
                for(count = 0; count < myStyleSheetRules.length; count++) {
                    // recup du fontsize
                    var styleFont = myStyleSheetRules[count].style.fontSize;
                    
                    // suppression du px
                    var pos = styleFont.indexOf('px')
                    if (pos != -1)
                        styleFont = styleFont.substring(0, pos);
                    
                    // inc/dec val
                    styleFont = parseInt(styleFont);
                    if ((val>0 && styleFont>40) || (val<0 && styleFont<8))
                        bIsOk = 0;
                }
                
                if (bIsOk) {
                    for(count = 0; count < myStyleSheetRules.length; count++) {                
                        // recup du fontsize
                        var styleFont = myStyleSheetRules[count].style.fontSize;
                        
                        // suppression du px
                        var pos = styleFont.indexOf('px')
                        if (pos != -1)
                            styleFont = styleFont.substring(0, pos);                    
                        
                        // inc/dec val
                        styleFont = parseInt(styleFont) + val;
                        
                        //mise a jour
                        myStyleSheetRules[count].style.fontSize = styleFont + "px";
                    }
                }
            }
        }
    }
}

*/
