function openWindow(target, width ,height){
	thepopup = window.open('', target, 'width=' + width+ ',height=' + height +',toolbars=no,scrollbars=yes,resizable=yes,status=0')
	thepopup.moveTo(20,20)
	thepopup.focus()
}
function changeColourOn(element){
 document.getElementById(element).bgColor='pink'
}
function changeColourOff(element){
 document.getElementById(element).bgColor='silver'
}
var isOpen = 0

function showhide(element, value){
	if (value == false){
		document.getElementById(element).style.display='none'
	}
	else{
		document.getElementById(element).style.display='block'
	}
}//#################################################################//

function ResetRowStyle(){
	if(selectedRow){
		selectedRow.className = "normalRow"
		// set the row back to its original styles
		//selectedRow.className = "rownormal"
		//for(i=0; i < selectedRow.childNodes.length; i++){
			//if(selectedRow.childNodes[i].nodeName == "TD"){
				//selectedRow.childNodes[i].style.backgroundColor = "#ffffff"
			//}			
		//}
		// change the link colur back to its default
		//if(selectedRow.childNodes[2].childNodes[0] && selectedRow.childNodes[2].childNodes[0].nodeName == "A"){
			//alert(selectedRow.childNodes[0].childNodes[0].innerHTML)
			//selectedRow.childNodes[2].childNodes[0].style.color = ""
		//}
		//else{
			//selectedRow.childNodes[1].childNodes[0].style.color = ""
		//}
	}	
}
	
var selectedRow = null
function commonPopUpCode(e){
	if(document.all){
		var srcElement = event.srcElement; var clientX = event.clientX; var clientY = event.clientY;
		var c = getXY(event.srcElement);
	
	// check if there is already a row selected
		if(selectedRow){
			ResetRowStyle()
		}
		
		// set the current row to its selected state
		element = srcElement.parentNode.parentNode
		if(element.nodeName == "TR"){element.className = "selectedRow"}
		//for(i=0; i < element.childNodes.length; i++){
			//if(element.childNodes[i].nodeName == "TD"){
				//element.childNodes[i].style.backgroundColor = "black"
			//}
			//srcElement.style.color = "#ffffff"
		//}
		// set the current selected row into a global varialbe
		selectedRow = srcElement.parentNode.parentNode
	}
	
	else{
		var srcElement = e.target; var clientX = e.clientX; var clientY = e.clientY 
		var c = getXY(e.target);
	}
	//alert(document.body.scrollHeight)
	if(document.all){
		var topPos = document.body.scrollTop + clientY
		if((topPos + 200) > document.body.clientHeight){
			topPos = topPos - 200
		}
	}
	
	else{
		if(c.y + 220 >= document.body.scrollHeight - c.h){
			//alert(c.h)
			//alert(c.y + 220)
			//alert(document.body.scrollHeight - 220)
			var topPos = document.body.scrollHeight - 220 + "px"
		}
		else{
			var topPos = c.y  - 10 + "px"
			}
		}
	
	document.getElementById('pageDetails').style.left = 130 + "px" //event.srcElement.parentNode.offsetLeft + 100+ "px";
	document.getElementById('pageDetails').style.top = topPos //(clientY - 25)+ "px" //window.event.clientY - 45 + "px";
	document.getElementById('pageDetails').style.visibility = "visible";
	document.getElementById('pageDetails').style.zIndex = 1000;
	html = ""
	//window.status = "class = "+ element.className + ", scrollTop=" + document.body.scrollTop + ",scrollheight = " + document.body.scrollHeight 	+ ", toppos=" + topPos + ", clientHeight="+document.body.clientHeight + ", clientY=" + clientY
}

