<!--
//functions for dynamic summary pages

/**
 * (c) Copyright 2001-2002 netdecisions Limited.  This file is the copyright
 * and confidential information of netdecisions Limited or one of its
 * group of companies ("netdecisions") and may not be used in whole or in
 * part without the prior written consent of netdecisions or pursuant to
 * a licence granted by netdecisions allowing such use.
 **/

var isPostingEdit = false;
var isPostingDelete = false;

function setEdit() {
	isPostingEdit = true;
	isPostingDelete = false;
}

function setDelete() {
	isPostingEdit = false;
	isPostingDelete = true;
}

function setCreate() {
	isPostingEdit = false;
	isPostingDelete = false;
}


// functions for author tree

// Switch between author tree and editor console
function openTree(n){
	a=document.getElementById("tree");
	b=document.getElementById("editorOptions");
	c=document.getElementById("treeLink");
	d=document.getElementById("consoleHeader")
	a.style.display=a.style.display=='block'?'none':'block';
	b.style.display=a.style.display=='none'?'block':'none';
	c.innerHTML=c.innerHTML=="Switch To Site Tree"?"Switch To Editor Console":"Switch To Site Tree";
	d.innerHTML=d.innerHTML=="EDITOR CONSOLE"?"SITE TREE":"EDITOR CONSOLE";
}	

// Set base href for image
host = "http://" + location.hostname 
minusGif = host + "/InvensysGlobal/Resources/images/author/tree_minus.gif";
plusGif = host + "/InvensysGlobal/Resources/images/author/tree_plus.gif";

// Show/hide channels and postings
function switchTree(n){
	a=n.parentNode.getElementsByTagName('div')[0];
	b=n.parentNode.getElementsByTagName('img')[0];
	a.style.display=a.style.display=='block'?'none':'block';
	b.src=b.src==minusGif?plusGif:minusGif;
}	

// Presentation console 

var dragOn=0
var dragDiv=null;
var dragX=0,dragY=0;
var zMax=0;
var dragInit=0;

function initDrag() {
	if (document.layers) 
	   document.captureEvents(Event.MOUSEMOVE|Event.MOUSEDOWN|Event.MOUSEUP);
	document.onmousemove=dragf;
	document.onmousedown=dragf;
	document.onmouseup=dragf;
	dragDiv=null;
	dragInit=1;
	if (document.getElementsByTagName) 
	   zMax=document.getElementsByTagName("DIV").length;
	else if (document.all) zMax=document.body.all.tags("DIV").length;
	else if (document.layers) zMax=document.layers.length;
}

function dragf(arg) {
	ev=arg?arg:event;
	if (dragDiv && ev.type=="mousedown") {
		dragOn=1;
		dragX=(ev.pageX?ev.pageX:ev.clientX)-parseInt(dragDiv.style.left);
		dragY=(ev.pageY?ev.pageY:ev.clientY)-parseInt(dragDiv.style.top);
		dragDiv.style.zIndex=zMax++; // remove this line to preserve z-indexes
		return false;
	}
	if (ev.type=="mouseup") {
		dragOn=0;
	}
	if (dragDiv && ev.type=="mousemove" && dragOn) {
		dragDiv.style.left=(ev.pageX?ev.pageX:ev.clientX)-dragX;
		dragDiv.style.top=(ev.pageY?ev.pageY:ev.clientY)-dragY;
		return false;
	}
	if (ev.type=="mouseout") {
		if (!dragOn) dragDiv=null;
	}
}

function drag(div) {
	if (!dragInit) initDrag();
	if (!dragOn) {
		dragDiv=document.getElementById?document.getElementById(div): 
		document.all?document.all[div]:document.layers?document.layers[div]:null;
		if (document.layers) dragDiv.style=dragDiv;
		dragDiv.onmouseout=dragf;
	}
}

function OpenCloseDiv(divName){
	if (divName.style.display == "none") {
		divName.style.display="block";
	}
	else {
		divName.style.display="none";
	}
}
//-->