var CurrentSelections = new Array()
var HoveringSelection
var IsMouseDown = Boolean(false)
var curHelpWinX=new Number(0)
var curHelpWinY=new Number(0)
var imgCloseWindowDown = new Image()
var imgCloseRedOKBtn=new Image()
var htmlTemp=new String()
var temp=new String()
var LastSearchForm
var ns4 = (document.layers) ? true : false;
var ie4 = (document.all && !document.getElementById) ? true : false;
var ie5 = (document.all && document.getElementById) ? true : false;
var ns6 = (!document.all && document.getElementById) ? true : false;

imgCloseWindowDown.src="./images/icons/WindowCloseBoxRedDown10x10.gif"
imgCloseRedOKBtn.src="./images/buttons/OKRedDown50x25.gif"


function ChangeRoles(obj){
	if (obj.options[obj.selectedIndex].value != '') {
		var frm = document.getElementById("frmRoles")
		ProcessRequest()
		frm.submit()
	}
}

function ClearAllSelections(myArr){
	var TheObject
	var Len=new Number(myArr.length)
	if (myArr.length > 0){
		var x =new Number(myArr.length)
		for(var i=1;i <= Len;i++){
			TheObject=document.getElementById(myArr[myArr.length-1].toString())
			TheObject.className="clsUnselectedColor"
			myArr.pop()
		}
	}
}

function AddSelection(myArr,TheObject){
	myArr.push(TheObject.id)
	TheObject.className="clsSelectedColor"
}

function RemoveSelection(myArr,TheObject){
	if (myArr.length > 0){
		var x=new Number(0)
		do{
			if (myArr[x].toString()==TheObject.id){
				myArr.splice(x,1)
				TheObject.className="clsHoverColor"
				break
			}
			x+=1
		}
		while (x <= myArr.length-1)
	}
}
function IsSelected(myArr,TheObject){
	var bolIsSelected=new Boolean(false)
	if (myArr.length > 0){
		var x=new Number(0)
		do{
			if (myArr[x].toString()==TheObject.id){
				bolIsSelected=true
				break
			}
			x+=1
		}
		while (x <= myArr.length-1)
	}
	return bolIsSelected
}


function HighlightSelection(TheObject){
	
	if (IsSelected(CurrentSelections,TheObject)==false){
			TheObject.className="clsHoverColor"
	}
}
			
function UnhighlightSelection(TheObject){
	if (IsSelected(CurrentSelections,TheObject)==false){
			TheObject.className="clsUnselectedColor"
	}
}

function UpdateSelection (IEvent) {
	if (IEvent.ctrlKey){
		if (IsSelected(CurrentSelections,HoveringSelection)==true){
			RemoveSelection(CurrentSelections,HoveringSelection)
		}else{
			AddSelection(CurrentSelections,HoveringSelection)
		}
	}else{
		if (CurrentSelections.length==1){
			if (IsSelected(CurrentSelections,HoveringSelection)==true){
				ClearAllSelections(CurrentSelections)
				HighlightSelection(HoveringSelection)
			}else{
				ClearAllSelections(CurrentSelections)
				AddSelection(CurrentSelections,HoveringSelection)
			}
		}else{
			ClearAllSelections(CurrentSelections)
			AddSelection(CurrentSelections,HoveringSelection)
		}
	}
}

function ValidateEntityDeletions(ParentName,ChildName,SelectedType,Relationship,ParentID,ParentType,ChildID){

	if (window.confirm("Are you sure you would like to remove " + ChildName + " from " + ParentName +  "?")){
		with (document.frmMain){
			window.location=window.location
			a.value="2"
			b.value=SelectedType
			c.value=ParentName
			d.value=ChildName
			e.value=Relationship
			f.value=ParentType
			g.value=ChildID
			h.value=ParentID
			action="RegistryView.aspx"
			ProcessRequest()
			submit()

		}
	}
}

