function doButtonClick( openstring, ttarget ) {
	window.open(openstring, ttarget);
}

function CreateFlash(div, movie, source, width, height) {
	shtml = "<OBJECT classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" WIDTH=\"" + width + "\" HEIGHT=\"" + height + "\" id=\"slideshow\" ALIGN=\"\">";
	shtml += "<PARAM NAME=\"movie\" VALUE=\"" + movie + "\">";
	shtml += "<PARAM NAME=\"quality\" VALUE=\"high\">";
	shtml += "<PARAM NAME=bgcolor VALUE=#000000>";
	shtml += "<PARAM NAME=wmode VALUE=transparent>";
	shtml += "<EMBED src=" + source + "></EMBED>";
	shtml += "</OBJECT>";
	
	element = document.getElementById(div);
	element.innerHTML = shtml;
}

function displayTab(act){
	var myElement = document.getElementById("TabContent"+act);
	var myLinkElement = document.getElementById("TabLink"+act);

	if (myElement.style.display == "block") {
		myElement.style.display = "none";
		myLinkElement.className="collapsed";
	} else {
		myElement.style.display = "block";
		myLinkElement.className="expanded";
	}
}
					  
function ShowPermissions(value) {
	if (value!="") {
		var thisValue = value.split(":");
	
		switch (thisValue[0])
		{
			case "3":
				document.all.chkFullControl.checked = true;
				document.all.chkDelete.checked = true;
				document.all.chkWrite.checked = true;
				document.all.chkRead.checked = true;
				document.all.chkDeny.checked = false;
				break;
			case "2":
				document.all.chkFullControl.checked = false;
				document.all.chkDelete.checked = true;
				document.all.chkWrite.checked = true;
				document.all.chkRead.checked = true;
				document.all.chkDeny.checked = false;
				break;
			case "1":
				document.all.chkFullControl.checked = false;
				document.all.chkDelete.checked = false;
				document.all.chkWrite.checked = true;
				document.all.chkRead.checked = true;
				document.all.chkDeny.checked = false;
				break;
			case "0":
				document.all.chkFullControl.checked = false;
				document.all.chkDelete.checked = false;
				document.all.chkWrite.checked = false;
				document.all.chkRead.checked = true;
				document.all.chkDeny.checked = false;
				break;
			case "-1":
				document.all.chkFullControl.checked = false;
				document.all.chkDelete.checked = false;
				document.all.chkWrite.checked = false;
				document.all.chkRead.checked = false;
				document.all.chkDeny.checked = true;
				break;
			default:
		}
	}
}
						
function AddNewAccount_Click(thisList) {
	targetAccountList = thisList;
	
	openString = "dialog.php?action=perform&ClassName=welibrary&MethodName=ShowAccountsDialog";
	window.open(openString,"_blank","top=0,left=0,status=no,toolbar=no,resizable=yes,scrollbars=no,width=570,height=380");
}

function RemoveAccount_Click(selList) {
	for (var x=selList.length-1; x>=0; x--) {
		if (selList.options[x].selected == true) {
			selList.options[x] = null;
		}
	}
}

function Browse_Click(Index,ObjectIdentifier) {
	document.all.BrowserTargetIndex.value = Index;
	openString = "dialog.php?id=" + ObjectIdentifier + "&action=perform&ClassName=welibrary&MethodName=ShowFormBrowseDialog";
	window.open(openString,"_blank","top=0,left=0,status=yes,toolbar=no,resizable=no,scrollbars=yes,width=675,height=500");
}
						
function SelectPHPFormArray() {
	items = document.getElementsByName('GOid[]').length;
	itemChecked = false;
	
	if (!isNaN(items)) {
		for (var x=0;x<items;x++) {
			thisItem = document.getElementsByName('GOid[]')[x];
			
			if (!thisItem.disabled) {
				if (thisItem.checked) {
					thisItem.checked  = false;
				} else {
					thisItem.checked  = true;
				}
			}
		} 
	}  else {
		thisItem = document.all.GOid;
		
		if (!thisItem.disabled) {
			if (thisItem.checked) {
				thisItem.checked  = false;
			} else {
				thisItem.checked  = true;
			}
		}
	}
}