//#################################################################//
function showPopUp(intID,lockType,navID,e,elType){
commonPopUpCode(e)

if(lockType==0){
	if(elType != "page" ){
	html = html + "<div><a href='/xento/properties/properties.aspx?ID="+intID+"&elType="+ elType+"' onClick=\"openNewWindow(this.href,'properties'); document.getElementById('pageDetails').style.visibility='hidden'\" target='properties'>Properties</a></div>";
	}
	
	if(elType == "page" ){
	    html = html + "<div><a href='/xento/properties/page/properties.aspx?ID="+intID+"&elType="+ elType+"' onClick=\"openNewWindow(this.href,'properties'); document.getElementById('pageDetails').style.visibility='hidden'\" target='properties'>Properties</a></div>";
		
		html = html + "<div><a href='/page.aspx?pageID="+ intID+"' target='_blank'><img src='/xento/supporting_files/xento-images/page2.gif'/></a></div>";	
	}
	
	html = html + "<div><a href='/xento/browse_edit.aspx?manager=browse_edit&pageID="+intID+"&nav=content&edit=On' onClick=\"document.getElementById('pageDetails').style.visibility='hidden'\">Edit Page</a></div>";

	html = html + "<hr/>";

	html = html + "<div><a href='/xento/history/history.aspx?ID="+intID+"&elType=page' onClick=\"openNewWindow(this.href,'history',600,575,'no','no'); document.getElementById('pageDetails').style.visibility='hidden'\" target=\"history\">History</a></div>";
	html = html + "<div><a href='/xento/navigation/navigation.aspx?manager=navigation&navID="+ navID+"' onclick=\"document.getElementById('pageDetails').style.visibility='hidden'\">Edit Nav</a></div>";

	html = html + "<hr/>";

	//html = html + "<div><a href='/xento/delete/delete_single_element.aspx?ID="+intID+"&elType=page' onClick=\"openNewWindow(this.href,'properties'); document.getElementById('pageDetails').style.visibility='hidden'\" target='properties'>Delete Page</a></div>";
	//html = html + "<div><a href='/supporting_files/publisher/publish-element.asp?ID="+intID+"&element=page' onClick=\"openNewWindow(this.href,'properties'); document.getElementById('pageDetails').style.visibility='hidden'\" target='properties'>publish page</a></div>";
	//html = html + "<div><a href='/xento/publish/publish_single_element.aspx?ID="+intID+"&elType="+elType+"' onClick=\"openNewWindow(this.href,'properties'); document.getElementById('pageDetails').style.visibility='hidden'\" target='properties'>Publish</a></div>";
	
	//html = html + "<hr/>";

	html = html + "<div><a href='/xento/properties/viewhtml.aspx?ID="+ intID+"' onclick=\"openNewWindow(this.href,'viewhtml'); document.getElementById('pageDetails').style.visibility='hidden'\" target=\"viewhtml\">View Html</a></div>";
	//if(blnSecureAreas == 'true') {html = html + "<div><a href='/supporting_files/website_admin/secure/add-page-to-areas.asp?pageID="+ intID+"' onclick=\"openNewWindow(this.href,'edituser'); document.getElementById('pageDetails').style.visibility='hidden'\" target=\"edituser\">add page to areas</a></div>";}
	html = html + "<hr/>";

	html = html + "<div><a href='javascript:;' onClick=\"document.getElementById('pageDetails').style.visibility='hidden'; ResetRowStyle()\">Close</a></div>";
}
else if(lockType ==1){
	html = html + "<div><a href='javascript:;' class='alpha' disabled='disabled'>Properties</a></div>";
	
	if(elType == "page" ){		
		html = html + "<div><a href='/page.aspx?pageID="+ intID+"' target='_blank'><img src='/xento/supporting_files/xento-images/page2.gif'/></a></div>";	
	}
	
	html = html + "<div><a href='javascript:;' class='alpha' disabled='disabled'>Edit Page</a></div>";
	
	
	html = html + "<hr/>";

	html = html + "<div><a href='/xento/history/history.aspx?ID="+intID+"&elType=page' onClick=\"openNewWindow(this.href,'history'); document.getElementById('pageDetails').style.visibility='hidden'\" target=\"history\">History</a></div>";
	html = html + "<div><a href='javascript:;' class='alpha' disabled='disabled'>Edit Nav</a></div>";

	html = html + "<hr/>";

	//html = html + "<div><a href='javascript:;' class='alpha' disabled='disabled'> Delete Page</a></div>";	
	//html = html + "<div><a href='javascript:;' class='alpha' disabled='disabled'>Publish</a></div>";	

	//html = html + "<hr/>";

	html = html + "<div><a href='/xento/properties/viewhtml.aspx?ID="+ intID+"' onclick=\"openNewWindow(this.href,'viewhtml'); document.getElementById('pageDetails').style.visibility='hidden'\" target=\"viewhtml\">View Html</a></div>";

	html = html + "<hr/>";

	html = html + "<div><a href='javascript:;' onClick=\"document.getElementById('pageDetails').style.visibility='hidden';ResetRowStyle()\">Close</a></div>";
}
	
	setTimeout("document.getElementById('menuPopup').innerHTML = html",1)
}

//#################################################################//

function showPopUpSmall(intID,lockType,navID,e,elType){
commonPopUpCode(e)

if(lockType==0){
if(elType == "page"){
		html = html + "<div><a href='/xento/properties/page/properties.aspx?ID="+intID+"&elType="+ elType+"' onClick=\"openNewWindow(this.href,'properties'); document.getElementById('pageDetails').style.visibility='hidden'\" target='properties'>Properties</a></div>";
}
else{
		html = html + "<div><a href='/xento/properties/properties.aspx?ID="+intID+"&elType="+ elType+"' onClick=\"openNewWindow(this.href,'properties'); document.getElementById('pageDetails').style.visibility='hidden'\" target='properties'>Properties</a></div>";
}

if(elType != "tag"){
		html = html + "<div><a href='javascript:;' onClick='window.opener.location.href=\"/xento/browse_edit.aspx?manager=browse_edit&pageID=" + intID + "\"'>Edit Page</a></div>";
}
else{
		html = html + "<div><a href='/xento/edit_tag.aspx?ID="+ intID +"&manager=tag&hideNav=true' target='edittag' onClick=\"openNewWindow(this.href,'edittag'); document.getElementById('pageDetails').style.visibility='hidden'\">Edit Content</a></div>";
}
		//html = html + "<hr/>";
		//html = html + "<div><a href='/xento/publish/publish_single_element.aspx?ID="+intID+"&elType="+elType+"' onClick=\"openNewWindow(this.href,'publish_single_element'); document.getElementById('pageDetails').style.visibility='hidden'\" target='publish_single_element'>Publish</a></div>";
		html = html + "<hr/>";
if(elType != "tag"){
		html = html + "<div><a href='/xento/properties/viewhtml.aspx?ID="+ intID+"' onclick=\"openNewWindow(this.href,'viewhtml',); document.getElementById('pageDetails').style.visibility='hidden'\" target=\"viewhtml\">View Html</a></div>";
		html = html + "<hr/>";
}
		html = html + "<div><a href='javascript:;' onClick=\"document.getElementById('pageDetails').style.visibility='hidden';ResetRowStyle()\">Close</a></div>";

}
else if(lockType ==1){
	html = html + "<div><a href='javascript:;' class='alpha' disabled='disabled'>Properties</a></div>";
	html = html + "<div><a href='javascript:;' class='alpha' disabled='disabled'>Edit</a></div>";
	
	//html = html + "<hr/>";

	//html = html + "<div><a href='javascript:;' class='alpha' disabled='disabled'>Publish</a></div>";	

	html = html + "<hr/>";
if(elType != "tag"){
	html = html + "<div><a href='/xento/properties/viewhtml.aspx?ID="+ intID+"' onclick=\"openNewWindow(this.href,'viewhtml'); document.getElementById('pageDetails').style.visibility='hidden'\" target=\"viewhtml\">View Html</a></div>";
	html = html + "<hr/>";
}
	html = html + "<div><a href='javascript:;' onClick=\"document.getElementById('pageDetails').style.visibility='hidden';ResetRowStyle()\">Close</a></div>";
}
	document.getElementById('menuPopup').innerHTML = html
}

