
var ns = (navigator.appName == "Netscape");
var win = (navigator.userAgent.indexOf("Win")!=-1)
var browserversion = navigator.appVersion.substring(0,3)


var initTimer
var pageLoaded = false
function initWhenReady(yColPos) {
// ######## Starts the output for the left menus ########
// ######## Stops the dynamic left meny then page is printed #######
if(document.layers)
{                   
	if(parent.opener){
		if(!parent.printmess) {
		  WQ_Menu(openColActive,yColPos)
		  }
	}
	else if(!parent.printmess) {
		WQ_Menu(openColActive,yColPos)
	}
}
else
{

	  WQ_Menu(openColActive,yColPos)
}
	// ######## Initates variables ########
//	top.navigate_top.menuActive=false
//	top.navigate_top.currentMenu=''
	nextUrl=''
//	top.AddToHistory()
//	top.navigate_top.changeDocinfo()

	// ####### Back/Forward #########

	// ######## Loads event-handlers for menu removal ########
	if(ns) document.captureEvents(Event.MOUSEUP)
	if(ns) document.onmouseup = removeMenu
	else {
		document.onclick = removeMenu
		//self.onscroll = removeMenu
	}
  pageLoaded = true
  // ######## Starts the scroll-following top-menus ########
  if (document.all) self.onscroll = WQ_ScrollIE
  if (document.layers) WQ_ScrollNN()
}

function WQ_ScrollIE() {
//  for (var i in menuArr) document.all.item(menuArr[i]+"menu").style.top = document.body.scrollTop
}
var scrollTimern
function WQ_ScrollNN() {
  clearTimeout(scrollTimern)
  for (var i in menuArr) document.layers[menuArr[i]+"menu"].top = pageYOffset
  scrollTimern = setTimeout("WQ_ScrollNN()",100) // 100 = the time in millisecond between the browser checks whether it has be an "onScroll"-event
}

var openColActive
function init(yColPos) {

  openColActive = (typeof(openCol) != 'undefined') ? openCol : [] ;
//  if(top.topReady) 
  //{
//  if(top.topReady && top.bottomReady) {
    //clearTimeout(initTimer)
    initWhenReady(yColPos)
  //}
//  else {
    //yColPos = (typeof(yColPos) == "undefined") ? '' : yColPos
	//if(parent.printmess && document.layers){ top.close();}
//    initTimer=setTimeout('init('+yColPos+')',100)
//  }

  //document.oncontextmenu = function() {return false;};

}

var openColActive
function popupInit(yColPos) {
  if (top.topReady) {
    openColActive = (typeof(openCol) != 'undefined') ? openCol : [] ;
    WQ_Menu(openColActive,yColPos)
  } else {
    yColPos = (typeof(yColPos) == "undefined") ? '' : yColPos
    setTimeout("popupInit("+yColPos+")",200)
  }
}

function exit() {
	top.mainReady=false
}

// ######## Function: Closes current menu (when user clicks outside menu) ########
var nextUrl = ""
function removeMenu() {
	menuItemOver=false
	menuLinkOver=false

//	top.navigate_top.menuActive=false
//	top.navigate_top.hideMenu(top.navigate_top.currentMenu)

  // Changed by Glenn Nilsson 1999-11-30 
	if(nextUrl.length > 0) { // här hopppar nn vidare ... långt från där IE hoppar!! 
    stat = ""
    if (nextUrl.substring(0,9) == "popupw-1:") {
      stat = "popupw-1"
      nextUrl = nextUrl.substring(9)
    }
	if (nextUrl.substring(0,9) == "popupw-2:") {
      stat = "popupw-2"
      nextUrl = nextUrl.substring(9)
    }
    if (nextUrl.substring(0,9) == "external:") {
      stat = "external"
      nextUrl = nextUrl.substring(9)
    }
    if (nextUrl.substring(0,9) == "internal:") {
      stat = "internal"
      nextUrl = nextUrl.substring(9)
    }
	if (stat == "popupw-1") nextUrl = "window.open('"+nextUrl+"', 'set', 'width=532,height=353')"
	if (stat == "popupw-2") nextUrl = "window.open('"+nextUrl+"', 'set', 'width=736,height=450,scrollbars=no')"
    if (stat == "external") nextUrl = "window.open('"+nextUrl+"')"
    if (stat == "internal") nextUrl = "top.document.location='"+nextUrl+"'"
	
//	Changed by Glenn Nilsson 2000-04-28, next row was changed to the senond next row :)
//	if (stat == "") nextUrl = "document.location='"+nextUrl+"'"
	if (stat == "") nextUrl = "top.main.location='"+nextUrl+"'"
    eval(nextUrl)
  }
  //  End changes
}