function IsValidFormFieldEmailAddress(field) {
	var filter=/^.+@.+\..{2,3}$/
	
	if ( !filter.test(field.value) ) {
		return false ;
	}
	
	return true;
}

function ShowModalessWindow(Action,GUid,dialogWidth,dialogHeight)
{
	if (Action!="") {
		var Component = Action.split("#");
		var openString = "index.php?id=" + GUid + "&action=perform&ComponentName=" + Component[0] + "&MethodName=" + Component[1];
		
		window.showModelessDialog(openString,null,
		    "dialogWidth=" + dialogWidth + "px;dialogHeight=" + dialogHeight + "px;help=no;status=no")
	}
}
 
function ShowModalWindow(ObjectIdentifier,Action,dialogWidth,dialogHeight) {
	if (Action!="") {
		var Component = Action.split("#");
		var openString;

		openString = "dialog.php?id=" + ObjectIdentifier + "&action=perform&ClassName=" + Component[0] + "&MethodName=" + Component[1];
		
		if (window.showModalDialog) {
			window.showModalDialog(openString,window,
		    "dialogWidth="+dialogWidth+"px;dialogHeight="+dialogHeight+"px;help=no;status=no");
		} else {
		    window.top.captureEvents (Event.CLICK|Event.FOCUS)
		    window.top.onclick=IgnoreEvents
		    window.top.onfocus=HandleFocus 
		    winModalWindow = 
		    window.open ("ModalChild.htm","ModalChild",
		    	"dependent=yes,width=200,height=100")
		    winModalWindow.focus()
		}
	}
}

function doLogonOpen(ObjectIdentifier,Action,dialogWidth,dialogHeight) {
	if (Action!="") {
		var Component = Action.split("#");
		var openString;

		openString = "dialog.php?id=" + ObjectIdentifier + "&action=perform&ClassName=" + Component[0] + "&MethodName=" + Component[1];
		window.open(openString,null,"top=0,left=0,status=no,toolbar=no,resizable=yes,scrollbars=no,width="+dialogWidth+",height="+dialogHeight);
	}
}

// Description: Opens a dialog window
// Accepts:			Required ObjectIdentifier
//							Required Action
//							Required ActionType
//							Required WinTarget
//							Optional OptionalArguments
function doOpen2() {
	var ObjectIdentifier = arguments[0];
	var Action = arguments[1];
	var ActionType = arguments[2];
	var WinTarget = arguments[3];
	var Component = Action.split("#");
	var openString;
	var OptionalArgs = -1;
	
	if (arguments.length == 5) {
		OptionalArgs = arguments[4];
	}
	
	if (OptionalArgs == -1) {
		openString = "dialog.php?id=" + ObjectIdentifier + "&action=perform&ActionType=" + ActionType + "&ClassName=" + Component[0] + "&MethodName=" + Component[1];
	} else {
		openString = "dialog.php?id=" + ObjectIdentifier + "&action=perform&ActionType=" + ActionType + "&ClassName=" + Component[0] + "&MethodName=" + Component[1] + OptionalArgs;
	}
	
	window.open(openString,WinTarget,"top=0,left=0,status=no,toolbar=no,resizable=yes,scrollbars=yes,width=800,height=480");	
}

function doOpen(ObjectIdentifier,Action,ActionType,WinTarget){
	if (Action!="") {
		var Component = Action.split("#");
		var openString;

		openString = "dialog.php?id=" + ObjectIdentifier + "&action=perform&ActionType=" + ActionType + "&ClassName=" + Component[0] + "&MethodName=" + Component[1];
		window.open(openString,WinTarget,"top=0,left=0,status=no,toolbar=no,resizable=yes,scrollbars=no,width=760,height=480");
		//modalDialogShow(openString,770,570);
		//modelessDialogShow(openString,770,570);
	}
}

function reloadandclose() {
	if(typeof (opener) != "undefined" ) {
 		window.close();
 		opener.location.reload();
	}	
	
	if(typeof (opener) == "undefined" ) {
 		parent.close();
 		parent.opener.location.reload();
	}
}

function Point(strImage) {
	var myElement = document.getElementById(strImage);
	myElement.className = "Point";
}
      
function DontPoint(strImage) {
	var myElement = document.getElementById(strImage);
	myElement.className = "DontPoint";
}