//#################################################################//
//function showPopUpProject(intID, projectName,lockType,e){
	//commonPopUpCode(e)

//if(lockType==0){
	//html = html + "<div><a href='/xento/properties/properties.aspx?ID="+intID+"' onClick=\"openNewWindow(this.href,'properties'); document.getElementById('pageDetails').style.visibility='hidden'\" target='properties'>edit properties</a></div>";
	//html = html + "<div><a href='/supporting_files/projects/project.asp?projectID="+intID+"&nav=project' document.getElementById('pageDetails').style.visibility='hidden'\">view project</a></div>";
	//html = html + "<div><p>delete project</p></div>"
	//html = html + "<div><a href='javascript:;' onClick=\"document.getElementById('pageDetails').style.visibility='hidden';ResetRowStyle()\">Close</a></div>";
//}
//else if(lockType==1){
	//html = html + "<div><p>edit project</div>";
	//html = html + "<div><a href='/supporting_files/projects/project.asp?projectName="+projectName+"&nav=project' document.getElementById('pageDetails').style.visibility='hidden'\">view project</a></div>";
	//html = html + "<div><p>delete project</p></div>";
	//html = html + "<div><a href='javascript:;' onClick=\"document.getElementById('pageDetails').style.visibility='hidden'; ResetRowStyle()\">close popup</a></div>";
//}
	//document.getElementById('menuPopup').innerHTML = html
//}

