/*

'//=-----------------------------------------------------------------------------------------=
'
'    Title:	Common Publisher Functions
'    Date:	2004-06-14 [yyyy-mm-dd]
'    Version:	1.00
'
'		Copyright (c) 2002-2004 Thomas Kjoernes / IPV - www.ipv.no
'
'    Contents:
'
'//=-----------------------------------------------------------------------------------------= */


var	currentTab;

var	currentItem = 0;
var	currentType = "";
var	currentCmd = "";

var	previousItem = 0;
var	previousType = "";
var	previousCmd = "";



function doToolbarOut(item) {

	item.className = "ToolbarIcon";

}


function doToolbarOver(item) {

	item.className = "ToolbarOver";

}


function doToolbarDown(item) {

	item.className = "ToolbarDown";

}


function doToolbarClick(item, cmd) {

	item.className = "ToolbarOver";

	previousCmd = currentCmd;
	currentCmd = cmd;
	
	if (cmd == "Save") {
		
		idFrame.doSave();
	}
	
	else if (cmd == "NewFolder") {
		
		idFrame.doNewFolder();
	}

	else if (cmd == "NewDocument") {

		idFrame.doNewDocument();
	}

	else if (cmd == "NewImage") {

		idFrame.doNewImage();
	}

	else if (cmd == "Cut" & currentItem != 0) {
		
		previousItem = currentItem;
		previousType = currentType;
	}

	else if (cmd == "Copy" & currentItem != 0) {
		
		previousItem = currentItem;
		previousType = currentType;
	}

	else if (cmd == "Paste" & previousCmd == "Cut" & previousItem != 0) {
		
		idFrame.doCutPaste(previousType, previousItem);
		
		currentCmd = "";
		previousCmd = "";
		previousType = "";
		previousItem = 0;
	}

	else if (cmd == "Paste" & previousCmd == "Copy" & previousItem != 0) {
		
		idFrame.doCopyPaste(previousType, previousItem);
		
		currentCmd = "";
		previousCmd = "";
		previousType = "";
		previousItem = 0;
	}

	else if (cmd == "Delete" & currentItem != 0) {

		idFrame.doDelete(currentType, currentItem);
		
		currentCmd = "";
		previousCmd = "";
		previousType = "";
		previousItem = 0;
	}

	else if (cmd == "Help") {
	
	//	alert("Help");
	
	}
	
	else {
	
	//	alert("Nothing to do!");
	
	}


}


function doSelectTab(tab) {

	if (currentTab != null) {

		document.getElementById("idTab" + currentTab).className = "TabNormal";

		document.getElementById("idSection" + currentTab).style.display = "none";

	}

	document.getElementById("idTab" + tab).className = "TabSelect";

	document.getElementById("idSection" + tab).style.display = "block";

	currentTab = tab;

}


/* Handles 'onMouseOver' for MenuBar items */

function doMenuBarSelect(item) {

	item.className = "MenuBarSelect";
}


/* Handles 'onMouseOut' for MenuBar items */

function doMenuBarNormal(item) {

	item.className = "MenuBarNormal";
}


/* Handles 'onMouseOver' for MenuBox items */

function doMenuBoxSelect(item) {

	item.className = "MenuBoxSelect";
}


/* Handles 'onMouseOut' for MenuBox items */

function doMenuBoxNormal(item) {

	item.className = "MenuBoxNormal";
}


/* */

function verifyPassword() {

	if (document.formUser.Password.value != document.formUser.elements("_Password:Text").value) {

		document.formUser.ButtonUpdate.disabled = true;

		document.getElementById("FormPassStatus").innerHTML = "* " + document.formUser.elements("PassStatusBad").value;

	}

	else {

		document.formUser.ButtonUpdate.disabled = false;

		document.getElementById("FormPassStatus").innerHTML = "";

	}
}


/* */

function doPopup(pURL, pWidth, pHeight) {

	doPopupEx(pURL, pWidth, pHeight, "no", "no");

}


/* */

function doPopupEx(pURL, pWidth, pHeight, pScroll, pResize) {

var	w = pWidth;
var	h = pHeight;

	if (w==0) {

		w = screen.availWidth-20;
	}

	if (h==0) {

		h = screen.availHeight-20;
	}

var	x = (screen.availWidth - w) / 2;
var	y = (screen.availHeight - h) / 2;

	window.open(pURL, "", "left=" + x + ", top=" + y + ", width=" + w + ", height=" + h + ", location=no, menubar=no, status=no, toolbar=no, scrollbars=" + pScroll + ", resizable=" + pResize + "");

}


function doBrowseImage(target) {

	doPopup("/browse.asp?target=" + target, 750, 550);

}