function ValidateRelationInsertion(ParentName,ChildName,SelectedType,Relationship,GroupType,ParentID,ChildID){

	
		with (document.frmData){
			a.value="3"
			b.value=SelectedType
			c.value=ParentName
			d.value=ChildName
			f.value=Relationship
			e.value=GroupType
			h.value=ChildID
			g.value=ParentID
			action="RegistryView.aspx"
			submit()
		}
	
}

function InsertNewEntity(ParentName,ChildName,SelectedType,Relationship,GroupType,ParentID,WebLoginAllowed){

	
		with (document.frmData){
			a.value="4"
			b.value=SelectedType
			g.value=ParentID
			c.value=ParentName
			d.value=ChildName
			e.value=GroupType
			f.value=Relationship
			h.value=WebLoginAllowed
			action="ProfileEditor.aspx"
			submit()
		}
	
}

function ValidateExtendedRelationInsertion(ParentName,ParentID,ChildName,Params,SelectedType,Relationship,GroupType){

	
		with (document.frmData){
			a.value="4"
			b.value=SelectedType
			c.value=ParentName
			d.value=ChildName
			e.value=Relationship
			f.value=GroupType
			g.value=Params
			h.value=ParentID
			
			action="RegistryView.aspx"
			submit()
		}
	
}


function ValidateInsertNewEntity(ParentName,ParentID,ChildName,SelectedType,Relationship,GroupType){

	
		with (document.frmData){
			a.value="5"
			b.value=SelectedType
			c.value=ParentName
			d.value=ChildName
			f.value=Relationship
			e.value=GroupType
			g.value=ParentID
			
			action="RegistryView.aspx"
			submit()
		}
	
}

function RequestNewEntity(RequestedEntityType,RequestedEntityTypeDesc){

	
		with (document.frmData){
			a.value="5"
			b.value=RequestedEntityType
			c.value=RequestedEntityTypeDesc
			action="Email.aspx"
			submit()
		}
	
}

function OpenPopupWindow(objEvent,Title,Contents){
	var txt="<TABLE WIDTH=300 ALIGN=center HEIGHT=100 BORDER=0 CELLSPACING=1 CELLPADDING=1 bgcolor=#cc6666 ID=HelpTable Name=\"\HelpTable\"\><TR onmousedown=\"\IsMouseDown=true;curHelpWinX=event.x;curHelpWinY=event.y;\"\ onmouseup=\"\IsMouseDown=false\"\ onMouseMove =\"\DragWindow(event)\"\><TD height=15 width=295><i><font face=Georgia color=black size=2><STRONG>" + Title + "</STRONG></font></i></td><td width=10 align=right valign=top><IMG id=\"\CloseBox\"\ onclick=\"\ClosePopUpWindow()\"\ align=right onMouseDown=\"\CloseBox.src='./images/icons/WindowCloseBoxRedDown10x10.gif'\"\ onMouseOut=\"\CloseBox.src='./images/icons/WindowCloseBoxRed10x10.gif'\"\ height=10 src=\"\./images/icons/WindowCloseBoxRed10x10.gif\"\ width=10 title=\"\Click here to close window\"\></TD></TR><TR><TD  colspan=2 bgcolor=#ffcccc valign=top><p align=left><font face=Verdana size=2 color=black>" + Contents + "</font></p><p align=center><font face=Verdana size=2 color=black><IMG id=\"\OKBtn\"\ onclick=\"\ClosePopUpWindow()\"\ align=center onMouseDown=\"\OKBtn.src='./images/buttons/OKRedDown50x25.gif'\"\ onMouseOut=\"\OKBtn.src='./images/buttons/OKRedUp50x25.gif'\"\ height=25 src=\"\./images/buttons/OKRedUp50x25.gif\"\ width=50 align=center title=\"\Click here to close window\"\></font></p></TD></TR></TABLE>"
	var helpWin=document.getElementById("helpWindow")
	
	helpWin.innerHTML = txt
	helpWin.style.visibility = 'visible'
	helpWin.zIndex=5
	helpWin.style.left=objEvent.clientX + document.body.scrollLeft
	helpWin.style.top=objEvent.clientY + document.body.scrollTop
}

