		
		var root_link = "http://www.r744.com";
		
		var tempContent = "";
		
		var loaded = 0;
		
		var loadedContent = 1;
		
		var dispLoader = 1;
		
		var currLib	= "";
		
		var currAdvertise	= 0;
		var advertiseTotal	= 5;
		
		var mapMembersResults = 0;

		var ShareFileOpen = 0;
		
		var DirectoryOffice = 0;
		var DirectoryOfficeCount = 0;
		
		var currDiv = "";
		var currAnchor = "";
		var currFunction = "";
		var secondaryFunction = "";
		var ajaxTimeout = 0;
		var currTab = 0;
		var currPartner = 1;
		var currPartnerWide = 1;
		var partnerRotateTimeout = null;
		var partnerRotateTimeoutMain = null;
		var advertiseRotateTimeoutMain = null;
		var requestRotateTimeout = null;
		var tabOn = 1;
		var currFeat = 1;
		var galleryPos = 1;
		var rotateTimeout = 0;
		var menuSubTimeout = 0;
		var currMainLink = 1;
		var currMenuSub = 0;
		var currTopPartners = 0;
		var partnersHeight = 134;
		var partnersScrollTimeout = 0;
		
		var CurrInfoBox = -1;
		var LinkInfoBoxOpen = 0;
		var LinkInfoBoxTimer = 0;
		var AbortCloseBox = 0;
		
		var waitFunction = '';
		
		var clearForumPost = 0;
		
		var CurrMessage = 0;
		
		var tempForumSubject = '';
		var tempForumPost = '';
		
		var formBoxActive = '';
		
		var formBoxLeft = 0;
		var formBoxTop = 0;
		var formBoxWidth = 370;
		var formBoxHeight = 300;
		
		var formBoxSet = 0;
		
		var sectionClass = new Array();
		sectionClass[0] = 'contentInsideBlue';
		sectionClass[1] = 'contentInsideBlue';
		sectionClass[2] = 'contentInsideGray';
		sectionClass[3] = 'contentInsideGray';
		sectionClass[4] = 'contentInsideRed';
		sectionClass[5] = 'contentInsideRed';
		
		// Detect if the browser is IE or not.
		// If it is not IE, we assume that the browser is NS.
		var IE = document.all?true:false
		
		// If NS -- that is, !IE -- then set up for mouse capture
		if (!IE) document.captureEvents(Event.MOUSEMOVE)
		
		// Main function to retrieve mouse x-y pos.s
		
		var tempX = 0;
		var tempY = 0;
		
		// Set-up to use getMouseXY function onMouseMove
		document.onmousemove = getMouseXY;
		
		// Temporary variables to hold mouse x-y pos.s
		var tempMouseX = 0
		var tempMouseY = 0
		
		// Main function to retrieve mouse x-y pos.s
		
		function getMouseXY(e) {
		  if (IE) { // grab the x-y pos.s if browser is IE
			tempMouseX = event.clientX + document.body.scrollLeft
			tempMouseY = event.clientY + document.body.scrollTop
		  } else {  // grab the x-y pos.s if browser is NS
			tempMouseX = e.pageX
			tempMouseY = e.pageY
		  }  
		  // catch possible negative values in NS4
		  if (tempMouseX < 0){tempMouseX = 0}
		  if (tempMouseY < 0){tempMouseY = 0}  
		  // show the position values in the form named Show
		  // in the text fields named MouseX and MouseY
		  
		  if (currFunction != '') {
			
			eval(currFunction);
			
		  }
		  
		  return true
		}
		
		if (document.getElementsByTagName) {
		var inputElements = document.getElementsByTagName("input");
		for (i=0; inputElements[i]; i++) {
		//if (inputElements[i].className && (inputElements[i].className.indexOf("disableAutoComplete") != -1)) {
		inputElements[i].setAttribute("autocomplete","off");
		//}//if current input element has the disableAutoComplete class set.
		}//loop thru input elements
		}//basic DOM-happiness-check 
		
		function check_email(email) {
			
			ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";
			
			for(i=0; i < email.length ;i++){
				if(ok.indexOf(email.charAt(i))<0){ 
					return (false);
				}	
			}
			
			re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
			re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
			if (!email.match(re) && email.match(re_two)) {
				return (-1);		
			} 
			
		
		}
		
		function defaultField(fieldValue,fieldObject,fieldState) {
			
			//var fieldObject = eval('document.'+fieldForm+'.'+fieldName);
			//fieldForm,fieldName
			
			if ((fieldState == 0) && (fieldObject.value == fieldValue)) {
				fieldObject.value = '';	
			} else if ((fieldState == 1) && (fieldObject.value == '')) {
				fieldObject.value = fieldValue;	
			}
		
		}
		
		function print_page(pageLink) {
		myRef = window.open(''+pageLink,'mywin','left=20,top=20,width=760,height=500,toolbar=0,resizable=0,scrollbars=1;');
		}
		
		var currPropAucStockNum = 0;
		
		var propAucStockSubmit = 0;
		
		var timeoutVar = 0;
		
		var opacityTimeoutVar = 0;
		
		function getScrollOffset() {
		
			setWindowProps();
		
			tempX = 0;
			tempY = 0;
			
			if (IE) { // grab the x-y pos.s if browser is IE
				tempX = document.body.scrollLeft;
				tempY = document.body.scrollTop;
			} else {
				tempX = window.pageXOffset;
				tempY = window.pageYOffset;
			}
			
			// catch possible negative values in NS4
			if (tempX < 0){tempX = 0}
			if (tempY < 0){tempY = 0}
			
			//alert(tempX + " " + tempY); 
		
		}

		function setWindowProps() {
			
			if (parseInt(navigator.appVersion)>3) {
				if (navigator.appName=="Netscape") {
					winW = window.innerWidth;
					winH = window.innerHeight;
				}
				if (navigator.appName.indexOf("Microsoft")!=-1) {
					winW = (document.body.offsetWidth-21);
					winH = (document.body.offsetHeight-4);
				}
			}
			
		}
		
		function setOpacity(divName,value) {
			document.getElementById(divName).style.opacity = value/10;
			document.getElementById(divName).style.filter = 'alpha(opacity=' + value*10 + ')';
		}
		
		function displayOpacity(divName,value) {
			
			if (value == 10) {
				setOpacity(divName,value);
				clearTimeout(opacityTimeoutVar);
			} else {
				setOpacity(divName,value);
				opacityTimeoutVar = window.setTimeout("displayOpacity('"+divName+"',"+(value+1)+")",50);
			}
			
		}
		
		function init(resize) {
			
			setWindowProps();
			//alert(winW + " " + winH);
			
			formBoxLeft	= Math.round((winW-formBoxWidth)/2)+tempX;
			formBoxTop	= Math.round((winH-formBoxHeight)/2)+tempY;
			
			if (document.getElementById('formBox')) {
			
				document.getElementById('formBox').style.left = formBoxLeft + "px";
				document.getElementById('formBox').style.top = formBoxTop + "px";
				document.getElementById('formBoxContent').style.left = (formBoxLeft+5) + "px";
				document.getElementById('formBoxContent').style.top = (formBoxTop+5) + "px";
				
			}
			
			if (resize == 0) {
				//alert(document.getElementById('currTab'));
				if (document.getElementById('currTab')) {
					tabOn = document.getElementById('currTab').value;
					//alert(tabOn);
				}
				//window.setTimeout('PartnerRotate(1)',5000);
				window.setTimeout('PartnerRotateWide(1)',4000);
				//window.setTimeout('PartnerRotateWideTop(1)',4000);
			}
			
			if (document.getElementById('partnersTop')) {
				window.setTimeout('PartnerRotateGold(1)',4000);
				currAdvertise = document.getElementById('advertiseBanner').value;
				window.setTimeout('rotateAdvertise(1,1)',(4000));
			} else {
			
				if (document.getElementById('advertiseBanner')) {
					currAdvertise = document.getElementById('advertiseBanner').value;
					window.setTimeout('rotateAdvertise(1,4)',(4000));
				}
				
			}
			
			loaded = 1;
			
			if (document.getElementById('CurrMem')) {
				
				setVisit();
				//sendAjax("functions.php?PageView=1&ArticleId="+ArticleId+"&color="+color+"&colorName="+colorName,processAjax);
			
			}
			
			if (document.getElementById('TopBanner1')) {
				currHref = document.location.href;
				if (currHref.indexOf('news.php') == -1) {
				rotateBanners(2);
				} else {
				rotateBanners(1);
				}
			}
			
			if (document.getElementById('currLib')) {
				currLib = document.getElementById('currLib').value;
				//alert(currLib);
			}
			
			if (document.getElementById('googleMap')) {	
				loadMap();
				if (document.getElementById('startDirectoryId')) {
					if (document.getElementById('startDirectoryId').value != 0) {
						dispMarkerInfo((document.getElementById('startDirectoryId').value*1));
					}
				}
				if (document.getElementById('startMemberId')) {
					if (document.getElementById('startMemberId').value != 0) {
						dispMarkerInfo2((document.getElementById('startMemberId').value*1),0);
					}
				}
			}
			
			if (document.getElementById('lookingContent')) {
				var CurrMember = document.getElementById('LoggedInMemberId').value*1;
				//requestRotateTimeout = window.setTimeout('lookingContent('+CurrMember+',0,"MembersProfile.UpdateDate DESC",1,5000)',12000);
			}
			
		}
		
		function setVisit() {
		
			ItemType = 0;
			ItemId = 0;
			currSalesPartner = 0;
		
			currIp = document.getElementById('CurrIp').value;
			currMember = document.getElementById('CurrMem').value;
			currSession = document.getElementById('CurrSession').value;
		
			if (document.getElementById('CurrSalesPartner')) {
				currSalesPartner = document.getElementById('CurrSalesPartner').value*1;	
			}
			if (document.getElementById('ThisItemType')) {
				ItemType = document.getElementById('ThisItemType').value;	
			}
			if (document.getElementById('ThisItemId')) {
				ItemId = document.getElementById('ThisItemId').value;	
			}
		
			currHref = document.location.href;
			
			questionLocation = currHref.indexOf('?');
			
			variables = '';
			currPage = currHref;
			
			if (questionLocation != -1) {
				variables = currHref.split('?');
				currPage = variables[0];
				variables = variables[1].split('&');
			}
			
			//alert("functions.php?PageView=1&currPage="+currPage+"&variables="+variables+"&currMember="+currMember+"&currIp="+currIp+"&currSession="+currSession);
			
			currDiv = 'test';
			sendAjax("functions.php?PageView=1&currPage="+currPage+"&variables="+variables+"&currMember="+currMember+"&currIp="+currIp+"&currSession="+currSession+"&currSalesPartner="+currSalesPartner+"&ItemType="+ItemType+"&ItemId="+ItemId,processAjax);
			
		}
		
		function changeLang(num) {
		
			if (num == 2) {
				currHref = document.location.href;
				currHref = currHref.replace("www","cn");
				
				if (document.getElementById("LangUrl")) {
					
					currHref = "http://cn.r744.com/"+document.getElementById("LangUrl").value;
					
				} else {
				
				if (document.getElementById("CurrId")) {
					var CurrId = document.getElementById("CurrId").value;
					var NewId = document.getElementById("IdR744").value;
					
					currHref = currHref.replace(CurrId, NewId);
					
				}
				
				}
				
				document.location.href = currHref;
			}
		
		}
		
		function PaperDownload(MemberId,PaperId,CurrIp) {
	
			currDiv = 'test';
			sendAjax("functions.php?PaperDownload=1&MemberId="+MemberId+"&PaperId="+PaperId+"&CurrIp="+CurrIp,processAjax);
			
		}
		
		function PatentDownload(MemberId,PatentId,PatentCountryId,CurrIp) {
		
			//alert(MemberId+','+PatentId+','+CurrIp);
		
			currDiv = 'test';
			sendAjax("functions.php?PatentDownload=1&MemberId="+MemberId+"&PatentId="+PatentId+"&PatentCountryId="+PatentCountryId+"&CurrIp="+CurrIp,processAjax);
			
		}
		
		function IsNumeric(sText) {
		
			var ValidChars = "0123456789.,";
			var IsNumber=true;
			var Char;
		 
			for (i = 0; i < sText.length && IsNumber == true; i++) { 
				Char = sText.charAt(i); 
				if (ValidChars.indexOf(Char) == -1) {
					IsNumber = false;
				}
			}
			
			return IsNumber;
		   
		}

		function nothing() {}
		
		function sendAjax(urlContent,returnFunc) {
		
			if (loaded == 1) {
		
			if (currLib != '') {
				urlContent	+= "&LibName="+currLib;
			}
			
			//alert(urlContent);
			
			if (dispLoader != 0) {
		
				thisWidth = document.getElementById(currDiv).style.width.substring(0,((document.getElementById(currDiv).style.width.length*1)-2))*1;
				thisHeight = document.getElementById(currDiv).style.height.substring(0,((document.getElementById(currDiv).style.height.length*1)-2))*1;
				topPadding = Math.round(thisHeight/2);
				leftPadding = Math.round(thisWidth/2);
				
				if (currDiv == 'memberResults') {
					document.getElementById(currDiv).innerHTML = '<div align="center" style="padding-top: 60px; font-weight: bold;"><img src="'+root_link+'/images/main/ajax_loader.gif" hspace="10"> loading...</div>';
				} else {
					document.getElementById(currDiv).innerHTML = '<div align="center" style="padding: '+topPadding+'px 0px 0px '+leftPadding+'px"><img src="'+root_link+'/images/main/ajax_loader.gif"></br></div>';
				}			
			
			}
			
			dispLoader	= 1;
			
			createRequest();			
			
			request.open("GET", root_link + "/includes/scripts/" + urlContent, true);
			request.onreadystatechange = eval(returnFunc);
			request.send(null);
			/*
			window.clearTimeout(ajaxTimeout);
			ajaxTimeout = window.setTimeout("request.send(null)",500);
			*/
			
			}
			
		}
		
		function sendAjaxNew(libName,functionName,fieldsList) {
		
			if (loaded == 1) {
		
			createRequest();			
			
			var urlContent = libName+"?functionName="+functionName+"&fieldsList="+fieldsList;
			
			request.open("GET", root_link + "/includes/scripts/" + urlContent, true);
			request.onreadystatechange = eval(returnFunc);
			request.send(null);
			
			}
			
		}
		
		function processAjax() {
		
			if(request.readyState == 4) {
				
				if(request.status == 200) {
				
					//alert(trim(request.responseText));
				
					if((document.getElementById(currDiv)) && (trim(request.responseText) != '')) {
						//alert(document.getElementById('hoverMain').innerHTML);
						document.getElementById(currDiv).innerHTML = trim(request.responseText);
						document.getElementById(currDiv).style.visibility = "visible";
						//setOpacity(currDiv,9.7);
						/*
						clearTimeout(opacityTimeoutVar);
						displayOpacity(currDiv,1);
						*/
						//document.getElementById(currDiv).style.visibility = "visible";
						
						if (secondaryFunction != '') {
							var thisFunction = secondaryFunction;
							secondaryFunction = '';
							eval(thisFunction);
						}
						
						if (currAnchor != '') {
							document.location.href = currAnchor;
							currAnchor = '';
						}
						
						tempContent = '';
						loadedContent = 1;
						
						/*
						if (waitFunction != '') {
							eval(waitFunction);	
						}
						*/
						
					}
					
				}
				
			}
		
		}
		
		function pageScroll() {
			getScrollOffset();
			if ((tempY+winH) < 570) {
				window.scrollBy(0,10); // horizontal and vertical scroll increments
				scrolldelay = setTimeout("pageScroll()",20); // scrolls every 100 milliseconds
			}
		}
		
		function trim(stringToTrim) {
			return stringToTrim.replace(/^\s+|\s+$/g,"");
		}
		
		function dispInfoBox(Content) {
			
			setWindowProps();
		
			document.getElementById('hoverContent').innerHTML = Content;
			
			leftPos = (tempMouseX+5);
			
			document.getElementById('hoverContent').style.left = leftPos + "px";
			document.getElementById('hoverContent').style.top = (tempMouseY-30) + "px";
			
			document.getElementById('hoverContent').style.visibility = "visible";
		
		}
		
		function hideInfoBox() {
		
			document.getElementById('hoverContent').innerHTML = '';
			document.getElementById('hoverContent').style.visibility = "hidden";
		
		}
		
		function check_errors(formName) {
			
			var submitOk = 1;
			var errorContent = '<div style="font-weight: bold; padding-bottom: 5px;">The following fields have not been entered:</div>';
			
			if (formName == 'RegistrationForm') {
			
				var PrefixId = document.RegistrationForm.PrefixId.value;
				var FirstName = document.RegistrationForm.FirstName.value;
				var LastName = document.RegistrationForm.LastName.value;
				var Email = document.RegistrationForm.Email.value;
				var City = document.RegistrationForm.City.value;
				var CountryId = document.RegistrationForm.CountryId.value;
				var EmailRepeat = document.RegistrationForm.EmailRepeat.value;
				var EmailValid = document.RegistrationForm.EmailValid.value;
				var Username = document.RegistrationForm.Username.value;
				var UsernameValid = document.RegistrationForm.UsernameValid.value;
				var Password = document.RegistrationForm.Password.value;
				var PasswordRepeat = document.RegistrationForm.PasswordRepeat.value;
				
				var SecurityWord = document.RegistrationForm.SecurityWord.value;
				var SecurityWordVerify = document.RegistrationForm.SecurityWordVerify.value;
				
				var Company = document.RegistrationForm.Company.value;
				
				if (PrefixId == 0) {
					submitOk = 0;
					errorContent += 'Please select your title<br>';
				}
				
				if (FirstName == '') {
					submitOk = 0;
					errorContent += 'Please enter your first name<br>';
				}
				
				if (LastName == '') {
					submitOk = 0;
					errorContent += 'Please enter your last name<br>';
				}
				
				if (Company.indexOf('google') != -1) {
					submitOk = 0;
					errorContent += 'Please enter a valid organisation<br>';
				}
				
				if ((Email == '')) {
					submitOk = 0;
					errorContent += 'Please enter your email address<br>';
				} else if (!check_email(Email)) {
					submitOk = 0;
					errorContent += 'Please enter a valid email address<br>';
				} else {
				
					if (EmailValid == 0) {
						submitOk = 0;
						errorContent += 'Your email address is already stored in our system<br>';
					}
				
				}
				
				if (City == '') {
					submitOk = 0;
					errorContent += 'Please enter your city<br>';
				}
				
				if (CountryId == 0) {
					submitOk = 0;
					errorContent += 'Please enter select your country<br>';
				}
				
				if (Email != EmailRepeat) {
					submitOk = 0;
					errorContent += 'Your emails do not match!<br>';
				}
				
				/*else {
				
					if (EmailValid == 0) {
						submitOk = 0;
						errorContent += 'Please enter a valid username<br>';
					}
				
				}*/
				
				if (Username == '') {
					submitOk = 0;
					errorContent += 'Please enter a username of at least 4 characters<br>';
				} else {
				
					if (UsernameValid == 0) {
						submitOk = 0;
						errorContent += 'Please enter a valid username of at least 4 characters<br>';
					}
				
				}
				
				if (Password.length < 6) {
					submitOk = 0;
					errorContent += 'Please enter a password of at least 6 characters<br>';
				}
				
				if (Password != PasswordRepeat) {
					submitOk = 0;
					errorContent += 'Your passwords do not match!<br>';
				}
				
				if (SecurityWord != SecurityWordVerify) {
					submitOk = 0;
					errorContent += 'Your security word is not correct!<br>';
				}
				
				if (!document.RegistrationForm.terms.checked) {
					submitOk = 0;
					errorContent += 'Please confirm that you have read our terms and conditions<br>';
				}
			
			} else if (formName == 'SubscriptionForm') {
			
				var FirstName = document.SubscriptionForm.FirstName.value;
				var LastName = document.SubscriptionForm.LastName.value;
				var Email = document.SubscriptionForm.Email.value;
				
				if (FirstName == '') {
					submitOk = 0;
					errorContent += 'Please enter your first name<br>';
				}
				
				if (LastName == '') {
					submitOk = 0;
					errorContent += 'Please enter your last name<br>';
				}
				
				if ((Email == '')) {
					submitOk = 0;
					errorContent += 'Please enter your email address<br>';
				} else if (!check_email(Email)) {
					submitOk = 0;
					errorContent += 'Please enter a valid email address<br>';
				}
			
			} else if (formName == 'ProfileForm') {
			
				var PrefixId = document.ProfileForm.PrefixId.value;
				var FirstName = document.ProfileForm.FirstName.value;
				var LastName = document.ProfileForm.LastName.value;
				var Email = document.ProfileForm.Email.value;
				var City = document.ProfileForm.City.value;
				var CountryId = document.ProfileForm.CountryId.value;
				var Username = document.ProfileForm.Username.value;
				var UsernameValid = document.ProfileForm.UsernameValid.value;
				var Password = document.ProfileForm.Password.value;
				var PasswordRepeat = document.ProfileForm.PasswordRepeat.value;
				/*
				var Password = document.RegistrationForm.Password.value;
				var PasswordRepeat = document.RegistrationForm.PasswordRepeat.value;
				*/
				if (PrefixId == 0) {
					submitOk = 0;
					errorContent += 'Please select your title<br>';
				}
				
				if (FirstName == '') {
					submitOk = 0;
					errorContent += 'Please enter your first name<br>';
				}
				
				if (LastName == '') {
					submitOk = 0;
					errorContent += 'Please enter your last name<br>';
				}
				
				if ((Email == '')) {
					submitOk = 0;
					errorContent += 'Please enter your email address<br>';
				} else if (!check_email(Email)) {
					submitOk = 0;
					errorContent += 'Please enter a valid email address<br>';
				}
				
				if (City == '') {
					submitOk = 0;
					errorContent += 'Please enter your city<br>';
				}
				
				if (CountryId == 0) {
					submitOk = 0;
					errorContent += 'Please enter select your country<br>';
				}
				
				if (Username == '') {
					submitOk = 0;
					errorContent += 'Please enter a username of at least 4 characters<br>';
				} else {
				
					if (UsernameValid == 0) {
						submitOk = 0;
						errorContent += 'Please enter a valid username of at least 4 characters<br>';
					}
				
				}
				
				if (Password != '') {
				
					if (Password.length < 6) {
						submitOk = 0;
						errorContent += 'Please enter a password of at least 6 characters<br>';
					}
					
					if (Password != PasswordRepeat) {
						submitOk = 0;
						errorContent += 'Your passwords do not match!<br>';
					}
				
				}
			
			} else if (formName == 'PaperForm') {
			
				var Title = document.PaperForm.Title.value;
				
				var Year = document.PaperForm.Year.value;
				var Pages = document.PaperForm.Pages.value;
				var SectorCount = document.PaperForm.SectorCount.value;
				var TopicCount = document.PaperForm.TopicCount.value;
				var AuthorCount = document.PaperForm.AuthorCount.value;
				var OrgCount = document.PaperForm.OrgCount.value;
				
				var SectorId = document.PaperForm.SectorId.value;
				var TopicId = document.PaperForm.TopicId.value;
				var AuthorId = document.PaperForm.AuthorId.value;
				var AuthorNew = document.PaperForm.AuthorNew.value;
				var OrgId = document.PaperForm.OrgId.value;
				var OrgNew = document.PaperForm.OrgNew.value;
				
				var FileSource = document.PaperForm.FileSource.value;
				
				document.getElementById('loaderPaper').style.visibility = "visible";
				
				//errorContent = '';
				
				var fileExt = FileSource.substring((FileSource.length-4),FileSource.length);
				
				if (Title == '') {
					submitOk = 0;
					errorContent += 'Please enter the title of your paper<br>';
				}
				
				if ((Year == '') || (Year == 0)) {
					submitOk = 0;
					errorContent += 'Please enter the year of publication of your paper<br>';
				}
				
				if ((Pages == '') || (Pages == 0)) {
					submitOk = 0;
					errorContent += 'Please enter the number of pages in your paper<br>';
				}
				
				if ((SectorCount == 1) && (SectorId == 0)) {
					submitOk = 0;
					errorContent += 'Please add at least 1 sector<br>';
				}
				
				if ((TopicCount == 1) && (TopicId == 0)) {
					submitOk = 0;
					errorContent += 'Please add at least 1 topic<br>';
				}
				
				if ((AuthorCount == 1) && (AuthorId == 0) && (AuthorNew == '')) {
					submitOk = 0;
					errorContent += 'Please select at least 1 author<br>';
				}
				
				if ((OrgCount == 1) && (OrgId == 0) && (OrgNew == '')) {
					submitOk = 0;
					errorContent += 'Please select at least 1 organisation<br>';
				}
				
				if (FileSource == '') {
					submitOk = 0;
					errorContent += 'Please choose your file before submitting<br>';
				}
				
				if ((fileExt != '.pdf') && (fileExt != '.ppt') && (fileExt != '.doc') && (fileExt != '.xls')) {
					submitOk = 0;
					errorContent += 'Please upload a file of "pdf format", "powerpoint", "document" or "excel"<br>';
				}
			
			} else if (formName == 'ProfileNewsForm') {
			
				var SourceId = document.ProfileNewsForm.SourceId.value;
				var SourceNew = document.ProfileNewsForm.SourceNew.value;
				var Title = document.ProfileNewsForm.Title.value;
				var Synopsis = document.ProfileNewsForm.Synopsis.value;
				var AttachCount = document.ProfileNewsForm.AttachCount.value;
				
				var Title = document.ProfileNewsForm.AttachCount.value;
				
				document.getElementById('loaderNews').style.visibility = "visible";
				
				InvalidDoc = 0;
				
				for (i = 1; i < AttachCount; i++) {
				
					if (eval('document.ProfileNewsForm.AttachFile_'+i)) {
						FileSource = eval('document.ProfileNewsForm.AttachFile_'+i).value;
						fileExt = FileSource.substring((FileSource.length-4),FileSource.length);
						if (fileExt != '.pdf'){
							InvalidDoc = 1;
						}
					}
				
				}
				
				//errorContent = '';
				//var fileExt = FileSource.substring((FileSource.length-4),FileSource.length);
				
				if ((SourceNew == '') && (SourceId == 0)) {
					submitOk = 0;
					errorContent += 'Please enter the source of your news article<br>';
				}
				
				if (Title == '') {
					submitOk = 0;
					errorContent += 'Please enter the title of your news article<br>';
				}
				
				if ((Synopsis == '') || (Synopsis.length > 300)) {
					submitOk = 0;
					errorContent += 'Please enter the summary for your news article, without exceeding 300 characters<br>';
				}
				
				if (InvalidDoc == 1) {
					submitOk = 0;
					errorContent += 'Please add attachments of "pdf format" only<br>';
				}
				
				if (document.getElementById('AttachDocContent_'+AttachCount).style.visibility == 'visible') {
					submitOk = 0;
					errorContent += 'Please click on the Attach button to add your file or link before sharing your news<br>';
				}
				
				/*
				if (FileSource == '') {
					submitOk = 0;
					errorContent += 'Please choose your file before submitting<br>';
				}
				
				if ((fileExt != '.pdf') && (fileExt != '.ppt') && (fileExt != '.doc') && (fileExt != '.xls')) {
					submitOk = 0;
					errorContent += 'Please upload a file of "pdf format", "powerpoint", "document" or "excel"<br>';
				}*/
				
			} else if (formName == 'ProfileDocForm') {
			
				var Title = document.ProfileDocForm.Title.value;
				var FileName = document.ProfileDocForm.FileName.value;
				
				if (Title == '') {
					submitOk = 0;
					errorContent += 'Please enter the document title<br>';
				}
				
				if (FileName == '') {
					submitOk = 0;
					errorContent += 'Please specify the file you wish to upload<br>';
				}
			
			} else if (formName == 'ProfileInviteForm') {
			
				var FirstName = document.ProfileInviteForm.FirstName.value;
				var LastName = document.ProfileInviteForm.LastName.value;
				var Email = document.ProfileInviteForm.Email.value;
				var Message = document.ProfileInviteForm.Message.value;
				
				if (FirstName == '') {
					submitOk = 0;
					errorContent += 'Please enter the first name of the person you wish to invite<br>';
				}
				
				if (LastName == '') {
					submitOk = 0;
					errorContent += 'Please enter the last name of the person you wish to invite<br>';
				}
				
				if (Email == '') {
					submitOk = 0;
					errorContent += 'Please enter the email address of the person you wish to invite<br>';
				}
				
				if (Message == '') {
					submitOk = 0;
					errorContent += 'Please enter a brief message to accompany your invitation<br>';
				}
			
			} else if (formName == 'ProfileInviteFormPublic') {
			
				var SenderName = document.ProfileInviteFormPublic.SenderName.value;
				var SenderEmail = document.ProfileInviteFormPublic.SenderEmail.value;
				var RecipientName = document.ProfileInviteFormPublic.RecipientName.value;
				var RecipientEmail = document.ProfileInviteFormPublic.RecipientEmail.value;
				var Message = document.ProfileInviteFormPublic.Message.value;
				
				if (SenderName == '') {
					submitOk = 0;
					errorContent += 'Please enter your name<br>';
				}
				
				if (SenderEmail == '') {
					submitOk = 0;
					errorContent += 'Please enter your email<br>';
				}
				
				if (RecipientName == '') {
					submitOk = 0;
					errorContent += 'Please enter the recipient\'s name<br>';
				}
				
				if (RecipientEmail == '') {
					submitOk = 0;
					errorContent += 'Please enter the recipient\'s email<br>';
				}
				
				if (Message == '') {
					submitOk = 0;
					errorContent += 'Please enter a brief message to accompany your invitation<br>';
				}
			
			} else if (formName == 'CommentForm') {
			
				var Comment = document.CommentForm.Comment.value;
			/*	var SecurityWord = document.CommentForm.SecurityWord.value;
				var SecurityWordVerify = document.CommentForm.SecurityWordVerify.value;
				*/
				if (trim(Comment) == '') {
					submitOk = 0;
					errorContent += 'Please enter a comment before submitting<br>';
				}
				
				if ((Comment.indexOf('<a') != -1) || (Comment.indexOf('<A') != -1) || (Comment.indexOf('http://') != -1) || (Comment.indexOf('www.') != -1)) {
					submitOk = 0;
					errorContent += 'Please do not enter any links in your comment<br>';
				}
				/*
				if (SecurityWord != SecurityWordVerify) {
					submitOk = 0;
					errorContent += 'Your security word is not correct!<br>';
				}
				*/			
			} else if (formName == 'LoginForm') {
			
				document.LoginForm.LoginUrl.value=document.location.href;
							
			} else if (formName == 'ForumPostForm') {
			
				var Title = document.ForumPostForm.Title.value;
				
				if (trim(Title) == '') {
					submitOk = 0;
					errorContent += 'Please enter a subject before submitting<br>';
				}
							
			} else if (formName == 'GroupPostForm') {
			
				var Title = document.GroupPostForm.Title.value;
				
				if (trim(Title) == '') {
					submitOk = 0;
					errorContent += 'Please enter a subject before submitting<br>';
				}
							
			} else if (formName == 'GroupShareFileForm') {
			
				var Title = document.GroupShareFileForm.Title.value;
				var File = document.GroupShareFileForm.File.value;
				var Link = document.GroupShareFileForm.Link.value;
				
				var checkFile = 1;
				
				if ((document.GroupShareFileForm.MemberDocument) && (document.GroupShareFileForm.MemberDocument.selectedIndex != 0)) {
					checkFile = 0;	
				}
				
				if (checkFile == 1) {
				
					if (trim(Title) == '') {
						submitOk = 0;
						errorContent += 'Please enter a file title<br>';
					}
				
					if ((trim(File) == '') && ((trim(Link) == '') || (trim(Link) == 'http://'))) {
						submitOk = 0;
						errorContent += 'Please choose a file through the browser or enter a link url<br>';
					}
				
				}
							
			} else if (formName == 'GroupMemberForm') {
			
				var Name = document.GroupMemberForm.Name.value;
				var Email = document.GroupMemberForm.Email.value;
				
				if (trim(Name) == '') {
					submitOk = 0;
					errorContent += 'Please enter the full name of the person you wish to invite<br>';
				}
			
				if (trim(Email) == '') {
					submitOk = 0;
					errorContent += 'Please enter the email address of the person you wish to invite<br>';
				}
			
			} else if (formName == 'GroupMeetingForm') {
			
				var Name = document.GroupMeetingForm.Name.value;
				var Location = document.GroupMeetingForm.Location.value;
				var StartDate = document.GroupMeetingForm.StartDate.value;
				var EndDate = document.GroupMeetingForm.EndDate.value;
				
				if (trim(Name) == '') {
					submitOk = 0;
					errorContent += 'Please enter the name of the meeting<br>';
				}
			
				if (trim(Location) == '') {
					submitOk = 0;
					errorContent += 'Please enter the location of the meeting <br>';
				}
			
				if (trim(StartDate) == '') {
					submitOk = 0;
					errorContent += 'Please enter the start date of the meeting <br>';
				}
			
				if (trim(EndDate) == '') {
					submitOk = 0;
					errorContent += 'Please enter the end date of the meeting <br>';
				}
							
			} else if (formName == 'GroupThreadForm') {
			
				var Name = document.GroupThreadForm.Name.value;
				var Synopsis = document.GroupThreadForm.Synopsis.value;
				
				if (trim(Name) == '') {
					submitOk = 0;
					errorContent += 'Please enter the subject of your thread<br>';
				}
			
				if (trim(Synopsis) == '') {
					submitOk = 0;
					errorContent += 'Please enter the message of your thread <br>';
				}
							
			} else if (formName == 'GroupDocForm') {
			
				var Title = document.GroupDocForm.Title.value;
				var Synopsis = document.GroupDocForm.Synopsis.value;
				
				if (trim(Title) == '') {
					submitOk = 0;
					errorContent += 'Please enter the title of the document<br>';
				}
			
				if (trim(Synopsis) == '') {
					submitOk = 0;
					errorContent += 'Please enter the description of the document <br>';
				}
							
			} else if (formName == 'GroupDocSectionForm') {
			
				var Title = document.GroupDocSectionForm.Title.value;
				var Synopsis = document.GroupDocSectionForm.Synopsis.value;
				
				if (trim(Title) == '') {
					submitOk = 0;
					errorContent += 'Please enter the name of the section<br>';
				}
			
				if (trim(Synopsis) == '') {
					submitOk = 0;
					errorContent += 'Please enter the description of the section <br>';
				}
							
			} else if (formName == 'ContactInquiry') {
			
				var FirstName = document.ContactInquiry.FirstName.value;
				var LastName = document.ContactInquiry.LastName.value;
				var Email = document.ContactInquiry.Email.value;
				var Comments = document.ContactInquiry.Comments.value;
				
				if (FirstName == '') {
					submitOk = 0;
					errorContent += 'Please enter your first name<br>';
				}
				
				if (LastName == '') {
					submitOk = 0;
					errorContent += 'Please enter your last name<br>';
				}
				
				if ((Email == '')) {
					submitOk = 0;
					errorContent += 'Please enter your email address<br>';
				} else if (!check_email(Email)) {
					submitOk = 0;
					errorContent += 'Please enter a valid email address<br>';
				}
				
				if (Comments == '') {
					submitOk = 0;
					errorContent += 'Please enter your comments<br>';
				}
				
			} else if (formName == 'SurveyFormHome') {
			
				var Name = document.SurveyFormHome.Name.value;
				var Location = document.SurveyFormHome.Location.value;
				var Country = document.SurveyFormHome.Country.value;
				var Retailer = document.SurveyFormHome.Comments2.value;
				var InstType = document.SurveyFormHome.SurveyOption3.value;
				var Manufaturers = document.SurveyFormHome.Comments5.value;
				
				if (Name == '') {
					submitOk = 0;
					errorContent += 'Please enter the name of Food Store using R744 system<br>';
				}
				
				if (Location == '') {
					submitOk = 0;
					errorContent += 'Please enter the location<br>';
				}
				
				if (Country == '') {
					submitOk = 0;
					errorContent += 'Please enter the country<br>';
				} 
				
				if (Retailer == '') {
					submitOk = 0;
					errorContent += 'Please enter the name of retailer<br>';
				}
				
				if (InstType == '') {
					submitOk = 0;
					errorContent += 'Please enter the type of System<br>';
				}
				
				if (Manufaturers == '') {
					submitOk = 0;
					errorContent += 'Please enter the systems manufacturers involved<br>';
				}
				
			} else if (formName == 'GroupSuggest') {
			
				var Name = document.GroupSuggest.Name.value;
				var Synopsis = document.GroupSuggest.Synopsis.value;
				
				if (Name == '') {
					submitOk = 0;
					errorContent += 'Please enter the group name<br>';
				}
				/*
				if (Synopsis == '') {
					submitOk = 0;
					errorContent += 'Please enter a description of the group<br>';
				}
				*/
				
			} else if (formName == 'ProfileMessageForm') {
			
				var Contact_1 = document.ProfileMessageForm.Contact_1.value;
				var Subject = document.ProfileMessageForm.Subject.value;
				
				//alert(Contact_1);
				
				if (Contact_1 == 0) {
					submitOk = 0;
					errorContent += 'Please select at least one contact<br>';
				}
				if (Subject == '') {
					submitOk = 0;
					errorContent += 'Please enter the subject of your message<br>';
				}
				/*
				if (Synopsis == '') {
					submitOk = 0;
					errorContent += 'Please enter a description of the group<br>';
				}
				*/
				
			}
			
			if (submitOk == 1) {
				if (formName == 'SurveyFormHome') {
					document.SurveyFormHome.submit();
				} else {
					return true;	
				}
			} else {
				
				if (document.getElementById('loaderPaper')) {
				document.getElementById('loaderPaper').style.visibility = "hidden";
				}
				
				if (document.getElementById('loaderNews')) {
				document.getElementById('loaderNews').style.visibility = "hidden";
				}
				
				document.location.href = '#formErrors';
				document.getElementById('formErrorsDiv').style.padding = "10px 5px 5px 0px";
				document.getElementById('formErrorsDiv').style.display = "block";
				document.getElementById('formErrorsDiv').style.color = "#CC0000";
				document.getElementById('formErrorsDiv').innerHTML = errorContent;
				return false;
			}
			
		}
		
		function displayLink(divName) {
			
			//alert(currDiv +" "+ divName);
			
			if ((currDiv != '') && (currDiv != divName)) {
				hideLink(currDiv);
			}
			
			currDiv = divName;	
			
			clearTimeout(timeoutVar);
			pageScroll();
			document.getElementById(divName).style.visibility = "visible";
		
		}
		
		function delayHideLink(divName) {
		
			timeoutVar = setTimeout("hideLink('"+divName+"')",800);
		
		}
		
		function hideLink(divName) {
		
			//sendAjax("functions.php",processAjax);
			//pageScroll();
			document.getElementById(divName).style.visibility = "hidden";
		
		}
		
		function displaySignup() {
			
			currDiv = 'middleInfo';
			
			document.getElementById(currDiv).style.left = "5px";
			document.getElementById(currDiv).style.top = "3px";
			document.getElementById(currDiv).style.width = "605px";
			document.getElementById(currDiv).style.height = "222px";
			
			sendAjax("functions.php?signupInfo=1",processAjax);
			
		}
			
		function displayBlurb(ArticleId,halt,color,colorName) {
			
			
			/*if ((loadedContent == 0)) {
				window.setTimeout("displayBlurb("+ArticleId+","+halt+",'"+color+"','"+colorName+"')",1000);
			} else {}*/
			document.getElementById('hoverDisplayContent').style.top = '0px';
			currDiv = 'hoverDisplay';
			sendAjax("functions.php?displayBlurb=1&ArticleId="+ArticleId+"&color="+color+"&colorName="+colorName,processAjax);
			
		
		}
			
		function displayProdBlurb(ProductId,halt,color,colorName) {
			
			
			document.getElementById('hoverDisplayContent').style.top = '0px';
			currDiv = 'hoverDisplay';
			
			sendAjax("functions.php?displayBlurb=4&ProductId="+ProductId+"&color="+color+"&colorName="+colorName,processAjax);
		
		}
			
		function displayPartnerBlurb(PartnerId,halt) {
			
			//alert(ArticleId);
			
			setWindowProps();
			
			currDiv = 'hoverContent';
			currFunction = 'displayPartnerBlurb('+PartnerId+',1)';
						
			if((tempMouseX+420) > winW) {
				leftPos = winW-420;
			} else {
				leftPos = (tempMouseX+15);
			}
			
			document.getElementById(currDiv).style.left = leftPos + "px";
			document.getElementById(currDiv).style.top = (tempMouseY-125) + "px";
			document.getElementById(currDiv).style.width = "385px";
			document.getElementById(currDiv).style.height = "110px";
			
			document.getElementById(currDiv).style.visibility = "visible";
			
			if(halt == 0) {
				sendAjax("functions.php?displayBlurb=0&PartnerId="+PartnerId,processAjax);
			}
		
		}
			
		function displayIconBlurb(ProfileImageId) {
			
			currDiv = 'imageBlurb';
			//alert(ProfileImageId);
			document.getElementById(currDiv).style.visibility = "visible";
			sendAjax("functions.php?profileIcon=1&ProfileImageId="+ProfileImageId,processAjax);
		
		}
			
		function displayPaperBlurb(PaperId,halt,color,colorName) {
		
			document.getElementById('hoverDisplayContent').style.top = '0px';
			currDiv = 'hoverDisplay';
			
			sendAjax("functions.php?displayBlurb=5&PaperId="+PaperId+"&color="+color+"&colorName="+colorName,processAjax);
		
		}
		
		function uncheckImage() {
			for (var i=0; i<document.MemberImageForm.ProfileImage.length; i++) {
				document.MemberImageForm.ProfileImage[i].checked=false;
			}
		}
		
		function hideBlurb() {
		
			//sendAjax("functions.php",processAjax);
			//pageScroll();
			//clearCurrDiv();
			
			
			if (currDiv == 'hoverDisplay') {
			document.getElementById('hoverDisplayContent').style.top = '-20px';
			}
			
			document.getElementById(currDiv).style.visibility = 'hidden';
			currDiv = "";
			currFunction = "";
		
		}
		
		function clearCurrDiv() {
			if (currDiv != "") {
				document.getElementById(currDiv).style.visibility = "hidden";
				document.getElementById(currDiv).innerHTML = "";
				document.getElementById(currDiv).style.width = "1px";
				document.getElementById(currDiv).style.height = "1px";
				document.getElementById(currDiv).style.left = "0px";
				document.getElementById(currDiv).style.top = "0px";
				currDiv = "";
			}
		}
		
		function hoverTopLink(divName) {
		
		}
		
		function moveGallery(direction,stopLoc) {
		
			//alert(document.getElementById('gallery').style.width);
		
			if ((direction == 0) && (galleryPos <= 0)) {
				galleryPos += 10;
				document.getElementById('gallery').style.left = galleryPos + "px";
				timeoutVar = window.setTimeout("moveGallery("+direction+","+stopLoc+")",50);
			} else if ((direction == 1) && (galleryPos >= (stopLoc+10))) {
				galleryPos -= 10;
				document.getElementById('gallery').style.left = galleryPos + "px";
				timeoutVar = window.setTimeout("moveGallery("+direction+","+stopLoc+")",50);
			}
		
		}
		
		function stopGallery() {
			window.clearTimeout(timeoutVar);
		}
		
		function changeInputType(oldObject, oType) {
			var newObject = document.createElement('input');
			newObject.type = oType;
			if(oldObject.size) newObject.size = oldObject.size;
			if(oldObject.value) newObject.value = oldObject.value;
			if(oldObject.name) newObject.name = oldObject.name;
			if(oldObject.id) newObject.id = oldObject.id;
			if(oldObject.className) newObject.className = oldObject.className;
			oldObject.parentNode.replaceChild(newObject,oldObject);
			return newObject;
		}
		
		function dispTab(tabNum,TabType,CategoryId,Color) {

			hideTab(currTab,Color);
			currTab = tabNum;
			timeoutVar = window.setTimeout('dispTabDesc('+tabNum+')',500);
			document.getElementById('tab'+currTab).className = "insideTabLinksOn";
			
		}
		
		function hideTab(tabNum,Color) {
			
			window.clearTimeout(timeoutVar);
			
			if ((tabNum != 0) && (tabNum != tabOn)) {
				document.getElementById('tab'+tabNum).className = "insideTabLinks";
				//alert(Color);
				if (Color == 'Blue') {
				document.getElementById('tab'+tabNum).className = "insideTabLinksBlue";
				}
				document.getElementById('tabLink'+tabNum).className = "insideTabLinks";
				currTab = 0;
			}
		
		}
		
		function dispTabDesc(tabNum) {
			/*
			document.getElementById('tabInfo'+tabNum).style.height = "5px";
			document.getElementById('tabInfo'+tabNum).style.visibility = "visible";
			timeoutVar = window.setTimeout('expandTabDesc('+tabNum+',10)',10);
			*/
		}
		
		function displayFeat(featNum) {
			
			if (currFeat != featNum) {
				window.clearTimeout(rotateTimeout);
				hideFeat(currFeat);
				hoverFeat(currFeat,featNum);
				currFeat = featNum;
				setOpacity('featContent'+featNum,0,1,10);
				document.getElementById('featContent'+featNum).style.visibility = "visible";				
			}
		}
		
		function displayFeat2(featNum,type,SectionColor,SectionColorBg,Id) {
			
			/*
			alert('displayFeat2('+featNum+','+type+','+SectionColor+','+SectionColorBg+','+Id+')');
			*/
			
			if (currFeat != featNum) {
			
				document.getElementById('featArrow'+currFeat).style.visibility = "hidden";
			
				waitFunction = 'displayFeat2('+featNum+','+type+','+SectionColor+','+SectionColorBg+','+Id+')';
				
				window.clearTimeout(rotateTimeout);
				//hideFeat(currFeat);
				//hoverFeat(currFeat,featNum);
				document.getElementById('featIcon'+currFeat).style.opacity = 6/10;
				document.getElementById('featIcon'+currFeat).style.filter = 'alpha(opacity=' + 6*10 + ')';
				currFeat = featNum;
				document.getElementById('featIcon'+currFeat).style.opacity = 10/10;
				document.getElementById('featIcon'+currFeat).style.filter = 'alpha(opacity=' + 10*10 + ')';
				currDiv = 'featContent';
				
				tempContent = document.getElementById(currDiv).innerHTML;
				
				document.getElementById('featArrow'+featNum).style.visibility = "visible";
				
				loadedContent = 0;
				
				sendAjax("functions.php?tabContentDisp=1&type="+type+"&SectionColor="+SectionColor+"&SectionColorBg="+SectionColorBg+"&Id="+Id,processAjax);
				
			}
		}
		
		function hoverFeat(thisFeat,featNum) {
			featTop = (document.getElementById('featHover').style.top.substr(0,(document.getElementById('featHover').style.top.length-2)))*1;
			//alert(((featNum*1)-(thisFeat*1)));
			//alert(featTop+(((featNum*1)-(thisfeat*1))*100));
			//alert(thisFeat + ' ' + featNum);
			newTop = ((featNum - 1)*100)+10;
			//newTop = featNum*100;
			document.getElementById('featHover').style.top = newTop + "px";
			if (thisFeat != featNum) {
			}
			
		}
		
		function hideFeat(featNum) {
			
			divName = 'featContent'+featNum;
			
			document.getElementById(divName+'Image').style.zIndex = 0;
			document.getElementById(divName+'Image').style.visibility = "hidden";
			/*
			document.getElementById(divName+'Image').style.opacity = 0;
			document.getElementById(divName+'Image').style.filter = 'alpha(opacity=0)';
			if (document.getElementById(divName+'Title')) {
				document.getElementById(divName+'Title').style.opacity = 0;
				document.getElementById(divName+'Title').style.filter = 'alpha(opacity=0)';
				document.getElementById(divName+'Desc').style.opacity = 0;
				document.getElementById(divName+'Desc').style.filter = 'alpha(opacity=0)';
			}
			*/
			
		}
		
		function setOpacityOLD(divName,value,type,timeOffset) {
			
			document.getElementById(divName+'Image').style.zIndex = 4;
			document.getElementById(divName+'Image').style.visibility = "visible";
			document.getElementById(divName+'Image').style.opacity = value/10;
			document.getElementById(divName+'Image').style.filter = 'alpha(opacity=' + value*10 + ')';
			
			if ((value == 10) && (type == 1)) {
				if (document.getElementById(divName+'Title')) {
					document.getElementById(divName+'Title').style.opacity = 8.5/10;
					document.getElementById(divName+'Title').style.filter = 'alpha(opacity=' + 8.5*10 + ')';
					document.getElementById(divName+'Desc').style.opacity = 8.5/10;
					document.getElementById(divName+'Desc').style.filter = 'alpha(opacity=' + 8.5*10 + ')';
				}
			} else if ((value == 0) && (type == 2)) {
				document.getElementById(divName).style.visibility = "hidden";	
			}
			
			if (type == 1) {
				if (value < 10) {
					rotateTimeout = window.setTimeout("setOpacity('"+divName+"',"+(value+1)+","+type+")",timeOffset);
				}
			} else {
				if (value > 0) {
					rotateTimeout = window.setTimeout("setOpacity('"+divName+"',"+(value-1)+","+type+")",timeOffset);
				}
			}
			
		}
		
		function dispFeatDesc(featNum) {
			
			window.clearTimeout(timeoutVar);
			if (currFeat != featNum) {
			
				currFeat = featNum;
			
				document.getElementById('featDesc'+featNum).style.height = "5px";
				timeoutVar = window.setTimeout('expandFeatDesc('+featNum+',10)',10);
				
			}
		}
		
		function expandFeatDesc(featNum,newHeight) {
				
			document.getElementById('featDesc'+featNum).style.visibility = "visible";
			
			if (newHeight < 110) {
				document.getElementById('featDesc'+featNum).style.height = newHeight+"px";
				newHeight += 5;
				timeoutVar = window.setTimeout('expandFeatDesc('+featNum+','+newHeight+')',10);
			}
			
		}
		
		function hideFeatDesc(featNum) {
			currFeat = 0;
			document.getElementById('featDesc'+featNum).style.height = "0px";
			document.getElementById('featDesc'+featNum).style.visibility = "hidden";
		}
		
		function rotateFeat(featNum,startWidth) {
			
			/*alert(document.getElementById('featLink'+currFeat));*/
			
			if (currFeat != featNum) {
				document.getElementById('featLink'+currFeat).style.height = '17px';
				window.setTimeout('rotateFeatMove('+currFeat+',0,0)',10);	
				currFeat = featNum;
				document.getElementById('featContent'+currFeat).style.left = (startWidth+3)+'px';
				//document.getElementById('featLink'+currFeat).style.visibility = 'visible';
				document.getElementById('featLink'+currFeat).style.height = '22px';
				window.setTimeout('rotateFeatMove('+featNum+','+(startWidth-50)+',1)',10);
				
			}
			
			window.clearTimeout(rotateTimeout);
			
			if(featNum == 5) {
				rotateTimeout = window.setTimeout('rotateFeat(1,697)',10000);
			} else {
				rotateTimeout = window.setTimeout('rotateFeat('+(featNum+1)+',697)',10000);
			}
			
		}
		
		function rotateFeatMove(featNum,newLeft,rotateType) {
		
			if ( ((rotateType == 1) && (newLeft > -5)) || ((rotateType == 0) && (newLeft >= -700))) {
				
				if ((rotateType == 1) && (newLeft < 0)) {
					newLeft = 0;
				}
				
				document.getElementById('featContent'+featNum).style.left = newLeft+'px';
				newLeft = (newLeft-50);
				
				window.setTimeout('rotateFeatMove('+featNum+','+newLeft+','+rotateType+')',10);
			}
		}
		
		function setTabContent(tabSection,tabNum,TabType,CategoryId,MemberId,Color,Id) {
			
			currDiv = 'TabContents';
			prevTab = tabOn;
			tabOn = tabNum;
			hideTab(prevTab,Color);
			
			if (tabSection == 1) {
			document.getElementById('tab'+tabNum).className = "insideTabLinksOnBlue";
			} else {
			document.getElementById('tab'+tabNum).className = "insideTabLinksOn";
			}
			
			document.getElementById('tabLink'+tabNum).className = "insideTabLinksOn";
			sendAjax("functions.php?tabContent="+tabSection+"&TabType="+TabType+"&CategoryId="+CategoryId+"&MemberId="+MemberId+"&Id="+Id,processAjax);
			
		}
		
		function show_star(num){
			
			//alert(num);
			
			for (i = 1; i <= num; i++) {
				//alert(document.getElementById('star'+i));
				document.getElementById('star'+i).src = root_link + '/images/main/star_on.gif';
			}
			
		}
		
		function hide_star(){
			
			for (i = 1; i <= 5; i++) {
				document.getElementById('star'+i).src = root_link + '/images/main/star_off.gif';
			}
			
		}
		
		function setRating(TypeId,Id,Num,UserId) {
			
			currDiv = 'ratingDisp';
			//alert("functions.php?setRating=1&TypeId="+TypeId+"&Id="+Id+"&Num="+Num+"&UserId="+UserId);
			sendAjax("functions.php?setRating=1&TypeId="+TypeId+"&Id="+Id+"&Num="+Num+"&UserId="+UserId,processAjax);
		}
		
		function showTopLink(num) {
			document.getElementById('mainLink'+num).className='topLinksButtonOn';
			//document.getElementById('inside').className=sectionClass[(num-1)];
		}
		
		function hideTopLink(num) {
			document.getElementById('mainLink'+num).className='topLinksButton';
			//document.getElementById('inside').className=sectionClass[(currMainLink-1)];
		}
		
		function dispSubMenuSec(num) {
			
			window.clearTimeout(menuSubTimeout);
			
			if(currMenuSub != num) {
				if (currMenuSub != 0) {
					hideSubMenuSec(currMenuSub);
				}
				currMenuSub = num;
				document.getElementById('menuSub'+num).style.visibility = "visible";
			}
			
		}
		
		function delayHideSubMenuSec(num) {
			menuSubTimeout = window.setTimeout('hideSubMenuSec('+num+')',200);
		}
		
		function hideSubMenuSec(num) {
			currMenuSub = 0;
			document.getElementById('menuSub'+num).style.visibility = "hidden";
		}
		
		function changeTextsize(num) {
			
			if (!document.getElementById('textContent').style.fontSize) {
				document.getElementById('textContent').style.fontSize = "13px";	
			}
		
			currFontSize = (document.getElementById('textContent').style.fontSize.substr(0,(document.getElementById('textContent').style.fontSize.length-2)))*1;
			currLineHeight = (document.getElementById('textContent').style.lineHeight.substr(0,(document.getElementById('textContent').style.lineHeight.length-2)))*1;
			
			currFontSize += num;
		
			if ((currFontSize > 8) && (currFontSize < 17)) { 
		
			document.getElementById('textContent').style.fontSize = (currFontSize) + "px";
			document.getElementById('textContent').style.lineHeight = (currLineHeight+num) + "px";
			
			}
		
		}
		
		function scrollPartners() {
			
			if ((document.getElementById('maxTopPartners')) && (document.getElementById('partners'))) {
				
				var maxTopPartners = document.getElementById('maxTopPartners').value;
				maxTopPartners *= -1;
				//alert(maxTopPartners+ ' ' + currTopPartners);
				if ((currTopPartners-maxTopPartners) > 0) {
					//currTopPartners = partnersHeight;
					document.getElementById('partners').style.top = currTopPartners+"px";
				} else {
					currTopPartners = partnersHeight;
					document.getElementById('partners').style.top = currTopPartners+"px";
				}
				
				scrollPartnersMove((currTopPartners-partnersHeight));
			
			}
			/*
			*/
			
		}
		
		function scrollPartnersMove(maxTop) {
			
			//alert(currTopPartners + ' ' + maxTop);
			
			window.clearTimeout(partnersScrollTimeout);
			
			if ((currTopPartners-20) >= maxTop) {
				currTopPartners -= 20;
				document.getElementById('partners').style.top = currTopPartners+"px";
				partnersScrollTimeout = window.setTimeout('scrollPartnersMove('+maxTop+')',50);
			} else {
				currTopPartners = maxTop;
				document.getElementById('partners').style.top = currTopPartners+"px";
				if (currTopPartners > (document.getElementById('package1').value*(-1))) {
					document.getElementById('partnerType').innerHTML = '<img src="'+root_link+'/images/main/partners_gold.gif" width="55" height="65" vspace="0" hspace="0" border="0" style="margin-top: 10px;" /><br />';
					partnersScrollTimeout = window.setTimeout('scrollPartners()',10000);
				} else if (currTopPartners > (document.getElementById('package2').value*(-1))) {
					document.getElementById('partnerType').innerHTML = '<img src="'+root_link+'/images/main/partners_silver.gif" width="55" height="65" vspace="0" hspace="0" border="0" style="margin-top: 10px;" /><br />';
					partnersScrollTimeout = window.setTimeout('scrollPartners()',7000);
				} else {
					document.getElementById('partnerType').innerHTML = '<img src="'+root_link+'/images/main/partners_bronze.gif" width="55" height="65" vspace="0" hspace="0" border="0" style="margin-top: 10px;" /><br />';
					partnersScrollTimeout = window.setTimeout('scrollPartners()',5000);
				} 
			}
			
		}
		
		function verifyUsername(valueVer,divName) {
			if (valueVer.length >= 4) {
				currDiv = divName;
				document.getElementById(divName).innerHTML = '<input type="hidden" name="UsernameValid" value="0" />Verifying availibility...';
				thisMemId = 0;
				if ((document.ProfileForm) && (document.ProfileForm.MemberId)){
					thisMemId = document.ProfileForm.MemberId.value;
				}
				sendAjax("functions.php?verifyUsername=1&Username="+valueVer+"&thisMemId="+thisMemId,processAjax);
			} else {
				document.getElementById(divName).innerHTML = '<input type="hidden" name="UsernameValid" value="0" />&nbsp;';
			}
		}
		
		function verifyEmailValid(valueVer,divName) {
			if (valueVer.length >= 4) {
				currDiv = divName;
				document.getElementById(divName).innerHTML = '<input type="hidden" name="EmailValid" value="0" />Verifying availibility...';
				thisMemId = 0;
				if ((document.ProfileForm) && (document.ProfileForm.MemberId)){
					thisMemId = document.ProfileForm.MemberId.value;
				}
				sendAjax("functions.php?verifyEmailValid=1&Email="+valueVer+"&thisMemId="+thisMemId,processAjax);
			} else {
				document.getElementById(divName).innerHTML = '<input type="hidden" name="EmailValid" value="0" />&nbsp;';
			}
		}
		
		function verifyCompanies(valueVer,divName) {
			if (valueVer != '') {
				currDiv = divName;
				document.getElementById(divName).innerHTML = '&nbsp;';
				sendAjax("functions.php?verifyCompanies=1&CompName="+valueVer,processAjax);
			} else {
				document.getElementById(divName).innerHTML = '';
			}
		}
		
		function setAreaCode(CountryId,divName) {
			currDiv = divName;
			document.getElementById(divName).innerHTML = '&nbsp;';
			//alert("functions.php?getAreaCode=1&CountryId="+CountryId);
			sendAjax("functions.php?getAreaCode=1&CountryId="+CountryId,processAjax);
		}
		
		function hideProfilePicUpload() {
			document.getElementById('addPhoto').style.visibility='hidden';
			document.getElementById('addLogo').style.visibility='hidden';
			document.getElementById('selectImage').style.visibility='hidden';
		}
		
		function hideProfileForm() {
			document.location.href = '#profileTop';
			document.getElementById('profileForm').innerHTML = '';
		}
		
		function editMemberProfile(MemberId) {
			currDiv = 'profileForm';
			currAnchor = '#profileFormLoc'
			sendAjax("functions.php?profileEditForm=1&MemberId="+MemberId,processAjax);
		}
		
		function editMemberImage(MemberId) {
			currDiv = 'profileForm';
			currAnchor = '#profileFormLoc';
			sendAjax("functions.php?profileImageForm=1&MemberId="+MemberId,processAjax);
		}
		
		function editMemberAlerts(MemberId) {
			currDiv = 'profileForm';
			currAnchor = '#profileFormLoc';
			sendAjax("functions.php?profileAlertsForm=1&MemberId="+MemberId,processAjax);
		}
		
		function dispProfileMessageForm(MemberId) {
			currDiv = 'profileForm';
			currAnchor = '#profileFormLoc'
			//alert(MemberId);
			sendAjax("functions.php?profileMessageForm=1&MemberId="+MemberId,processAjax);
		}
		
		function dispMemberProfile(MemberId) {
			currDiv = 'profileForm';
			currAnchor = '#profileFormLoc'
			//alert(MemberId);
			sendAjax("functions.php?dispProfileDetails=1&MemberId="+MemberId,processAjax);
		}
		
		function dispProfileDocForm(MemberId) {
			
			/*
			formBoxWidth = 500;
			formBoxHeight = 300;
			formBoxLoad();
			currDiv = 'formBoxContent';
			*/
			currDiv = 'profileForm';
			currAnchor = '#profileFormLoc'
			
			//document.location.href = '#profileFormLoc';
			//alert(MemberId);
			sendAjax("functions.php?profileDocForm=1&MemberId="+MemberId,processAjax);
		}
		
		function goToCommentsPage(ItemId,Start,Width,Type) {
			currDiv = 'CommentsContent';
			//alert(ItemId+"&Start="+Start+"&Width="+Width);
			sendAjax("functions.php?commentsList=1&ItemId="+ItemId+"&Start="+Start+"&Width="+Width+"&Type="+Type,processAjax);
		}
		
		function knowledgeTabs(SectionId) {
			currDiv = 'tabSpace';
			//alert(document.getElementById('tabSpace'));
			//alert(SectionId);
			sendAjax("functions.php?knowledgeTabs=1&SectionId="+SectionId,processAjax);
		}
		
		function displayShare(Type,Id,MemberId) {
			/*
			document.getElementById('shareDiv').style.visibility = "visible";
			document.getElementById('shareContent').innerHTML = "Loading ...";
			*/
			formBoxLoad();
			currDiv = 'formBoxContent';
			sendAjax("functions.php?shareItem=1&Type="+Type+"&Id="+Id+"&MemberId="+MemberId,processAjax);
		}
		
		function hideShare() {
			document.getElementById('shareDiv').style.visibility = "hidden";
			document.getElementById('shareContent').innerHTML = "";
		}
		
		function sendPartnerRequest(MemberId,PartnerId) {
			
			if (loaded == 1) {
				currDiv = 'PartnerContent';
				//alert(MemberId);
				sendAjax("functions.php?partnerRequestForm=1&MemberId="+MemberId+"&PartnerId="+PartnerId,processAjax);
			}
		}
		
		function dispPartnerProfile(MemberId,PartnerId) {
			currDiv = 'featContent';
			sendAjax("functions.php?dispPartnerProfile=1&PartnerId="+PartnerId+"&MemberId="+MemberId,processAjax);
		}
		
		function PartnerRotate(direction) {
		
		
			if (document.getElementById('partnerTotal')) {
		
				clearTimeout(partnerRotateTimeout);
				clearTimeout(opacityTimeoutVar);
				
				document.getElementById('PartnerRotate'+currPartner).style.visibility = "hidden";
				if (direction == 1) {
					currPartner++;
				} else {
					
					//alert(document.getElementById('partnerTotal').value);
					
					if (currPartner == 1) {
						currPartner = document.getElementById('partnerTotal').value;
					} else {
						currPartner--;
					}
				}
			
				if (!document.getElementById('PartnerRotate'+currPartner)) {
					currPartner = 1;
				}
			
				partnerTimeout = document.getElementById('partnerTimeout'+currPartner).value;
				
				//document.getElementById('partnersTop').style.backgroundColor = '#'+document.getElementById('packageColor'+currPartner).value;
				//document.getElementById('partnersTopTitle').innerHTML = document.getElementById('packageName'+currPartner).value + ' Partners';
				//document.getElementById('partnersTopBorder').style.borderColor = '#'+document.getElementById('packageSecColor'+currPartner).value;
				//document.getElementById('partnersContent').style.backgroundColor = '#'+document.getElementById('packageColor'+currPartner).value;
				
				//setOpacity('PartnerRotate'+currPartner,0);
				//displayOpacity('PartnerRotate'+currPartner,1);
				
				document.getElementById('PartnerRotate'+currPartner).style.visibility = "visible";
				partnerRotateTimeout = window.setTimeout('PartnerRotate(1)',partnerTimeout);
			
			}
		
		}
		
		
		function PartnerRotateGold(direction) {
			
			if (document.getElementById('PartnerRotate'+currPartner)) {
			
				//document.getElementById('partnerDiv'+currPartnerWide).style.visibility = "hidden";
								
				window.clearTimeout(partnerRotateTimeoutMain);
				opacityDivGold('PartnerRotate'+currPartner,10,0);
				//rotateAdvertise();
				
				if (direction == 0) {
					if (currPartner > 1) {
						currPartner--;
					} else {
						currPartner = (document.getElementById('partnerTotal').value*1);
					}
				}
				else {
					if (currPartner < (document.getElementById('partnerTotal').value*1)) {
						currPartner++;
					} else {
						currPartner = 1;
					}
				}
				
			}
			
		}
		
		function opacityDivGold(divName,opacityValue,direction) {
		
			setOpacity(divName,opacityValue);
			
			if (direction == 1) {
				if (opacityValue < 10) {
					window.setTimeout("opacityDivGold('"+divName+"','"+(opacityValue+1)+"',"+direction+")",120);
				} else {
					partnerRotateTimeoutMain = window.setTimeout('PartnerRotateGold(1)',(4000));
				}
			} else {
				if (opacityValue > 0) {
					window.setTimeout("opacityDivGold('"+divName+"','"+(opacityValue-1)+"',"+direction+")",50);
				} else {
					document.getElementById(divName).style.visibility = "hidden";
					opacityDivGold('PartnerRotate'+currPartner,0,1);
					document.getElementById('PartnerRotate'+currPartner).style.visibility = "visible";
				}
			}
		
		}
		
		/*
		
		*/
		
		function removeBookmark(MemberId,BookmarkId,CurrPage) {
			//alert(BookmarkId);
			currDiv = 'TabContents';
			sendAjax("functions.php?removeBookmark=1&MemberId="+MemberId+"&BookmarkId="+BookmarkId+"&CurrPage="+CurrPage,processAjax);
		}
		
		function formBoxLoad() {
			
			window.setTimeout('createFormBox()',100);
		
		}
		
		function createFormBox() {
			
			getScrollOffset();
			/*
			
			formBoxLeft	= Math.round((winW-formBoxWidth)/2)+tempX;
			formBoxTop	= Math.round((winH-formBoxHeight)/2)+tempY;
			*/
			if (formBoxSet == 0) {
			formBoxLeft	= 200;
			formBoxTop	= tempY+110;
			}
			
			formBoxSet = 0;
			
			document.getElementById('formBox').style.left = formBoxLeft + "px";
			document.getElementById('formBox').style.top = formBoxTop + "px";
			document.getElementById('formBoxContent').style.left = (formBoxLeft+5) + "px";
			document.getElementById('formBoxContent').style.top = (formBoxTop+5) + "px";
			
			document.getElementById('formBox').style.width = formBoxWidth + "px";
			document.getElementById('formBox').style.height = formBoxHeight + "px";
			document.getElementById('formBoxCorners').style.width = formBoxWidth + "px";
			document.getElementById('formBoxCorners').style.height = formBoxHeight + "px";
			
			document.getElementById('formBoxContent').style.width = (formBoxWidth-10) + "px";
			document.getElementById('formBoxContent').style.height = (formBoxHeight-10) + "px";
			
			document.getElementById('formBox').style.visibility = "visible";
			document.getElementById('formBoxContent').style.visibility = "visible";
		
		}
		
		function createFormBox_OLD() {
			
			formBoxLeft	= 200+((formBoxWidth-100)/2);
			formBoxTop	= 80;
			
			document.getElementById('formBox').style.left = formBoxLeft + "px";
			document.getElementById('formBox').style.top = formBoxTop + "px";
			document.getElementById('formBoxContent').style.left = (formBoxLeft+5) + "px";
			document.getElementById('formBoxContent').style.top = (formBoxTop+5) + "px";
			
			document.getElementById('formBox').style.width = 100 + "px";
			document.getElementById('formBox').style.height = 10 + "px";
			document.getElementById('formBoxCorners').style.width = 100 + "px";
			document.getElementById('formBoxCorners').style.height = 10 + "px";
			
			document.getElementById('formBoxContent').style.width = (90) + "px";
			document.getElementById('formBoxContent').style.height = (90) + "px";
			
			document.getElementById('formBox').style.visibility = "visible";
			document.getElementById('formBoxContent').style.visibility = "visible";
			
			expandFormBox((formBoxWidth-130),10);
			
		}
		
		function expandFormBox(offset,interval) {
			
			if (offset > 0) {
			
				formBoxLeft	= 200+((offset)/2);
				
				document.getElementById('formBox').style.left = formBoxLeft + "px";
				document.getElementById('formBox').style.top = formBoxTop + "px";
				document.getElementById('formBoxContent').style.left = (formBoxLeft+5) + "px";
				document.getElementById('formBoxContent').style.top = (formBoxTop+5) + "px";
				
				document.getElementById('formBox').style.width = (formBoxWidth-offset) + "px";
				document.getElementById('formBoxCorners').style.width = (formBoxWidth-offset) + "px";
				document.getElementById('formBoxContent').style.width = ((formBoxWidth-offset)-10) + "px";
				
				offset = offset - 30;
				
				window.setTimeout("expandFormBox("+offset+","+interval+")",interval);
			
			} else {
			
				formBoxLeft	= 200;
				
				document.getElementById('formBox').style.left = formBoxLeft + "px";
				document.getElementById('formBox').style.top = formBoxTop + "px";
				document.getElementById('formBoxContent').style.left = (formBoxLeft+5) + "px";
				document.getElementById('formBoxContent').style.top = (formBoxTop+5) + "px";
				
				document.getElementById('formBox').style.width = formBoxWidth + "px";
				document.getElementById('formBoxCorners').style.width = formBoxWidth + "px";
				document.getElementById('formBoxContent').style.width = (formBoxWidth-10) + "px";
				
			}
			
		}
		
		function verifyBox() {
			
			if ((document.getElementById('formBox').style.visibility == 'visible')) {
				
				formBoxLeftLimit = formBoxLeft+formBoxWidth;
				formBoxTopLimit = formBoxTop+formBoxHeight;
				
				if (((tempMouseX < formBoxLeft) || (tempMouseX > formBoxLeftLimit)) || ((tempMouseY < formBoxTop) || (tempMouseY > formBoxTopLimit))) {
					if (loaded != 1) {
						closeFormBox();
					}
				}
				
			}
			
		}
		
		function closeFormBox() {
			
			if (clearForumPost == 0) {
				
				if (document.ForumPostForm) {
			
				if (document.ForumPostForm.Title) {
					tempForumSubject = document.ForumPostForm.Title.value;	
				}
				if (document.ForumPostForm.Content) {
					tempForumPost = document.ForumPostForm.Content.value;	
				}
				
				}
				
			} else {
				tempForumSubject = '';
				tempForumPost = '';
			}
			
			clearForumPost = 0;
			
			document.getElementById('formBox').style.visibility = "hidden";
			document.getElementById('formBoxContent').innerHTML = '&nbsp;';
			document.getElementById('formBoxContent').style.visibility = "hidden";
		}
		
		function createTopic(MemberId,CategoryId) {
		
			formBoxWidth	= 600;
			formBoxHeight	= 400;
			
			formBoxLoad();
			currDiv = 'formBoxContent';
			sendAjax("functions.php?forumTopic=1&MemberId="+MemberId+"&CategoryId="+CategoryId,processAjax);
		
		}
		
		function createThread(MemberId,TopicId) {
		
			formBoxWidth	= 600;
			formBoxHeight	= 400;
			
			formBoxLoad();
			currDiv = 'formBoxContent';
			sendAjax("functions.php?forumThread=1&MemberId="+MemberId+"&TopicId="+TopicId,processAjax);
		
		}
		
		function createGroupThread(MemberId,GroupId) {
		
			formBoxWidth	= 600;
			formBoxHeight	= 400;
			
			formBoxLoad();
			currDiv = 'formBoxContent';
			sendAjax("functions.php?groupThread=1&MemberId="+MemberId+"&GroupId="+GroupId,processAjax);
		
		}
		
		function createPost(MemberId,ThreadId,PostId) {
		
			currDiv = 'NewPost';
			document.location='#addPost';
			/*
			formBoxWidth	= 600;
			formBoxHeight	= 460;
			
			formBoxLoad();
			currDiv = 'formBoxContent';
			*/
			sendAjax("functions.php?forumPost=1&MemberId="+MemberId+"&ThreadId="+ThreadId+"&PostId="+PostId+"&Title="+tempForumSubject+"&Content="+tempForumPost,processAjax);
		
		}
		
		function closeCreatePost() {
		
			document.getElementById('NewPost').innerHTML = '';
		
		}
		
		function createGroupPost(MemberId,ThreadId,PostId) {
		
			formBoxWidth	= 600;
			formBoxHeight	= 420;
			
			formBoxLoad();
			currDiv = 'formBoxContent';
			sendAjax("functions.php?groupPost=1&MemberId="+MemberId+"&ThreadId="+ThreadId+"&PostId="+PostId+"&Title="+tempForumSubject+"&Content="+tempForumPost,processAjax);
		
		}
		
		/*
		
		function groupShareFile(MemberId,GroupId,MeetingId) {
		
			//formBoxWidth	= 600;
			//formBoxHeight	= 420;
			//formBoxLoad();
			
			currDiv = 'ShareFile';
			if (MeetingId != 0) {
				currDiv += MeetingId;
			}
			if (document.getElementById(currDiv).innerHTML != '&nbsp;') {
			document.getElementById(currDiv).innerHTML = '&nbsp;'
			} else {
			sendAjax("functions.php?groupShareFile=1&MemberId="+MemberId+"&GroupId="+GroupId+"&MeetingId="+MeetingId,processAjax);
			}
			
		}
		
		function cancelGroupShareFile(MeetingId) {
			
			closeDiv = 'ShareFile';
			if (MeetingId != 0) {
				closeDiv += MeetingId;
			}
			document.getElementById(closeDiv).innerHTML = '&nbsp;';
		}
		
		*/
		
		/*
		
		function groupAddMeeting(MemberId,GroupId) {
		
			currDiv = 'AddMeeting';
			if (document.getElementById(currDiv).innerHTML != '&nbsp;') {
			document.getElementById(currDiv).innerHTML = '&nbsp;'
			} else {
			sendAjax("functions.php?groupAddMeeting=1&MemberId="+MemberId+"&GroupId="+GroupId,processAjax);
			}
		
		}
		
		function cancelGroupAddMeeting() {
			
			closeDiv = 'AddMeeting';
			document.getElementById(closeDiv).innerHTML = '&nbsp;';
		}
		*/
		
		function groupAddPubEntry(MemberId,PubSectionId,ContentId) {
		
			/*
			formBoxWidth	= 600;
			formBoxHeight	= 420;
			formBoxLoad();
			*/
			
			//document.getElementById('ContentNewMain').style.height = '435px';
			
			if (ContentId == 0) {
				currDiv = 'ApprovedVersion';
			} else {
				currDiv = 'ContentNew';
			}
			
			sendAjax("functions.php?groupAddPubEntry=1&MemberId="+MemberId+"&PubSectionId="+PubSectionId+"&ContentId="+ContentId,processAjax);
		
		}
		
		function cancelPubEntry(PubSectionId,ContentId) {
		
			if (ContentId == 0) {
			
				sendAjax("functions.php?groupApprovedPubEntry=1&PubSectionId="+PubSectionId,processAjax);
			
			} else {
		
				document.getElementById('ContentNewMain').style.height = '35px';
				document.getElementById('ContentNew').innerHTML = '&nbsp;';
				document.getElementById('ContentNew').style.visibility = 'hidden';
			
			}
		
		}
		
		function createTestPost(MemberId,ThreadId,PostId) {
		
			formBoxWidth	= 600;
			formBoxHeight	= 460;
			
			formBoxLoad();
			currDiv = 'formBoxContent';
			sendAjax("functions.php?forumPostNew=1&MemberId="+MemberId+"&ThreadId="+ThreadId+"&PostId="+PostId+"&Title="+tempForumSubject+"&Content="+tempForumPost,processAjax);
		
		}
		
		function setCalendarMonth(Month,Year) {
		
			//Month = document.getElementById('CalendarMonth').value;
			//Year = document.getElementById('CalendarYear').value;
		
			currDiv = 'featContent';
			sendAjax("functions.php?setCalendarMonth=1&Month="+Month+"&Year="+Year,processAjax);
		
		}
		
		function PartnerRotateWideTop(num) {
			
			if (document.getElementById('partnerDivTop'+currPartnerWide)) {
			
				opacityDivTop('partnerDivTop'+currPartnerWide,10,0);
				
				if (num == 0) {
					if (currPartnerWide > 1) {
						currPartnerWide--;
					} else {
						currPartnerWide = (document.getElementById('partnersWideTotal').value*1);
					}
				}
				else {
					if (currPartnerWide < (document.getElementById('partnersWideTotal').value*1)) {
						currPartnerWide++;
					} else {
						currPartnerWide = 1;
					}
				}
				
				//alert(currPartnerWide);
				
				currPackage = document.getElementById('packageId'+currPartnerWide).value*1;
				//alert(currPackage + ' ' + currPartnerWide);
				currBg = document.getElementById('partnerBg'+currPackage).value;
				currTitle = document.getElementById('partnerTitle'+currPackage).value;
				currBorder = document.getElementById('partnerBorder'+currPackage).value;
				
				//document.getElementById('partnerTitle').innerHTML = currTitle;
				document.getElementById('partnerBg').style.backgroundColor = "#"+currBg;
				document.getElementById('partnerBorder').style.backgroundColor = "#"+currBg;
				/*
				*/
				opacityDivTop('partnerDivTop'+currPartnerWide,0,1);
				//rotateDiv('partnerDivTop'+currPartnerWide,5,-100,0);
				//document.getElementById('partnerDivTop'+currPartnerWide).style.visibility = "visible";
	
				//clearTimeout(partnerRotateTimeoutMain);
				
				//alert(document.getElementById('partnerDivTop'+currPartnerWide).style.visibility);
				
			}
			
		}
		
		function PartnerRotateWide(num) {
			
			if (document.getElementById('partnerDiv'+currPartnerWide)) {
			
				//document.getElementById('partnerDiv'+currPartnerWide).style.visibility = "hidden";
				
				opacityDiv('partnerDiv'+currPartnerWide,10,0);
				//rotateAdvertise();
				
				if (num == 0) {
					if (currPartnerWide > 1) {
						currPartnerWide--;
					} else {
						currPartnerWide = (document.getElementById('partnersWideTotal').value*1);
					}
				}
				else {
					if (currPartnerWide < (document.getElementById('partnersWideTotal').value*1)) {
						currPartnerWide++;
					} else {
						currPartnerWide = 1;
					}
				}
				
				currPackage = document.getElementById('packageId'+currPartnerWide).value*1;
				//alert(currPackage + ' ' + currPartnerWide);
				currBg = document.getElementById('partnerBg'+currPackage).value;
				currTitle = document.getElementById('partnerTitle'+currPackage).value;
				currBorder = document.getElementById('partnerBorder'+currPackage).value;
				
				document.getElementById('partnerBg').style.backgroundColor = "#"+currBg;
				document.getElementById('partnerBorder').style.backgroundColor = "#"+currBg;
				
				//rotateDiv('partnerDiv'+currPartnerWide,8,-300,0);
				//document.getElementById('partnerDiv'+currPartnerWide).style.visibility = "visible";
	
				window.clearTimeout(partnerRotateTimeoutMain);
				
				//rotateAdvertise();
				
				//partnerRotateTimeoutMain = window.setTimeout('PartnerRotateWide(1)',4000);
				
			}
			
		}
		
		function rotateAdvertise(num,limit) {
			
			if (document.getElementById('advertiseBanner'+currAdvertise)) {
			
				opacityDivAd('advertiseBanner'+currAdvertise,10,0,limit);
				
				if (num == 0) {
					if (currAdvertise > 0) {
						currAdvertise--;
					} else {
						currAdvertise = limit;
					}
				}
				else {
					if (currAdvertise < limit) {
						currAdvertise++;
					} else {
						currAdvertise = 0;
					}
				}
				
				window.clearTimeout(advertiseRotateTimeoutMain);
				
			}
			
		}
		
		function changeOpacity(divName,opacityValue,direction) {
			
			if (direction == 0) {
				if (opacityValue > 0) {
					window.setTimeout("changeOpacity('"+divName+"',"+(opacityValue-1)+","+direction+")",50);
					setOpacity(divName,opacityValue);
				} else {
					if (currAdvertise == 4) {
						currAdvertise = 0;
					} else {
						currAdvertise = (currAdvertise*1)+1;
					}
					document.getElementById(divName).style.visibility = "hidden";
					divName		= 'advertiseBanner'+currAdvertise;
					setOpacity(divName,0);
					document.getElementById(divName).style.visibility = "visible";
					changeOpacity(divName,0,1);
				}
			} else {
				if (opacityValue < 10) {
					window.setTimeout("changeOpacity('"+divName+"',"+(opacityValue+1)+","+direction+")",120);
				} else {
					window.setTimeout('rotateAdvertise(1,4)',(4000));	
				}
				setOpacity(divName,opacityValue);
			}
			
			
		}
		
		function opacityDiv(divName,opacityValue,direction) {
		
			setOpacity(divName,opacityValue);
			
			if (direction == 1) {
				if (opacityValue < 10) {
					window.setTimeout("opacityDiv('"+divName+"','"+(opacityValue+1)+"',"+direction+")",120);
				} else {
					partnerRotateTimeoutMain = window.setTimeout('PartnerRotateWide(1)',(4000));
				}
			} else {
				if (opacityValue > 0) {
					window.setTimeout("opacityDiv('"+divName+"','"+(opacityValue-1)+"',"+direction+")",50);
				} else {
					document.getElementById(divName).style.visibility = "hidden";
					opacityDiv('partnerDiv'+currPartnerWide,0,1);
					document.getElementById('partnerDiv'+currPartnerWide).style.visibility = "visible";
				}
			}
		
		}
		
		function opacityDivAd(divName,opacityValue,direction,limit) {
		
			setOpacity(divName,opacityValue);
			
			if (direction == 1) {
				if (opacityValue < 10) {
					window.setTimeout("opacityDivAd('"+divName+"','"+(opacityValue+1)+"',"+direction+","+limit+")",120);
				} else {
					advertiseRotateTimeoutMain = window.setTimeout('rotateAdvertise(1,'+limit+')',(4000));
				}
			} else {
				if (opacityValue > 0) {
					window.setTimeout("opacityDivAd('"+divName+"','"+(opacityValue-1)+"',"+direction+","+limit+")",50);
				} else {
					document.getElementById(divName).style.visibility = "hidden";
					opacityDivAd('advertiseBanner'+currAdvertise,0,1,limit);
					document.getElementById('advertiseBanner'+currAdvertise).style.visibility = "visible";
				}
			}
		
		}
		
		function opacityDivTop(divName,opacityValue,direction) {
		
			setOpacity(divName,opacityValue);
			
			if (direction == 1) {
				if (opacityValue < 10) {
					window.setTimeout("opacityDivTop('"+divName+"','"+(opacityValue+1)+"',"+direction+")",120);
				} else {
					partnerRotateTimeoutMain = window.setTimeout('PartnerRotateWideTop(1)',(4000));
					//partnerRotateTimeoutMain = window.setTimeout('rotateAdvertise()',(4000));					
				}
			} else {
				if (opacityValue > 0) {
					window.setTimeout("opacityDivTop('"+divName+"','"+(opacityValue-1)+"',"+direction+")",50);
				} else {
					document.getElementById(divName).style.visibility = "hidden";
					opacityDivTop('partnerDivTop'+currPartnerWide,0,1);
					document.getElementById('partnerDivTop'+currPartnerWide).style.visibility = "visible";
				}
			}
		
		}
		
		function rotateDiv(divName,currOffset,currValue,endValue) {

			//alert(currValue);

			clearTimeout(partnerRotateTimeout);

			if (currValue > -20) {
				currOffset = 10;
			}
			
			if (currValue < endValue) {
				document.getElementById(divName).style.top = currValue + "px";
				partnerRotateTimeout = setTimeout('rotateDiv(\''+divName+'\','+currOffset+','+(currValue+currOffset)+','+endValue+')',30);
			} else {
				document.getElementById(divName).style.top = endValue + "px";
			}

		}
		
		function verifyKey(e) {
		
			var keynum;
			var keychar;
			var numcheck;
			
			if(window.event) {// IE
				keynum = e.keyCode;
			} else if(e.which) { // Netscape/Firefox/Opera
				keynum = e.which;
			}
			
			//alert(keynum);
			
			if (keynum == 13) {
				loginSubmit();
			}

		}
		
		function loginSubmit() {
			document.LoginForm.LoginUrl.value=document.location.href;
			document.LoginForm.submit();
		}
		
		function faqQuestions(FaqId) {
		
			currDiv = "faqQuestions"+FaqId;
			sendAjax("functions.php?setFaqQuestions=1&CategoryId="+FaqId,processAjax);
		
		}
		
		function faqQuestionsHide(FaqId) {
		
			document.getElementById("faqQuestions"+FaqId).innerHTML = document.getElementById("faqQuestionsReplace"+FaqId).innerHTML;
		
		}
		
		function faqQuestionsAnswer(FaqId) {
		
			/*
			formBoxWidth = 600;
			formBoxHeight = 400;
			formBoxLoad();
			currDiv = 'formBoxContent';
			*/
			currDiv = 'faqQuestionItem'+FaqId;
			sendAjax("functions.php?setFaqAnswer=1&ItemId="+FaqId,processAjax);
			
		}
		
		function memberFaqQuestionsAnswer(FaqId) {
		
			/*
			formBoxWidth = 600;
			formBoxHeight = 400;
			formBoxLoad();
			currDiv = 'formBoxContent';
			*/
			currDiv = 'faqQuestionItem'+FaqId;
			sendAjax("functions.php?setMemberFaqAnswer=1&ItemId="+FaqId,processAjax);
			
		}
		
		function faqQuestionsAnswerHide(ItemId) {
		
			document.getElementById("faqQuestionItem"+ItemId).innerHTML = document.getElementById("faqQuestionItemReplace"+ItemId).innerHTML;
		
		}
		
		function displayTextContent(TypeId,Width,Height) {
			formBoxWidth = Width;
			formBoxHeight = Height;
			formBoxLoad();
			currDiv = 'formBoxContent';
			sendAjax("functions.php?displayTextContent=1&TypeId="+TypeId,processAjax);
		}
		
		function displayRequestForm(ContactId,MemberId,ProductId) {
			
			//alert(ContactId+"-"+MemberId+"-"+ProductId);
			if (loaded == 1) {
				
				BannerSectionId = 0;
				
				if (document.getElementById('BannerSectionIdContent')) {
					//alert(document.getElementById('BannerSectionIdContent').innerHTML);
					BannerSectionId	= document.getElementById('BannerSectionIdContent').innerHTML*1;
				}
							
				formBoxWidth = 500;
				formBoxHeight = 330;
				formBoxLoad();
				currDiv = 'formBoxContent';
				sendAjax("functions.php?displayRequestForm=1&ContactId="+ContactId+"&MemberId="+MemberId+"&ProductId="+ProductId+"&BannerSectionId="+BannerSectionId,processAjax);
			
			}
			
		}
		
		function displayPatentForm(AgentId,MemberId,PatentId) {
			
			//alert(ContactId+"-"+MemberId+"-"+ProductId);
			
			formBoxWidth = 500;
			formBoxHeight = 300;
			formBoxLoad();
			currDiv = 'formBoxContent';
			sendAjax("functions.php?displayPatentForm=1&AgentId="+AgentId+"&MemberId="+MemberId+"&PatentId="+PatentId,processAjax);
		}
		
		function displayRequestFormBanner(ContactId,MemberId,BannerId) {
			
			//alert(ContactId+"-"+MemberId+"-"+ProductId);
			
			formBoxWidth = 500;
			formBoxHeight = 300;
			formBoxLoad();
			currDiv = 'formBoxContent';
			sendAjax("functions.php?displayRequestFormBanner=1&ContactId="+ContactId+"&MemberId="+MemberId+"&BannerId="+BannerId,processAjax);
		}
		
		function rotateBanners(num) {
			
			document.getElementById("TopBanner"+num).style.visibility = "visible";
			
			//alert(num);
			//alert(document.getElementById("TopBanner"+num));
			
			if (num == 1) {
				num = 2;
			} else {
				num = 1;
			}
			
			document.getElementById("TopBanner"+num).style.visibility = "hidden";
			
			window.setTimeout("rotateBanners("+num+")",4500);
		
		}
				
		function displayMoreEvents(Year,Month,Day) {
			
			//alert(Year+"-"+Month+"-"+Day);
			
			formBoxWidth = 500;
			formBoxHeight = 300;
			formBoxLoad();
			currDiv = 'formBoxContent';
			sendAjax("functions.php?displayMoreEvents=1&Year="+Year+"&Month="+Month+"&Day="+Day,processAjax);
		}
		
		function alertsCats(num) {
		
			if (num == 0) {

				for (count = 1; count <= 5; count++) {
					
					if (eval('document.SubscriptionForm.CategoryId_'+count)) {
						eval('document.SubscriptionForm.CategoryId_'+count).checked = false;
					}
					
				}
			
			}
		
		}
		
		function groupWarning(NotLoggedIn) {
			formBoxWidth = 500;
			formBoxHeight = 200;
			formBoxLoad();
			currDiv = 'formBoxContent';
			sendAjax("functions.php?groupWarning=1&NotLoggedIn="+NotLoggedIn,processAjax);
		}
		
		function displayForgotContent(SectionId) {
			if (loaded == 1) {
				formBoxWidth = 500;
				formBoxHeight = 200;
				formBoxLoad();
				currDiv = 'formBoxContent';
				sendAjax("functions.php?forgotPassword=1&SectionId="+SectionId,processAjax);
			}
		}
		
		function profileWarning(SectionId) {
			formBoxWidth = 500;
			formBoxHeight = 200;
			formBoxLoad();
			currDiv = 'formBoxContent';
			sendAjax("functions.php?profileWarning=1&SectionId="+SectionId,processAjax);
		}
		
		function paperWarning(SectionId) {
			formBoxWidth = 500;
			formBoxHeight = 200;
			formBoxLoad();
			currDiv = 'formBoxContent';
			sendAjax("functions.php?paperWarning=1&SectionId="+SectionId,processAjax);
		}
		
		function newsShareWarning(SectionId) {
			formBoxWidth = 500;
			formBoxHeight = 200;
			formBoxLoad();
			currDiv = 'formBoxContent';
			sendAjax("functions.php?newsShareWarning=1&SectionId="+SectionId,processAjax);
		}
		
		function sendPassword() {
			
			Email = document.PasswordRequest.Email.value;
			Section = document.PasswordRequest.Section.value;
			currDiv = 'formBoxContent';
			sendAjax("functions.php?forgotPasswordProcess=1&Email="+Email+"&Section="+Section,processAjax);
			
		}
		
		function displayPartnerMedia(MediaId) {
			formBoxWidth = 550;
			formBoxHeight = 430;
			formBoxLoad();
			currDiv = 'formBoxContent';
			sendAjax("functions.php?displayPartnerMedia=1&MediaId="+MediaId,processAjax);
		}
		
		function loadWarning(num) {
			
			if (num == 1) {
			
			formBoxWidth = 500;
			formBoxHeight = 200;
			formBoxLoad();
			
			contentDisp = '<div style="width: 590px; height: 30px; background-color: #c4a1a3"><div class="headline" style="color: #8e1935">Login Error</div></div>';
			contentDisp += '<div style="padding: 10px; padding-bottom: 0px;">';
        	contentDisp += 'The <span style="font-weight: bold;">username</span> or <span style="font-weight: bold;">password</span> you entered is incorrect. Please try again.';
            contentDisp += '<br />';
            contentDisp += '<br />';
            contentDisp += 'If you have forgotten your password, please <a href="javascript: nothing()" onclick="displayForgotContent(4)" style="font-weight: bold;">click here</a>.';
            contentDisp += '<br />';
            contentDisp += '<br />';
            contentDisp += 'If you are not a member, please <a href="'+root_link+'/register.php" class="contentLinks" style="font-weight: bold;">register here</a>.';
            contentDisp += '<br />';
            contentDisp += '<br />';
            contentDisp += '<input type="button" name="Cancel" value="Close Warning" class="button" onclick="closeFormBox()"/>';
        	contentDisp += '</div>';
		
			document.getElementById('formBoxContent').innerHTML = contentDisp;
			//alert(document.getElementById('formBoxContent').innerHTML);
			document.getElementById('formBoxContent').style.visibility = "visible";
		
			} else if (num == 4) {
			
			formBoxWidth = 500;
			formBoxHeight = 200;
			formBoxLoad();
			
			contentDisp = '<div style="width: 590px; height: 30px; background-color: #c4a1a3"><div class="headline" style="color: #8e1935">Login Error</div></div>';
			contentDisp += '<div style="padding: 10px; padding-bottom: 0px;">';
        	contentDisp += '<span style="font-weight: bold;">You have exceeded the maximum number of allowed login attempts.</span>';
            contentDisp += '<br />';
            contentDisp += '<br />';
        	contentDisp += 'You will receive an email shortly with your new generated password which you can modify after logging in.';
            contentDisp += '<br />';
            contentDisp += '<br />';
            contentDisp += '<input type="button" name="Cancel" value="Close Warning" class="button" onclick="closeFormBox()"/>';
        	contentDisp += '</div>';
		
			document.getElementById('formBoxContent').innerHTML = contentDisp;
			//alert(document.getElementById('formBoxContent').innerHTML);
			document.getElementById('formBoxContent').style.visibility = "visible";
				
				
				
			} else if (num == 3) {
				paperWarning(5);
			}
			
		}
		
		function dispGroupPubEntry(ContentId) {
			
			//alert(ContentId);
		
			if (document.getElementById('Revisions'+ContentId).style.visibility == 'visible') {
				document.getElementById('Revisions'+ContentId).style.visibility = 'hidden';
			}
		
			if (document.getElementById('Content'+ContentId).style.visibility == 'hidden') {
				document.getElementById('ContentMain'+ContentId).style.height = '260px';
				document.getElementById('Content'+ContentId).style.visibility = 'visible';
				
				parentContentId = document.getElementById('ContentAboveId'+ContentId).value;
				
				while (parentContentId != 0) {
					parentHeight	= (document.getElementById('ContentMain'+parentContentId).style.height.substr(0,(document.getElementById('ContentMain'+parentContentId).style.height.length-2))*1)+230;
					document.getElementById('ContentMain'+parentContentId).style.height = parentHeight+'px';
					parentContentId = document.getElementById('ContentAboveId'+parentContentId).value;
				}
				
			} else {
				
				parentContentId = document.getElementById('ContentAboveId'+ContentId).value;
				
				while (parentContentId != 0) {
					parentHeight	= (document.getElementById('ContentMain'+parentContentId).style.height.substr(0,(document.getElementById('ContentMain'+parentContentId).style.height.length-2))*1)-230;
					document.getElementById('ContentMain'+parentContentId).style.height = parentHeight+'px';
					parentContentId = document.getElementById('ContentAboveId'+parentContentId).value;
				}
				
				document.getElementById('ContentMain'+ContentId).style.height = '30px';
				document.getElementById('Content'+ContentId).style.visibility = 'hidden';
			}
		
		}
		
		function dispGroupPubRevs(ContentId,RevCount,MemberId,SectionId) {
		
			if (document.getElementById('Content'+ContentId)) {
		
				if (document.getElementById('Content'+ContentId).style.visibility == 'visible') {
					document.getElementById('Content'+ContentId).style.visibility = 'hidden';
				}
				
			}
			
			if (document.getElementById('Revisions'+ContentId).style.visibility != 'hidden') {
				document.getElementById('ContentMain'+ContentId).style.height = '30px';
				
				parentContentId = document.getElementById('ContentAboveId'+ContentId).value;
				
				while (parentContentId != 0) {
					parentHeight	= (document.getElementById('ContentMain'+parentContentId).style.height.substr(0,(document.getElementById('ContentMain'+parentContentId).style.height.length-2))*1)-((RevCount*30));
					document.getElementById('ContentMain'+parentContentId).style.height = parentHeight+'px';
					parentContentId = document.getElementById('ContentAboveId'+parentContentId).value;
				}
				
				document.getElementById('Revisions'+ContentId).style.visibility = 'hidden';
			} else {
				document.getElementById('ContentMain'+ContentId).style.height = ((RevCount*30)+30)+'px';
				
				parentContentId = document.getElementById('ContentAboveId'+ContentId).value;
				
				while (parentContentId != 0) {
					parentHeight	= (document.getElementById('ContentMain'+parentContentId).style.height.substr(0,(document.getElementById('ContentMain'+parentContentId).style.height.length-2))*1)+((RevCount*30));
					document.getElementById('ContentMain'+parentContentId).style.height = parentHeight+'px';
					parentContentId = document.getElementById('ContentAboveId'+parentContentId).value;
				}
				
				document.getElementById('Revisions'+ContentId).style.visibility = 'visible';
				currDiv = 'Revisions'+ContentId;
				sendAjax("functions.php?groupPubRevs=1&ContentId="+ContentId+"&MemberId="+MemberId+"&SectionId="+SectionId,processAjax);
			}
			
			//alert(ContentId);
		
		}
		
		function viewContacts(MemberId,DispType) {
			
			currDiv = 'profileTab';
			sendAjax("functions.php?viewContacts=1&MemberId="+MemberId+"&DispType="+DispType,processAjax);
			
		}
		
		function viewContactsList(MemberId,DispType,OrderBy,CurrResults) {
			
			currDiv = 'profileTab';
			sendAjax("functions.php?viewContactsList=1&MemberId="+MemberId+"&DispType="+DispType+"&OrderBy="+OrderBy+"&CurrResults="+CurrResults,processAjax);
			
		}
		
		function viewContactsSearch(MemberId) {
			
			currDiv = 'profileTab';
			sendAjax("functions.php?viewContactsSearch=1&MemberId="+MemberId,processAjax);
			
		}
		
		function viewPapers(MemberId,DispType) {
			
			currDiv = 'profileTab';
			sendAjax("functions.php?viewPapers=1&MemberId="+MemberId+"&DispType="+DispType,processAjax);
			
		}
		
		function viewPaperEdit(MemberId) {
			
			currDiv = 'profileTab';
			sendAjax("functions.php?viewPaperEdit=1&MemberId="+MemberId,processAjax);
			
		}
		
		function viewPaperHelp(MemberId) {
			
			currDiv = 'profileTab';
			sendAjax("functions.php?viewPaperHelp=1&MemberId="+MemberId,processAjax);
			
		}
		
		function memberPaperInfo(MemberId,PaperId) {
			
			currDiv = 'profileTab';
			sendAjax("functions.php?memberPaperInfo=1&MemberId="+MemberId+"&PaperId="+PaperId,processAjax);
			
		}
		
		function viewNews(MemberId,DispType) {
			
			currDiv = 'profileTab';
			sendAjax("functions.php?viewNews=1&MemberId="+MemberId+"&DispType="+DispType,processAjax);
			
		}
		
		function viewNewsEdit(MemberId,ArticleId) {
			
			currDiv = 'profileTab';
			sendAjax("functions.php?viewNewsEdit=1&MemberId="+MemberId+"&ArticleId="+ArticleId,processAjax);
			
		}
		
		function viewNewsHelp(MemberId) {
			
			currDiv = 'profileTab';
			sendAjax("functions.php?viewNewsHelp=1&MemberId="+MemberId,processAjax);
			
		}
		
		function memberArticleInfo(MemberId,ArticleId) {
			
			currDiv = 'profileTab';
			sendAjax("functions.php?memberArticleInfo=1&MemberId="+MemberId+"&ArticleId="+ArticleId,processAjax);
			
		}
		
		function viewProfileTopics(MemberId) {
			
			currDiv = 'profileTab';
			sendAjax("functions.php?viewProfileTopics=1&MemberId="+MemberId,processAjax);
			
		}
		
		function viewProfileThreads(MemberId) {
			
			currDiv = 'profileTab';
			sendAjax("functions.php?viewProfileThreads=1&MemberId="+MemberId,processAjax);
			
		}
		
		function viewProfilePosts(MemberId) {
			
			currDiv = 'profileTab';
			sendAjax("functions.php?viewProfilePosts=1&MemberId="+MemberId,processAjax);
			
		}
		
		function viewProfileGroups(MemberId,DispType) {
			
			currDiv = 'profileTab';
			sendAjax("functions.php?viewProfileGroups=1&MemberId="+MemberId+"&DispType="+DispType,processAjax);
			
		}
		
		function viewFiles(MemberId) {
			
			currDiv = 'profileTab';
			sendAjax("functions.php?viewFiles=1&MemberId="+MemberId,processAjax);
			
		}
		
		function profileCreateFile(MemberId) {
			
			currDiv = 'profileTab';
			sendAjax("functions.php?profileCreateFile=1&MemberId="+MemberId,processAjax);
			
		}
		
		function dispMemberMessage(MessageId,MemberId,OrderBy,CurrResults) {
			
			document.location.href = '#messageAnchor'+MessageId;
		
			CurrMessage = MessageId;
			currDiv = 'Message'+MessageId;
			
			//alert("MessageId="+MessageId+"&MemberId="+MemberId);
			
			sendAjax("functions.php?messageContent=1&MessageId="+MessageId+"&ThisMemSent="+MemberId+"&OrderBy="+OrderBy+"&CurrResults="+CurrResults,processAjax);
					
		}
		
		function hideMemberMessage(MessageId,MemberId,OrderBy,CurrResults) {
			
			document.location.href = '#messageAnchor'+MessageId;
		
			CurrMessage = MessageId;
			currDiv = 'Message'+MessageId;
			
			//alert(document.getElementById(currDiv).innerHTML);
			
			sendAjax("functions.php?hideMessageContent=1&MessageId="+MessageId+"&ThisMemSent="+MemberId+"&OrderBy="+OrderBy+"&CurrResults="+CurrResults,processAjax);
					
		}
		
		function removeMemberMessage(MessageId,MemberId,OrderBy,CurrResults,Type) {
			
			currDiv = 'profileTab';
			
			//alert("functions.php?removeMemberMessage=1&MessageId="+MessageId+"&ThisMemSent="+MemberId+"&OrderBy="+OrderBy+"&CurrResults="+CurrResults+"&Type="+Type);
						
			sendAjax("functions.php?removeMemberMessage=1&MessageId="+MessageId+"&ThisMemSent="+MemberId+"&OrderBy="+OrderBy+"&CurrResults="+CurrResults+"&Type="+Type,processAjax);
					
		}
		
		function viewBookmarks(MemberId,Type) {
			
			currDiv = 'profileTab';
			sendAjax("functions.php?viewBookmarks=1&MemberId="+MemberId+"&Type="+Type,processAjax);
		
		}
		
		function viewComments(MemberId,Type) {
			
			currDiv = 'profileTab';
			sendAjax("functions.php?viewComments=1&MemberId="+MemberId+"&Type="+Type,processAjax);
		
		}
		
		function viewProfileEdit(MemberId) {
			
			currDiv = 'profileTab';
			sendAjax("functions.php?viewProfileEdit=1&MemberId="+MemberId,processAjax);
			
		}
		
		function viewPublicProfileEdit(MemberId) {
			
			currDiv = 'profileTab';
			sendAjax("functions.php?viewPublicEdit=1&MemberId="+MemberId,processAjax);
			
		}
		
		function viewAlertsEdit(MemberId) {
			
			currDiv = 'profileTab';
			sendAjax("functions.php?viewAlertsEdit=1&MemberId="+MemberId,processAjax);
			
		}
		
		function viewPrivacyEdit(MemberId) {
			
			currDiv = 'profileTab';
			sendAjax("functions.php?viewPrivacyEdit=1&MemberId="+MemberId,processAjax);
			
		}
		
		function viewProfileImageEdit(MemberId) {
			
			//alert(MemberId); 
			
			currDiv = 'profileTab';
			sendAjax("functions.php?viewProfileImageEdit=1&MemberId="+MemberId,processAjax);
			
		}
		
		function editMemberPublic(MemberId,FieldName) {
		
			currDiv = FieldName+'Div';
			//alert(currDiv);
			sendAjax("functions.php?editMemberPublic=1&ThisMember="+MemberId+"&ThisField="+FieldName,processAjax);
		
		}
		
		function cancelEditMemberPublic(MemberId,FieldName) {
		
			currDiv = FieldName+'Div';
			sendAjax("functions.php?cancelEditMemberPublic=1&ThisMember="+MemberId+"&ThisField="+FieldName,processAjax);
		
		}
		
		function saveEditMemberPublic(MemberId,FieldName) {
		
			contentSave = ("document.EditMemberPublic."+FieldName).value;
		
			//alert(document.EditMemberPublic)
			//alert(FieldName);
			
			document.EditMemberPublic.submit();
		
			//currDiv = FieldName+'Div';
			//sendAjax("functions.php?cancelEditMemberPublic=1&ThisMember="+MemberId+"&ThisField="+FieldName,processAjax);
		
		}
		
		function viewProfileInvite(MemberId) {
			
			//alert(MemberId); 
			
			currDiv = 'profileTab';
			sendAjax("functions.php?viewProfileInvite=1&MemberId="+MemberId,processAjax);
			
		}
		
		function groupViewMeetings(MemberId,GroupId) {
			
			currDiv = 'groupTab';
			sendAjax("functions.php?groupViewMeetings=1&MemberId="+MemberId+"&GroupId="+GroupId,processAjax);
			
		}
		
		function groupAddMeeting(MemberId,GroupId,MeetingId) {
			
			//alert(MemberId); 
			
			currDiv = 'groupTab';
			sendAjax("functions.php?groupAddMeeting=1&MemberId="+MemberId+"&GroupId="+GroupId+"&MeetingId="+MeetingId,processAjax);
			
		}
		
		function groupViewThreads(MemberId,GroupId,SecPage) {
			
			//alert(MemberId); 
			
			currDiv = 'groupTab';
			sendAjax("functions.php?groupViewThreads=1&MemberId="+MemberId+"&GroupId="+GroupId+"&SecPage="+SecPage,processAjax);
			
		}
		
		function groupAddThread(MemberId,GroupId) {
			
			currDiv = 'groupTab';
			sendAjax("functions.php?groupAddThread=1&MemberId="+MemberId+"&GroupId="+GroupId,processAjax);
			
		}
		
		function groupViewPosts(MemberId,GroupId,ThreadId) {
			
			//alert(MemberId); 
			
			currDiv = 'groupTab';
			sendAjax("functions.php?groupViewPosts=1&MemberId="+MemberId+"&GroupId="+GroupId+"&ThreadId="+ThreadId,processAjax);
			
		}
		
		function groupViewMembers(MemberId,GroupId) {
			
			currDiv = 'groupTab';
			sendAjax("functions.php?groupViewMembers=1&MemberId="+MemberId+"&GroupId="+GroupId,processAjax);
			
		}
		
		function groupAddMember(MemberId,GroupId) {
			
			currDiv = 'groupTab';
			sendAjax("functions.php?groupAddMember=1&MemberId="+MemberId+"&GroupId="+GroupId,processAjax);
			
		}
		
		function groupViewDocuments(MemberId,GroupId) {
			
			currDiv = 'groupTab';
			sendAjax("functions.php?groupViewDocuments=1&MemberId="+MemberId+"&GroupId="+GroupId,processAjax);
			
		}
		
		function groupAddDocument(MemberId,GroupId,DocumentId) {
			
			currDiv = 'groupTab';
			sendAjax("functions.php?groupAddDocument=1&MemberId="+MemberId+"&GroupId="+GroupId+"&DocumentId="+DocumentId,processAjax);
			
		}
		
		function groupOpenDocument(MemberId,GroupId,PublicationId,SectionId) {
			
			currDiv = 'groupTab';
			sendAjax("functions.php?groupOpenDocument=1&MemberId="+MemberId+"&GroupId="+GroupId+"&PublicationId="+PublicationId+"&SectionId="+SectionId,processAjax);
			
		}
		
		function groupAddDocumentSection(MemberId,GroupId,PublicationId,SectionId) {
			
			currDiv = 'groupContentInside';
			
			getScrollOffset();
			
			/*alert(document.getElementById('groupContent'));*/
			
			document.getElementById('groupContent').style.width = (winW-2)+"px";
			document.getElementById('groupContent').style.height = (winH-2)+"px";
			
			document.getElementById('groupContent').style.left = (tempX-1)+"px";
			document.getElementById('groupContent').style.top = (tempY-1)+"px";
			
			document.getElementById('groupContentTop').style.width = (winW-2)+"px";
			
			document.getElementById('groupContentInside').style.width = (winW-2)+"px";
			document.getElementById('groupContentInside').style.height = (winH-32)+"px";
			
			document.getElementById('groupContent').style.visibility = "visible";
			
			sendAjax("functions.php?groupAddDocumentSection=1&MemberId="+MemberId+"&GroupId="+GroupId+"&PublicationId="+PublicationId+"&SectionId="+SectionId+"&Width="+(winW-2)+"&Height="+(winH-32),processAjax);
			
		}
		
		function groupAddDocumentEntry(MemberId,GroupId,SectionId,ContentId) {
			
			currDiv = 'groupContentInside';
			
			getScrollOffset();
			
			/*alert(document.getElementById('groupContent'));*/
			
			document.getElementById('groupContent').style.width = (winW-2)+"px";
			document.getElementById('groupContent').style.height = (winH-2)+"px";
			
			document.getElementById('groupContent').style.left = (tempX-1)+"px";
			document.getElementById('groupContent').style.top = (tempY-1)+"px";
			
			document.getElementById('groupContentTop').style.width = (winW-2)+"px";
			
			document.getElementById('groupContentInside').style.width = (winW-2)+"px";
			document.getElementById('groupContentInside').style.height = (winH-32)+"px";
			
			document.getElementById('groupContent').style.visibility = "visible";
			
			sendAjax("functions.php?groupAddDocumentEntry=1&MemberId="+MemberId+"&GroupId="+GroupId+"&SectionId="+SectionId+"&ContentId="+ContentId+"&Width="+(winW-2)+"&Height="+(winH-32),processAjax);
			
		}
		
		function viewPublicationRevision(ContentId) {
			
			currDiv = 'dispRevision';
			
			sendAjax("functions.php?groupViewDocumentContent=1&ContentId="+ContentId,processAjax);
			
		}
		
		function closeGroupWindow() {
			
			document.getElementById('groupContent').style.width = 10+"px";
			document.getElementById('groupContent').style.height = 30+"px";
			
			document.getElementById('groupContentTop').style.width = 10+"px";
			
			document.getElementById('groupContentInside').style.width = 10+"px";
			document.getElementById('groupContentInside').style.height = 10+"px";
			
			document.getElementById('groupContent').style.visibility = "hidden";
			
		}
		
		function groupViewDocumentEntries(MemberId,GroupId,SectionId) {
			
			currDiv = 'revisionsList';
			document.location = '#revisionsAnchor';
			sendAjax("functions.php?groupViewDocumentEntries=1&MemberId="+MemberId+"&GroupId="+GroupId+"&SectionId="+SectionId,processAjax);
			
		}
		
		function groupViewDocumentEntry(num) {
		
			document.getElementById('entry'+num).style.height = "345px";
			document.getElementById('entryContent'+num).style.visibility = "visible";
			
		}
		
		function groupCloseDocumentEntry(num) {
		
			document.getElementById('entry'+num).style.height = "25px";
			document.getElementById('entryContent'+num).style.visibility = "hidden";
			
		}
		
		function groupViewFolders(MemberId,GroupId) {
			
			currDiv = 'groupTab';
			sendAjax("functions.php?groupViewFolders=1&MemberId="+MemberId+"&GroupId="+GroupId,processAjax);
			
		}
		
		function groupAddFolder(MemberId,GroupId) {
			
			currDiv = 'groupTab';
			sendAjax("functions.php?groupAddFolder=1&MemberId="+MemberId+"&GroupId="+GroupId,processAjax);
			
		}
		
		function groupViewFiles(MemberId,GroupId,MemberDisp,OrderBy,FolderId) {
			
			currDiv = 'groupTab';
			//alert("functions.php?groupViewFiles=1&MemberId="+MemberId+"&GroupId="+GroupId+"&MemberDisp="+MemberDisp);
			sendAjax("functions.php?groupViewFiles=1&MemberId="+MemberId+"&GroupId="+GroupId+"&MemberDisp="+MemberDisp+"&OrderBy="+OrderBy+"&FolderId="+FolderId,processAjax);
			
		}
		
		function groupShareFile(MemberId,GroupId,MeetingId) {
			
			if (MeetingId != 0) {
				currDiv = 'ShareFile'+MeetingId;
				//alert(currDiv);
				if (ShareFileOpen == 1) {
				document.getElementById(currDiv).innerHTML = '&nbsp;';
				ShareFileOpen = 0;
				} else {
				sendAjax("functions.php?groupShareFile=1&MemberId="+MemberId+"&GroupId="+GroupId+"&MeetingId="+MeetingId,processAjax);
				ShareFileOpen = 1;
				}
			} else {
				currDiv = 'groupTab';
				sendAjax("functions.php?groupShareFile=1&MemberId="+MemberId+"&GroupId="+GroupId+"&MeetingId="+MeetingId,processAjax);
			}
			
		}
		
		function groupShareFileEdit(MemberId,GroupId,FileId) {
			
			currDiv = 'groupTab';
			sendAjax("functions.php?groupShareFileEdit=1&MemberId="+MemberId+"&GroupId="+GroupId+"&FileId="+FileId,processAjax);
			
		}
		
		function cancelGroupShareFile(MeetingId) {
			
			closeDiv = 'ShareFile';
			if (MeetingId != 0) {
				closeDiv += MeetingId;
			}
			document.getElementById(closeDiv).innerHTML = '&nbsp;';
			ShareFileOpen = 0;
		}
		
		function groupAddPost(MemberId,GroupId,ThreadId,PostId) {
		
			currDiv = 'newPost';
			
			if (document.getElementById(currDiv).innerHTML != '') {
				document.getElementById(currDiv).innerHTML = '';
			} else {
				//alert("&MemberId="+MemberId+"&GroupId="+GroupId+"&ThreadId="+ThreadId+"&PostId="+PostId);
				document.getElementById(currDiv).innerHTML = '<div style="width: 200px; height: 500px;">&nbsp;</div>';
				sendAjax("functions.php?groupAddPost=1&MemberId="+MemberId+"&GroupId="+GroupId+"&ThreadId="+ThreadId+"&PostId="+PostId,processAjax);
				document.location.href = '#newPostAnchor';
			}
			
		}
		
		function groupCancelPost() {
			document.getElementById('newPost').innerHTML = '';
		}
		
		/*
		function groupSavePost(MemberId,GroupId,ThreadId,PostId) {
		
			Title = document.GroupPostForm.Title.value;
			Content = document.GroupPostForm.Content.value;
		
		}
		*/
		
		function addPaperSector(num) {
		
			newContentText = document.PaperForm.SectorId[document.PaperForm.SectorId.selectedIndex].text;
			newContentValue = document.PaperForm.SectorId.value;
			newContentNumber = document.PaperForm.SectorCount.value;
			
			//document.PaperForm.SectorCount.value = (newContentNumber*1)+1;
			
			if (newContentValue != 0) {
			
				count = 0;
				
				newContent = '';
		        
				selectContent = '<div style="width: 250px; height: 22px;">';
				selectContent += '<div align="center" style="float: left; width: 170px; height: 30px;">';
				selectContent += '<select name="SectorId" style="width: 150px">';
				for (i = 0; i < document.PaperForm.SectorId.length; i++) {
					if (i != document.PaperForm.SectorId.selectedIndex) {
						selectContent += '<option value="'+document.PaperForm.SectorId[i].value+'">'+document.PaperForm.SectorId[i].text+'</option>';
						count++;
					}
				}
				selectContent += '</select>';
		        selectContent += '</div>';
		        selectContent += '<div align="left" style="float: left; width: 80px; height: 30px;">';
		        selectContent += '<a href="javascript: nothing()" onclick="addPaperSector(0)" style="text-decoration: underline;">';
		        selectContent += 'add another';
		        selectContent += '</a>';
		        selectContent += '</div>';
		        selectContent += '</div>';
				
				startHeight = 30;
				
				if (count == 1) {
					startHeight = 0;
					selectContent = '';
				}
				
				newContent = '<input type="hidden" name="SectorCount" value="'+((newContentNumber*1)+1)+'">';
				
				for (i = 1; i < (newContentNumber*1); i++) {
					newContent += '<div id="SectorAdded_'+i+'" style="width: 250px; height: 22px;">';
					newContent += document.getElementById('SectorAdded_'+i).innerHTML;
					newContent += '</div>';
				}
				
				newContent += '<div id="SectorAdded_'+newContentNumber+'" style="width: 250px; height: 22px;">';
				
				newContent += '<div style="float: left; width: 170px; height: 22px;">';
				newContent += '<input type="hidden" name="Sector_'+newContentNumber+'" value="'+newContentValue+'">';
				newContent += '<div id="SectorAddedText_'+newContentNumber+'" style="padding: 2px 5px 5px 10px;">';
				newContent += newContentText;
				newContent += '</div>';
				newContent += '</div>';
		       
			    newContent += '<div align="left" style="float: left; width: 80px; height: 22px;">';
				newContent += '<div style="padding: 2px 5px 5px 0px;">';
		        newContent += '<a href="javascript: nothing()" onclick="removePaperSector('+newContentNumber+')" style="text-decoration: underline;">';
		        newContent += 'remove';
		        newContent += '</a>';
				newContent += '</div>';
		        newContent += '</div>';
				
				newContent += '</div>';
				
				newContent += selectContent;
				
				document.getElementById('SectorsMain').style.height = startHeight + ((newContentNumber*1)*22);
				document.getElementById('SectorsSelect').style.height = startHeight + ((newContentNumber*1)*22);
				
				document.getElementById('sectors').innerHTML = newContent;
			
			} else {
			
				alert('Please select a sector before adding new one.');
			
			}
			//alert(newContent);
		
		}
		
		/*
		
		*/
		
		function removePaperSector(num) {
		
			newContentNumber = document.PaperForm.SectorCount.value;
	        
			newSelectValue = eval('document.PaperForm.Sector_'+num).value;
			newSelectText = document.getElementById('SectorAddedText_'+num).innerHTML;
			
			selectContent = '<div style="width: 250px; height: 22px;">';
			selectContent += '<div align="center" style="float: left; width: 170px; height: 30px;">';
			selectContent += '<select name="SectorId" style="width: 150px">';
			selectContent += '<option value="0">-Please Select-</option>';
			selectContent += '<option value="'+newSelectValue+'">'+newSelectText+'</option>';
			if (document.PaperForm.SectorId) {
			for (i = 0; i < document.PaperForm.SectorId.length; i++) {
				if (document.PaperForm.SectorId[i].value != 0) {
					selectContent += '<option value="'+document.PaperForm.SectorId[i].value+'">'+document.PaperForm.SectorId[i].text+'</option>';
				}
			}
			}
			selectContent += '</select>';
	        selectContent += '</div>';
	        selectContent += '<div align="left" style="float: left; width: 80px; height: 30px;">';
	        selectContent += '<a href="javascript: nothing()" onclick="addPaperSector(0)" style="text-decoration: underline;">';
	        selectContent += 'add another';
	        selectContent += '</a>';
	        selectContent += '</div>';
	        selectContent += '</div>';
			
			newContent = '<input type="hidden" name="SectorCount" value="'+((newContentNumber*1)-1)+'">';
			
			count = 1;
			
			for (i = 1; i < newContentNumber; i++) {
			
				if (i != num) {
			
					newContent += '<div id="SectorAdded_'+count+'" style="width: 250px; height: 22px;">';
					
					newContent += '<div style="float: left; width: 170px; height: 22px;">';
					newContent += '<input type="hidden" name="Sector_'+count+'" value="'+eval('document.PaperForm.Sector_'+i).value+'">';
					newContent += '<div id="SectorAddedText_'+count+'" style="padding: 2px 5px 5px 10px;">';
					newContent += document.getElementById('SectorAddedText_'+i).innerHTML;
					newContent += '</div>';
					newContent += '</div>';
			       
				    newContent += '<div align="left" style="float: left; width: 80px; height: 22px;">';
					newContent += '<div style="padding: 2px 5px 5px 0px;">';
			        newContent += '<a href="javascript: nothing()" onclick="removePaperSector('+count+')" style="text-decoration: underline;">';
			        newContent += 'remove';
			        newContent += '</a>';
					newContent += '</div>';
			        newContent += '</div>';
					
					newContent += '</div>';
					
					count++;
				
				}
			}
			
			newContent += selectContent;
			
			document.getElementById('SectorsMain').style.height = 30 + ((newContentNumber-2)*22);
			document.getElementById('SectorsSelect').style.height = 30 + ((newContentNumber-2)*22);
			
			document.getElementById('sectors').innerHTML = newContent;
		
		}
		
		function addPaperTopic(num) {
		
			newContentText = document.PaperForm.TopicId[document.PaperForm.TopicId.selectedIndex].text;
			newContentValue = document.PaperForm.TopicId.value;
			newContentNumber = document.PaperForm.TopicCount.value;
			
			if (newContentValue != 0) {
			
				count = 0;
				
				newContent = '';
		        
				selectContent = '<div style="width: 250px; height: 22px;">';
				selectContent += '<div align="center" style="float: left; width: 170px; height: 30px;">';
				selectContent += '<select name="TopicId" style="width: 150px">';
				for (i = 0; i < document.PaperForm.TopicId.length; i++) {
					if (i != document.PaperForm.TopicId.selectedIndex) {
						selectContent += '<option value="'+document.PaperForm.TopicId[i].value+'">'+document.PaperForm.TopicId[i].text+'</option>';
						count++;
					}
				}
				selectContent += '</select>';
		        selectContent += '</div>';
		        selectContent += '<div align="left" style="float: left; width: 80px; height: 30px;">';
		        selectContent += '<a href="javascript: nothing()" onclick="addPaperTopic(0)" style="text-decoration: underline;">';
		        selectContent += 'add another';
		        selectContent += '</a>';
		        selectContent += '</div>';
		        selectContent += '</div>';
				
				//alert(newContentText);
				
				startHeight = 30;
				
				if (count == 1) {
					startHeight = 0;
					selectContent = '';
				}
				
				newContent = '<input type="hidden" name="TopicCount" value="'+((newContentNumber*1)+1)+'">';
				
				for (i = 1; i < (newContentNumber*1); i++) {
					newContent += '<div id="TopicAdded_'+i+'" style="width: 250px; height: 22px;">';
					newContent += document.getElementById('TopicAdded_'+i).innerHTML;
					newContent += '</div>';
				}
				
				newContent += '<div id="TopicAdded_'+newContentNumber+'" style="width: 250px; height: 22px;">';
				
				newContent += '<div style="float: left; width: 170px; height: 22px;">';
				newContent += '<input type="hidden" name="Topic_'+newContentNumber+'" value="'+newContentValue+'">';
				newContent += '<div id="TopicAddedText_'+newContentNumber+'" style="padding: 2px 5px 5px 10px;">';
				newContent += newContentText;
				newContent += '</div>';
				newContent += '</div>';
		       
			    newContent += '<div align="left" style="float: left; width: 80px; height: 22px;">';
				newContent += '<div style="padding: 2px 5px 5px 0px;">';
		        newContent += '<a href="javascript: nothing()" onclick="removePaperTopic('+newContentNumber+')" style="text-decoration: underline;">';
		        newContent += 'remove';
		        newContent += '</a>';
				newContent += '</div>';
		        newContent += '</div>';
				
				newContent += '</div>';
				
				newContent += selectContent;
				
				document.getElementById('TopicsMain').style.height = startHeight + ((newContentNumber*1)*22);
				document.getElementById('TopicsSelect').style.height = startHeight + ((newContentNumber*1)*22);
				
				document.getElementById('topics').innerHTML = newContent;
			
			} else {
			
				alert('Please select a topic before adding new one.');
			
			}
			
			//alert(newContent);
		
		}
		
		/*
		
		*/
		
		function removePaperTopic(num) {
		
			newContentNumber = document.PaperForm.TopicCount.value;
	        
			newSelectValue = eval('document.PaperForm.Topic_'+num).value;
			newSelectText = document.getElementById('TopicAddedText_'+num).innerHTML;
			
			selectContent = '<div style="width: 250px; height: 22px;">';
			selectContent += '<div align="center" style="float: left; width: 170px; height: 30px;">';
			selectContent += '<select name="TopicId" style="width: 150px">';
			selectContent += '<option value="0">-Please Select-</option>';
			selectContent += '<option value="'+newSelectValue+'">'+newSelectText+'</option>';
			if (document.PaperForm.TopicId) {
			for (i = 0; i < document.PaperForm.TopicId.length; i++) {
				if (document.PaperForm.TopicId[i].value != 0) {
				selectContent += '<option value="'+document.PaperForm.TopicId[i].value+'">'+document.PaperForm.TopicId[i].text+'</option>';
				}
			}
			}
			selectContent += '</select>';
	        selectContent += '</div>';
	        selectContent += '<div align="left" style="float: left; width: 80px; height: 30px;">';
	        selectContent += '<a href="javascript: nothing()" onclick="addPaperTopic(0)" style="text-decoration: underline;">';
	        selectContent += 'add another';
	        selectContent += '</a>';
	        selectContent += '</div>';
	        selectContent += '</div>';
			
			newContent = '<input type="hidden" name="TopicCount" value="'+((newContentNumber*1)-1)+'">';
			
			count = 1;
			
			for (i = 1; i < newContentNumber; i++) {
			
				if (i != num) {
			
					newContent += '<div id="TopicAdded_'+count+'" style="width: 250px; height: 22px;">';
					
					newContent += '<div style="float: left; width: 170px; height: 22px;">';
					newContent += '<input type="hidden" name="Topic_'+count+'" value="'+eval('document.PaperForm.Topic_'+i).value+'">';
					newContent += '<div id="TopicAddedText_'+count+'" style="padding: 2px 5px 5px 10px;">';
					newContent += document.getElementById('TopicAddedText_'+i).innerHTML;
					newContent += '</div>';
					newContent += '</div>';
			       
				    newContent += '<div align="left" style="float: left; width: 80px; height: 22px;">';
					newContent += '<div style="padding: 2px 5px 5px 0px;">';
			        newContent += '<a href="javascript: nothing()" onclick="removePaperTopic('+count+')" style="text-decoration: underline;">';
			        newContent += 'remove';
			        newContent += '</a>';
					newContent += '</div>';
			        newContent += '</div>';
					
					newContent += '</div>';
					
					count++;
				
				}
			}
			
			newContent += selectContent;
			
			document.getElementById('TopicsMain').style.height = 30 + ((newContentNumber-2)*22);
			document.getElementById('TopicsSelect').style.height = 30 + ((newContentNumber-2)*22);
			
			document.getElementById('topics').innerHTML = newContent;
		
		}
		
		function addPaperAuthor(num) {
		
			newContentText = document.PaperForm.AuthorId[document.PaperForm.AuthorId.selectedIndex].text;
			newContentValue = document.PaperForm.AuthorId.value;
			newContentNumber = document.PaperForm.AuthorCount.value;
			
			unknownName	= document.PaperForm.AuthorNew.value;
			
			if ((newContentValue != 0) || (unknownName != '')) {
			
				//document.PaperForm.AuthorCount.value = (newContentNumber*1)+1;
				
				count = 0;
				
				newContent = '';
		        
				selectContent = '<div style="width: 480px; height: 22px;">';
				selectContent += '<div align="center" style="float: left; width: 400px; height: 30px;">';
				selectContent += '<select name="AuthorId" style="width: 200px">';
				for (i = 0; i < document.PaperForm.AuthorId.length; i++) {
					if ((i != document.PaperForm.AuthorId.selectedIndex) || (unknownName != '')) {
						selectContent += '<option value="'+document.PaperForm.AuthorId[i].value+'">'+document.PaperForm.AuthorId[i].text+'</option>';
						count++;
					}
				}
				selectContent += '</select>';
				selectContent += ' or ';
	        	selectContent += ' <input type="text" name="AuthorNew" value="" size="30" style="width: 162px" class="input">';
		        selectContent += '</div>';
		        selectContent += '<div align="left" style="float: left; width: 80px; height: 30px;">';
		        selectContent += '<a href="javascript: nothing()" onclick="addPaperAuthor(0)" style="text-decoration: underline;">';
		        selectContent += 'add another';
		        selectContent += '</a>';
		        selectContent += '</div>';
		        selectContent += '</div>';
				
				//alert(newContentText);
				
				startHeight = 30;
				
				if (count == 1) {
					startHeight = 0;
					selectContent = '';
				}
				
				newContent = '<input type="hidden" name="AuthorCount" value="'+((newContentNumber*1)+1)+'">';
				
				for (i = 1; i < (newContentNumber*1); i++) {
					newContent += '<div id="AuthorAdded_'+i+'" style="width: 300px; height: 22px;">';
					newContent += document.getElementById('AuthorAdded_'+i).innerHTML;
					newContent += '</div>';
				}
				
				newContent += '<div id="AuthorAdded_'+newContentNumber+'" style="width: 300px; height: 22px;">';
				
				newContent += '<div style="float: left; width: 220px; height: 22px;">';
				if (unknownName != '') {
				newContent += '<input type="hidden" name="Author_'+newContentNumber+'" value="0">';
				newContentText = unknownName;
				} else {
				newContent += '<input type="hidden" name="Author_'+newContentNumber+'" value="'+newContentValue+'">';
				}
				newContent += '<input type="hidden" name="AuthorText_'+newContentNumber+'" value="'+newContentText+'">';
				newContent += '<div id="AuthorAddedText_'+newContentNumber+'" style="padding: 2px 5px 5px 10px;">';
				newContent += newContentText;
				newContent += '</div>';
				newContent += '</div>';
		       
			    newContent += '<div align="left" style="float: left; width: 80px; height: 22px;">';
				newContent += '<div style="padding: 2px 5px 5px 0px;">';
		        newContent += '<a href="javascript: nothing()" onclick="removePaperAuthor('+newContentNumber+')" style="text-decoration: underline;">';
		        newContent += 'remove';
		        newContent += '</a>';
				newContent += '</div>';
		        newContent += '</div>';
				
				newContent += '</div>';
				
				newContent += selectContent;
				
				document.getElementById('AuthorsMain').style.height = startHeight + ((newContentNumber*1)*22);
				document.getElementById('AuthorsSelect').style.height = startHeight + ((newContentNumber*1)*22);
				
				document.getElementById('authors').innerHTML = newContent;
			
			} else {
			
				alert('Please select an author or enter a new one before adding the next one.');
			
			}
			//alert(newContent);
		
		}
		
		/*
		
		*/
		
		function removePaperAuthor(num) {
		
			newContentNumber = document.PaperForm.AuthorCount.value;
	        
			newSelectValue = eval('document.PaperForm.Author_'+num).value;
			newSelectText = document.getElementById('AuthorAddedText_'+num).innerHTML;
			
			selectContent = '<div style="width: 480px; height: 22px;">';
			selectContent += '<div align="center" style="float: left; width: 400px; height: 30px;">';
			selectContent += '<select name="AuthorId" style="width: 200px">';
			selectContent += '<option value="0">-Please Select or Enter New-</option>';
			//alert(newSelectText);
			if (newSelectValue != 0) {
			selectContent += '<option value="'+newSelectValue+'">'+newSelectText+'</option>';
			}
			if (document.PaperForm.AuthorId) {
			for (i = 0; i < document.PaperForm.AuthorId.length; i++) {
				if (document.PaperForm.AuthorId[i].value != 0) {
				selectContent += '<option value="'+document.PaperForm.AuthorId[i].value+'">'+document.PaperForm.AuthorId[i].text+'</option>';
				}
			}
			}
			selectContent += '</select>';
			//alert(selectContent);
			selectContent += ' or ';
        	selectContent += ' <input type="text" name="AuthorNew" value="" size="30" style="width: 162px" class="input">';
	        selectContent += '</div>';
	        selectContent += '<div align="left" style="float: left; width: 80px; height: 30px;">';
	        selectContent += '<a href="javascript: nothing()" onclick="addPaperAuthor(0)" style="text-decoration: underline;">';
	        selectContent += 'add another';
	        selectContent += '</a>';
	        selectContent += '</div>';
	        selectContent += '</div>';
			
			newContent = '<input type="hidden" name="AuthorCount" value="'+((newContentNumber*1)-1)+'">';
			
			count = 1;
			
			for (i = 1; i < newContentNumber; i++) {
			
				if (i != num) {
			
					newContent += '<div id="AuthorAdded_'+count+'" style="width: 300px; height: 22px;">';
					
					newContent += '<div style="float: left; width: 220px; height: 22px;">';
					newContent += '<input type="hidden" name="Author_'+count+'" value="'+eval('document.PaperForm.Author_'+i).value+'">';
					newContent += '<input type="hidden" name="AuthorText_'+count+'" value="'+eval('document.PaperForm.AuthorText_'+i).value+'">';
					newContent += '<div id="AuthorAddedText_'+count+'" style="padding: 2px 5px 5px 10px;">';
					newContent += document.getElementById('AuthorAddedText_'+i).innerHTML;
					newContent += '</div>';
					newContent += '</div>';
			       
				    newContent += '<div align="left" style="float: left; width: 80px; height: 22px;">';
					newContent += '<div style="padding: 2px 5px 5px 0px;">';
			        newContent += '<a href="javascript: nothing()" onclick="removePaperAuthor('+count+')" style="text-decoration: underline;">';
			        newContent += 'remove';
			        newContent += '</a>';
					newContent += '</div>';
			        newContent += '</div>';
					
					newContent += '</div>';
					
					count++;
				
				}
			}
			
			newContent += selectContent;
			
			document.getElementById('AuthorsMain').style.height = 30 + ((newContentNumber-2)*22);
			document.getElementById('AuthorsSelect').style.height = 30 + ((newContentNumber-2)*22);
			
			document.getElementById('authors').innerHTML = newContent;
		
		}
		
		function addPaperOrg(num) {
		
			newContentText = document.PaperForm.OrgId[document.PaperForm.OrgId.selectedIndex].text;
			newContentValue = document.PaperForm.OrgId.value;
			newContentNumber = document.PaperForm.OrgCount.value;
			
			unknownName	= document.PaperForm.OrgNew.value;
			
			if ((newContentValue != 0) || (unknownName != '')) {
			
				count = 0;
				
				newContent = '';
		        
				selectContent = '<div style="width: 480px; height: 22px;">';
				selectContent += '<div align="center" style="float: left; width: 400px; height: 30px;">';
				selectContent += '<select name="OrgId" style="width: 200px">';
				for (i = 0; i < document.PaperForm.OrgId.length; i++) {
					if ((i != document.PaperForm.OrgId.selectedIndex) || (unknownName != '')) {
						selectContent += '<option value="'+document.PaperForm.OrgId[i].value+'">'+document.PaperForm.OrgId[i].text+'</option>';
						count++;
					}
				}
				selectContent += '</select>';
				selectContent += ' or ';
	        	selectContent += ' <input type="text" name="OrgNew" value="" size="30" style="width: 162px" class="input">';
		        selectContent += '</div>';
		        selectContent += '<div align="left" style="float: left; width: 80px; height: 30px;">';
		        selectContent += '<a href="javascript: nothing()" onclick="addPaperOrg(0)" style="text-decoration: underline;">';
		        selectContent += 'add another';
		        selectContent += '</a>';
		        selectContent += '</div>';
		        selectContent += '</div>';
				
				//alert(newContentText);
				
				startHeight = 30;
				
				if (count == 1) {
					startHeight = 0;
					selectContent = '';
				}
				
				newContent = '<input type="hidden" name="OrgCount" value="'+((newContentNumber*1)+1)+'">';
				
				for (i = 1; i < (newContentNumber*1); i++) {
					newContent += '<div id="OrgAdded_'+i+'" style="width: 300px; height: 22px;">';
					newContent += document.getElementById('OrgAdded_'+i).innerHTML;
					newContent += '</div>';
				}
				
				newContent += '<div id="OrgAdded_'+newContentNumber+'" style="width: 300px; height: 22px;">';
				
				newContent += '<div style="float: left; width: 220px; height: 22px;">';
				if (unknownName != '') {
				newContent += '<input type="hidden" name="Org_'+newContentNumber+'" value="0">';
				newContentText = unknownName;
				} else {
				newContent += '<input type="hidden" name="Org_'+newContentNumber+'" value="'+newContentValue+'">';
				}
				newContent += '<input type="hidden" name="OrgText_'+newContentNumber+'" value="'+newContentText+'">';
				newContent += '<div id="OrgAddedText_'+newContentNumber+'" style="padding: 2px 5px 5px 10px;">';
				newContent += newContentText;
				newContent += '</div>';
				newContent += '</div>';
		       
			    newContent += '<div align="left" style="float: left; width: 80px; height: 22px;">';
				newContent += '<div style="padding: 2px 5px 5px 0px;">';
		        newContent += '<a href="javascript: nothing()" onclick="removePaperOrg('+newContentNumber+')" style="text-decoration: underline;">';
		        newContent += 'remove';
		        newContent += '</a>';
				newContent += '</div>';
		        newContent += '</div>';
				
				newContent += '</div>';
				
				newContent += selectContent;
				
				document.getElementById('OrgsMain').style.height = startHeight + ((newContentNumber*1)*22);
				document.getElementById('OrgsSelect').style.height = startHeight + ((newContentNumber*1)*22);
				
				document.getElementById('orgs').innerHTML = newContent;
			
			} else {
			
				alert('Please select an organisation or enter a new one before adding the next one.');
			
			}
			//alert(newContent);
		
		}
		
		/*
		
		*/
		
		function removePaperOrg(num) {
		
			newContentNumber = document.PaperForm.OrgCount.value;
	        
			newSelectValue = eval('document.PaperForm.Org_'+num).value;
			newSelectText = document.getElementById('OrgAddedText_'+num).innerHTML;
			
			selectContent = '<div style="width: 480px; height: 22px;">';
			selectContent += '<div align="center" style="float: left; width: 400px; height: 30px;">';
			selectContent += '<select name="OrgId" style="width: 200px">';
			selectContent += '<option value="0">-Please Select or Enter New-</option>';
			if (newSelectValue != 0) {
			selectContent += '<option value="'+newSelectValue+'">'+newSelectText+'</option>';
			}
			if (document.PaperForm.OrgId) {
			for (i = 0; i < document.PaperForm.OrgId.length; i++) {
				if (document.PaperForm.OrgId[i].value != 0) {
				selectContent += '<option value="'+document.PaperForm.OrgId[i].value+'">'+document.PaperForm.OrgId[i].text+'</option>';
				}
			}
			}
			selectContent += '</select>';
			selectContent += ' or ';
        	selectContent += ' <input type="text" name="OrgNew" value="" size="30" style="width: 162px" class="input">';
	        selectContent += '</div>';
	        selectContent += '<div align="left" style="float: left; width: 80px; height: 30px;">';
	        selectContent += '<a href="javascript: nothing()" onclick="addPaperOrg(0)" style="text-decoration: underline;">';
	        selectContent += 'add another';
	        selectContent += '</a>';
	        selectContent += '</div>';
	        selectContent += '</div>';
			
			newContent = '<input type="hidden" name="OrgCount" value="'+((newContentNumber*1)-1)+'">';
			
			count = 1;
			
			for (i = 1; i < newContentNumber; i++) {
			
				if (i != num) {
			
					newContent += '<div id="OrgAdded_'+count+'" style="width: 300px; height: 22px;">';
					
					newContent += '<div style="float: left; width: 220px; height: 22px;">';
					newContent += '<input type="hidden" name="Org_'+count+'" value="'+eval('document.PaperForm.Org_'+i).value+'">';
					newContent += '<input type="hidden" name="OrgText_'+count+'" value="'+eval('document.PaperForm.OrgText_'+i).value+'">';
					newContent += '<div id="OrgAddedText_'+count+'" style="padding: 2px 5px 5px 10px;">';
					newContent += document.getElementById('OrgAddedText_'+i).innerHTML;
					newContent += '</div>';
					newContent += '</div>';
			       
				    newContent += '<div align="left" style="float: left; width: 80px; height: 22px;">';
					newContent += '<div style="padding: 2px 5px 5px 0px;">';
			        newContent += '<a href="javascript: nothing()" onclick="removePaperOrg('+count+')" style="text-decoration: underline;">';
			        newContent += 'remove';
			        newContent += '</a>';
					newContent += '</div>';
			        newContent += '</div>';
					
					newContent += '</div>';
					
					count++;
				
				}
			}
			
			newContent += selectContent;
			
			document.getElementById('OrgsMain').style.height = 30 + ((newContentNumber-2)*22);
			document.getElementById('OrgsSelect').style.height = 30 + ((newContentNumber-2)*22);
			
			document.getElementById('orgs').innerHTML = newContent;
		
		}
		
		function displayPaperHelp(num) {
			
			var helpContent = new Array();
			
			helpContent[0] = '<span style="font-weight: bold;">Language:</span> Choose the main language of the document. For now, R744.com displays papers in English, German and French.';
			helpContent[1] = '<span style="font-weight: bold;">Source:</span> Choose the type of source that published the paper:';
			helpContent[1] += '<ul><li><span style="font-weight: bold;">Industry / Business:</span> companies, industry associations etc.</li>';
			helpContent[1] += '<li><span style="font-weight: bold;">Media:</span> magazines, newspapers, websites & other news sources</li>';
			helpContent[1] += '<li><span style="font-weight: bold;">Policy & NGOs:</span> governments, international organizations, non-governmental sources, state/federal environmental agencies etc.</li>';
			helpContent[1] += '<li><span style="font-weight: bold;">Research / Science:</span> universities, research institutes etc.</li></ul>';
			helpContent[2] = '<span style="font-weight: bold;">Type:</span> Choose the most relevant type associated with your paper.';
			helpContent[3] = '<span style="font-weight: bold;">Year:</span> Add the year when the papers was created, first published or presented.';
			helpContent[4] = '<span style="font-weight: bold;">Page Number:</span>  Add the number of pages the document consists of.';
			helpContent[5] = '<span style="font-weight: bold;">Paper Title:</span> Add the exact and complete title of the publication. Please do not exceed <span style="font-weight: bold">150 characters</span>.';
			helpContent[6] = '<span style="font-weight: bold;">Summary:</span> Please give a short description of what the publication is about. Try to be as concise as possible. (optional)';
			helpContent[7] = '<span style="font-weight: bold;">Sector:</span> Select one or more applications the paper talks about:';
			helpContent[7] += '<ul><li><span style="font-weight: bold;">Heating:</span> heat pumps, hot water & space heating etc.</li>';
			helpContent[7] += '<li><span style="font-weight: bold;">Refrigeration:</span> industrial, transport & commercial refrigeration, chillers, freezers, vending machines, etc.</li>';
			helpContent[7] += '<li><span style="font-weight: bold;">Mobile Air Conditioning:</span> air conditioning for cars, buses, trucks, trains.</li>';
			helpContent[7] += '<li><span style="font-weight: bold;">Others:</span> stationary air conditioning, other new developments.</li></ul>';
			helpContent[8] = '<span style="font-weight: bold;">Topic:</span> Select one or more subjects mentioned in the paper:<br>';
			helpContent[8] += '<ul><li><span style="font-weight: bold;">Product / Technology:</span> specific products, test models, installations, developments </li>';
			helpContent[8] += '<li><span style="font-weight: bold;">Test Results:</span> diagrammes, calculations, test results etc.</li>';
			helpContent[8] += '<li><span style="font-weight: bold;">Environment:</span> direct & indirect greenhouse gas emissions, leakage, energy efficiency etc.</li>';
			helpContent[8] += '<li><span style="font-weight: bold;">Economy / Business:</span> costs of CO2 Technology & alternatives, commercialization, market trends, sales figures etc.</li>';
			helpContent[8] += '<li><span style="font-weight: bold;">Safety:</span> pressure, toxicity, flammability, servicing, maintenance, training requirements, safety standards</li>';
			helpContent[8] += '<li><span style="font-weight: bold;">Policy & Law:</span> laws, regulations, directives, state / regional / national / international climate policy, global environmental frameworks (Montreal, Kyoto Protocol) etc.</li></ul>';
			helpContent[9] = '<span style="font-weight: bold;">Author(s):</span> Select one author from the scroll menu (already linked to organisation) OR enter a new name.';
			helpContent[10] = '<span style="font-weight: bold;">Organisation(s):</span> Select an organisation from the scroll menu OR enter a new organisation.';
			helpContent[11] = '<span style="font-weight: bold;">Upload your file:</span> Select the file you want to upload from your local drive. Please note: All documents must be submitted in pdf format.';
			
			var helpContentHeight = new Array();

			helpContentHeight[0] = 140;
			helpContentHeight[1] = 210;
			helpContentHeight[2] = 140;
			helpContentHeight[3] = 140;
			helpContentHeight[4] = 140;
			helpContentHeight[5] = 140;
			helpContentHeight[6] = 140;
			helpContentHeight[7] = 210;
			helpContentHeight[8] = 320;
			helpContentHeight[9] = 140;
			helpContentHeight[10] = 140;
			helpContentHeight[11] = 140;

			document.getElementById('paperHelp').innerHTML = '<div style="padding: 5px;">'+helpContent[num-1]+'</div>';
			document.getElementById('paperHelp').style.height = helpContentHeight[num-1]+"px";
		
			if (num > 7) {
			document.getElementById('paperHelp').style.top = "130px";
			} else {
			document.getElementById('paperHelp').style.top = "0px";
			}
		
			document.getElementById('paperHelp').style.visibility = "visible";
		
		}
		
		function hidePaperHelp(num) {
		
			document.getElementById('paperHelp').style.visibility = "hidden";
		
		}
		
		function dispAddNewsMoreInfo() {
		
			AttachCount = document.ProfileNewsForm.AttachCount.value*1;
			RemoveCount = document.ProfileNewsForm.RemoveCount.value*1; 
			
			ExtraHeight = 50*((AttachCount-RemoveCount)-1);
			
			//alert(ExtraHeight+ ' ' + document.ProfileNewsForm.AttachCount.value);
			
			document.getElementById('AttachDocDiv').style.height = (ExtraHeight+150) + "px";
		
			document.getElementById('AttachDocList').style.height = (ExtraHeight+120) + "px";
			
			document.getElementById('AttachDocContent_'+AttachCount).style.visibility = "visible";
		
			document.getElementById('AttachDocLink').style.top = (ExtraHeight+120) + "px";
			
			document.location.href='#newsForm';
		
		}
		
		function hideNewsMoreInfo() {
		
			AttachCount = document.ProfileNewsForm.AttachCount.value*1; 
			RemoveCount = document.ProfileNewsForm.RemoveCount.value*1; 
			
			ExtraHeight = 50*((AttachCount-RemoveCount)-1);
			
			document.getElementById('AttachDocDiv').style.height = (ExtraHeight+30) + "px";
		
			document.getElementById('AttachDocList').style.height = (ExtraHeight) + "px";
			
			document.getElementById('AttachDocContent_'+AttachCount).style.visibility = "hidden";
		
			document.getElementById('AttachDocLink').style.top = (ExtraHeight) + "px";
		
		}
		
		function addNewsMoreInfo() {
		
			var AttachCount = document.ProfileNewsForm.AttachCount.value*1;
			var RemoveCount = document.ProfileNewsForm.RemoveCount.value*1; 
			var AttachTitle = document.ProfileNewsForm.AttachTitle.value;
			var AttachLink = document.ProfileNewsForm.AttachLink.value;
			var AttachFile = eval('document.ProfileNewsForm.AttachFile_'+AttachCount).value;
			
			//alert(AttachLink);
			
			if (AttachTitle == '') {
				alert('Please enter a title for you attachment.');
			} else if (((AttachLink == '') || (AttachLink == 'http://')) && (AttachFile == '')) {
				alert('Please add a link or select a file.');
			} else {
			
				var fileExt = AttachFile.substring((AttachFile.length-4),AttachFile.length);
				
				if (AttachTitle.length > 56) {
					AttachTitle = AttachTitle.substring(0,53)+'...';
				}
				
				document.getElementById('AttachDocContentText_'+AttachCount).innerHTML = (AttachCount-RemoveCount) + '. <input type="hidden" name="AttachTitle_'+AttachCount+'" value="'+AttachTitle+'">'+AttachTitle;
				document.getElementById('AttachDocContentText_'+AttachCount).style.height = "20px";
				
				if (AttachFile == '') {
					document.getElementById('AttachFileField_'+AttachCount).innerHTML = '<input type="text" name="AttachLink_'+AttachCount+'" value="'+AttachLink+'" size="65" style="width: 300px;" class="input" maxlength="250" />';
				}
				
				document.getElementById('AttachFileFieldName_'+AttachCount).innerHTML = "&nbsp";
				document.getElementById('AttachFileFieldName_'+AttachCount).style.width = "15px";
				document.getElementById('AttachDocContentRemove_'+AttachCount).style.visibility = "visible";
				
				document.getElementById('AttachDocContent_'+AttachCount).style.height = "50px";
				/*
				document.getElementById('AttachDocContent_'+AttachCount).style.width = "478px";
				
				document.getElementById('AttachDocContent_'+AttachCount).style.borderStyle = "solid";
				document.getElementById('AttachDocContent_'+AttachCount).style.borderColor = "#B0C1BE";
				document.getElementById('AttachDocContent_'+AttachCount).style.borderWidth = "1px";
				*/
				AttachCount++;
				
				var contentDisp = '';
				
				contentDisp += '<div id="AttachDocContentText_'+AttachCount+'" style="width: 480px; height: 60px;">';
				
				contentDisp += '<div style="width: 480px; height: 30px;">';
				contentDisp += '<div align="right" style="float: left; width: 90px; height: 30px;">';
				contentDisp += '<div style="padding-top: 2px;">';
				contentDisp += 'Display name:';
				contentDisp += '</div>';
				contentDisp += '</div>';
				contentDisp += '<div align="left" style="float: left; width: 385px; height: 30px;">';
				contentDisp += '<div style="padding-left: 5px; font-weight: bold;">';
				contentDisp += '<input type="text" name="AttachTitle" value="" size="65" style="width: 300px;" class="input" maxlength="150" />';
				contentDisp += '</div>';
				contentDisp += '</div>';
				contentDisp += '</div>';
				
				contentDisp += '<div style="width: 480px; height: 30px;">';
				contentDisp += '<div align="right" style="float: left; width: 90px; height: 30px;">';
				contentDisp += '<div style="padding-top: 2px;">';
				contentDisp += 'Add link URL:';
				contentDisp += '</div>';
				contentDisp += '</div>';
				contentDisp += '<div align="left" style="float: left; width: 385px; height: 30px;">';
				contentDisp += '<div style="padding-left: 5px; font-weight: bold;">';
				contentDisp += '<input type="text" name="AttachLink" value="http://" size="65" style="width: 300px;" class="input" maxlength="250" />';
				contentDisp += '</div>';
				contentDisp += '</div>';
				contentDisp += '</div>';
				
				contentDisp += '</div>';
				
				contentDisp += '<div id="AttachDocContentFile_'+AttachCount+'" style="width: 480px; height: 30px;">';
						
				contentDisp += '<div style="width: 480px; height: 30px;">';
				contentDisp += '<div id="AttachFileFieldName_'+AttachCount+'" align="right" style="float: left; width: 95px; height: 30px;">';
				contentDisp += '<div style="padding-top: 2px; padding-right: 5px;">';
				contentDisp += '<span style="font-weight: bold;">OR</span> upload a file:';
				contentDisp += '</div>';
				contentDisp += '</div>';
				contentDisp += '<div align="left" style="float: left; width: 305px; height: 30px;">';
				contentDisp += '<div id="AttachFileField_'+AttachCount+'" style="font-weight: bold;">';
				contentDisp += '<input type="file" name="AttachFile_'+AttachCount+'" value="" size="40" style="width: 300px;" class="input"/>';
				contentDisp += '</div>';
				contentDisp += '</div>';
				contentDisp += '<div id="AttachDocContentRemove_'+AttachCount+'" align="left" style="float: left; width: 80px; height: 30px; visibility: hidden;">';
				contentDisp += '<div style="padding-top: 2px;">';
				contentDisp += '<a href="javascript: nothing()" onclick="removeNewsMoreInfo('+AttachCount+')" style="text-decoration: underline;">';
				contentDisp += 'remove';
				contentDisp += '</a>';
				contentDisp += '</div>';
				contentDisp += '</div>';
				contentDisp += '</div>';
				
				contentDisp += '</div>';
				
				contentDisp += '<div id="AttachDocContent_'+(AttachCount+1)+'" style="width: 480px; height: 30px;">';
						
				contentDisp += '<div style="width: 480px; height: 30px;">';
				contentDisp += '<div align="right" style="float: left; width: 90px; height: 30px;">';
				contentDisp += '<div style="padding-top: 2px;">';
				contentDisp += '&nbsp;';
				contentDisp += '</div>';
				contentDisp += '</div>';
				contentDisp += '<div align="left" style="float: left; width: 385px; height: 30px;">';
				contentDisp += '<div style="padding-left: 5px; font-weight: bold;">';
				contentDisp += '<input type="button" name="AddNewDoc" value="Attach" class="button" onclick="addNewsMoreInfo()" />';
				contentDisp += ' <input type="button" name="CanceNewDoc" value="Cancel" class="button" onclick="hideNewsMoreInfo()" />';
				contentDisp += '</div>';
				contentDisp += '</div>';
				contentDisp += '</div>';
				
				contentDisp += '</div>';
				
				contentDisp += '</div>';
				
				document.getElementById('AttachDocContent_'+AttachCount).innerHTML = contentDisp;
				document.getElementById('AttachDocContent_'+AttachCount).style.height = '120px';
				document.getElementById('AttachDocContent_'+AttachCount).style.visibility = "hidden";
								
				document.ProfileNewsForm.AttachCount.value = AttachCount;
				
				ExtraHeight = 50*((AttachCount-RemoveCount)-1);
				TopOffsetHeight = 50*((AttachCount-RemoveCount)-1);
			
				document.getElementById('AttachDocDiv').style.height = (ExtraHeight+30) + "px";
			
				document.getElementById('AttachDocList').style.height = (ExtraHeight) + "px";
			
				document.getElementById('AttachDocLink').style.top = (ExtraHeight) + "px";
				
			}
			
		}
		
		function removeNewsMoreInfo(num) {
		
			var AttachCount = document.ProfileNewsForm.AttachCount.value*1;
			var RemoveCount = document.ProfileNewsForm.RemoveCount.value*1;
			
			var count = 1;
			
			for (var i = 1; i < AttachCount; i++) {
				
				if ((eval('document.ProfileNewsForm.AttachTitle_'+i)) && (i != num)) {
					document.getElementById('AttachDocContentText_'+i).innerHTML = count + '. <input type="hidden" name="AttachTitle_'+i+'" value="'+eval('document.ProfileNewsForm.AttachTitle_'+i).value+'">'+eval('document.ProfileNewsForm.AttachTitle_'+i).value;
					count++;
				}
			
			}
			
			document.getElementById('AttachDocContentText_'+num).innerHTML = '<img src="'+root_link+'/images/main/pixel.jpg" width="1" height="1" border="0" hspace="0" vspace="0"><br>';
			document.getElementById('AttachDocContentText_'+num).style.height = '1px';
			document.getElementById('AttachDocContentFile_'+num).innerHTML = '<img src="'+root_link+'/images/main/pixel.jpg" width="1" height="1" border="0" hspace="0" vspace="0"><br>';
			document.getElementById('AttachDocContentFile_'+num).style.height = '1px';
			
			document.getElementById('AttachDocContent_'+AttachCount).style.height = "2px";
			
			RemoveCount++;
			
			document.ProfileNewsForm.RemoveCount.value = RemoveCount;
				
			ExtraHeight = 50*((AttachCount-RemoveCount)-1);
			TopOffsetHeight = 50*((AttachCount-RemoveCount)-AttachCount-1);
		
			document.getElementById('AttachDocDiv').style.height = (ExtraHeight+30) + "px";
		
			document.getElementById('AttachDocList').style.height = (ExtraHeight) + "px";
		
			document.getElementById('AttachDocLink').style.top = (ExtraHeight) + "px";
				
		}
		
		function displayNewsHelp(num) {
			
			var helpContent = new Array();
			
			helpContent[0] = '<span style="font-weight: bold;">Source:</span> Enter the name of the news source, i.e. the title of the magazine or newspaper the article was published in. If your news source is a website, please enter the name, not the URL. (put "Reuters", but not "www.reuters.com"). If you are the author of the news, please put your name.';
			helpContent[1] = '<span style="font-weight: bold;">Title:</span> Enter a headline for your news. Please do not exceed <span style="font-weight: bold;">70 characters</span>.';
			helpContent[2] = '<span style="font-weight: bold;">Summary:</span> Provide a short summary of what the article is about. Please do not exceed <span style="font-weight: bold;">300 characters</span>.';
			helpContent[3] = '<span style="font-weight: bold;">Content:</span> Enter the text body of the article. This can be text taken from any news source or written by you.';
			helpContent[4] = '<span style="font-weight: bold;">Upload image:</span> Choose an image to accompany your news story.';
			helpContent[5] = '<span style="font-weight: bold;">Attachments:</span> Here you can include links or <span style="font-weight: bold;">pdf</span> documents with additional information. Choose a title for the link to be visible to the reader and add the URL or browse for the file to be attached. You can add more than one link or document.';
						
			var helpContentHeight = new Array();

			helpContentHeight[0] = 120;
			helpContentHeight[1] = 120;
			helpContentHeight[2] = 120;
			helpContentHeight[3] = 120;
			helpContentHeight[4] = 120;
			helpContentHeight[5] = 120;

			document.getElementById('newsHelp').innerHTML = '<div style="padding: 5px;">'+helpContent[num-1]+'</div>';
			document.getElementById('newsHelp').style.height = helpContentHeight[num-1]+"px";
		
			if (num > 4) {
			document.getElementById('newsHelp').style.top = "201px";
			} else {
			document.getElementById('newsHelp').style.top = "0px";
			}
		
			document.getElementById('newsHelp').style.visibility = "visible";
		
		}
		
		function hideNewsHelp(num) {
		
			document.getElementById('newsHelp').style.visibility = "hidden";
		
		}
		
		function verifyFieldVal(FieldId,FieldCheck,State) {
			
			if (State == 1) {
				if (document.getElementById(FieldId).value == FieldCheck) {
					document.getElementById(FieldId).value = '';
					document.getElementById(FieldId).className = 'input';
				} 
			}
			if (State == 0) {
				if (document.getElementById(FieldId).value == '') {
					document.getElementById(FieldId).value = FieldCheck;
					document.getElementById(FieldId).className = 'inputFilled';
				}
			} 
			
		}
		
		function verifyContactSearchEnter(e,MemberId,CurrResults) {
			
			if(window.event) // IE
			{
			keynum = e.keyCode;
			}
			else if(e.which) // Netscape/Firefox/Opera
			{
			keynum = e.which;
			}
			
			if (keynum == 13) {
			SearchProfileContacts(MemberId,CurrResults);
			}
		}
		
		function SearchProfileContacts(MemberId,CurrResults) {
		
			var ContactName = document.getElementById('ContactName').value;
			var ContactOrg = document.getElementById('ContactOrg').value;
			var ContactKeyword = document.getElementById('ContactKeyword').value;
			
			var dispOk = 1;
			
			if (ContactName == 'Enter Name') {
				ContactName = '';
			}
			if (ContactOrg == 'Enter Organisation') {
				ContactOrg = '';
			}
			if (ContactKeyword == 'Enter Keyword') {
				ContactKeyword = '';
			}
			
			if ((ContactName == '') && (ContactOrg == '') && (ContactKeyword == '')) {
				dispOk = 0;
				errorContent = "Please enter at least one search field";
			} else {
			
				if ((ContactKeyword != '') && (ContactKeyword.length < 3)) {
					dispOk = 0;
					errorContent = "Please enter at least 3 letters for the keyword field";
				}
				if ((ContactOrg != '') && (ContactOrg.length < 3)) {
					dispOk = 0;
					errorContent = "Please enter at least 3 letters for the organisation field";
				}
				if ((ContactName != '') && (ContactName.length < 2)) {
					dispOk = 0;
					errorContent = "Please enter at least 2 letters for the name field";
				}
				
			}
			
			if (dispOk == 0) {
				if (ContactName.length >= 2) {
					dispOk = 1;		
				}
				if (ContactOrg.length >= 3) {
					dispOk = 1;		
				}
				if (ContactKeyword.length >= 3) {
					dispOk = 1;		
				}
			}
			
			if (dispOk == 1) {
				document.getElementById('formErrorsDiv').style.padding = "0px";
				document.getElementById('formErrorsDiv').innerHTML = "&nbsp;";
				currDiv = 'ContactSearchDiv';
				//alert("functions.php?viewContactsResults=1&MemberId="+MemberId+"&ContactName="+ContactName+"&ContactOrg="+ContactOrg+"&ContactKeyword="+ContactKeyword+"&CurrResults="+CurrResults);
				sendAjax("functions.php?viewContactsResults=1&MemberId="+MemberId+"&ContactName="+ContactName+"&ContactOrg="+ContactOrg+"&ContactKeyword="+ContactKeyword+"&CurrResults="+CurrResults,processAjax);
			} else {
				document.location.href = '#formErrors';
				document.getElementById('formErrorsDiv').style.padding = "10px 5px 10px 0px";
				document.getElementById('formErrorsDiv').innerHTML = errorContent;
			}
		
		}
		
		function viewContactsResults(MemberId,ContactName,ContactOrg,ContactKeyword,CurrResults) {
			currDiv = 'ContactSearchDiv';
			sendAjax("functions.php?viewContactsResults=1&MemberId="+MemberId+"&ContactName="+ContactName+"&ContactOrg="+ContactOrg+"&ContactKeyword="+ContactKeyword+"&CurrResults="+CurrResults,processAjax);
			
		}
		
		function addMessageContact(MemberId,Counter) {
			
			ContactTotal = document.ProfileMessageForm.ContactTotal.value;
			currContact = eval('document.ProfileMessageForm.Contact_'+Counter).value;
			
			//alert(Counter + ' ' + ContactTotal);
			
			if (currContact == 0) {
				alert("Please select a contact before adding another one.");
			}
			
			if ((Counter < ContactTotal) && (currContact != 0)) {
			
				var contacts = new Array();
				
				for (i = 1; i <= Counter; i++) {
					contacts[i-1] = eval('document.ProfileMessageForm.Contact_'+i).value;
				}
			
				contactsString = contacts.join();
				
				document.getElementById('MessageRecipients').style.height = (((Counter)*20)+30) + "px";
				document.getElementById('MessageRecipientsInside').style.height = (((Counter)*20)+30) + "px";
				document.ProfileMessageForm.ContactCount.value = (Counter+1);
				
				currDiv = 'MessageRecipientsInside';
				//alert("functions.php?addMessageContact=1&MemberId="+MemberId+"&Contacts="+contacts+"&Counter="+Counter);
				sendAjax("functions.php?addMessageContact=1&MemberId="+MemberId+"&Contacts="+contactsString+"&Counter="+Counter,processAjax);
				
			}
		
		}
		
		function removeMessageContact(MemberId,Position) {
			
			OrigCounter = document.ProfileMessageForm.ContactCount.value;
			Counter = OrigCounter-1;
			
			var contacts = new Array();
			
			j = 0;
			
			for (i = 1; i < OrigCounter; i++) {
				if (i != Position) {
					contacts[j] = eval('document.ProfileMessageForm.Contact_'+i).value;
					j++;
				}
			}
		
			contactsString = contacts.join();
				
			document.getElementById('MessageRecipients').style.height = (((Counter-1)*20)+30) + "px";
			document.getElementById('MessageRecipientsInside').style.height = (((Counter-1)*20)+30) + "px";
			document.ProfileMessageForm.ContactCount.value = Counter;
			
			if (contactsString == '') {
				contactsString = 0;
			}
			
			currDiv = 'MessageRecipientsInside';
			//alert("functions.php?addMessageContact=1&MemberId="+MemberId+"&Contacts="+contacts+"&Counter="+Counter);
			sendAjax("functions.php?addMessageContact=1&MemberId="+MemberId+"&Contacts="+contactsString+"&Counter="+(Counter-1),processAjax);
		
		}
		
		function profileSendMessage(MemberId,MessageId) {
			
			currDiv = 'profileTab';
			sendAjax("functions.php?profileSendMessage=1&MemberId="+MemberId+"&MessageId="+MessageId,processAjax);
			
		}
		
		function profileForwardMessage(MemberId,MessageId) {
			
			currDiv = 'profileTab';
			sendAjax("functions.php?profileForwardMessage=1&MemberId="+MemberId+"&MessageId="+MessageId,processAjax);
			
		}
		
		function removeContact(MemberContactId) {
			
			formBoxWidth = 500;
			formBoxHeight = 100;
			formBoxLoad();
			currDiv = 'formBoxContent';
			sendAjax("functions.php?removeContact=1&MemberContactId="+MemberContactId,processAjax);
			
		}
		
		function displayPaperSearch() {
			
			formBoxSet = 1;
			
			formBoxLeft	= 220;
			formBoxTop	= 353;
			
			formBoxWidth = 300;
			formBoxHeight = 60;
			formBoxLoad();
			
			contentDisp	= '<div align="center" style="padding: 5px 10px 10px 10px;">';
			contentDisp	+= '<div style="width: 280px; height: 40px;">';
			
			contentDisp	+= '<div align="center" style="float: left; width: 50px; height: 40px;">';
			contentDisp	+= '<img src="'+root_link+'/images/main/ajax_loader.gif" vspace="10"></br>';
			contentDisp	+= '</div>';
			
			contentDisp	+= '<div align="left" style="float: left; width: 230px; height: 20px;">';
			contentDisp	+= '<div style="padding-top: 2px;">';
			contentDisp	+= 'Please wait while your search is running';
			contentDisp	+= '</div>';
			contentDisp	+= '</div>';
			
			contentDisp	+= '<div align="left" style="float: left; width: 230px; height: 20px;">';
			contentDisp	+= '<div style="padding-top: 2px;">';
			contentDisp	+= 'This may take a few seconds.';
			contentDisp	+= '</div>';
			contentDisp	+= '</div>';
			
			contentDisp	+= '</div>';
			contentDisp	+= '</div>';
		
			document.getElementById('formBoxContent').innerHTML = contentDisp;
			
		}
		
		function viewMessages(MemberId,Type,OrderBy,CurrResults,ExtraField) {
			
			currDiv = 'profileTab';
			sendAjax("functions.php?viewMessages=1&MemberId="+MemberId+"&Type="+Type+"&OrderBy="+OrderBy+"&CurrResults="+CurrResults+"&ExtraField="+ExtraField,processAjax);
			
		}
		
		function createMessage(MemberId) {
			
			currDiv = 'profileTab';
			sendAjax("functions.php?createMessage=1&MemberId="+MemberId,processAjax);
			
		}
		
		function displayPrivacy(num) {
		
			if (num == 1) {
				document.getElementById('MembersPrivacy').style.height = "315px";
			} else {
				document.getElementById('MembersPrivacy').style.height = "30px";
			}
		
		}
		
		function expandBox(DivId,Height,ThisLimit) {
		
			if (Height >= ThisLimit) {
			document.getElementById(DivId).style.height=ThisLimit+"px";				
			} else {
			document.getElementById(DivId).style.height=Height+"px";
			Height+=10;
			window.setTimeout("expandBox('"+DivId+"',"+Height+","+ThisLimit+")",50);
			}/**/
		
		}
		
		function closeBox(DivId,Height,ThisLimit) {
		
			
			if (Height <= ThisLimit) {
			document.getElementById(DivId).style.height=ThisLimit+"px";				
			} else {
			document.getElementById(DivId).style.height=Height+"px";
			Height-=10;
			window.setTimeout("closeBox('"+DivId+"',"+Height+","+ThisLimit+")",50);
			}
			/**/
		}
	
		function openBoxInfo(num) {
			
			if (CurrInfoBox != num) {
			
				CurrInfoBox = num;
			
				AbortCloseBox = 1;
				
				document.getElementById('linkInfoBox').style.visibility = "visible";
				
				document.getElementById('linkInfoContent').innerHTML = document.getElementById('linkInfoContent'+num).innerHTML;
				
				if (LinkInfoBoxOpen == 0) {
					expandBoxInfo('linkInfoBox',10,300);
				} else {
					clearTimeout(LinkInfoBoxTimer);
					LinkInfoBoxTimer = window.setTimeout("closeBoxInfo('linkInfoBox',300,0)",10000);
				}
				
				window.setTimeout("AbortCloseBox = 0",200);
			
			} else {
			
				closeBoxInfo('linkInfoBox',300,0);
			
			}
			
		}
			
		function expandBoxInfo(DivId,Width,ThisLimit) {
			
			window.clearTimeout(LinkInfoBoxTimer);
			
			document.getElementById(DivId).style.visibility = "visible";
		
			if (Width >= ThisLimit) {
			document.getElementById(DivId).style.left=((ThisLimit*(-1))+1)+"px";		
			document.getElementById(DivId).style.width=ThisLimit+"px";		
			LinkInfoBoxOpen = 1;
			LinkInfoBoxTimer = window.setTimeout("closeBoxInfo('linkInfoBox',300,0)",10000);
			} else {
			document.getElementById(DivId).style.left=((Width*(-1))+1)+"px";	
			document.getElementById(DivId).style.width=Width+"px";
			Width+=20;
			LinkInfoBoxTimer = window.setTimeout("expandBoxInfo('"+DivId+"',"+Width+","+ThisLimit+")",10);
			}/**/
			//alert(LinkInfoBoxOpen);
		
		}
			
		function closeBoxInfo(DivId,Width,ThisLimit) {
			
			//alert(LinkInfoBoxOpen);
			
			if ((LinkInfoBoxOpen == 1) && (AbortCloseBox == 0)) {
		
				window.clearTimeout(LinkInfoBoxTimer);
			
				if (Width <= ThisLimit) {
				document.getElementById(DivId).style.left=((ThisLimit*(-1))+1)+"px";		
				document.getElementById(DivId).style.width=ThisLimit+"px";		
				LinkInfoBoxOpen = 0;
				document.getElementById(DivId).style.visibility = "hidden";
				} else {
				//alert(Width);
				document.getElementById(DivId).style.left=((Width*(-1))+1)+"px";	
				document.getElementById(DivId).style.width=Width+"px";
				Width-=20;
				LinkInfoBoxTimer = window.setTimeout("closeBoxInfo('"+DivId+"',"+Width+","+ThisLimit+")",10);
				}
				
				CurrInfoBox = -1;
				
			}
		
		}
		
		function displayPatentScribd(PatentId,PatentNumber) {
			
			document.getElementById('NumberDisp'+PatentId).innerHTML = '<span style="font-size: 14px; font-weight: bold;">'+PatentNumber+'</span>';
			
			CurrPatentId = document.getElementById('currCountry').value;
			CurrPatentNumber = document.getElementById('currNumber').value;
			
			document.getElementById('NumberDisp'+CurrPatentId).innerHTML = '<a href="javascript: nothing()" onclick="displayPatentScribd('+CurrPatentId+',\''+CurrPatentNumber+'\');" class="contentLinks" style="font-weight: bold; text-decoration: underline;">'+CurrPatentNumber+'</a>';
			document.getElementById('NumberDisp'+PatentId).innerHTML = '<span style="font-size: 14px; font-weight: bold;">'+PatentNumber+'</span>';
			
			document.location = '#PatentScribdAnchor';
			
			currDiv = 'PatentScribd';
			//alert("functions.php?displayPatentScribd=1&PatentId="+PatentId);
			sendAjax("functions.php?displayPatentScribd=1&PatentId="+PatentId,processAjax);
			
		}
		
		function getPatentsResults(All,Fields,CurrResults) {
			currDiv = 'patentResults';
			//alert("functions.php?displayPatentScribd=1&PatentId="+PatentId);
			sendAjax("functions.php?getPatentsResults=1&Fields="+Fields+"&CurrResults="+CurrResults,processAjax);
		}
		
		function lookingContent(ThisMember,TypeId,OrderBy,Next,timeOutInterval) {
			
			var MemberId = document.getElementById('lookingContentMember').value;
			
			if (TypeId == 0) {
			var UpdateDate = document.getElementById('lookingContentDate').value;
			} else {
			var UpdateDate = '';
			}
			clearTimeout(requestRotateTimeout);
			//requestRotateTimeout = window.setTimeout('lookingContent('+ThisMember+',0,"MembersProfile.UpdateDate DESC",1,12000)',timeOutInterval);
			
			currDiv = 'lookingContent';
			//alert(MemberId+"&UpdateDate="+UpdateDate+"&OrderBy="+OrderBy);
			sendAjax("functions.php?lookingContent=1&CurrMember="+ThisMember+"&ThisMemberId="+MemberId+"&UpdateDate="+UpdateDate+"&OrderBy="+OrderBy+"&Next="+Next,processAjax);
		}
		
		function memberWarning(Message) {
			formBoxWidth = 500;
			formBoxHeight = 140;
			formBoxLoad();
			if (loaded == 1) {
			currDiv = 'formBoxContent';
			sendAjax("functions.php?memberWarning=1&Message="+Message,processAjax);
			}
		}
		
		function saveAdvertiseView(MemberId,DocumentId) {
			
			currIp = document.getElementById('CurrIp').value;
			currSession = document.getElementById('CurrSession').value;
			
			currDiv = 'test';
			sendAjax("functions.php?saveAdvertiseView=1&ThisMemberId="+MemberId+"&DocumentId="+DocumentId+"&currIp="+currIp+"&currSession="+currSession,processAjax);
			
		}
		
		/*
		function verifyDirectoryEnter() {
			if (window.event && window.event.keyCode == 13) {
				directoryResults(MemberId,CurrResults,Type,DirectoryKeyword);
			}
  		}
		*/
		
		function directoryResults(MemberId,CurrResults,Type,DirectoryKeyword) {
			
			if (DirectoryKeyword == '') {
				if (document.getElementById('DirectoryKeyword')) {
					DirectoryKeyword = document.getElementById('DirectoryKeyword').value;
				}
			}
			
			//if (DirectoryKeyword != '') {
			document.location = '#directoryResultsAnchor';
	
			document.getElementById('directoryHeadline').innerHTML = 'Search Results';
			
			//alert(Type);
			
			currDiv = 'directoryResults';
			sendAjax("functions.php?directoryResults=1&Type="+Type+"&DirectoryKeyword="+DirectoryKeyword+"&CurrResults="+CurrResults+"&MemberDispId="+MemberId,processAjax);
			//}
			
			return false;
			
		}
		
		function viewDirectoryOffices(DirectoryId,OfficeCount) {
			
			if (DirectoryOffice == DirectoryId) {
		
				var thisHeight	= (document.getElementById('directoryResultsContent').style.height.substr(0,((document.getElementById('directoryResultsContent').style.height.length*1)-2))*1);
			
				var extendHeight = (OfficeCount*77);
				
				document.getElementById('directoryResultsContent').style.height = (thisHeight-extendHeight)+"px";
				document.getElementById('directoryResultsContentTop').style.height = ((thisHeight-extendHeight)+1)+"px";
				document.getElementById('directoryResultsContentTop2').style.height = ((thisHeight-extendHeight)+1)+"px";
				document.getElementById('directoryResultsContentTop3').style.height = ((thisHeight-extendHeight)+1)+"px";
				document.getElementById('directoryContent'+DirectoryId).style.height = (135)+"px";
				document.getElementById('OfficeDisplay'+DirectoryId).style.height = (20)+"px";
				DirectoryOffice = 0;
				DirectoryOfficeCount = 0;
				
			} else {
				
				var thisHeight = 0;
				var extendHeight = 0;
				
				if (DirectoryOffice != 0) {
					 
					thisHeight = (document.getElementById('directoryResultsContent').style.height.substr(0,((document.getElementById('directoryResultsContent').style.height.length*1)-2))*1);
			
					extendHeight = (DirectoryOfficeCount*77);
					
					document.getElementById('directoryResultsContent').style.height = (thisHeight-extendHeight)+"px";
					document.getElementById('directoryResultsContentTop').style.height = ((thisHeight-extendHeight)+1)+"px";
					document.getElementById('directoryResultsContentTop2').style.height = ((thisHeight-extendHeight)+1)+"px";
					document.getElementById('directoryResultsContentTop3').style.height = ((thisHeight-extendHeight)+1)+"px";
					document.getElementById('directoryContent'+DirectoryOffice).style.height = (135)+"px";
					document.getElementById('OfficeDisplay'+DirectoryOffice).style.height = (20)+"px";
				
				}
		
				thisHeight = (document.getElementById('directoryResultsContent').style.height.substr(0,((document.getElementById('directoryResultsContent').style.height.length*1)-2))*1);
			
				extendHeight = (OfficeCount*77);
				
				document.getElementById('directoryResultsContent').style.height = (extendHeight+thisHeight)+"px";
				document.getElementById('directoryResultsContentTop').style.height = (extendHeight+thisHeight+1)+"px";
				document.getElementById('directoryResultsContentTop2').style.height = (extendHeight+thisHeight+1)+"px";
				document.getElementById('directoryResultsContentTop3').style.height = (extendHeight+thisHeight+1)+"px";
				document.getElementById('directoryContent'+DirectoryId).style.height = (extendHeight+135)+"px";
				document.getElementById('OfficeDisplay'+DirectoryId).style.height = (extendHeight+20)+"px";
				DirectoryOffice = DirectoryId;
				DirectoryOfficeCount = OfficeCount;
				
			}
		}
		
		function getMembersResults(Fields,CurrResults,MemberId) {
			
			if (loaded == 1) {
			
				document.location = '#memberResultsAnchor';
				
				if (Math.ceil(CurrResults/48) != Math.ceil(mapMembersResults/48)) {
					
					mapMembersResults = Math.floor(CurrResults/48) * 48;
					
					//alert(mapMembersResults);
					
					secondaryFunction = 'getMembersMap(\''+Fields+'\','+mapMembersResults+','+MemberId+')';
					
				}
				
				currDiv = 'memberResults';
				sendAjax("functions.php?getMembersResults=1&Fields="+Fields+"&CurrResults="+CurrResults+"&MemberDispId="+MemberId,processAjax);
			
			}
			
		}
		
		function getMembersMap(Fields,CurrResults,MemberId) {
			
			dispLoader = 0;
			
			secondaryFunction = 'loadMarkers()';
		
			currDiv = 'memberResultsMap';
			sendAjax("functions.php?mapMembers=1&Fields="+Fields+"&CurrResults="+CurrResults+"&MemberDispId="+MemberId,processAjax);
			
		}
		
		function trackDownload(SectionId,FileId) {
			
			currIp = document.getElementById('CurrIp').value;
			currMember = document.getElementById('CurrMem').value;
			currSession = document.getElementById('CurrSession').value;
			
			if (currMember == '') {
				currMember = 0;	
			}
			
			//alert("trackDownload=1&SectionId="+SectionId+"&FileId="+FileId+"&currIp="+currIp+"&currSession="+currSession+"&currMember="+currMember);
			
			sendAjax("functions.php?trackDownload=1&SectionId="+SectionId+"&FileId="+FileId+"&currIp="+currIp+"&currSession="+currSession+"&currMember="+currMember,nothing);
			
		}
		
		function defaultField(fieldValue,fieldObject,fieldState) {
			
			if ((fieldState == 0) && (fieldObject.value == fieldValue)) {
				fieldObject.value = '';	
			} else if ((fieldState == 1) && (fieldObject.value == '')) {
				fieldObject.value = fieldValue;	
			}
		
		}
		
		function setOptionExtra(num) {
			
			if (num == 1) {
				if (document.getElementById('Question3ContentTemp').innerHTML != '') {
					document.getElementById('Question3Content').innerHTML = document.getElementById('Question3ContentTemp').innerHTML;
				}
				document.getElementById('surveyQuestion3').style.height = '210px';
				document.getElementById('Question3ContentTemp').innerHTML = '';
			} else {
				if ((document.getElementById('Question3Content').innerHTML != '') && (document.getElementById('Question3Content').innerHTML != '&nbsp;')) {
					document.getElementById('Question3ContentTemp').innerHTML = document.getElementById('Question3Content').innerHTML;
				}
				document.getElementById('surveyQuestion3').style.height = '80px';
				document.getElementById('Question3Content').innerHTML = '';
			} 
			

			//alert(document.getElementById('surveyQuestion3').style.height);
			
		}
		