//#################################################################//
function showPopUpImage(intID,lockType,e,elType,elSource){
	commonPopUpCode(e)
	

if(lockType==0){
	if(elType == "email" || elType == "template" || elType == "sp" || elType == "article" || elType == "xsl" || elType == "tag"){
		html = html + "<div><a href='/xento/properties/properties.aspx?ID="+intID+"&elType="+ elType+"' onClick=\"openNewWindow(this.href,'properties'); document.getElementById('pageDetails').style.visibility='hidden'\" target='properties'>Properties</a></div>";
	}
	else if(elType == "flash"){
		html = html + "<div><a href='/xento/properties/flash_properties.aspx?ID="+intID+"&elType="+ elType+"' onClick=\"openNewWindow(this.href,'properties'); document.getElementById('pageDetails').style.visibility='hidden'\" target='properties'>Properties</a></div>";
	}	
	else{
		html = html + "<div><a href='/xento/properties/file_properties.aspx?ID="+intID+"&elType="+ elType+"' onClick=\"openNewWindow(this.href,'properties'); document.getElementById('pageDetails').style.visibility='hidden'\" target='properties'>Properties</a></div>";
	}
	
	if(elType == "xsl" || elType == "pdf" || elType == "doc" || elType == "zip" || elType == "excel" || elType == "ppt" || elType == "flash"){
		html = html + "<div><a href='/" + elType + "/"+ elSource+"' target='_blank'><img src='/xento/supporting_files/xento-images/" + elType +".gif'/></a></div>";	
	}
	
	if(elType == "sp"){
		var spType
		if(elSource.indexOf(".css") != -1){
			spType = "css"
			}
		else{
			spType = "js"
		}
		
		html = html + "<div><a href='/" + spType + "/"+ elSource+"' target='_blank'><img src='/xento/supporting_files/xento-images/" + elType +".gif'/></a></div>";	
	}
	
	if(elType == "template"){
		html = html + "<div><a href='/" + elSource + "' target='_blank'><img src='/xento/supporting_files/xento-images/page2.gif' /></a></div>";	
	}
	
	if(elType == "image"){
		html = html + "<div><a href='view_image.aspx?ID="+intID+"' target='viewimage'><img src='/img/" + elSource + "' width='130'/></a></div>";	
	}
	
	if(elType == "template"){
		html = html + "<div><a href='/xento/edit_template.aspx?ID="+intID+"&manager=template'>Edit Template</a></div>";	
	}
	



if(elType == "sp"){
	html = html + "<div><a href='/xento/edit_sp.aspx?ID="+intID+"&manager=sp'>Edit File</a></div>";	
}

if(elType == "tag"){
	html = html + "<div><a href='/xento/edit_tag.aspx?ID="+intID+"&manager=tag'>Edit Content</a></div>";	
}

if(elType == "xsl"){
	html = html + "<div><a href='/xento/edit_XSL.aspx?ID="+intID+"&manager=xsl'>Edit XSL</a></div>";	
}

if(elType == "email"){
	html = html + "<div><a href='/xento/email/edit_email.aspx?ID="+intID+"&manager=email'>Edit HTML Email</a></div>";	
	html = html + "<div><a href='/xento/email/edit_text_email.aspx?ID="+intID+"&manager=email'>Edit Text Email</a></div>";	

}

if(elType != "article" && elType != "xsl" && elType != "email"){
	html = html + "<hr/>";
	html = html + "<div><a href='/xento/placements/element_placements.aspx?ID="+intID+"&elSource=" + elSource + "&elType="+ elType+"&page=true' onClick=\"openNewWindow(this.href,'placements'); document.getElementById('pageDetails').style.visibility='hidden'\" target='placements'>Page Placements</a></div>";	
}

if(elType != "article" && elType != "template" && elType != "sp" && elType != "tag" && elType != "xsl" && elType != "email"){
	html = html + "<hr/>";
	html = html + "<div><a href='/xento/placements/element_tag_placements.aspx?ID="+intID+"&elType="+ elType+"&page=false' onClick=\"openNewWindow(this.href,'placements'); document.getElementById('pageDetails').style.visibility='hidden'\" target='placements'>Content Placements</a></div>";	
}
if(elType != "email"){

	html = html + "<hr/>";
	html = html + "<div><a href='/xento/history/history.aspx?ID="+intID+"&elType="+ elType+"' onClick=\"openNewWindow(this.href,'history'); document.getElementById('pageDetails').style.visibility='hidden'\" target='history'>History</a></div>";	
}		
	html = html + "<hr/>";

	//html = html + "<div><a href='/xento/publish/publish_single_element.aspx?ID="+intID+"&elType="+elType+"' onClick=\"openNewWindow(this.href,'publish_single_element'); document.getElementById('pageDetails').style.visibility='hidden'\" target='publish_single_element'>Publish</a></div>";
	//html = html + "<div><a href='/xento/delete/delete_single_element.aspx?ID="+intID+"&elType="+elType+"' onClick=\"openNewWindow(this.href,'delete'); document.getElementById('pageDetails').style.visibility='hidden'\" target='delete'>Delete</a></div>";

	//html = html + "<hr/>";

	html = html + "<div><a href='javascript:;' onClick=\"document.getElementById('pageDetails').style.visibility='hidden'; ResetRowStyle()\">Close</a></div>";
}


else if(lockType==1){
	html = html + "<div><a href='javascript:;' class='alpha' disabled='disabled'>Properties</a></div>";
	
	if(elType == "xsl" || elType == "pdf" || elType == "doc" || elType == "zip" || elType == "excel" || elType == "ppt" || elType == "flash"){
		html = html + "<div><a href='/" + elType + "/"+ elSource+"' target='_blank'><img src='/xento/supporting_files/xento-images/" + elType +".gif'/></a></div>";	
	}

	
	if(elType == "image"){
		html = html + "<div><a href='view_image.aspx?ID="+intID+"' target='viewimage'><img src='/img/" + elSource + "' width='130'/></a></div>";	
	}
	
	if(elType == "template"){
		html = html + "<div><a href='/" + elSource + "' target='_blank'><img src='/xento/supporting_files/xento-images/page2.gif' /></a></div>";	
	}

	if(elType == "sp"){
		var spType
		if(elSource.indexOf(".css") != -1){
			spType = "css"
			}
		else{
			spType = "js"
		}
		
		html = html + "<div><a href='/" + spType + "/"+ elSource+"' target='_blank'><img src='/xento/supporting_files/xento-images/" + elType +".gif'/></a></div>";	
	}

if(elType != "article" && elType != "xsl" && elType != "email"){
	html = html + "<hr/>";
	html = html + "<div><a href='/xento/placements/element_placements.aspx?ID="+intID+"&elSource=" + elSource + "&elType="+ elType+"&page=true' onClick=\"openNewWindow(this.href,'placements'); document.getElementById('pageDetails').style.visibility='hidden'\" target='placements'>Page Placements</a></div>";	
}

if(elType != "article" && elType != "template" && elType != "sp" && elType != "tag" && elType != "xsl" && elType != "email"){
	html = html + "<div><a href='/xento/placements/element_tag_placements.aspx?ID="+intID+"&elType="+ elType+"&page=false' onClick=\"openNewWindow(this.href,'placements'); document.getElementById('pageDetails').style.visibility='hidden'\" target='placements'>Content Placements</a></div>";	
}
	html = html + "<hr/>";
	html = html + "<div><a href='/xento/history/history.aspx?ID="+intID+"&elType="+ elType+"' onClick=\"openNewWindow(this.href,'history'); document.getElementById('pageDetails').style.visibility='hidden'\" target='history'>History</a></div>";	

	html = html + "<hr/>";

	//html = html + "<div><a href='javascript:;' class='alpha' disabled='disabled'>Publish</a></div>";
	//html = html + "<div><a href='javascript:;' class='alpha' disabled='disabled'>Delete</a></div>";

	//html = html + "<hr/>";

	html = html + "<div><a href='javascript:;' onClick=\"document.getElementById('pageDetails').style.visibility='hidden'; ResetRowStyle()\">Close</a></div>";
}

	setTimeout("document.getElementById('menuPopup').innerHTML = html",1)

}
 //#################################################################//