function ClosePopUpWindow(){
	var helpWin=document.getElementById("helpWindow")
	IsMouseDown=false
	helpWin.style.visibility = 'hidden'
}


function MoveWindow(objEvent){
	if (navigator.appName == "Microsoft Internet Explorer") {
		document.all.helpWindow.style.pixelLeft=document.body.scrollLeft+10

	}else{
		//document.nhelpWindow.left=objEvent.x
		//document.nhelpWindow.top=objEvent.y+20
	}
}

function DragWindow(objEvent){
	if (IsMouseDown==true){
		var helpWin=document.getElementById("helpWindow")
		var diffX=new Number(0)
		var diffY=new Number(0)
		diffX = curHelpWinX - objEvent.x 
		diffY = curHelpWinY - objEvent.y
		curHelpWinY =objEvent.y
		curHelpWinX=objEvent.x 
		helpWin.style.pixelLeft-=(diffX)
		helpWin.style.pixelTop-=(diffY)
	}
}


function ValidateLogin(objEvent){
	var ErrMsg
	ErrMsg=""
	if (document.frmMain.txtUsername.value.length==0){
		ErrMsg= ErrMsg + "Please enter your <i>Username</i> before clicking the <STRONG>Sign On</STRONG> button<BR><BR>"
	}
	
	if (document.frmMain.txtPassword.value.length==0){
		ErrMsg=ErrMsg+ "Please enter your <i>Password</I> before clicking the <STRONG>Sign On</STRONG> button<BR><BR>"
	}

	if (ErrMsg.length > 0){
		OpenPopupWindow(objEvent,"Missing Username or Password",ErrMsg)
		return false
	}else{
		return true
	}
}

function ValidateForgotForm(objEvent){
	var ErrMsg
	ErrMsg=""
	if (document.frmMain.fpsMode.value=="1"){
		if (document.frmMain.txtEmail.value.length==0){
			ErrMsg= ErrMsg + "Please enter an <i>E-mail</i> address before clicking the <STRONG>Next</STRONG> button<BR><BR>"
		}
	}else{ 
		if(document.frmMain.fpsMode.value=="2"){
			if (document.frmMain.txtAnswer.value.length==0){
				ErrMsg= ErrMsg + "Please enter the <i>Answer</i> to your Secret Question before clicking the <STRONG>Next</STRONG> button<BR><BR>"
			}
		}
	}
	if (ErrMsg.length > 0){
		OpenPopupWindow(objEvent,"Missing Item",ErrMsg)
		return false
	}else{
		return true
	}
}

function WriteDate(){
	var curDate = new Date()
	var ClientDate=document.getElementById("ClientDate")
	ClientDate.innerHTML = curDate.toLocaleDateString()
}

function UpdateProfileRequiredFields(){
	if (document.frmMain.h.value=="True"){
		
		RequiredFieldsForPerson()
	}else{
		RequiredFieldsForOrganization()
	}
	
}

