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) >= 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;
}

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');
	
	var win = open( url, 'plateform_preview','');
	
   	if (win) {
        if (!bw.ns5)
			win.resizeTo(700, 600);
        win.focus();
		win.print();
	}
	
	return false;
}

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";
					}
				}
			}
		}
	}
}