function showPopUpUser(intID,userGroups,e){
	commonPopUpCode(e)

	html = html + "<div><a href='/supporting_files/website_admin/admin/edit_user.asp?ID="+intID+"' onClick=\"openNewWindow('edituser'); document.getElementById('pageDetails').style.visibility='hidden'\" target='edituser'>edit user</a></div>"
	html = html + "<div><a href='/supporting_files/website_admin/admin/delete-user.asp?ID="+intID+"' onClick=\"window.open('','user','width=400,height=400,toolbars=no'); document.getElementById('pageDetails').style.visibility='hidden'\" target='user'>delete user</a></div>"
	if(userGroups != 0){
		html = html + "<div><a href='/supporting_files/user_groups/add-user-to-groups.asp?userID="+intID+"' onClick=\"openNewWindow('edituser'); document.getElementById('pageDetails').style.visibility='hidden'\" target='edituser'>user groups</a></div>"
	}
	html = html + "<div><a href='javascript:;' onClick=\"document.getElementById('pageDetails').style.visibility='hidden'; ResetRowStyle()\">Close</a></div>";
	document.getElementById('menuPopup').innerHTML = html
}
 //#################################################################//
function showPopUpSecureUser(intID,e){
	commonPopUpCode(e)

	html = html + "<div><a href='/supporting_files/website_admin/secure/edit_secure_user.asp?ID="+intID+"' onClick=\"openNewWindow(this.href,'edituser'); document.getElementById('pageDetails').style.visibility='hidden'\" target='edituser'>edit login</a></div>"
	html = html + "<div><a href='/supporting_files/website_admin/secure/delete-user.asp?ID="+intID+"' onClick=\"openNewWindow(this.href,'edituser'); document.getElementById('pageDetails').style.visibility='hidden'\" target='edituser'>delete login</a></div>"
	html = html + "<div><a href='/supporting_files/website_admin/secure/publish-area-login.asp?ID="+intID+"' onClick=\"openNewWindow(this.href,'edituser'); document.getElementById('pageDetails').style.visibility='hidden'\" target='edituser'>publish login</a></div>"
	html = html + "<div><a href='/supporting_files/website_admin/secure/add-user-to-areas.asp?userID="+intID+"' onClick=\"openNewWindow(this.href,'edituser'); document.getElementById('pageDetails').style.visibility='hidden'\" target='edituser'>secure areas</a></div>"
	html = html + "<div><a href='javascript:;' onClick=\"document.getElementById('pageDetails').style.visibility='hidden'; ResetRowStyle()\">Close</a></div>";

	document.getElementById('menuPopup').innerHTML = html
}

 //#################################################################//
function showPopUpSecureArea(intID,e){
	commonPopUpCode(e)

	html = html + "<div><a href='/supporting_files/website_admin/secure/edit_secure_area.asp?ID="+intID+"' onClick=\"openNewWindow(this.href,'edituser'); document.getElementById('pageDetails').style.visibility='hidden'\" target='edituser'>edit area</a></div>"
	html = html + "<div><a href='/supporting_files/website_admin/secure/publish-area.asp?ID="+intID+"' onClick=\"openNewWindow(this.href,'edituser'); document.getElementById('pageDetails').style.visibility='hidden'\" target='edituser'>publish area</a></div>"
	html = html + "<div><a href='/supporting_files/website_admin/secure/delete-area.asp?ID="+intID+"' onClick=\"openNewWindow(this.href,'edituser'); document.getElementById('pageDetails').style.visibility='hidden'\" target='edituser'>delete area</a></div>"
	html = html + "<div><a href='javascript:;' onClick=\"document.getElementById('pageDetails').style.visibility='hidden'; ResetRowStyle()\">Close</a></div>";
//html = html + "<div><a href='/supporting_files/website_admin/secure/add-user-to-areas.asp?userID="+intID+"' onClick=\"openNewWindow(this.href,'edituser'); document.getElementById('pageDetails').style.visibility='hidden'\" target='edituser'>secure areas</a></div>"
	
	document.getElementById('menuPopup').innerHTML = html
}
//#################################################################//
/*function myFunction(value){
	delete_entry = confirm("are you sure you want to delete this page");
		if (delete_entry == true){
			window.location.href = "/supporting_files/website_admin/content/delete-page.asp?ID="+ value+""
		}
}*/
function reloadMyPage(){ window.location.reload() }

//#################################################################//

timeout=null
timer=1500

function startTimer(){
if (window.event.srcElement.tagName == "SELECT" || window.event.srcElement.tagName == "INPUT"){
timer=120000
}

else {
timer=5000
}
timeout = setTimeout('window.close(this)',timer)
//test.innerHTML = timer + " on " + window.event.srcElement.tagName
}

function cancelTimer(seconds){
window.clearTimeout(timeout)
//test.innerHTML = timer + " off " + window.event.srcElement.tagName
}