function RequiredFieldsForPerson(){
	document.frmMain.cmbSelectedContactInfo.className="clsRequiredItem"
	if (document.frmMain.a.value=='5'){
		document.frmMain.cmbYearJoined.className="clsRequiredItem"
	}
	document.frmMain.txtFirstName.className="clsRequiredItem"
	document.frmMain.txtLastName.className="clsRequiredItem"
	if (document.frmMain.cmbSelectedContactInfo.value==1){
			
			document.frmMain.txtOrganizationName.className="clsRequiredItem"
			document.frmMain.txtBusinessAddress1.className="clsRequiredItem"
			document.frmMain.txtBusinessAddressCity.className="clsRequiredItem"
			document.frmMain.txtBusinessAddressState.className="clsRequiredItem"
			document.frmMain.cmbBusinessCountry.className="clsRequiredItem"
			document.frmMain.txtBusinessAddressPostalCode.className="clsRequiredItem"
			document.frmMain.txtBusinessTelephone.className="clsRequiredItem"
			document.frmMain.txtBusinessEmail.className="clsRequiredItem"
			if (document.frmMain.a.value!=4){
				//document.frmMain.txtSecretQuestion.className="clsRequiredItem"
				//document.frmMain.txtSecretAnswer.className="clsRequiredItem"
				//document.frmMain.txtBusinessFax.className="clsRequiredItem"
				document.frmMain.txtOrganizationName.focus()
			}else{
				document.frmMain.txtFirstName.focus()
			}
			
			document.frmMain.txtHomeAddress1.className="clsNotRequiredItem"
			document.frmMain.txtHomeAddressCity.className="clsNotRequiredItem"
			document.frmMain.txtHomeAddressState.className="clsNotRequiredItem"
			document.frmMain.cmbHomeCountry.className="clsNotRequiredItem"
			document.frmMain.txtHomeAddressPostalCode.className="clsNotRequiredItem"
			document.frmMain.txtHomeTelephone.className="clsNotRequiredItem"
			document.frmMain.txtHomeEmail.className="clsNotRequiredItem"
			
			
		}else {
			if (document.frmMain.cmbSelectedContactInfo.value==2){
				
				document.frmMain.txtOrganizationName.className="clsNotRequiredItem"
				document.frmMain.txtBusinessAddress1.className="clsNotRequiredItem"
				document.frmMain.txtBusinessAddressCity.className="clsNotRequiredItem"
				document.frmMain.txtBusinessAddressState.className="clsNotRequiredItem"
				document.frmMain.cmbBusinessCountry.className="clsNotRequiredItem"
				document.frmMain.txtBusinessAddressPostalCode.className="clsNotRequiredItem"
				document.frmMain.txtBusinessTelephone.className="clsNotRequiredItem"
				//document.frmMain.txtBusinessFax.className="clsNotRequiredItem"
				document.frmMain.txtBusinessEmail.className="clsNotRequiredItem"
				
				
				
				
				document.frmMain.txtHomeAddress1.className="clsRequiredItem"
				document.frmMain.txtHomeAddressCity.className="clsRequiredItem"
				document.frmMain.txtHomeAddressState.className="clsRequiredItem"
				document.frmMain.cmbHomeCountry.className="clsRequiredItem"
				document.frmMain.txtHomeAddressPostalCode.className="clsRequiredItem"
				document.frmMain.txtHomeTelephone.className="clsRequiredItem"
				document.frmMain.txtHomeEmail.className="clsRequiredItem"
				document.frmMain.txtHomeAddress1.focus()
				
				if (document.frmMain.a.value!=4){
					//document.frmMain.txtSecretQuestion.className="clsRequiredItem"
					//document.frmMain.txtSecretAnswer.className="clsRequiredItem"
					document.frmMain.txtHomeAddress1.focus()
				}else{
					document.frmMain.txtFirstName.focus()
				}
			}
		}
}

function RequiredFieldsForOrganization(){
	document.frmMain.cmbYearJoined.className="clsRequiredItem"
	document.frmMain.txtOrganizationName.className="clsRequiredItem"
	document.frmMain.txtBusinessAddress1.className="clsNotRequiredItem"
	document.frmMain.txtBusinessAddressCity.className="clsNotRequiredItem"
	document.frmMain.txtBusinessAddressState.className="clsNotRequiredItem"
	document.frmMain.cmbBusinessCountry.className="clsNotRequiredItem"
	document.frmMain.txtBusinessAddressPostalCode.className="clsNotRequiredItem"
	document.frmMain.txtBusinessTelephone.className="clsNotRequiredItem"
	document.frmMain.txtBusinessFax.className="clsNotRequiredItem"
	document.frmMain.txtBusinessEmail.className="clsNotRequiredItem"
}

