function selectIcon(id){
	opener.document.getElementById('iconId').value = id;
	opener.document.images['iconImage'].src = 'DisplayEngine/TreeIcon.php?icon=' + id;
	this.close();
}
function viewIcons(){
	window.open('iconView.php','IconView','WIDTH=300, HEIGHT=200,scrollbars=1');
}
function doDelete(id,page){
	if (confirm("Are you sure you want to delete this record")){
		document.location.href = page + '?action=5&id=' + id;
	}
}
function setIFrameHeight(){
	var height	 = document.body.scrollHeight;
	height	 = height - 100;
	document.getElementById('menuFrame').style.height = height + "px";
}
function openBranch(id){
	if (document.getElementById(id)){
		var obj	= document.getElementById(id);
		if (obj.style.display == 'inline'){
			obj.style.display = 'none';
		}else{
			obj.style.display = 'inline';
			//reverseLookUpTree(id);
		}
	}
}

function openBranchLoad(id){
	if (document.getElementById(id)){
		var obj	= document.getElementById(id);
		if (obj.style.display == 'inline'){
			obj.style.display = 'none';
		}else{
			obj.style.display = 'inline';
			reverseLookUpTree(id);
		}
	}
}
function reverseLookUpTree(pId){
	if (document.getElementById(pId).parentElement){
		id = document.getElementById(pId).parentElement.id;
		if (id == ""){
			return false;
		}else{
			document.getElementById(id).style.display = 'inline';
			reverseLookUpTree(id);
		}
	}
}


var oldWindow = "";

function openWin(id){
  if (oldWindow){
    oldWindow.close()
  }
  //image source processing /////////////////////////////////////////////////////
  imgSrc   = 'viewFull.php?id=' + id;
  
  //html string creation ////////////////////////////////////////////////////////
  html = '<html>';
  html += '<head>';
  html += '<title>Photo Album</title>';
  html += '<scr' + 'ipt>\n';
  html += 'function deleteLoad(){\n';
  html += 'document.getElementById("loadLayer").innerHTML = "";\n';
  html += '}\n';
  html += '</scr' + 'ipt>';
  html += '</head>';
  html += '<body bgcolor="#000000;" topmargin="0" marginheight="0" leftmargin="0" marginwidth="0"><span id="loadLayer" style="font-family:Arial;font-weight: bold; font-size: 20px;color: #ffffff;"><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Loading, please wait ...</span>';
  html += '<img src="'+imgSrc+'" onLoad="resizeTo(document.imageLarge.width+10,document.imageLarge.height+60);deleteLoad()" name="imageLarge">';
  html += '</body>';
  html += '</html>';
  
  //window opening processing //////////////////////////////////////////////////
  winProp           = "width=400, height=300,status=yes";
  var imgWindow     = window.open('','',winProp);
  imgWindow.document.write(html);
  oldWindow = imgWindow;
  imgWindow.focus();
  imgWindow = null;
}