//#################################################################//
function changeTR(element, colour){
		if(element.className != "selectedRow"){
			element.className = "normalRowOver"
		}
	//for(i=0; i < element.childNodes.length; i++){
		//if(element.childNodes[i].nodeName == "TD" && element.childNodes[i].style.backgroundColor != "black"){
			//element.childNodes[i].style.backgroundColor = colour
		//}
	//}
	
	if(document.getElementById('pageDetails').style.visibility=='hidden'){
		ResetRowStyle()
	}	
}

function changeTRBack(element, colour){
	if(element.className != "selectedRow"){
		element.className = "normalRow"
		//for(i=0; i < element.childNodes.length; i++){
			//if(element.childNodes[i].nodeName == "TD"){
			//element.childNodes[i].style.backgroundColor = "" //colour
			//}
		//}
	}
	
	if(document.getElementById('pageDetails').style.visibility=='hidden'){
		ResetRowStyle()
	}
}
//#################################################################//
function cancelEvent(){
	    window.event.cancelBubble = true;
}

//#################################################################//
function checkDay(posMonth, elValue, elName){

Month = document.getElementById(posMonth).value

switch (elValue) {
	case "31":
		if(Month =="02"){
			document.getElementById(elName).value = "28"
		}
 	else
 		if(Month == "04" || Month== "06" || Month == "09" || Month == "11" && elValue > parseInt("28")){
  			document.getElementById(elName).value = "30" }
 	break;
 	default:
 	break;
	}
}

 //#################################################################//
 function checkMonth(posDay,elValue){ 
 	 NumberOfDays = document.getElementById(posDay).value;	
	 	switch (elValue) {
			case "02":
				if(NumberOfDays > 28){
					document.getElementById(posDay).value = "28"
				}
			 break;
	  		case "04":
	  			if(NumberOfDays > 30){
	   				document.getElementById(posDay).value = "30"
	    		}
			break;
	 		case "06":
	 			if(NumberOfDays > 30){
					document.getElementById(posDay).value = "30"
				}
	  		break;
	  		case "09":
				if(NumberOfDays > 30){
					document.getElementById(posDay).value = "30"
				}
	 		break;
	  		case "11":
				if(NumberOfDays > 30){
					document.getElementById(posDay).value = "30"
				}
	 		break;
			default:
			break;
	 }
 }
 
//#################################################################//
function openBentoWindow(target, width, height, resize, canscroll){

	if(resize == "yes"){
		resize = ", resizable=yes"
	}
	scrolling = ""
	if(canscroll == "yes"){
		scrolling = ", scrollbars=yes"
	}
	screenWidth = window.screen.Width
	screenHeight = window.screen.Height
	screenAvailWidth = window.screen.availWidth
	screenAvailHeight = window.screen.availHeight
	wastedWidth = screenWidth - screenAvailWidth
	wastedHeight = screenHeight - screenAvailHeight
	popupWidth = width
	popupHeight = height
	screenWidthCentre = (screenAvailWidth / 2) + wastedWidth
	screenHeightCentre = (screenHeight / 2)
	Left = screenWidthCentre - ((popupWidth + 8) / 2)
	Top = screenHeightCentre - (popupHeight/ 2)
	target = window.open('', target, 'width='+popupWidth+',height='+popupHeight+',left ='+Left+',top='+Top+ resize + scrolling +',status=1')
	target.moveTo(Left,Top)
	target.resizeTo( width,height)
	target.focus()
}

//#################################################################//

function openBentoWindowWithUrl(url,target, width, height){
	screenWidth = window.screen.Width
	screenHeight = window.screen.Height
	screenAvailWidth = window.screen.availWidth
	screenAvailHeight = window.screen.availHeight
	wastedWidth = screenWidth - screenAvailWidth
	wastedHeight = screenHeight - screenAvailHeight
	popupWidth = width
	popupHeight = height
	screenWidthCentre = (screenAvailWidth / 2) + wastedWidth
	screenHeightCentre = (screenHeight / 2)
	Left = screenWidthCentre - ((popupWidth + 8) / 2)
	Top = screenHeightCentre - (popupHeight/ 2)
	target = window.open(url, target, 'width='+popupWidth+',height='+popupHeight+',left ='+Left+',top='+Top+', resizable=no,status=1')
	target.moveTo(Left,Top)
	target.resizeTo( width,height)
	target.focus()
	return false
}
//<summary>
//
//</summary>
function DisplayCloseButton(){
document.write('<img src="/xento/supporting_files/xento-images/close_icon.gif" align="right" title="close" onclick="parent.frames[\'editframeset2\'].cols=\'0,*\';parent.frames[\'editbar\'].frameOpen = \'False\'" />')
}