function ViewProfile(EntityID,EntityType,RelationshipType,WebLoginAllowed,RegistryViewType){
	
		document.frmData.i.value=WebLoginAllowed
		document.frmData.a.value=1
		document.frmData.g.value=EntityID
		document.frmData.b.value=EntityType
		document.frmData.e.value=RelationshipType
		document.frmData.h.value=WebLoginAllowed
		document.frmData.i.value=RegistryViewType
		document.frmData.action="ProfileEditor.aspx"
		ProcessRequest()
		document.frmData.submit()
	
}

function ViewRelationships(EntityID,IEvent){
	if (IEvent.ctrlKey==false){
		document.frmMain.a.value=5
		document.frmMain.b.value=EntityID
		document.frmMain.submit()
	}
}

function VerifyRequiredProfileField(objevent){
	var Msgs =new String()
	with (document.frmMain){
		if (WebLoginAllowed.value=="True"){
			Msgs+=IsBlank(txtFirstName,"First Name<BR>")
			Msgs+=IsBlank(txtLastName,"First Name<BR>")
			
			if (document.frmMain.Mode.value!=2){
				//Msgs+=IsBlank(txtSecretQuestion,"Secret Question<BR>")
				//Msgs+=IsBlank(txtSecretAnswer,"Secret Answer<BR>")
			}
			
			if (cmbSelectedContactInfo.selectedIndex > 0){
				
				var SelectedContactInfo=new String()
				SelectedContactInfo=cmbSelectedContactInfo.options[cmbSelectedContactInfo.selectedIndex].value
				
				if (SelectedContactInfo=="1"){
					
					Msgs+=IsBlank(txtOrganizationName,"Organization Name<BR>")
					Msgs+=IsBlank(txtBusinessAddress1,"Address 1<BR>")
					Msgs+=IsBlank(txtBusinessAddressCity,"City<BR>")
					Msgs+=IsBlank(txtBusinessAddressState,"State<BR>")
					if (cmbBusinessCountry.selectIndex=0){
						Msgs+="Country"
					}
					Msgs+=IsBlank(txtBusinessAddressPostalCode,"Postal Code<BR>")
					Msgs+=IsBlank(txtBusinessTelephone,"Telephone<BR>")
					//if (document.frmMain.Mode.value!=2){
						//Msgs+=IsBlank(txtBusinessFax,"Fax<BR>")
					//}
					
					Msgs+=IsBlank(txtBusinessEmail,"Email<BR>")
					
				}else{
					if (SelectedContactInfo=="2"){
						
						Msgs+=IsBlank(txtHomeAddress1,"Address 1<BR>")
						Msgs+=IsBlank(txtHomeAddressCity,"City<BR>")
						Msgs+=IsBlank(txtHomeAddressState,"State<BR>")
						if (cmbHomeCountry.selectIndex=0){
							Msgs+="Country"
						}
						Msgs+=IsBlank(txtHomeAddressPostalCode,"Postal Code<BR>")
						Msgs+=IsBlank(txtHomeTelephone,"Telephone<BR>")
						if (document.frmMain.Mode.value!=2){
							IsBlank(txtHomeFax,"Fax<BR>")
						}
						//Msgs+=IsBlank(txtHomeFax,"Fax<BR>")
						Msgs+=IsBlank(txtHomeEmail,"Email<BR>")
					}
				}
				
			}else{
				Msgs+="Please direct all communications to"
			}
		}else{
			Msgs+=IsBlank(txtOrganizationName,"Organization Name<BR>")
		}
	}
	if (Msgs.length > 0){
		OpenPopupWindow(objevent,"Required Fields Missing",Msgs)
		return false
	}else{
		return true
	}
}

function IsBlank(objField,Msg){
	if (objField.value.length==0){
			return Msg
	}else{
		return ''
	}
}

