function testWin(){
 if (typeof win != 'undefined')
     if (win.closed) history.go(0)
}

function adminpopup(myURL){
  win=window.open(myURL,'admin','width=800, height=600, menubar=no, scrollbars=yes')
}

function windowPopUp(myTargetURL, myWindowName, myWindowWidth, myWindowHeight, myWindowPosX, myWindowPosY, myAllowResize, myAllowScrollbar, myAllowToolbar, myAllowLocationBox, myAllowDirectories, myAllowWindowStatus, myAllowMenuBar, myAllowCopyHistory)
{
	window.onerror=null;
	//var agt=navigator.userAgent.toLowerCase();
	windowAttributes = '';
	windowAttributes += 'width=' + myWindowWidth;
	windowAttributes += ',height=' + myWindowHeight;
	windowAttributes += ',resizable=' + myAllowResize;
	windowAttributes += ',scrollbars=' + myAllowScrollbar;
	windowAttributes += ',toolbar=' + myAllowToolbar;
	windowAttributes += ',location=' + myAllowLocationBox;
	windowAttributes += ',directories=' + myAllowDirectories;
	windowAttributes += ',status=' + myAllowWindowStatus;
	windowAttributes += ',menubar=' + myAllowMenuBar;
	windowAttributes += ',copyhistory=' + myAllowCopyHistory;
	newPopupWindow = window.open(myTargetURL,myWindowName,windowAttributes);
	newPopupWindow.moveTo(myWindowPosX - (myWindowWidth/2), myWindowPosY - (myWindowHeight/2));
	newPopupWindow.focus();
}

function adminPopup(myTargetURL, myAction, myWindowName)
{
	realTargetURL = myTargetURL + '&a=' + myAction;
	if (myAction == "DELETE")
	{
		allowPopup = confirm("Are you sure you want to delete this item?");
		if (allowPopup)
		{
			windowPopUp(realTargetURL, myWindowName, 300, 70, (window.screen.width/2), (window.screen.height/2), 'yes', 'yes', 'no', 'no', 'no', 'yes', 'no', 'no');
		}		
	}
	else if (myAction == "DELETEARTICLE")
	{
		allowPopup = confirm("Are you sure you want to delete this article?\n\nDoing so will also delete all the content below.");
		if (allowPopup)
		{
			windowPopUp(realTargetURL, myWindowName, 300, 70, (window.screen.width/2), (window.screen.height/2), 'yes', 'yes', 'no', 'no', 'no', 'yes', 'no', 'no');
		}		
	}
	else if (myAction == "DELETEUSER")
	{
		allowPopup = confirm("Are you sure you want to delete this user?\n\n");
		if (allowPopup)
		{
			windowPopUp(realTargetURL, myWindowName, 300, 70, (window.screen.width/2), (window.screen.height/2), 'yes', 'yes', 'no', 'no', 'no', 'yes', 'no', 'no');
		}		
	}
	else if (myAction == "DELETESERVICE")
	{
		allowPopup = confirm("Are you sure you want to delete this service?\n\n");
		if (allowPopup)
		{
			windowPopUp(realTargetURL, myWindowName, 300, 70, (window.screen.width/2), (window.screen.height/2), 'yes', 'yes', 'no', 'no', 'no', 'yes', 'no', 'no');
		}		
	}
	else
	{
		windowPopUp(realTargetURL, myWindowName, 500, 500, (window.screen.width/2), (window.screen.height/2), 'yes', 'yes', 'no', 'no', 'no', 'yes', 'no', 'no');
	}
}

function adminServicePopup(myTargetURL, myAction, myWindowName)
{
	realTargetURL = myTargetURL + '&a=' + myAction;
	windowPopUp(realTargetURL, myWindowName, 500, 600, (window.screen.width/2), (window.screen.height/2), 'yes', 'yes', 'no', 'no', 'no', 'yes', 'no', 'no');
}

function ServicePopup(myTargetURL)
{
	windowPopUp(myTargetURL, "SERVICEPOPUP", 400, 400, (Math.round(window.screen.width * 0.66)), (Math.round(window.screen.height * 0.33)), 'yes', 'yes', 'no', 'no', 'no', 'no', 'no', 'no');
}
