//Make links

function go(x,y) {

	top.menu.location.href="menu.asp?menu="+y;
	top.submenu.location.href="submenu.asp?sub="+x;
	
}

//Make popups
var j,n,m
function popwindow(j,n,m) {
	window.open("popup.asp?id="+j+"&width="+n+"&height="+m+"", "popup", "toolbar=no,locacion=no, directories=no, status=no, status=0, menubar=no, scrollbars=no,rezisable=no, width="+n+",height="+m+", top=150,left=75");
}

function popupload(j,n) {
	window.open("upload.asp?artnr="+j+"", "popup", "toolbar=no, locacion=no, directories=no, status=no, status=0, menubar=no, scrollbars=no, rezisable=no, width=450, height="+n+", top=150, left=75");
}

function help() {
	window.open("help.asp", "help", "toolbar=no, locacion=no, directories=no, status=no, menubar=no, scrollbars=auto,rezisable=yes,width=450,height=450,top=100,left=75");
}

function printWindow() {
bV = parseInt(navigator.appVersion);
if (bV >= 4) {
  window.print();
  window.close();
 }
}

// fake print() for IE4.x
if ( !printIsNativeSupport() )
  window.print = printFrame;

// main stuff
function printFrame(frame, onfinish) {
  if ( !frame ) frame = window;

  if ( frame.document.readyState !== "complete" &&
       !confirm("The document to print is not downloaded yet! Continue with printing?") )
  {
    if ( onfinish ) onfinish();
    return;
  }

  if ( printIsNativeSupport() ) {
    /* focus handling for this scope is IE5Beta workaround,
       should be gone with IE5 RTM.
    */
    var focused = document.activeElement; 
    frame.focus();
    frame.self.print();
    if ( onfinish ) onfinish();
    if ( focused && !focused.disabled ) focused.focus();
    return;
  }

  var eventScope = printGetEventScope(frame);
  var focused = document.activeElement;

  window.printHelper = function() {
    execScript("on error resume next: printWB.ExecWB 6, 1", "VBScript");
    printFireEvent(frame, eventScope, "onafterprint");
    printWB.outerHTML = "";
    if ( onfinish ) onfinish();
    if ( focused && !focused.disabled ) focused.focus();
    window.printHelper = null;
  }

  document.body.insertAdjacentHTML("beforeEnd",
    "<object id=\"printWB\" width=0 height=0 \
    classid=\"clsid:8856F961-340A-11D0-A96B-00C04FD705A2\"></object>");

  printFireEvent(frame, eventScope, "onbeforeprint");
  frame.focus();
  window.printHelper = printHelper;
  setTimeout("window.printHelper()", 0);
}

// helpers
function printIsNativeSupport() {
  var agent = window.navigator.userAgent;
  var i = agent.indexOf("MSIE ")+5;
  return parseInt(agent.substr(i)) >= 5 && agent.indexOf("5.0b1") < 0;
}

function printFireEvent(frame, obj, name) {
  var handler = obj[name];
  switch ( typeof(handler) ) {
    case "string": frame.execScript(handler); break;
    case "function": handler();
  }
}

function printGetEventScope(frame) {
  var frameset = frame.document.all.tags("FRAMESET");
  if ( frameset.length ) return frameset[0];
  return frame.document.body;
}

function printHidden(url) {
  document.body.insertAdjacentHTML("beforeEnd",
    "<iframe name=printHiddenFrame width=0 height=0></iframe>");
  var doc = printHiddenFrame.document;
  doc.open();
  doc.write("<body onload=\"setTimeout('parent.onprintHiddenFrame()', 0)\">");
  doc.write("<iframe name=printMe width=0 height=0 src=\"" + url + "\"></iframe>");
  doc.write("</body>");
  doc.close();
}

function onprintHiddenFrame() {
  function onfinish() {
    printHiddenFrame.outerHTML = "";
    if ( window.onprintcomplete ) window.onprintcomplete();
  }
  printFrame(printHiddenFrame.printMe, onfinish);
}

function lib_bwcheck(){ //Browsercheck (needed)
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.opera5=(navigator.userAgent.indexOf("Opera")>-1 && document.getElementById)?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6
	this.mac=this.agent.indexOf("Mac")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
	return this
}
var bw=lib_bwcheck()

/***************************************************************************************
Variables to set:
***************************************************************************************/
messages=new Array()
//Write your descriptions in here.
messages[0] = "Depending on the type of installation, and depending on which type of flue material applicable, choose one of the 12 options listed."
messages[1] = "Two types of fuel can be choosen. Gas or oil. When no entry is Choosen both flue products that are suitable to gas boiler as well as flue products suitable to oil boilers are listed."
messages[2] = "The temperature class (e.g. T120)  is indicating the maximum temperature that the flue system is able to resist. Most condensing (wet) systems work with T120, most normal combustion (dry) systems are T200 and T250."
messages[3] = "The diameter or dimension of the flue influences the amount of flue gases to be transported. 60-100, 80-125 indicate concentric parts. 80 twin and 60 twin are the most important dimensions for parallel flueing situations."
messages[4] = "The type of material indicates which material is used to guide the flue gases.  Stainless steel, PP (polypropylene) and aluminium can be entered as choice."
messages[5] = "Choose Artnr."
messages[6] = "Choose database."
messages[7] = "Indicates which material is used to guide the fresh air from the exterior of the building to the boiler. Examples of materials that can be entered as a choice."
messages[8] = "---"
messages[9] = "Status (of product life cycle in BAAN)"
messages[10] = "Actual Status (reg. special action, product development project or client)"
messages[11] = "Please select a category of articles you want to manage"
messages[12] = "Choose all products or newly updaded"
messages[13] = "Choose all products or basic configuration products"
messages[14] = "Choose all products or 6-digit, 7-digit or 8-digit products"

//To have more descriptions just add to the array.

fromX = 15 //How much from the actual mouse X should the description box appear?
fromY = -10 //How much from the actual mouse Y should the description box appear?

//To set the font size, font type, border color or remove the border or whatever,
//change the clDescription class in the stylesheet.

//Makes crossbrowser object.
function makeObj(obj){								
   	this.evnt=bw.dom? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?document.layers[obj]:0;
	if(!this.evnt) return false
	this.css=bw.dom||bw.ie4?this.evnt.style:bw.ns4?this.evnt:0;	
   	this.wref=bw.dom||bw.ie4?this.evnt:bw.ns4?this.css.document:0;		
	this.writeIt=b_writeIt;																
	return this
}

// A unit of measure that will be added when setting the position of a layer.
var px = bw.ns4||window.opera?"":"px";

function b_writeIt(text){
	if (bw.ns4){this.wref.write(text);this.wref.close()}
	else this.wref.innerHTML = text
}

//Capturing mousemove
var descx = 0
var descy = 0
function popmousemove(e){descx=bw.ns4||bw.ns6?e.pageX:event.x; descy=bw.ns4||bw.ns6?e.pageY:event.y}

var oDesc;
//Shows the messages
function popup(num){
    if(oDesc){
		oDesc.writeIt('<div class="clDescription">'+messages[num]+'</div>')
		if(bw.ie5||bw.ie6) descy = descy+document.body.scrollTop
		oDesc.css.left = (descx+fromX)+px
		oDesc.css.top = (descy+fromY)+px
		oDesc.css.visibility = "visible"
    }
}
//Hides it
function popout(){
	if(oDesc) oDesc.css.visibility = "hidden"
}
function setPopup(){
   	if(bw.ns4)document.captureEvents(Event.MOUSEMOVE)
    document.onmousemove = popmousemove;
	oDesc = new makeObj('divDescription')
}