function ValidateSearchSelections(objevent){
	with (document.frmMain){
		
		if (a.value=="0"){
			OpenPopupWindow(objevent,"Invalid Selection","Please make a valid selection before clicking the <STRONG>Next</STRONG> button.")
			return false
		}
		if (a.value=="1"){
			if (txtSearchtext.value.length==0){
				OpenPopupWindow(objevent,"Invalid search phrase","Please enter something in the search text box before clicking the <STRONG>Search</STRONG> button.")
				return false
			}else{
			if (txtPage != undefined){txtPage.value='1'}
				return true
			}
		}
		
		if (a.value=="2"){
			if (lbEntities.selectedIndex==-1){
				OpenPopupWindow(objevent,"Invalid Selection","Please select an entity to which " + txtEntityName.value + " should be affiliated before clicking <STRONG>Next</STRONG> button.")
				return false
			}else{
				document.frmMain.b.value=document.frmMain.lbEntities.options[document.frmMain.lbEntities.selectedIndex].text;
				return true
			}
		}
		
		
		if (a.value=="4"){
			if (lstEntites.selectedIndex==-1){
				OpenPopupWindow(objevent,"Invalid Selection","Please select an entity to asscociate the new entity with before clicking the <STRONG>Next</STRONG> button.")
				return false
			}else{
				return true
			}
		}
		
		if (a.value=="5"){
			return true
		}else{
			OpenPopupWindow(objevent,"Invalid Selection","Please make a valid selection before clicking the <STRONG>Next</STRONG> button.")
			return false
		}
	
	}
}

function ValidateCredentials(objEvent){
	var ErrMsg = new String()
	
	if (document.frmMain.txtUsername.value.length < 6){
		ErrMsg= ErrMsg + "Please make sure your new <STRONG>Username</STRONG> is between 6 and 8 characters in length.<BR><BR>"
	}
	if (document.frmMain.txtUsername.value.indexOf(" ",0)> -1){
				ErrMsg= ErrMsg + "Your new <STRONG>Username</STRONG> cannot contain any spaces.<BR><BR>"
	}
	if (document.frmMain.txtPassword.value.length==0 && document.frmMain.txtConfirm.value.length != 0) {
		ErrMsg= ErrMsg + "Please enter a new password in the <STRONG>New Password</STRONG> textbox<BR><BR>"
	}else{
		if (document.frmMain.txtPassword.value != document.frmMain.txtConfirm.value){
			ErrMsg= ErrMsg + "Your new <STRONG>Password</STRONG> and the <STRONG>Confirmation</STRONG> are not the same.<BR><BR>"
		}
		if (document.frmMain.txtPassword.value.length!=0 && document.frmMain.txtConfirm.value.length != 0){
			if (document.frmMain.txtPassword.value.length < 7){
				ErrMsg= ErrMsg + "Your new <STRONG>Password</STRONG> needs to be at least 7 characters in length.<BR><BR>"
			}
		}
		if (document.frmMain.txtPassword.value.indexOf(" ",0)> -1){
			ErrMsg= ErrMsg + "Your new <STRONG>Password</STRONG> cannot contain any spaces.<BR><BR>"
		}
	}

	if (ErrMsg.length > 0){
		OpenPopupWindow(objEvent,"Please Fix",ErrMsg)
		return false
	}else{
		return true
	}
}

function ShowHideNode(PlusMinusImg,tblSearchResults) {
	var imgPlus=document.getElementById(PlusMinusImg)
	var tblResults=document.getElementById(tblSearchResults)
	if (imgPlus.src.indexOf('images/icons/ListPlusSign.gif') > -1){
		tblResults.style.display = 'inline'
		tblResults.style.visibility = 'visible'
		imgPlus.src='images/icons/ListMinusSign.gif'
	}else{
		tblResults.style.display = 'none'
		tblResults.style.visibility = 'hidden'
		imgPlus.src='images/icons/ListPlusSign.gif'
	}
}