//<summary>
//
//</summary>
function showPopUpCustomContent(intID,catalogName,lockType,intAdminLevel,e){
	commonPopUpCode(e)
	if(lockType == "1"){
	
		html = html + "<div><a href='javascript:;' class='alpha' disabled='disabled'>Properties</a></div>";
		html = html + "<div><a href='javascript:;' class='alpha' disabled='disabled'>Edit Common Content</a></div>";
		
		if(userLevel >= intAdminLevel){		
			html = html + "<div><a href='javascript:;' class='alpha' disabled='disabled'>Amend XML Nodes</a></div>";
			html = html + "<hr/>";
		}
		html = html + "<div><a href='/xento/manager/manager.aspx?manager=item&typeID="+intID+"'>View Content Items</a></div>";
		if(userLevel >= intAdminLevel){
			html = html + "<hr/>";
			html = html + "<div><a href='javascript:;' class='alpha' disabled='disabled'>Publish</a></div>"
		}
	}
	else {
		html = html + "<div><a href='/xento/properties/properties.aspx?elType=custom_content&ID=" + intID + "' onClick=\"openNewWindow(this.href,'properties'); document.getElementById('pageDetails').style.visibility='hidden'\" target='properties'>Properties</a></div>";
		html = html + "<div><a href='/xento/custom_content/editCommonContent.aspx?contentID=" + intID + "' onclick=\"openNewWindow(this.href,'editcustomcontent'); document.getElementById('pageDetails').style.visibility='hidden'\" target='editcustomcontent'>Edit Common Content</a></div>";
		
		if(userLevel >= intAdminLevel){
			html = html + "<div><a href='/xento/custom_content/content_type_nodes.aspx?ctype=" + intID + "' onclick=\"openNewWindow(this.href,'amendnodes'); document.getElementById('pageDetails').style.visibility='hidden'\" target='amendnodes'>Amend XML Nodes</a></div>";
			html = html + "<hr/>";
		}
		
		html = html + "<div><a href='/xento/manager/manager.aspx?manager=item&typeID="+intID+"' document.getElementById('pageDetails').style.visibility='hidden'\">View Content Items</a></div>";
		
		if(userLevel >= intAdminLevel){
			html = html + "<hr/>";
			html = html + "<div><a href='/xento/publish/publish_content_type.aspx?elType=custom_content&ID="+intID+"' onClick=\"openNewWindow(this.href,'publish_single_element'); document.getElementById('pageDetails').style.visibility='hidden'\" target='publish_single_element'>Publish</a></div>"
		}
	}


	html = html + "<hr/>";
	html = html + "<div><a href='javascript:;' onClick=\"document.getElementById('pageDetails').style.visibility='hidden'; ResetRowStyle()\">Close</a></div>";
	document.getElementById('menuPopup').innerHTML = html
}
//<summary>
//
//</summary>
function showPopUpItem(intID,typeID,itemName,lockType,e){
	commonPopUpCode(e)
	if(lockType == "1"){
	html = html + "<div><a href='javascript:;' class='alpha' disabled='disabled'>Properties</a></div>";
	html = html + "<div><a href='javascript:;' class='alpha' disabled='disabled'>Edit</a></div>";
	html = html + "<hr/>";
	html = html + "<div><a href='/xento/custom_content/view_xml.aspx?itemID="+intID+"&typeID=" + typeID + "' onClick=\"openNewWindow(this.href,'viewxml'); document.getElementById('pageDetails').style.visibility='hidden'\" target='viewxml''>View XML</a></div>";
	html = html + "<hr/>";
	html = html + "<div><a href='/xento/history/history.aspx?ID="+intID+"&elType=item&typeID="+ typeID+"' onClick=\"openNewWindow(this.href,'history'); document.getElementById('pageDetails').style.visibility='hidden'\" target=\"history\">History</a></div>";
	html = html + "<div><a href='javascript:;' class='alpha' disabled='disabled'>Publish</a></div>"
	html = html + "<hr/>";
	html = html + "<div><a href='javascript:;' onClick=\"document.getElementById('pageDetails').style.visibility='hidden'; ResetRowStyle()\">Close</a></div>";
	}
	
	else{
	html = html + "<div><a href='/xento/properties/properties.aspx?ID="+intID+"&elType=item' onClick=\"openNewWindow(this.href,'properties'); document.getElementById('pageDetails').style.visibility='hidden'\" target='properties'>Properties</a></div>";
	html = html + "<div><a href='/xento/custom_content/add_item.aspx?itemID="+intID+"&typeID=" + typeID + "' onClick=\"openNewWindow(this.href,'add_content_item'); document.getElementById('pageDetails').style.visibility='hidden'\" target='add_content_item'>Edit</a></div>";
	html = html + "<hr/>";
	html = html + "<div><a href='/xento/custom_content/view_xml.aspx?itemID="+intID+"&typeID=" + typeID + "' onClick=\"openNewWindow(this.href,'viewxml'); document.getElementById('pageDetails').style.visibility='hidden'\" target='viewxml''>View XML</a></div>";
	html = html + "<hr/>";
	html = html + "<div><a href='/xento/history/history.aspx?ID="+intID+"&elType=item&typeID="+ typeID+"' onClick=\"openNewWindow(this.href,'history'); document.getElementById('pageDetails').style.visibility='hidden'\" target=\"history\">History</a></div>";
	html = html + "<div><a href='/xento/publish/publish_content_item.aspx?ID=" + intID + "&elType=item&typeID=" + typeID + "' onClick=\"openNewWindow(this.href,'publish_single_element'); document.getElementById('pageDetails').style.visibility='hidden'\" target='publish_single_element'>Publish</a></div>"
	html = html + "<hr/>";
	html = html + "<div><a href='/xento/delete/delete_single_element.aspx?ID=" + intID + "&elType=item' onClick=\"openNewWindow(this.href,'delete'); document.getElementById('pageDetails').style.visibility='hidden'\" target='delete'>Delete</a></div>";
	html = html + "<div><a href='javascript:;' onClick=\"document.getElementById('pageDetails').style.visibility='hidden'; ResetRowStyle()\">Close</a></div>";
	}
	document.getElementById('menuPopup').innerHTML = html
}