function tandLager(lager){
	if(ns) document.layers[lager].visibility = 'show'
	else document.all.item(lager).style.visibility = ''
}
   
function slackLager(lager){
	if(ns) document.layers[lager].visibility = 'hide'
	else document.all.item(lager).style.visibility = 'hidden'
}


// Öppnar upp ett nytt fönster.
// Type=campaign | form | contactForm | release | calendar | freeWin
// Vid annat värde av Type används parametrarna width och height för storlek.

function openWin(url,type,width,height) {
	switch (type){
	case "campaign":	width=755; height=390; xAdjust=385;	break;
	case "form": 		width=360; height=332; xAdjust=405;	break;
	case "contactForm": 	width=610; height=348; xAdjust=155;	break;
	case "release": 	width=610; height=348; xAdjust=155;	break;
	case "calendar": 	width=610; height=348; xAdjust=155;	break;
	case "freeWin": 	width=610; height=348; xAdjust=155;	break;
	case "productKey":	width=750; height=365; xAdjust=385;	break;
	default: 		xAdjust=0;
	}

	window.open(url,type, 'width=' + width + ',height=' + height + ',menubar=no,resizable=no,titlebar=no,alwaysRaised=yes,status=no,scrollbars=no,left='+(screen.width/2-385)+',top='+(screen.height/2-210)+',screenX=0,screenY=0');
}

function WQ_Preload() {
  var args = WQ_Preload.arguments
  var imgArr = new Array()
  for (var i=0; i<args.length; i++) {
    imgArr[i] = new Image()
    imgArr[i].src = args[i]
  }
}

function printPage(url) {
  if (ns) {
  	top.main.print()
  } else {
  	printWin=window.open(url,'printWindow', 'width=600,height=100,menubar=no,resizable=no,titlebar=no,status=no,scrollbars=no');
  	printWin.print()
  	window.focus()
  	printWin.close()
  }
}


function openCampaign(url) {
	window.open(url,'', 'menubar=no,resizable=no,width=755,height=390,titlebar=no,status=no,scrollbars=no,left='+(screen.width/2-385)+',top='+(screen.height/2-210)+',screenX=0,screenY=0');
}

function openForm(url) {
	window.open(url,'', 'menubar=no,resizable=no,width=360,height=332,titlebar=no,status=no,scrollbars=no,left='+(screen.width/2-(385-405))+',top='+(screen.height/2-210)+',screenX=0,screenY=0');
}

function openContactForm(url) {
	window.open(url,'', 'menubar=no,resizable=no,width=610,height=348,titlebar=no,status=no,scrollbars=no,left='+(screen.width/2-(385-155))+',top='+(screen.height/2-210)+',screenX=0,screenY=0');
}

function openRelease(url) {
	window.open(url,'release', 'menubar=no,resizable=no,width=610,height=348,titlebar=no,status=no,scrollbars=no,left='+(screen.width/2-(385-155))+',top='+(screen.height/2-210)+',screenX=0,screenY=0');
}

function openCalendar(url) {
	window.open(url,'calendar', 'menubar=no,resizable=no,width=460,height=348,titlebar=no,status=no,scrollbars=no,left='+(screen.width/2-(385-155))+',top='+(screen.height/2-210)+',screenX=0,screenY=0');
}

function openFreeWin(url) {
	window.open(url,'calendar', 'menubar=no,resizable=no,width=610,height=348,titlebar=no,status=no,scrollbars=auto,left='+(screen.width/2-(385-155))+',top='+(screen.height/2-210)+',screenX=0,screenY=0');
}

function openImgPreviewWin(preview,hires) {
    window.open('/_preview.e?p='+preview+'&hires='+hires,'imagebank', 'menubar=no,resizable=no,width=610,height=410,titlebar=no,status=no,scrollbars=no,left='+(screen.width/2-(385-155))+',top='+(screen.height/2-210)+',screenX=0,screenY=0');
}

function openImgPreviewWinScroll(preview,hires) {
	window.open('/_preview.e?p='+preview+'&hires='+hires,'imagebank', 'menubar=no,resizable=no,width=482,height=352,titlebar=no,status=no,scrollbars=yes,left='+(screen.width/2-(385-155))+',top='+(screen.height/2-210)+',screenX=0,screenY=0');
}