function ShowHideSimpleView(objID){
	var SimpleView=document.getElementById(objID)
	var imgPlus=document.getElementById('imgExpanded')
	var myCell=document.getElementById('ExpandedCell')
	
	if (SimpleView.style.visibility == 'visible'){
		htmlTemp=SimpleView.style.innerHTML
		SimpleView.style.innerHTML=""
		SimpleView.style.visibility = 'hidden'
		imgPlus.src="images/icons/ListPlusSign.gif"
		myCell.style.height=0
	}else{
		SimpleView.style.visibility = 'visible'
		SimpleView.style.innerHTML=htmlTemp
		imgPlus.src="images/icons/ListMinusSign.gif"
	}
}


function ChgCls(obj,clsName){
	if ((navigator.appName != "Microsoft Internet Explorer") || (navigator.userAgent.indexOf('Mac') == -1)){
		obj.className=clsName
	}
}

function ShowHideEntity(objID){
    var myObj=document.getElementById(objID)
    if (myObj.style.visibility=='visible'){
        myObj.style.visibility='hidden'
        myObj.style.display='none'
    }else{
        myObj.style.visibility='visible'
        myObj.style.display='inline'
    }
}

function ProcessRequest(){
	ShowHideEntity('tblProcessing')
}


function SearchForEntity(Relationship,ParentID,ParentType,ParentName,ChildType,ChildDesc){

	var SearchString = prompt('Please enter the name of the ' + ChildDesc + ' to search for.',ChildDesc + ' name')
	if (SearchString != null){
		

			document.frmData.b.value=SearchString
			document.frmData.c.value=Relationship
			document.frmData.d.value=ChildType
			document.frmData.e.value=ParentType
			document.frmData.f.value=ParentID
			document.frmData.g.value=ParentName
			document.frmData.h.value=ChildDesc
		
		document.frmData.action='Search.aspx'
		ProcessRequest()
		document.frmData.submit()

	}
}

function ShowSearchForm(FormName,ElementName,Relationship,ParentID,ParentType,ParentName,ChildType,ChildDesc){
	var HTMLElement=document.getElementById(ElementName)
	var SearchForm=document.getElementById(FormName)
	if(typeof LastSearchForm=='object'){
		LastSearchForm.innerHTML=htmlTemp
	}
	LastSearchForm=HTMLElement
	htmlTemp=HTMLElement.innerHTML
	HTMLElement.innerHTML=HTMLElement.innerHTML + SearchForm.innerHTML
	document.frmData.c.value=Relationship
	document.frmData.d.value=ChildType
	document.frmData.e.value=ParentType
	document.frmData.f.value=ParentID
	document.frmData.g.value=ParentName
	document.frmData.h.value=ChildDesc
	
	//SearchForm.style.top=HTMLElement.style.top
	//SearchForm.style.left=HTMLElement.style.left
	//SearchForm.style.visibility='visible'
	//SearchForm.style.display='inline-block'
	

	
}

function AddEmail(){
	NewAddress="";
	NewAddress=prompt ("Please enter a new email address.", "");
	if (NewAddress != null){
		if (ValidEmail(NewAddress)){
			EmailOption= new Option (NewAddress,NewAddress,false,false);
			document.frmMain.txtTo.options[document.frmMain.txtTo.length]=EmailOption;
		}else{
			alert("The email address you have entered appears to be invalid.");
		}
	}
	
}
function RemoveEmail(){
	if (document.frmMain.txtTo.selectedIndex==-1){
		alert("Please select an e-mail address before clicking the remove button.");
	}else
	{
		document.frmMain.txtTo.options[document.frmMain.txtTo.selectedIndex]=null;
	}
}
function ValidEmail(EmailAddress){
	if (EmailAddress.search("@") ==-1){
		return false;
	}else{
		return true;
	}
}

function ChkErrors(Type,TypeDesc){
	with (document.frmMain){
			var _win=window.open('Issues.aspx?a=1&b=' + Type + '&c=' + TypeDesc,'_Issues','location=0,menubar=0,resizable=1,status=0,toolbar=0')


		}
}
