// Expanding Menues v1.0
// by Terje Soerheim 2001
function showMenu(clicked) {
	//alert(clicked);
	//alert('Last clicked: ' + last);
	nrOfMenues = document.all.menuArea.children.length;
	
	for (i=0; i<nrOfMenues; i++) {
		menuItem = document.all.menuArea.children[i];
		if (menuItem.id == clicked) {
			// Is the clicked one visible or not
			if (menuItem.children[1].style.visibility != 'visible') {
				menuItem.children[1].style.visibility = 'visible';
			} else {
				menuItem.children[1].style.visibility = 'hidden';
			} // End else-if
		} else {
			menuItem.children[1].style.visibility = 'hidden';
		} // End if
	} // End for-loop

}



// Window Resizer 1.0
// by Terje Soerheim 2001
// win = The window you want to resize
// win2= The window below the one you resize
function resize(win,win2) {
	var DragFrom = parseInt(window.event.clientY,10) - parseInt(document.all[win].style.top); 
	document.all[win].style.height = DragFrom;
	// If there is no windows below the selected one
	if (win2 != '') {
		var NewTopPos = parseInt(window.event.clientY,10)+10 //DragFrom + 20; //parseInt(document.all[win].style.height,10) + 20; // 20 is the space between
		document.all[win2].style.top = NewTopPos;
	}
}
function initPositions() {
	// Set top and left position.
	// Set window height
	// This settings can be loaded from a textfile created in a SOCP module..?

	win = 'window1';
	document.all[win].style.top = 110;
	document.all[win].style.left = 60;
	document.all[win].style.height = 250;
	document.all[win].style.width = 370;
	
	document.all['window2'].style.top = 360;
	document.all['window2'].style.left = 60;
	document.all['window2'].style.height = 250;
	document.all['window2'].style.width = 370;
	
	document.all['window3'].style.top = 110;
	document.all['window3'].style.left = 440;
	document.all['window3'].style.height = 500;
	document.all['window3'].style.width = 400;
}
function maximize(win) {
	// Must store the selected windows settings before maximizing it
		// Maybe it's best to open a new HTML-file instead?
		// Or show another window and load the content into that frame?
	// Maximize window
	var startPosY = 110;
	var startPosX = 60;
	var newWidth = parseInt(document.all[win].style.width,10) * 2 + 40;
	document.all[win].style.left = startPosX;
	document.all[win].style.top = startPosY;
	document.all[win].style.width = newWidth;
	document.all[win].style.height = '500';
	document.all[win].style.zIndex = 1; // When minimize this should be set to 0
}

	function checkAccess(arg){
		if (confirm("You have request a secure area - to access this you need a username and password")) {
			if(arg==2) {
				window.location="http://partner.superoffice.com/portal/applications/discussion/default.asp?forumid=22";
			}
			else{
				window.location="http://partner.superoffice.com";
			}
		}
		else {
			//Nothing is happening!
		}
	}

// Open window for displaying news and slideshow
function inWindow(source,use) {
	if (use=='news') {
		strWidth = 400;
		strHeight= 400;
	} else if (use=='slideshow') {
		strWidth = 650;
		strHeight= 400;
	}
	window.open(source,"","Width=" + strWidth + ",Height=" + strHeight + ",scrollbars=yes",0);
}

function openChat(arg) {
	webChat = window.open(arg,"Live_support","Width=600,Height=400,scrollbars=yes",0);
}