//<summary>
//
//</summary>
function showPopUpRegUser(Id,Username,lockType,e,elType,elSource){
	commonPopUpCode(e)
	if(lockType == "1"){
		html = html + "<div><a href='javascript:;' class='alpha' disabled='disabled'>Edit Settings</a></div>";
	}
	
	else{
		html = html + "<div><a href='/xento/admin/edit_user.aspx?ID="+Id+"' onClick=\"openNewWindow(this.href,'properties'); document.getElementById('pageDetails').style.visibility='hidden'\" target='properties'>Edit User</a></div>";
        html = html + "<div><a href='/xento/admin/user_role.aspx?ID="+Username+"' onClick=\"openNewWindow(this.href,'properties'); document.getElementById('pageDetails').style.visibility='hidden'\" target='properties'>User Roles</a></div>";

	}
	
	document.getElementById('menuPopup').innerHTML = html
}

//<summary>
//
//</summary>
function showPopUpJob(intID,lockType,e,elType,elSource){
	commonPopUpCode(e)

	if(lockType == 1){
		html = html + "<div><a href='javascript:;' class='alpha' disabled='disabled'>Edit</a></div>";
	}
	
	else{
		html = html + "<div><a href='/xento/" + elType + "/edit_" + elType + ".aspx?" + elType + "ID="+intID+"' onClick=\"openNewWindow(this.href,'editjob'); document.getElementById('pageDetails').style.visibility='hidden'\" target='editjob'>Edit</a></div>";
	}
		
		html = html + "<div><a href='javascript:;' onClick=\"document.getElementById('pageDetails').style.visibility='hidden'; ResetRowStyle()\">Close</a></div>";

	
	document.getElementById('menuPopup').innerHTML = html
	}
	
//<summary>
//
//</summary>
function openNewWindow(url,type){

var popupWidth;
var popupHeight;

	switch(type){
		case "viewhtml":
			popupWidth = 800;
			popupHeight = 600;
			break;	
		
		case "editcustomcontent":
			popupWidth = 800;
			popupHeight = 600;
			break;	
		
		case "viewxml":
			popupWidth = 800;
			popupHeight = 600;
			break;	
				
		case "main_publisher":
			popupWidth = 700;
			popupHeight = 635;
			break;
		
		case "publish_single_element":
			popupWidth = 400;
			popupHeight = 580;
			break;
		
		case "properties":
			popupWidth = 420;
			popupHeight = 580;
			break;
			
		case "addnew":
			popupWidth = 420;
			popupHeight = 580;
			break;	
		
		case "delete":
			popupWidth = 400;
			popupHeight = 580;
			break;
		
		case "addnewcontenttype":
			popupWidth = 400;
			popupHeight = 580;
			break;
		
		case "upload":
			popupWidth = 400;
			popupHeight = 420;
			break;
			
		case "amendnodes":
			popupWidth = 490;
			popupHeight = 580;
			break;	
		
		case "history":
			popupWidth = 610;
			popupHeight = 580;
			break;
		
		case "edittag":
			popupWidth = 800;
			popupHeight = 600;
			break;
			
		case "viewhtml":
			popupWidth = 800;
			popupHeight = 620;		
			break;	
		
		case "placements":
			popupWidth = 600;
			popupHeight = 575;		
			break;	
		
		case "edituser":
			popupWidth = 500;
			popupHeight = 500;		
			break;	
		
		case "editjob":
			popupWidth = 800;
			popupHeight = 700;		
			break;	
		
		case "inactive_nav":
			popupWidth = 600;
			popupHeight = 620;		
			break;
			
		case "amend_content_item":	
			popupWidth = 500;
			popupHeight = 575;		
			break;	
		
		case "add_content_item":	
			popupWidth = 590;
			popupHeight = 575;		
			break;
		
		case "form_response":
			popupWidth = 600;
			popupHeight = 630;		
			break;
			
		case "view_form_response":
			popupWidth = 600;
			popupHeight = 630;		
			break;
		
		case "email_addresses":
			popupWidth = 600;
			popupHeight = 630;		
			break;
		
		default:
			popupWidth = 800;
			popupHeight = 700;
		break;
	}
	
	var screenWidth = window.screen.Width
	var screenHeight = window.screen.Height
	var screenAvailWidth = window.screen.availWidth
	var screenAvailHeight = window.screen.availHeight
	var wastedWidth = screenWidth - screenAvailWidth
	var wastedHeight = screenHeight - screenAvailHeight
	
	var screenWidthCentre = (screenAvailWidth / 2) + wastedWidth
	var screenHeightCentre = (screenHeight / 2)
	var Left = screenWidthCentre - ((popupWidth + 8) / 2)
	var Top = screenHeightCentre - (popupHeight/ 2)
	var target = window.open(url, type, 'width='+popupWidth+',height='+popupHeight+',left ='+Left+',top='+Top+', resizable=no,status=1')
	
	target.moveTo(Left,Top)
	target.resizeTo( popupWidth,popupHeight)
	target.focus()
	return false
}
