				
		var tempContent = "";
		
		var pageLoaded = 0;
		var loadedContent = 1;
		
		var refreshTimeout = "";
		var currTimeout = "";
		var networkTimeout = "";
		var popupTimer = "";
		
		var currLib	= "";
		var ajaxWorking	= 0;
		
		var playerHeight = 0;
		
		var imageBoxLeft = 0;
		var imageBoxTop = 0;
		var imageBoxStartLeft = 0;
		var imageBoxStartTop = 0;
		
		var currUpdate = 0;
		var currUpdateClose = 1;
		
		var currPost = 0;
		var currPostClose = 1;
		
		var sortNavNum = 0;
		
		var commentsOn = 0;
		var messageChecked = 0;
		
		var popupOpen = 0;
		var popupWidth = 670;
		var popupHeight = 510;
		
		var noLoading = 0;
		
		var currLeftNav = 1;
		
		var CurrNav = 0;
		var currNavTimeout = '';
		
		var rotating = 0;
		var currProduct = 1;
		
		var currPopular = 1;
		
		var productTimeVar = '';
		
		var opacityTimeoutVar = new Array();
		
		opacityTimeoutVar[0] = '';
		opacityTimeoutVar[1] = '';
		opacityTimeoutVar[2] = '';
		opacityTimeoutVar[3] = '';
		opacityTimeoutVar[4] = '';
		
		var currDiv = "";
		var currAnchor = "";
		var currFunction = "";
		var secondaryFunction = "";
		var ajaxTimeout = 0;
		
		var divCount = 2;
		var openDiv = 0;
		
		var currLeftMenu = -1;
		
		var scrollTimeout = 0;
		
		var origLeft = new Array();
		var origTop = new Array();
		var currLeft = new Array();
		var currTop = new Array();
		var limitLeft = new Array();
		var limitTop = new Array();
		var offsetLeft = new Array();
		var offsetTop = new Array();
		
		origLeft[0] = 362;
		origLeft[1] = 587;
		origTop[0] = 100;
		origTop[1] = 190;
		
		currLeft[0] = 362;
		currLeft[1] = 587;
		currTop[0] = 100;
		currTop[1] = 190;
		limitLeft[0] = 317;
		limitLeft[1] = 707;
		limitTop[0] = 10;
		limitTop[1] = 10;
		offsetLeft[0] = 5;
		offsetLeft[1] = 10;
		offsetTop[0] = 10;
		offsetTop[1] = 15;
		
		var winW = 0;
		var winH = 0;
		
		// 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
		
		//setWindowProps();
		
		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
		}
		
		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 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,counter) {
			
			if (value == 10) {
				setOpacity(divName,value);
				clearTimeout(opacityTimeoutVar[counter]);
			} else {
				setOpacity(divName,value);
				opacityTimeoutVar[counter] = window.setTimeout("displayOpacity('"+divName+"',"+(value+1)+","+counter+")",50);
			}
			
		}
		
		function init(resize) {
			if (document.getElementById('DEVMODE')) {
				root_link = "http://www.cars21.local/community";
				web_link = "http://www.cars21.local";
			}
			
			
			if (document.getElementById('eventBanner1')) {
				window.setTimeout('eventBannerSwitch(1)',7000);
			}
			
			if (document.getElementById('eventBanner3')) {
				window.setTimeout('eventBannerSwitch2(1)',5000);
			}
			
			if (document.getElementById('currLib')) {
				currLib = document.getElementById('currLib').value;
				//alert(currLib);
			}
			
			if (document.getElementById('premiumContent1')) {
				opacityTimeoutVar[10] = window.setTimeout('dispPopular()',4000);
			}
			
			if (document.getElementById('productItem1')) {
				opacityTimeoutVar[0] = window.setTimeout('rotateProducts(1)',4000);
			}
			
			if (document.getElementById('networkActivitiesList')) {
				var MemberId = document.NetworkPostForm.CurrMember.value;
				networkTimeout = window.setTimeout('networkActivitiesList('+MemberId+',0)',60000);
			}
			
			if ((document.MessageForm) && (document.MessageForm.ContactAdd0)) {
				messageContactsAdd();	
			}
			
			//setWindowProps();
			setVisit();
			if (!document.getElementById('noRefresh')) {
				refreshPage();
			}
			
			pageLoaded = 1;
			
		}
		
		function eventBannerSwitch(num) {
		
			if (num == 1) {
				setOpacity('eventBanner1',0);
				document.getElementById('eventBanner2').style.zIndex = 0;
				document.getElementById('eventBanner1').style.zIndex = 1;
				window.setTimeout("displayOpacityNew('eventBanner1',0,1,10,2)",250);
				displayOpacityNew('eventBanner2',10,-1,0,1);
				//divName,value,increment,limit,num
				//document.getElementById('eventBanner2').style.visibility = 'hidden';
				//document.getElementById('eventBanner1').style.visibility = 'visible';
				window.setTimeout("eventBannerSwitch(2)",7000);
			} else {
				setOpacity('eventBanner2',0);
				document.getElementById('eventBanner1').style.zIndex = 0;
				document.getElementById('eventBanner2').style.zIndex = 1;
				displayOpacityNew('eventBanner1',10,-1,0,1);
				window.setTimeout("displayOpacityNew('eventBanner2',0,1,10,2)",250);
				//displayOpacityNew('eventBanner2',0,1,10,2);
				//document.getElementById('eventBanner1').style.visibility = 'hidden';
				//document.getElementById('eventBanner2').style.visibility = 'visible';
				window.setTimeout("eventBannerSwitch(1)",7000);
			}
		
		}
		
		function eventBannerSwitch2(num) {
		
			if (num == 1) {
				setOpacity('eventBanner3',0);
				document.getElementById('eventBanner4').style.zIndex = 0;
				document.getElementById('eventBanner3').style.zIndex = 1;
				window.setTimeout("displayOpacityNew('eventBanner3',0,1,10,2)",250);
				displayOpacityNew('eventBanner4',10,-1,0,1);
				//divName,value,increment,limit,num
				//document.getElementById('eventBanner2').style.visibility = 'hidden';
				//document.getElementById('eventBanner1').style.visibility = 'visible';
				window.setTimeout("eventBannerSwitch2(2)",7000);
			} else {
				setOpacity('eventBanner4',0);
				document.getElementById('eventBanner4').style.zIndex = 0;
				document.getElementById('eventBanner3').style.zIndex = 1;
				displayOpacityNew('eventBanner3',10,-1,0,1);
				window.setTimeout("displayOpacityNew('eventBanner4',0,1,10,2)",250);
				//displayOpacityNew('eventBanner2',0,1,10,2);
				//document.getElementById('eventBanner1').style.visibility = 'hidden';
				//document.getElementById('eventBanner2').style.visibility = 'visible';
				window.setTimeout("eventBannerSwitch2(1)",7000);
			}
		
		}
		
		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 displayOpacityNew(divName,value,increment,limit,num) {
			
			if (value == limit) {
				setOpacity(divName,value);
				clearTimeout(opacityTimeoutVar[num]);
			} else {
				setOpacity(divName,value);
				opacityTimeoutVar[num] = window.setTimeout("displayOpacityNew('"+divName+"',"+(value+increment)+","+increment+","+limit+","+num+")",20);
			}
			
		}
	
		
		function refreshPage() {
		
			clearTimeout(refreshTimeout);
			
			refreshTimeout = window.setTimeout("location.reload(true)",300000);
			
		}
		
		function setVisit() {
		
			currIp = document.getElementById('CurrIp').value;
			currMember = document.getElementById('CurrMem').value;
			currSession = document.getElementById('CurrSession').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';
			sendAjaxComm("functions.php?PageView=1&currPage="+currPage+"&variables="+variables+"&currMember="+currMember+"&currIp="+currIp+"&currSession="+currSession,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 (pageLoaded == 1) {
		
				if (currLib != '') {
					urlContent	+= "&LibName="+currLib;
				}
				
				//alert(currDiv);
			
				if (noLoading == 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);
					
					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>';
			
				}
			
				noLoading = 0;
			
				createRequest();			
				
				request.open("GET", web_link + "/includes/scripts/" + urlContent, true);
				request.onreadystatechange = eval(returnFunc);
				request.send(null);
				/*
				window.clearTimeout(ajaxTimeout);
				ajaxTimeout = window.setTimeout("request.send(null)",500);
				*/
			
			}
			
		}
		
		function sendAjaxComm(urlContent,returnFunc) {
			
			if (pageLoaded == 1) {
			
				if (currLib != '') {
					urlContent	+= "&LibName="+currLib;
				}
			
				if (noLoading == 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 (topPadding == 0) {
						topPadding = 20;	
					}
					
					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>';
			
				}
			
				noLoading = 0;
				
				createRequest();		
				
				//alert(urlContent);
				
				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 processAjax() {
		
			if(request.readyState == 4) {
				
				if(request.status == 200) {
				
					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 != '') {
							eval(secondaryFunction);
							secondaryFunction = '';
						}
						
						if (currAnchor != '') {
							document.location.href = currAnchor;
							currAnchor = '';
						}
						
						tempContent = '';
						loadedContent = 1;
						ajaxWorking = 0;
						
						/*
						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 check_errors(formName,Lang) {
			
			var submitOk = 1;
			var submitAnchor = '';
			var errorContent = 'Please make sure you fill out the fields which are highlighted';
			
			if (formName == 'RegisterForm') {
				
				submitAnchor = '#anchorPersonal';
				
				var FirstName = document.RegisterForm.FirstName.value;
				var LastName = document.RegisterForm.LastName.value;
				var Email = document.RegisterForm.Email.value;
				var Password = document.RegisterForm.Password.value;
				var PasswordConfirm = document.RegisterForm.PasswordConfirm.value;
				
				var Name = document.RegisterForm.Name.value;
				var PositionId = document.RegisterForm.PositionId.value;
				var Position = document.RegisterForm.Position.value;
				var City = document.RegisterForm.City.value;
				var CountryId = document.RegisterForm.CountryId.value;
				var TypeId = document.RegisterForm.TypeId.value;
				
				var TypeId0 = document.RegisterForm.TypeId0.value;
				
				var EmailValid = 0
				if (document.RegisterForm.EmailValid) {
					EmailValid = document.RegisterForm.EmailValid.value;
				}
				
				document.getElementById('errorFirstName').style.visibility = 'hidden';
				document.getElementById('errorLastName').style.visibility = 'hidden';
				document.getElementById('errorEmail').style.visibility = 'hidden';
				document.getElementById('errorPassword').style.visibility = 'hidden';
				document.getElementById('errorPasswordConfirm').style.visibility = 'hidden';
				
				document.getElementById('errorCity').style.visibility = 'hidden';
				document.getElementById('errorPosition').style.visibility = 'hidden';
				document.getElementById('errorName').style.visibility = 'hidden';
				
				if (FirstName == '') {
					submitOk = 0;
					document.getElementById('errorFirstName').style.visibility = 'visible';
				}
				
				if (LastName == '') {
					submitOk = 0;
					document.getElementById('errorLastName').style.visibility = 'visible';
				}
				
				if ((Email == '') || (!check_email(Email)) || (EmailValid == 0)) {
					submitOk = 0;
					document.getElementById('errorEmail').style.visibility = 'visible';
				} else if (!check_email(Email)) {
					submitOk = 0;
					document.getElementById('errorEmail').style.visibility = 'visible';
				}
				
				if ((Password == '') || (Password.length < 6)) {
					submitOk = 0;
					document.getElementById('errorPassword').style.visibility = 'visible';
				}
				
				if (PasswordConfirm == '') {
					submitOk = 0;
					document.getElementById('errorPasswordConfirm').style.visibility = 'visible';
				}
				
				if (Password != PasswordConfirm) {
					submitOk = 0;
					document.getElementById('errorPasswordConfirm').style.visibility = 'visible';
				}
				
				if ((Position == '') || (PositionId == 0)) {
					if (submitOk == 1) {
						submitAnchor = '#anchorCompany';
					}
					submitOk = 0;
					document.getElementById('errorPosition').style.visibility = 'visible';
				}
				
				if ((Name == '') || (TypeId == 0)) {
					if (submitOk == 1) {
						submitAnchor = '#anchorCompany';
					}
					submitOk = 0;
					document.getElementById('errorName').style.visibility = 'visible';
				}
				
				if ((City == '') || (CountryId == 0)) {
					if (submitOk == 1) {
						submitAnchor = '#anchorCompany';
					}
					submitOk = 0;
					document.getElementById('errorCity').style.visibility = 'visible';
				}
				
				if (submitOk == 1) {
					submitAnchor = '#anchorTerms';	
				}
				
				document.getElementById('termsContent').style.color = '#666666';
				
				if (document.RegisterForm.Terms.checked == false) {
					submitOk = 0;
					document.getElementById('termsContent').style.color = 'red';
				}
				
			}
			
			
			if (formName == 'ProfileEditSettings') {
				submitOk = 1;
				submitAnchor = '#anchorPersonal';
				
				var Email = document.ProfileEditSettings.Email.value;
				var Password = document.ProfileEditSettings.Password.value;
				var PasswordConfirm = document.ProfileEditSettings.PasswordConfirm.value;
				
				var EmailValid = 1;
				if (document.ProfileEditSettings.EmailValid) {
					EmailValid = document.ProfileEditSettings.EmailValid.value;
				}
				
				document.getElementById('errorEmail').style.visibility = 'hidden';
				document.getElementById('errorPassword').style.visibility = 'hidden';
				document.getElementById('errorPasswordConfirm').style.visibility = 'hidden';
				
				
				if ((Email != '') && ((!check_email(Email)) || (EmailValid == 0))) {
					submitOk = 0;
					document.getElementById('errorEmail').innerHTML = 'please enter a valid email address';
					document.getElementById('errorEmail').style.visibility = 'visible';
				} else if (!check_email(Email)) {
					submitOk = 0;
					document.getElementById('errorEmail').style.visibility = 'visible';
				}
				
				if ((Password != '') && (Password.length < 6)) {
					submitOk = 0;
					document.getElementById('errorPassword').innerHTML = 'the password needs at least 6 characters';
					document.getElementById('errorPassword').style.visibility = 'visible';
				}
				
				if ((PasswordConfirm != '') && Password != PasswordConfirm) {
					submitOk = 0;
					document.getElementById('errorPasswordConfirm').innerHTML = 'the passwords don\'t match';
					document.getElementById('errorPasswordConfirm').style.visibility = 'visible';
				}
				
				if ((Password != '')  && PasswordConfirm == '') {
					submitOk = 0;
					document.getElementById('errorPasswordConfirm').innerHTML = 'please repeat your password';
					document.getElementById('errorPasswordConfirm').style.visibility = 'visible';
				}
				
				
			}
			
			if (formName == 'MessageForm') {
				
				//alert(1);
				
				var AddContact = document.MessageForm.AddContact.value;
				var Contacts = document.MessageForm.Contacts.value;
				var MessageSubject = document.MessageForm.MessageSubject.value;
				var MessageContent = document.MessageForm.MessageContent.value;
				
				//alert(Contacts+' '+MessageSubject+' '+MessageContent);
				
				//document.getElementById('errorContacts').style.visibility = 'hidden';
				//document.getElementById('errorMessageSubject').style.visibility = 'hidden';
				//document.getElementById('errorMessageContent').style.visibility = 'hidden';
				
				errorContent = 'Please make sure you enter on or several contacts, a subject and a text before sending.';
				
				if ((document.MessageForm.SendAll) && (!document.MessageForm.SendAll.checked)) {
				
					if (Contacts == '') {
						submitOk = 0;
						//document.getElementById('errorContacts').style.visibility = 'visible';
					}
				
				}
				
				if (MessageSubject == '') {
					submitOk = 0;
					//document.getElementById('errorMessageSubject').style.visibility = 'visible';
				}
				
				if ((MessageContent == '') || (MessageContent == 'Please enter your message here')) {
					submitOk = 0;
					//document.getElementById('errorMessageContent').style.visibility = 'visible';
				}
				/*
				if (AddContact == 2) {
					submitOk = 0;
					alert('You can not send a message to this contact');
					window.location = root_link+'/messages.php';
				}*/
				
			}
			
			if (formName == 'OpportunityForm') {
				
				//alert(1);
				
				var Title = document.OpportunityForm.Title.value;
				var Content = document.OpportunityForm.Content.value;
				
				//alert(Contacts+' '+MessageSubject+' '+MessageContent);
				
				//document.getElementById('errorContacts').style.visibility = 'hidden';
				//document.getElementById('errorMessageSubject').style.visibility = 'hidden';
				//document.getElementById('errorMessageContent').style.visibility = 'hidden';
				
				if (Title == '') {
					submitOk = 0;
					//document.getElementById('errorContacts').style.visibility = 'visible';
				}
				
				if (Content == '') {
					submitOk = 0;
					//document.getElementById('errorMessageSubject').style.visibility = 'visible';
				}
				
			}
			
			if (formName == 'EventForm') {

			}
			
			
			if (formName == 'ForumTopicForm') {
				var CategoryId = document.ForumTopicForm.CategoryId.value;
				var PostTitle = document.ForumTopicForm.Title.value;
				var Description = document.ForumTopicForm.Description.value;
				
				if (PostTitle == '') {
					errorContent = 'Please add a title';
					submitOk = 0;
				}
				if (Description == '') {
					errorContent = 'Please add a description';
					submitOk = 0;
				}
				if (CategoryId == 0) {
					errorContent = 'Please add a category';
					submitOk = 0;
				}
			}
			
			if (formName == 'ProductsEditForm') {
				
				submitAnchor = '#anchorTop';
				
				var CategoryId = document.ProductsEditForm.CategoryId.value;
				var Name = document.ProductsEditForm.Name.value;
				var Description = document.ProductsEditForm.Description.value;
				var Specifications = document.ProductsEditForm.Specifications.value;
				//var Advantages = document.ProductsEditForm.Advantages.value;
				//var Options = document.ProductsEditForm.Options.value;
				
				document.getElementById('errorCategoryId').style.visibility = 'hidden';
				document.getElementById('errorName').style.visibility = 'hidden';
				document.getElementById('errorDescription').style.visibility = 'hidden';
				document.getElementById('errorSpecifications').style.visibility = 'hidden';
				//document.getElementById('errorAdvantages').style.visibility = 'hidden';
				//document.getElementById('errorOptions').style.visibility = 'hidden';
				
				if (CategoryId == 0) {
					submitOk = 0;
					document.getElementById('errorCategoryId').style.visibility = 'visible';
				}
				
				if (Name == '') {
					submitOk = 0;
					document.getElementById('errorName').style.visibility = 'visible';
				}
				
				if (Description == '') {
					submitOk = 0;
					document.getElementById('errorDescription').style.visibility = 'visible';
				}
				
				if (Specifications == '') {
					submitOk = 0;
					document.getElementById('errorSpecifications').style.visibility = 'visible';
				}
				
				/*
				if (Advantages == '') {
					submitOk = 0;
					document.getElementById('errorAdvantages').style.visibility = 'visible';
				}
				
				if (Options == '') {
					submitOk = 0;
					document.getElementById('errorOptions').style.visibility = 'visible';
				}*/
				
			}
			
			if (formName == 'CompaniesEditForm') {
				
				submitAnchor = '#anchorTop';
				
				var TypeId = document.CompaniesEditForm.TypeId.value;
				var Name = document.CompaniesEditForm.Name.value;
				var Email = document.CompaniesEditForm.Email.value;
				var Website = document.CompaniesEditForm.Website.value;
				var Description = document.CompaniesEditForm.Description.value;
				//var Logo = document.CompaniesEditForm.Logo.value;
				var CountryId = document.CompaniesEditForm.CountryId.value;
				var City = document.CompaniesEditForm.City.value;
				var Address = document.CompaniesEditForm.Address.value;
				var PostalCode = document.CompaniesEditForm.PostalCode.value;
				
				if (document.getElementById('errorTypeId')) {
					document.getElementById('errorTypeId').style.visibility = 'hidden';
				}
				document.getElementById('errorName').style.visibility = 'hidden';
				document.getElementById('errorEmail').style.visibility = 'hidden';
				document.getElementById('errorWebsite').style.visibility = 'hidden';
				document.getElementById('errorDescription').style.visibility = 'hidden';
				//document.getElementById('errorLogo').style.visibility = 'hidden';
				document.getElementById('errorCity').style.visibility = 'hidden';
				document.getElementById('errorAddress').style.visibility = 'hidden';
				document.getElementById('errorPostalCode').style.visibility = 'hidden';
				
				if (TypeId == 0) {
					submitOk = 0;
					if (document.getElementById('errorTypeId')) {
						document.getElementById('errorTypeId').style.visibility = 'visible';
					} else {
						document.getElementById('errorName').style.visibility = 'visible';
					}
				}
				
				if (Name == '') {
					submitOk = 0;
					document.getElementById('errorName').style.visibility = 'visible';
				}
				
				if (Website == '') {
					submitOk = 0;
					document.getElementById('errorWebsite').style.visibility = 'visible';
				}
				
				if ((Email == '') || (!check_email(Email))) {
					submitOk = 0;
					document.getElementById('errorEmail').style.visibility = 'visible';
				} else if (!check_email(Email)) {
					submitOk = 0;
					document.getElementById('errorEmail').style.visibility = 'visible';
				}
				
				if (Description == '') {
					submitOk = 0;
					document.getElementById('errorDescription').style.visibility = 'visible';
				}
				
				/*
				if (Logo == '') {
					submitOk = 0;
					document.getElementById('errorLogo').style.visibility = 'visible';
				}
				*/
				
				if (CountryId == 0) {
					submitOk = 0;
					document.getElementById('errorCity').style.visibility = 'visible';
				}
				
				if (City == '') {
					submitOk = 0;
					document.getElementById('errorCity').style.visibility = 'visible';
				}
				
				if (PostalCode == '') {
					submitOk = 0;
					document.getElementById('errorPostalCode').style.visibility = 'visible';
				}
				
				if (Address == '') {
					submitOk = 0;
					document.getElementById('errorAddress').style.visibility = 'visible';
				}
				
			}
			
			if (submitOk == 1) {
				if (formName == 'RegisterForm') {
					document.RegisterForm.submit();
				} else if (formName == 'MessageForm') {
					document.MessageForm.submit();
				} else if (formName == 'OpportunityForm') {
					document.OpportunityForm.submit();
				} else if (formName == 'EventForm') {
					document.EventForm.submit();
				} else if (formName == 'ForumTopicForm') {
					document.ForumTopicForm.submit();
				} else if (formName == 'ProductsEditForm') {
					document.ProductsEditForm.submit();
				} else if (formName == 'CompaniesEditForm') {
					document.CompaniesEditForm.submit();
				}  else if (formName == 'ProfileEditSettings') {
					document.ProfileEditSettings.submit();
				} else {
					return true;
				}
			} else {
				
				if (submitAnchor == '') {
					document.location.href = '#errorTop';	
				} else {
					document.location.href = submitAnchor;
				}
				if (document.getElementById('errorMessage')) {					
					document.getElementById('errorMessage').style.padding = "10px 0px 10px 0px";
					document.getElementById('errorMessage').innerHTML = errorContent;
				}
				if ((formName != 'ProductsEditForm') && (formName != 'CompaniesEditForm')) {
					return false;
				}
				
			}
		
		}
		
		
	function defaultField(fieldValue,fieldObject,fieldState) {
		
		//var fieldObject = eval('document.'+fieldForm+'.'+fieldName);
		//fieldForm,fieldName
		//alert(fieldObject.style.color);
		if ((fieldState == 0) && (fieldObject.value == fieldValue)) {
			if ((fieldObject.style.color == '#999') || (fieldObject.className == 'input') || (fieldObject.className == 'networkPostFieldBlank')) {
				fieldObject.style.color = '#333';
			}
			fieldObject.value = '';
		} else if ((fieldState == 1) && (fieldObject.value == '')) {
			if ((fieldObject.className == 'input') || (fieldObject.className == 'networkPostFieldBlank')) {
				fieldObject.style.color = '#999';
			}
			fieldObject.value = fieldValue;	
		}
	
	}
	
	function fieldType(fieldType,fieldObject) {
		
	}
	
	function shiftLeftMenu(divNum) {
		
		var divName = 'menuLeft'+divNum;
		
		if (currLeftMenu != divNum) {
			
			if (currLeftMenu != -1) {
				document.getElementById('menuLeft'+currLeftMenu+'On').style.zIndex = 0;
				document.getElementById('menuLeft'+currLeftMenu+'Off').style.zIndex = 1;
				document.getElementById('menuLeft'+currLeftMenu+'Off').style.left = "30px";
				document.getElementById('menuLeft'+currLeftMenu+'On').style.left = "0px";
				document.getElementById('menuLeft'+currLeftMenu+'On').style.visibility = "hidden";
				document.getElementById('menuLeft'+currLeftMenu+'Off').style.visibility = "visible";
				moveLeft('menuLeft'+currLeftMenu+'Off',30,0,-5);
				if (document.getElementById('rightContent'+divNum)) {
					document.getElementById('rightContent'+currLeftMenu).style.visibility = "hidden";
					moveLeft('rightContent'+currLeftMenu,0,-620,-103);
				}
			}
			
			currLeftMenu = divNum;
			document.getElementById(divName+'Off').style.visibility = "hidden";
			document.getElementById(divName+'On').style.visibility = "visible";
			document.getElementById(divName+'Off').style.zIndex = 0;
			document.getElementById(divName+'On').style.zIndex = 1;
			moveLeft(divName+'On',0,30,5);
			
			if (document.getElementById('rightContent'+divNum)) {
				document.getElementById('rightContent'+divNum).style.visibility = "visible";
				moveLeft('rightContent'+divNum,-620,0,103);
			}
			
		}
		
	}
	
	function moveLeft(divName,startPos,endPos,offset) {
		
		if (((offset < 0) && (startPos < endPos)) || ((offset > 0) && (startPos > endPos))) {
			document.getElementById(divName).style.left = endPos+"px";
		} else {
			document.getElementById(divName).style.left = startPos+"px";
			window.setTimeout('moveLeft("'+divName+'",'+(startPos+offset)+','+endPos+','+offset+')',50);
		}
	
	}
	
	function setPopup() {
		
		if (pageLoaded == 1) {
	
			getScrollOffset();
			
			leftOffset	= Math.floor((winW-popupWidth)/2)+tempX;
			topOffset	= Math.floor((winH-popupHeight)/2)+tempY;
			
			if (IE) {
				//popupWidth += 18;
			}
			
			document.body.style.overflow = "hidden";
			
			document.getElementById('popupMain').style.left = leftOffset + "px";
			document.getElementById('popupMain').style.top = topOffset + "px";
			document.getElementById('popupMain').style.width = popupWidth + "px";
			document.getElementById('popupMain').style.height = popupHeight + "px";
			/*
			document.getElementById('popupShadow').style.left = leftOffset + "px";
			document.getElementById('popupShadow').style.top = topOffset + "px";
			document.getElementById('popupShadow').style.width = Width + "px";
			document.getElementById('popupShadow').style.height = Height + "px";
			
			document.getElementById('popupContent').style.left = (leftOffset+10) + "px";
			document.getElementById('popupContent').style.top = (topOffset+10) + "px";
			document.getElementById('popupContent').style.width = (Width-20) + "px";
			document.getElementById('popupContent').style.height = (Height-20) + "px";
			
			document.getElementById('popupShadow').style.visibility = "visible";
			document.getElementById('popupContent').style.visibility = "visible";
			*/
			
			document.getElementById('pageOverlay').style.width = "100%";
			document.getElementById('pageOverlay').style.height = "100%";
			document.getElementById('pageOverlay').style.visibility = "visible";
			
			popupOpen = 1;
		
		}
	
	}
	
	function setPopupSec() {
		
		if (pageLoaded == 1) {
	
			getScrollOffset();
			
			clearTimeout(popupTimer);
			
			leftOffset	= Math.floor((winW-popupWidth)/2)+tempX;
			topOffset	= Math.floor((winH-popupHeight)/2)+tempY;
			
			if (IE) {
				//popupWidth += 18;
			}
			
			document.body.style.overflow = "hidden";
			
			document.getElementById('popupMainSec').style.left = leftOffset + "px";
			document.getElementById('popupMainSec').style.top = topOffset + "px";
			document.getElementById('popupMainSec').style.width = popupWidth + "px";
			document.getElementById('popupMainSec').style.height = popupHeight + "px";
			
			document.getElementById('pageOverlay').style.width = "100%";
			document.getElementById('pageOverlay').style.height = "100%";
			document.getElementById('pageOverlay').style.visibility = "visible";
			
			popupOpen = 1;
			
		}
	
	}
	
	function closePopup() {
		
		/*
		document.getElementById('popupShadow').style.left = "0px";
		document.getElementById('popupShadow').style.top = "0px";
		document.getElementById('popupShadow').style.width = "0px";
		document.getElementById('popupShadow').style.height = "0px";
		
		document.getElementById('popupContent').style.left = "0px";
		document.getElementById('popupContent').style.top = "0px";
		document.getElementById('popupContent').style.width = "0px";
		document.getElementById('popupContent').style.height = "0px";
		
		document.getElementById('popupShadow').style.visibility = "hidden";
		document.getElementById('popupContent').style.visibility = "hidden";
		
		document.getElementById('popupContentInside').innerHTML = '';
		*/
		
		document.getElementById('popupMain').innerHTML = '';
		
		document.getElementById('popupMain').style.left = "0px";
		document.getElementById('popupMain').style.top = "0px";
		document.getElementById('popupMain').style.width = "0px";
		document.getElementById('popupMain').style.height = "0px";
		
		document.getElementById('popupMainSec').innerHTML = '';
		
		document.getElementById('popupMainSec').style.left = "0px";
		document.getElementById('popupMainSec').style.top = "0px";
		document.getElementById('popupMainSec').style.width = "0px";
		document.getElementById('popupMainSec').style.height = "0px";
		
		document.getElementById('pageOverlay').style.width = "10px";
		document.getElementById('pageOverlay').style.height = "10px";
		document.getElementById('pageOverlay').style.visibility = "hidden";
		
		document.body.style.overflow = "auto";
		
		popupOpen = 0;
		
	}
	
	function verifyPopup() {
	
		if ((popupOpen == 1) && (ajaxWorking == 0)) {
	
			getScrollOffset();
			
			leftOffset	= Math.floor((winW-popupWidth)/2)+tempX;
			topOffset	= Math.floor((winH-popupHeight)/2)+tempY;
			
			//alert(leftOffset+' '+topOffset+' , '+tempMouseX+' '+tempMouseY+' , '+popupWidth+' '+popupHeight);
			
			if (((tempMouseX < leftOffset) || (tempMouseX > (leftOffset+popupWidth))) || ((tempMouseY < topOffset) || (tempMouseY > (topOffset+popupHeight)))) {
				closePopup();			
			}
		
		}
		
	}
	
	function displayNewsItem(ItemId) {
		
		//document.body.style.overflow = "hidden";
	
		getScrollOffset();
		
		Width = 600;
		Height = 400;
			
		setPopup(Width,Height);
	
	}
	
	function featureLoader(divName,folder,imageName,counter) {
		
		//alert(divName+counter+" url('"+root_link+"/images/features/"+folder+"/"+imageName+(counter+1)+".jpg')");
		setOpacity(divName+counter,0);
		document.getElementById(divName+counter).innerHTML = '<img src="'+root_link+'/images/features/'+folder+'/'+imageName+(counter+1)+'.jpg"><br>';
		displayOpacity(divName+counter,0,counter);
		
		//document.getElementById(divName+counter).style.backgroudImage = "url('"+root_link+"/images/features/"+folder+"/"+imageName+(counter+1)+".jpg')";
		//alert(document.getElementById(divName+counter).style.backgroudImage);
		if (counter < 4) {
			window.setTimeout("featureLoader('"+divName+"','"+folder+"','"+imageName+"',"+(counter+1)+")",200)	;
		}
		
	}
	
	function moveMenu(loaded) {
		
		if (document.getElementById('topNav')) {
			
			getScrollOffset();
			
			document.getElementById('topNav').style.top = (tempY)+'px';
				
		}
	
	}
	
	function leftNavItem(ItemId,counter,setLink) {
		
		getScrollOffset();
			
		if (setLink == 1) {
			//document.location = '#'+WebsiteId;
		
			var tempElem = document.getElementById('bodyContent').scrollTop;
			var limit = document.getElementById(ItemId).offsetTop;
			
			limit -= 160;	
			
			var tempLimit = document.getElementById('bodyContent').scrollHeight;
			
			//alert(limit + ' '+ (tempLimit-winH));
			
			if (IE) {
				limit += 170;	
			}
			
			if (limit > (tempLimit-winH)) {
				limit = (tempLimit-winH);	
			}
			
			if (tempElem < limit) {
			scrollSmooth(limit,1,15);
			} else {
			scrollSmooth(limit,0,15);
			}
			//window.scrollTo(0,document.getElementById(WebsiteId).offsetTop)
			//window.scrollTo(0);
			//.offset().top
		}
	
		document.getElementById("leftNavLink"+currLeftNav).className = "leftNav";
		currLeftNav = counter;
		document.getElementById("leftNavLink"+currLeftNav).className = "leftNavOn";
	
	}
	
	function scrollSmooth(limit,direction,increment) {
		
		//getScrollOffset();
		
		clearTimeout(scrollTimeout);
		
		increment++;
		
		var tempElem = document.getElementById('bodyContent').scrollTop;
		
		if ((direction == 1) && ((tempElem+increment) < limit)) {
			document.getElementById('bodyContent').scrollTop = (tempElem+increment);
			scrollTimeout = window.setTimeout("scrollSmooth("+limit+","+direction+","+increment+")",5);
		} else if ((direction == 0) && ((tempElem-increment) > limit)) {
			document.getElementById('bodyContent').scrollTop = (tempElem-increment);
			scrollTimeout = window.setTimeout("scrollSmooth("+limit+","+direction+","+increment+")",5);
		} else {
			document.getElementById('bodyContent').scrollTop = (limit);
		}
		
	}
	
	function dispNav(divName) {
		
		if (document.getElementById(divName)) {
			
			clearTimeout(currTimeout);
			
			if (window.currNav !== undefined && currNav != '') {
				hideNav(currNav);
			}
			
			currNav = divName;
			document.getElementById(divName).style.visibility = "visible";
		
		}
		
	}
	
	function hideNavTimer(divName) {
		
		if (document.getElementById(divName)) {
			currTimeout = window.setTimeout('hideNav(\''+divName+'\')',200);
		}
		
	}
	
	function hideNav(divName) {
		document.getElementById(divName).style.visibility = "hidden";
	}
	
	function setSearchSel(selText,selType) {
		
		if (document.topSearchForm) {
		
		document.topSearchForm.SearchType.value = selType;
		document.getElementById('topSearchSelText').innerHTML = selText;
		hideNav('topSearchSelOptions');
			
		} else {
		
		document.startSearchForm.SearchType.value = selType;
		document.getElementById('startSearchSelText').innerHTML = selText;
		hideNav('startSearchSelOptions');
			
		}
		
	}
	
	function viewGallery(GalleryId,ItemId) {
	
		getScrollOffset();
		document.body.scroll="no";
		//document.body.style.overflow="hidden";
		setWindowProps();
		currDiv = 'temp';
		document.getElementById(currDiv).style.top = tempY + "px";
		sendAjax("functions.php?viewGallery=1&GalleryId="+GalleryId+"&ItemId="+ItemId+"&Width="+winW+"&Height="+winH,processAjax);	
	
	}
		
	function viewGalleryItem(ItemId) {
		
		ImageTitle = document.getElementById('galleryImageTitle'+ItemId).value;
		ImageName = document.getElementById('galleryImageName'+ItemId).value;
		GalleryName = document.getElementById('galleryName').value;
		ImageOn = document.getElementById('galleryImageOn').value;
		
		document.getElementById('galleryContentThumb'+ImageOn).style.backgroundColor = 'transparent';
		
		document.getElementById('galleryImageOn').value = ItemId;
		document.getElementById('galleryContentThumb'+ItemId).style.backgroundColor = '#4997d2';
		
		document.getElementById('galleryContentImage').style.visibility = "hidden";
		document.getElementById('galleryContentTitleBox').style.visibility = "hidden";
		document.getElementById('galleryContentLoader').style.visibility = "visible";
				
		document.getElementById('galleryContentTitle').innerHTML = ImageTitle;
		document.getElementById('galleryContentImage').innerHTML = '<img src="'+web_link+'/images/galleries/'+GalleryName+'/400/'+ImageName+'" border="0" hspace="0" vspace="0" style="border: solid 0px #912422" onload="dispGalleryImage(this.height,this.width)"><br>';
		
		setVisit();
		
		//currDiv = 'galleryContentImage';
		//sendAjax("functions.php?viewGalleryItem=1&ItemId="+ItemId,processAjax);	
	
	}
	
	function dispGalleryImage(ImageHeight,ImageWidth) {
		
		BoxHeight = document.getElementById('galleryImageBoxHeight').value;
		BoxWidth = document.getElementById('galleryImageBoxWidth').value;
		//alert(Math.floor((BoxHeight-ImageHeight)/2));
		topOffset = Math.ceil((BoxHeight-ImageHeight)/2);
		leftOffset = Math.ceil((BoxWidth-ImageWidth)/2);
		document.getElementById('galleryContentImage').style.top = topOffset+"px";
		
		document.getElementById('galleryContentTitleBox').style.width = (ImageWidth)+"px";
		document.getElementById('galleryContentTitleBox').style.top = ((topOffset+ImageHeight)+2)+"px";
		document.getElementById('galleryContentTitleBox').style.left = (leftOffset)+"px";
		document.getElementById('galleryContentTitleBox').style.visibility = "visible";
		
		
		document.getElementById('galleryArrowLeft').style.left =  Math.ceil(leftOffset/2)+"px";
		document.getElementById('galleryArrowRight').style.right =  Math.ceil(leftOffset/2)+"px";

		window.setTimeout("document.getElementById('galleryContentImage').style.visibility='visible'",500);
		
	}
	
	function viewGalleryItemToggle(direction) {
	
		currItemCounter = document.getElementById('galleryItemCounter').value*1;
		itemCounterTotal = document.getElementById('galleryItemTotal').value*1;
	
		if (direction == 0) {
			
			if (currItemCounter == 1) {
				document.getElementById('galleryItemCounter').value = itemCounterTotal;
				nextItemCounter = itemCounterTotal;
			} else {
				nextItemCounter = currItemCounter - 1;
			}
			
		} else {
			
			if (currItemCounter == itemCounterTotal) {
				nextItemCounter = 1;
			} else {
				nextItemCounter = currItemCounter + 1;
			}
			
		}
	
		nextItem = document.getElementById('galleryItem'+nextItemCounter).value;
		
		document.getElementById('galleryItemCounter').value = nextItemCounter;
		
		viewGalleryItem(nextItem);
	
	}
	
	function closeGallery() {
		
		document.body.scroll="yes";
		document.body.style.overflow="auto";
		document.getElementById('temp').style.width = "10px";
		document.getElementById('temp').style.height = "10px";
		document.getElementById('temp').style.left = "0px";
		document.getElementById('temp').style.top = "0px";
		document.getElementById('temp').innerHTML = "";
		document.getElementById('temp').style.visibility = "hidden";
		
	}
	
	function setFieldChecked(fieldName) {
	
		if (fieldName.checked) {
			fieldName.checked = false;
		} else {
			fieldName.checked = true;
		}
	
	}
	
	function charCount() {
		
		var Content = document.NetworkPostForm.Content.value;
		var charCounter = Content.length;
		
		if (charCounter > 400) {
			document.NetworkPostForm.Content.value = Content.substr(0,400);
			charCounter = 400;
		}
		
		document.getElementById('charCount').innerHTML = (400-charCounter);
		
	}
	
	function charCountComp() {
		
		var Content = document.CompaniesEditForm.Description.value;
		var charCounter = Content.length;
		
		if (charCounter > 1000) {
			document.CompaniesEditForm.Description.value = Content.substr(0,1000);
			charCounter = 1000;
		}
		
		document.getElementById('charCount').innerHTML = (1000-charCounter);
		
	}
	
	function charCountEdit(num) {
		
		var Content = eval('document.NetworkPostForm'+num).Content.value;
		var charCounter = Content.length;
		
		if (charCounter > 400) {
			eval('document.NetworkPostForm'+num).Content.value = Content.substr(0,400);
			charCounter = 400;
		}
		
		document.getElementById('charCount'+num).innerHTML = (400-charCounter);
		
	}
	
	function displayMemberBrief(MemberId) {
		
		var offsetLeft = document.getElementById('memberBriefName'+MemberId).offsetWidth;
		//alert(offsetLeft);
		document.getElementById('memberBriefHover'+MemberId).style.left = (offsetLeft-10)+'px';
		dispNav('memberBriefHover'+MemberId);
		
	}
	
	function displayMemberBriefUpdate(MemberId,UpdateId) {
		
		var offsetLeft = document.getElementById('memberBriefName'+MemberId+'_'+UpdateId).offsetWidth;
		//alert(offsetLeft);
		document.getElementById('memberBriefHover'+MemberId+'_'+UpdateId).style.left = (offsetLeft-10)+'px';
		dispNav('memberBriefHover'+MemberId+'_'+UpdateId);
		
	}
	
	function verifyEmail(FieldObj) {
		
		var Email = FieldObj.value;
		var MemberId = 0;
		
		if ((FieldObj.value != '') && check_email(Email)) {
			
			noLoading = 1;
			
			if (document.ProfileForm) {
				MemberId = document.ProfileForm.MemberId.value;	
			}
			
			if (document.getElementById('errorEmail')) {
				document.getElementById('errorEmail').style.visibility = 'hidden';
			}
			
			currDiv = 'emailValid';
			sendAjaxComm("functions.php?verifyEmail=1&Email="+Email+"&MemberId="+MemberId,processAjax);
			
		} else {
			if (document.getElementById('errorEmail')) {
				document.getElementById('errorEmail').style.visibility = 'visible';
			}
			document.getElementById('emailValid').innerHTML = '<div class="formFieldTextReq" style="color: #981a1a">';
			document.getElementById('emailValid').innerHTML += '<input type="hidden" name="EmailValid" value="0"> Email invalid';
			document.getElementById('emailValid').innerHTML += '</div>';
		}
	
	}
	
	function verifyEmailRemember(FieldObj) {
		
		var Email = FieldObj.value;
		
		if ((FieldObj.value != '') && check_email(Email)) {
		
			//alert(Email);
			
			noLoading = 1;
			
			currDiv = 'emailValid';
			sendAjaxComm("functions.php?verifyEmailRemember=1&Email="+Email,processAjax);
			
		}
	
	}
	
	function verifyPass(num) {
	
		if (num == 0) {
		
			if (document.RegisterForm.Password.value.length < 6) {
				document.getElementById('passwordValid').innerHTML = 'minimum 6 characters';
			} else {
				document.getElementById('passwordValid').innerHTML = '';
			}
		
		} else {
		
			if (document.RegisterForm.PasswordConfirm.value != document.RegisterForm.Password.value) {
				document.getElementById('passwordValidConf').innerHTML = 'both passwords need to match';
			} else {
				document.getElementById('passwordValidConf').innerHTML = '';
			}
			
		}
	
	}
	
	function verifySubmit(keyCode,formName) {
	
		if (keyCode == 13) {
			if (formName == 'RegisterForm') {
				check_errors(formName);	
			} else if (formName == 'ContactFindList') {
				popupContactsList();	
			} else {
				if (formName == 'StartRegisterForm') {
					verifyEmail(document.StartRegisterForm.Email);
					window.setTimeout("eval('document."+formName+"').submit()",500);
				} else {
					eval('document.'+formName).submit();
				}
			}
		}
	
	}
		
		
	
	function verifyLogin() {
		
		var Username = document.LoginForm.Username.value;
		var Password = document.LoginForm.Password.value;
		
		if (Username != '' && Password != '' && Username != 'your email address' && Password != 'your password') {
			document.getElementById('loginerror').style.visibility = 'hidden';
			noLoading = 1;
			
			currDiv = 'loginerror';
			sendAjaxComm("functions2.php?verifyLogin=1&Username="+Username+"&Password="+Password,processAjax);
			
		} 
	
	}
	
	
	function carsLogin() {
		
		//alert(document.LoginForm.LoginCorrect.value);
				
		if (document.LoginForm.LoginCorrect.value==1) {
			document.LoginForm.submit();
		} else {	
			document.getElementById('homeLoginRemember').style.visibility = 'hidden';
			document.getElementById('loginerror').style.visibility = 'visible';
			document.getElementById('loginerror').style.color='red';
		}
	}
	
	
	
	function registerInterestsPopulate(num) {
		
		var Exclude = '';
		
		if (num != 4) {
			
			for (i = 0; i <= num; i++) {
				
				if (i == 0) {
					Exclude = eval("document.RegisterForm.TypeId"+i).value;
				} else {
					Exclude += ','+eval("document.RegisterForm.TypeId"+i).value;
				}
				
			}
				
			noLoading = 1;
			
			//alert(Exclude);
			
			currDiv = 'InterestType'+(num+1);
			sendAjaxComm("functions.php?registerInterestsPopulate=1&num="+((num*1)+1)+"&Exclude="+Exclude,processAjax);
		
		}
	
	}
	
	function registerCurrentPos(fieldState) {
		
		if (document.RegisterForm) {
		document.RegisterForm.EndMonth.disabled = fieldState;
		document.RegisterForm.EndYear.disabled = fieldState;
		} else {
		document.ProfileForm.EndMonth.disabled = fieldState;
		document.ProfileForm.EndYear.disabled = fieldState;
		}
		
	}
	
	function eventsCalendar(Month,Year) {
				
		noLoading = 1;
			
		currDiv = 'eventsCalendar';
		sendAjaxComm("functions.php?eventsCalendar=1&Month="+Month+"&Year="+Year,processAjax);
		
	}
	
	function opportunitiesCalendar(Month,Year) {
				
		noLoading = 1;
			
		currDiv = 'opportunitiesCalendar';
		sendAjaxComm("functions.php?opportunitiesCalendar=1&Month="+Month+"&Year="+Year,processAjax);
		
	}
	
	function checkMessagesAll() {
	
		var MessageId = 0;
		var counter = 0;
		var checkedValue = true;
		
		if (messageChecked == 1) {
			checkedValue = false;
		}
	
		while (document.getElementById('CheckMessage'+counter)) {
		
			MessageId = document.getElementById('CheckMessage'+counter).value;
			
			if (eval('document.ActionForm.CheckItem'+MessageId)) {
				eval('document.ActionForm.CheckItem'+MessageId).checked = checkedValue;
			}
			
			counter++;
		
		}
		
		if (messageChecked == 1) {
			messageChecked = 0;
		} else {
			messageChecked = 1;	
		}
	
	}
	
	/*
	function messageAddContact(MemberId) {
		
		var counter = 0;
		var offsetLeft = 0;
		
		var Contacts = document.MessageForm.Contacts.value;
		
		while (document.getElementById('messageNewFindAddedItem'+counter)) {
		
			offsetLeft = document.getElementById('messageNewFindAddedItem'+counter).offsetWidth;
			
			counter++;
			//alert(offsetLeft);
		
		}
			
		currDiv = 'eventsCalendar';
		sendAjaxComm("functions.php?eventsCalendar=1&Month="+Month+"&Year="+Year,processAjax);
		
	}
	*/
	
	function removeMessageContact(num) {
		
		var Contacts = document.getElementById('MessageContacts').innerHTML;
		var ContactName = 0;
		var ContactId = 0;
		var newContacts = '';	
		var newContent = '';
		var tempCount = 0;
		var contentWidth = 0;
		var contentHeight = 0;
		var currLeft = 0;
		var currTop = 0;
		var temp = new Array();
		
		var i = 0;
		var counter = 0;
		
		if (Contacts.indexOf(',') != -1) {
			
			temp = Contacts.split(',');
			
			for (i = 0; i < temp.length; i++) {
				
				if (i != num) {
				
					contentWidth = document.getElementById('messageNewFindAddedItem'+i).style.width;
					contentWidth = contentWidth.substr(0,(contentWidth.length*1)-2)*1;
					
					ContactName = document.getElementById('ContactName'+i).innerHTML;
					ContactId = eval('document.MessageForm.Contact'+i).value*1;
					
					if (counter != 0) {
						newContacts += ',';
					}
					newContacts += temp[i];
					newContent += '<div id="messageNewFindAddedItem'+counter+'" style="float: left; height: 14px; width: '+contentWidth+'px;">';
					newContent += '<input type="hidden" name="Contact'+counter+'" value="'+ContactId+'">';
					newContent += '&nbsp;<span id="ContactName'+counter+'">'+ContactName+'</span>&nbsp;<a href="javascript: nothing()" onfocus="this.blur()" onclick="removeMessageContact('+counter+')" class="removeSm" style="display: inline;">&nbsp;&nbsp;&nbsp;&nbsp;</a>';
					newContent += '</div>';
					
					if ((currLeft+contentWidth) > 400) {
						currLeft = contentWidth;
						currTop += 15;	
					} else {
						currLeft += contentWidth;
					}
					
					counter++;
				
				}
				
			}
		
		}
		
		document.MessageForm.Contacts.value = newContacts;
		document.getElementById('MessageContacts').innerHTML = newContacts;
		document.getElementById('messageNewFindAdded').style.visibility = "hidden";
		document.getElementById('messageNewFindAdded').style.width = "10000px";
		document.getElementById('messageNewFindAdded').innerHTML = newContent;
		
		if (currTop != 0) {
			document.getElementById('messageNewFindAdded').style.width = "406px";
			document.getElementById('messageNewFindAdded').style.height = (currTop+18)+"px";
			document.getElementById('messageNewHeaderContent').style.height = (currTop+45)+"px";
			document.getElementById('messageToContent').style.height = (currTop+20)+"px";
		} else {
			document.getElementById('messageNewFindAdded').style.width = currLeft+"px";
			document.getElementById('messageNewFindAdded').style.height = "18px";
			document.getElementById('messageNewHeaderContent').style.height = "45px";
			document.getElementById('messageToContent').style.height = "20px";
		}
		
		var inputWidth = 400-currLeft;
		document.MessageForm.ContactsInside.style.width = (inputWidth-2) + "px";
		document.getElementById('messageNewFindInput').style.width = inputWidth + "px";
		document.getElementById('messageNewFindInput').style.left = currLeft + "px";
		document.getElementById('messageNewFindInput').style.top = currTop + "px";
		
		document.getElementById('messageNewFindContent').style.left = currLeft + "px";
		document.getElementById('messageNewFindContent').style.top = (currTop+20) + "px";
		
		if (currTop != 0) {
			document.getElementById('messageNewFieldBg').style.height = currTop + "px";
			document.getElementById('messageNewFieldBg').style.visibility = "visible";
		} else {
			document.getElementById('messageNewFieldBg').style.height = 5 + "px";
			document.getElementById('messageNewFieldBg').style.visibility = "hidden";
		}
		
		document.getElementById('messageNewFindAdded').style.left = "0px";
		document.getElementById('messageNewFindAdded').style.visibility = "visible";
		
		document.MessageForm.ContactsInside.value = '';
		if (document.getElementById('popupMain').innerHTML == '') {
			document.MessageForm.ContactsInside.focus();
		}
	
	}
	
	function removeMessageContactAll() {
		
		var Contacts = '';
		var ContactName = 0;
		var ContactId = 0;
		var newContacts = '';	
		var newContent = '';
		var tempCount = 0;
		var contentWidth = 0;
		var contentHeight = 0;
		var currLeft = 0;
		var currTop = 0;
		
		document.MessageForm.Contacts.value = newContacts;
		document.getElementById('MessageContacts').innerHTML = newContacts;
		document.getElementById('messageNewFindAdded').style.visibility = "hidden";
		document.getElementById('messageNewFindAdded').style.width = "10000px";
		document.getElementById('messageNewFindAdded').innerHTML = newContent;
		
		if (currTop != 0) {
			document.getElementById('messageNewFindAdded').style.width = "406px";
			document.getElementById('messageNewFindAdded').style.height = (currTop+18)+"px";
			document.getElementById('messageNewHeaderContent').style.height = (currTop+45)+"px";
			document.getElementById('messageToContent').style.height = (currTop+20)+"px";
		} else {
			document.getElementById('messageNewFindAdded').style.width = currLeft+"px";
			document.getElementById('messageNewFindAdded').style.height = "18px";
			document.getElementById('messageNewHeaderContent').style.height = "45px";
			document.getElementById('messageToContent').style.height = "20px";
		}
		
		var inputWidth = 400-currLeft;
		document.MessageForm.ContactsInside.style.width = (inputWidth-2) + "px";
		document.getElementById('messageNewFindInput').style.width = inputWidth + "px";
		document.getElementById('messageNewFindInput').style.left = currLeft + "px";
		document.getElementById('messageNewFindInput').style.top = currTop + "px";
		
		document.getElementById('messageNewFindContent').style.left = currLeft + "px";
		document.getElementById('messageNewFindContent').style.top = (currTop+20) + "px";
		
		if (currTop != 0) {
			document.getElementById('messageNewFieldBg').style.height = currTop + "px";
			document.getElementById('messageNewFieldBg').style.visibility = "visible";
		} else {
			document.getElementById('messageNewFieldBg').style.height = 5 + "px";
			document.getElementById('messageNewFieldBg').style.visibility = "hidden";
		}
		
		document.getElementById('messageNewFindAdded').style.left = "0px";
		document.getElementById('messageNewFindAdded').style.visibility = "visible";
		
		document.MessageForm.ContactsInside.value = '';
		if (document.getElementById('popupMain').innerHTML == '') {
			document.MessageForm.ContactsInside.focus();
		}
	
	}
	
	function messageAddContact(thisKeyCode,MemberId) {
		
		var ContactsInside = document.MessageForm.ContactsInside.value;
		var Exclude = document.getElementById('MessageContacts').innerHTML;
		
		//alert(ContactsInside+'-'+Exclude);
		
		//populateContacts($MemberId,$Exclude,$Keyword
						   
		var populateContactsCount = 0;
						   
		if ((thisKeyCode == 9) || (thisKeyCode == 13)) {
			if (document.getElementById('populateContactsCount')) {
				populateContactsCount =  document.getElementById('populateContactsCount').value*1;
				ContactId =  document.getElementById('populateContactId').value*1;
				ContactName =  document.getElementById('populateContactName').value;
			}
		}
		
		if (populateContactsCount == 1) {
			
			setContact(ContactId,ContactName);
			
		} else {
		
			if ((ContactsInside != '') && (ContactsInside.length >= 2)) {
				clearTimeout(currTimeout);
				currTimeout = window.setTimeout("messageAddContactHide()",3000);
				currDiv = 'messageNewFindContent';
				sendAjaxComm("functions.php?populateContacts=1&MemberId="+MemberId+"&Exclude="+Exclude+"&Keyword="+ContactsInside,processAjax);
			}
		
		}
		
	}
	
	function messageAddContactItem(Contact,Type) {
		
		if (Type == 1) {
			clearTimeout(currTimeout);
			document.getElementById('ContactAdd'+Contact).style.backgroundColor = '#FAFAFA';
		} else {
			document.getElementById('ContactAdd'+Contact).style.backgroundColor = '#FFF';
			currTimeout = window.setTimeout("messageAddContactHide()",1500);
		}
		
	}
	
	function messageAddContactHide() {
		
		document.getElementById('messageNewFindContent').innerHTML = '';
		document.getElementById('messageNewFindContent').style.visibility = 'hidden';
		
	}
	
	function setContact(Contact,FullName) {
		
		var Contacts = document.getElementById('MessageContacts').innerHTML;
		var newContacts = '';	
		var newContent = '';
		var tempCount = 0;
		var contentWidth = 0;
		var contentHeight = 0;
		var currLeft = 0;
		var currTop = 0;
		var temp = new Array();
		
		var i = 0;
		
		if (Contacts.indexOf(',') != -1) {
			
			temp = Contacts.split(',');
			
			for (i = 0; i < temp.length; i++) {
				
				contentWidth = document.getElementById('messageNewFindAddedItem'+i).style.width;
				contentWidth = contentWidth.substr(0,(contentWidth.length*1)-2)*1;
				
				if (i != 0) {
					newContacts += ',';
				}
				newContacts += temp[i];
				newContent += '<div id="messageNewFindAddedItem'+i+'" style="float: left; height: 14px; width: '+contentWidth+'px;">';
				newContent += document.getElementById('messageNewFindAddedItem'+i).innerHTML;
				newContent += '</div>';
				
				if ((currLeft+contentWidth) > 400) {
					currLeft = contentWidth;
					currTop += 15;	
				} else {
					currLeft += contentWidth;
				}
				
			}
		
		} else if (Contacts != '') {
				
			contentWidth = document.getElementById('messageNewFindAddedItem'+i).style.width;
			contentWidth = contentWidth.substr(0,(contentWidth.length*1)-2)*1;
			currLeft = contentWidth;
			
			newContacts += Contacts;
			newContent += '<div id="messageNewFindAddedItem'+i+'" style="float: left; height: 14px; width: '+contentWidth+'px;">';
			newContent += document.getElementById('messageNewFindAddedItem'+i).innerHTML;
			newContent += '</div>';
		
			i++;
			
		} else {
			
			currLeft = 0;
			currTop = 0;
			
		}
		
		if (newContacts != '') {
			newContacts += ',';
		}
			
		newContacts += Contact;
		newContent += '<div id="messageNewFindAddedItem'+i+'" style="float: left; height: 14px;">';
		newContent += '<input type="hidden" name="Contact'+i+'" value="'+Contact+'">';
		newContent += '&nbsp;<span id="ContactName'+i+'">'+FullName+'</span>&nbsp;<a href="javascript: nothing()" onfocus="this.blur()" onclick="removeMessageContact('+i+')" class="removeSm" style="display: inline;">&nbsp;&nbsp;&nbsp;&nbsp;</a>';
		newContent += '</div>';
		
		document.MessageForm.Contacts.value = newContacts;
		document.getElementById('MessageContacts').innerHTML = newContacts;
		document.getElementById('messageNewFindAdded').style.visibility = "hidden";
		document.getElementById('messageNewFindAdded').style.width = "10000px";
		document.getElementById('messageNewFindAdded').innerHTML = newContent;
		
		var offsetLeft = (document.getElementById('messageNewFindAddedItem'+i).offsetWidth*1)+2;
		
		//alert(currLeft+offsetLeft);
		
		if ((currLeft+offsetLeft) > 400) {
			currLeft = offsetLeft;
			currTop += 15;	
		} else {
			currLeft += offsetLeft;
		}
		
		if (currTop != 0) {
			document.getElementById('messageNewFindAdded').style.width = "406px";
			document.getElementById('messageNewFindAdded').style.height = (currTop+18)+"px";
			document.getElementById('messageNewHeaderContent').style.height = (currTop+45)+"px";
			document.getElementById('messageToContent').style.height = (currTop+20)+"px";
		} else {
			document.getElementById('messageNewFindAdded').style.width = currLeft+"px";
			document.getElementById('messageNewHeaderContent').style.height = "45px";
			document.getElementById('messageToContent').style.height = "20px";
		}
		
		document.getElementById('messageNewFindAddedItem'+i).style.width = offsetLeft+"px";
		
		var inputWidth = 400-currLeft;
		document.MessageForm.ContactsInside.style.width = (inputWidth-2) + "px";
		document.getElementById('messageNewFindInput').style.width = inputWidth + "px";
		document.getElementById('messageNewFindInput').style.left = currLeft + "px";
		document.getElementById('messageNewFindInput').style.top = currTop + "px";
		
		document.getElementById('messageNewFindContent').style.left = currLeft + "px";
		document.getElementById('messageNewFindContent').style.top = (currTop+20) + "px";
		
		if (currTop != 0) {
			document.getElementById('messageNewFieldBg').style.height = currTop + "px";
			document.getElementById('messageNewFieldBg').style.visibility = "visible";
		} else {
			document.getElementById('messageNewFieldBg').style.height = 5 + "px";
			document.getElementById('messageNewFieldBg').style.visibility = "hidden";
		}		
		
		document.getElementById('messageNewFindAdded').style.left = "0px";
		document.getElementById('messageNewFindAdded').style.visibility = "visible";
		
		document.MessageForm.ContactsInside.value = '';
		if (document.getElementById('popupMain').innerHTML == '') {
			document.MessageForm.ContactsInside.focus();
		}
		
		messageAddContactHide();
		
	}
	
	function messageContactsAdd() {
	
		var counter = 0;
		var ContactId = 0;
		var ContactName = '';
	
		while (eval('document.MessageForm.ContactAdd'+counter)) {
		
			ContactId = eval('document.MessageForm.ContactAdd'+counter).value*1;
			ContactName = eval('document.MessageForm.ContactAddName'+counter).value;
			
			setContact(ContactId,ContactName);
			
			counter++;
		
		}
	
	}
	
	function contactsPopup(MemberId) {
		
		popupWidth = 670;
		popupHeight = 410;
		
		noLoading = 1;
		
		ajaxWorking = 1;
		
		removeMessageContactAll();
	
		setPopup();
		
		var Contacts = document.MessageForm.Contacts.value;
		
		currDiv = 'popupMain';
		sendAjaxComm("functions.php?popupContacts=1&MemberId="+MemberId+"&Contacts="+Contacts,processAjax);
	
	}
	
	function popupContactsList() {
		
		var CurrMember = document.ContactListFind.CurrMember.value;
		var Contacts = document.ContactListFind.Contacts.value;
		var Keyword = document.ContactListFind.Keyword.value;
		var SortField = document.ContactListFind.SortField.value;
		
		currDiv = 'messagePopupContacts';
		sendAjaxComm("functions.php?popupContactsList=1&MemberId="+CurrMember+"&Contacts="+Contacts+"&Keyword="+Keyword+"&SortField="+SortField,processAjax);
	
	}
	
	function popupContactsSort(SortField,num) {
		
		document.ContactListFind.SortField.value = SortField;
		
		document.getElementById('sortNav'+sortNavNum).className = 'sortNav';
		document.getElementById('sortNav'+num).className = 'sortNavOn';
		
		sortNavNum = num;
		
		popupContactsList();
		
	}
	
	function popupWarningContact() {
		
		popupWidth = 410;
		popupHeight = 300;
		
		ajaxWorking = 1;
		
		noLoading = 1;
	
		setPopupSec();
		
		currDiv = 'popupMainSec';
		
		//alert(document.getElementById(currDiv).style.left);
		sendAjaxComm("functions.php?popupWarningContact=1",processAjax);
	
	}
	
	function popupAddEvent(EventId,MemberId,Keyword,CategoryName,Time,CurrResults,SortField) {
		
		popupWidth = 410;
		popupHeight = 300;
		
		ajaxWorking = 1;
		
		noLoading = 1;
	
		setPopupSec();
		
		currDiv = 'popupMainSec';
		
		//alert(document.getElementById(currDiv).style.left);
		sendAjaxComm("functions.php?popupAddEvent=1&EventId="+EventId+"&MemberId="+MemberId+"&Keyword="+Keyword+"&CategoryName="+CategoryName+"&Time="+Time+"&CurrResults="+CurrResults+"&SortField="+SortField,processAjax);
	
	}
	
	function popupRemoveEvent(EventId,MemberId,Keyword,CategoryName,Time,CurrResults,SortField) {
		
		popupWidth = 410;
		popupHeight = 300;
		
		ajaxWorking = 1;
		
		noLoading = 1;
	
		setPopupSec();
		
		currDiv = 'popupMainSec';
		
		//alert(document.getElementById(currDiv).style.left);
		sendAjaxComm("functions.php?popupRemoveEvent=1&EventId="+EventId+"&MemberId="+MemberId+"&Keyword="+Keyword+"&CategoryName="+CategoryName+"&Time="+Time+"&CurrResults="+CurrResults+"&SortField="+SortField,processAjax);
	
	}
	
	function popupFollowCompany(CompanyId,MemberId) {
		
		popupWidth = 410;
		popupHeight = 300;
		
		ajaxWorking = 1;
		
		noLoading = 1;
	
		setPopupSec();
		
		currDiv = 'popupMainSec';
		
		sendAjaxComm("functions.php?popupFollowCompany=1&CompanyId="+CompanyId+"&MemberId="+MemberId,processAjax);
	
	}
	
	function popupCompanyPremium(CompanyId,MemberId) {
		
		popupWidth = 410;
		popupHeight = 300;
		
		ajaxWorking = 1;
		
		noLoading = 1;
	
		setPopupSec();
		
		currDiv = 'popupMainSec';
		//alert(CompanyId);
		//alert(document.getElementById(currDiv).style.left);
		sendAjaxComm("functions.php?popupCompanyPremium=1&CompanyId="+CompanyId+"&MemberId="+MemberId,processAjax);
	
	}
	
	function popupCompanyPremiumSave(CompanyId,MemberId) {
		
		popupWidth = 410;
		popupHeight = 300;
		
		ajaxWorking = 1;
		
		noLoading = 1;
	
		setPopupSec();
		
		currDiv = 'popupMainSec';	
		
		//alert(CompanyId);
		//alert(document.getElementById(currDiv).style.left);
		sendAjaxComm("functions.php?popupCompanyPremiumSave=1&CompanyId="+CompanyId+"&MemberId="+MemberId,processAjax);
	
	}
	
	function popupCompanyProductRemove(CompanyId,ProductId) {
		
		popupWidth = 410;
		popupHeight = 300;
		
		ajaxWorking = 1;
		
		noLoading = 1;
	
		setPopupSec();
		
		currDiv = 'popupMainSec';	
		
		//alert(CompanyId);
		//alert(document.getElementById(currDiv).style.left);
		sendAjaxComm("functions.php?popupCompanyProductRemove=1&CompanyId="+CompanyId+"&ProductId="+ProductId,processAjax);
	
	}
	
	function popupCompanyMemberRemove(CompanyId,MemberId) {
		
		popupWidth = 410;
		popupHeight = 300;
		
		ajaxWorking = 1;
		
		noLoading = 1;
	
		setPopupSec();
		
		currDiv = 'popupMainSec';	
		
		//alert(CompanyId);
		//alert(document.getElementById(currDiv).style.left);
		sendAjaxComm("functions.php?popupCompanyMemberRemove=1&CompanyId="+CompanyId+"&MemberId="+MemberId,processAjax);
	
	}
	
	function popupCompanyMemberApprove(CompanyId,MemberId) {
		
		popupWidth = 410;
		popupHeight = 300;
		
		ajaxWorking = 1;
		
		noLoading = 1;
	
		setPopupSec();
		
		currDiv = 'popupMainSec';	
		
		//alert(CompanyId);
		//alert(document.getElementById(currDiv).style.left);
		sendAjaxComm("functions.php?popupCompanyMemberApprove=1&CompanyId="+CompanyId+"&MemberId="+MemberId,processAjax);
	
	}
	
	function popupCompanyMember(CompanyId,MemberId) {
		
		popupWidth = 410;
		popupHeight = 300;
		
		ajaxWorking = 1;
		
		noLoading = 1;
	
		setPopupSec();
		
		currDiv = 'popupMainSec';
		//alert(CompanyId);
		//alert(document.getElementById(currDiv).style.left);
		sendAjaxComm("functions.php?popupCompanyMember=1&CompanyId="+CompanyId+"&MemberId="+MemberId,processAjax);
	
	}
	
	function popupCompanyMemberSave() {
		
		var MemberId = document.AddMemberForm.MemberId.value;
		var CompanyId = document.AddMemberForm.CompanyId.value;
		
		var Moderator = 0;
		if (document.AddMemberForm.Moderator.checked) {
			Moderator = 1;	
		}
		
		popupWidth = 410;
		popupHeight = 300;
		
		ajaxWorking = 1;
		
		noLoading = 1;
	
		setPopupSec();
		
		currDiv = 'popupMainSec';
		//alert(CompanyId);
		//alert(document.getElementById(currDiv).style.left);
		sendAjaxComm("functions.php?popupCompanyMemberSave=1&CompanyId="+CompanyId+"&MemberId="+MemberId+"&Moderator="+Moderator,processAjax);
	
	}
	
	function popupPassword() {
		
		popupWidth = 410;
		popupHeight = 300;
		
		ajaxWorking = 1;
		
		noLoading = 1;
	
		setPopupSec();
		
		currDiv = 'popupMainSec';
		
		//alert(document.getElementById(currDiv).style.left);
		sendAjaxComm("functions.php?popupPassword=1",processAjax);
	
	}
	
	function popupDeleteMessage(MessageId,Type,SortOrder,CurrResults,CurrUser) {
		
		popupWidth = 410;
		popupHeight = 300;
		
		ajaxWorking = 1;
		
		noLoading = 1;
	
		setPopupSec();
		
		currDiv = 'popupMainSec';
		
		//alert(document.getElementById(currDiv).style.left);
		sendAjaxComm("functions.php?popupDeleteMessage=1&MessageId="+MessageId+"&Type="+Type+"&SortOrder="+SortOrder+"&CurrResults="+CurrResults+"&CurrUser="+CurrUser,processAjax);
	
	}
	
	//($MessageId,$Type,$SortOrder,$CurrResults)
	
	function popupPasswordVerify() {
		
		popupWidth = 410;
		popupHeight = 300;
		
		ajaxWorking = 1;
		
		noLoading = 1;
	
		setPopupSec();
		
		var Email = document.ForgotPasswordForm.Email.value;
		var EmailValid = document.ForgotPasswordForm.EmailValid.value;
		
		if (!check_email(Email)) {
		
			var errorDisp	= 'Your email address is not formatted correctly!';
			document.getElementById('errorRemember').innerHTML = errorDisp;
			document.getElementById('errorRemember').style.padding = '10px 0px 10px 0px';
			
		} else if (EmailValid == 0) {
		
			var errorDisp	= 'Your email address was not found in our system, please verify.';
			document.getElementById('errorRemember').innerHTML = errorDisp;
			document.getElementById('errorRemember').style.padding = '10px 0px 10px 0px';
			
		} else {
			
			//alert('1');
		
			currDiv = 'popupMainSec';
			sendAjaxComm("functions.php?popupPasswordVerify=1&Email="+Email,processAjax);
			
		}
	
	}
	
	function popupShareAll() {
		
		if (document.NetworkPostForm.Shared.checked) {
			//alert('REALLY??');	
		}
		
	}
	
	function removeContact(MemberId) {
		
		popupWidth = 410;
		popupHeight = 300;
		
		ajaxWorking = 1;
		
		noLoading = 1;
	
		setPopupSec();
		
		currDiv = 'popupMainSec';
		
		//alert(document.getElementById(currDiv).style.left);
		sendAjaxComm("functions.php?removeContact=1&MemberId="+MemberId,processAjax);
		
	}
	
	function popupProductsUpload(CompanyId) {
		
		popupWidth = 410;
		popupHeight = 300;
		
		ajaxWorking = 1;
		
		noLoading = 1;
	
		setPopupSec();
		
		currDiv = 'popupMainSec';
		
		//alert(document.getElementById(currDiv).style.left);
		sendAjaxComm("functions.php?popupProductsUpload=1&LibName=lib.companies&CompanyId="+CompanyId,processAjax);
		
	}
	
	function addOpportunity(OpportunityId) {
		
		popupWidth = 410;
		popupHeight = 300;
		
		ajaxWorking = 1;
		
		noLoading = 1;
	
		setPopupSec();
		
		currDiv = 'popupMainSec';
		
		//alert(document.getElementById(currDiv).style.left);
		sendAjaxComm("functions.php?addOpportunity=1&OpportunityId="+OpportunityId,processAjax);
		
	}
	
	function messageFlag(MessageId,Contact,Flag) {
		
		noLoading = 1;
		
		if (Flag == 0) {
			document.getElementById('messageFlagImage'+MessageId).src = root_link+"/images/main/button-flag-on.png";
		} else {
			document.getElementById('messageFlagImage'+MessageId).src = root_link+"/images/main/button-flag.png";
		}
		
		currDiv = 'messageFlag'+MessageId;
		sendAjaxComm("functions.php?messageFlag=1&MessageId="+MessageId+"&Contact="+Contact+"&Flag="+Flag,processAjax);
		
	}
	
	function messageFlagInvite(InviteId,Flag) {
		
		noLoading = 1;
		
		if (Flag == 0) {
			document.getElementById('messageFlagImage'+InviteId).src = root_link+"/images/main/button-flag-on.png";
		} else {
			document.getElementById('messageFlagImage'+InviteId).src = root_link+"/images/main/button-flag.png";
		}
		
		currDiv = 'messageFlag'+InviteId;
		sendAjaxComm("functions.php?messageFlagInvite=1&InviteId="+InviteId+"&Flag="+Flag,processAjax);
		
	}
	
	function networkActivitiesList(MemberId,Counter,MemberDisp) {
		
		var contentDisp	= '<a href="javascript: nothing()" onclick="networkActivitiesListMore('+MemberId+','+MemberDisp+')" class="more" onfocus="this.blur()">';
		contentDisp	+= 'See older items';
		contentDisp	+= '</a>';
		
		if (document.getElementById('activitiesMore')) {
			document.getElementById('activitiesMore').innerHTML = contentDisp;
		}
		
		currDiv = 'networkActivitiesList';
		sendAjaxComm("functions.php?networkActivitiesList=1&MemberId="+MemberId+"&LibName=lib.home&MemberDisp="+MemberDisp+"&Counter="+Counter,processAjax);
		
		clearTimeout(networkTimeout);
		networkTimeout = window.setTimeout('networkActivitiesList('+MemberId+',0,'+MemberDisp+')',60000);
	
	}
	
	function networkActivitiesCommentsAdd(MemberId,UpdateId) {
	
		currUpdate = UpdateId;
	
		currDiv = 'networkActivitiesCommentsAdd'+UpdateId;
		if (document.getElementById('CommentCounter'+UpdateId).value == 0) {
			document.getElementById('networkActivitiesComments'+UpdateId).style.display = "block";
			document.getElementById('networkActivitiesComments'+UpdateId).style.paddingTop = "10px";
		}
		secondaryFunction = "document.getElementById('Content"+UpdateId+"').focus()";
		sendAjaxComm("functions.php?networkActivitiesCommentsAdd=1&MemberId="+MemberId+"&UpdateId="+UpdateId,processAjax);
		clearTimeout(networkTimeout);
		
	}
	
	function closeNetworkComment() {
		
		if (currUpdateClose == 1) {
			if ((document.getElementById('networkActivitiesCommentsAdd'+currUpdate)) && (document.getElementById('Content'+currUpdate))) {
				if (((document.getElementById('Content'+currUpdate).value == '') || (document.getElementById('Content'+currUpdate).value == 'Add comments...'))) {
			
					var MemberId = document.NetworkPostForm.CurrMember.value;
					
					document.getElementById('networkActivitiesCommentsAdd'+currUpdate).innerHTML = '';
					if (document.getElementById('CommentCounter'+currUpdate).value == 0) {
						document.getElementById('networkActivitiesComments'+currUpdate).style.display = "inline";
						document.getElementById('networkActivitiesComments'+currUpdate).style.paddingTop = "0px";
					} else {
						currDiv = 'networkActivitiesCommentsAdd'+currUpdate;
						sendAjaxComm("functions.php?networkActivitiesCommentsAddTemp=1&MemberId="+MemberId+"&UpdateId="+currUpdate,processAjax);
					}
					//currUpdate = 0;
					networkTimeout = window.setTimeout('networkActivitiesList('+MemberId+',0)',60000);
				
				}
			}
		}
		
	}
	
	function resetNetworkTimeout() {
		clearTimeout(networkTimeout);
		var MemberId = document.NetworkPostForm.CurrMember.value;
		networkTimeout = window.setTimeout('networkActivitiesList('+MemberId+',0)',60000);
	}
	
	function networkCommentSubmit(MemberId,UpdateId) {
		
		var Content = document.getElementById('Content'+currUpdate).value;
		Content = Content.replace(/\n/g,'<br />');
		Content = Content.replace(/&/g,"--amp;");
		Content = Content.replace(/'/g,"---39;");
		
		currDiv = 'networkActivitiesComments'+UpdateId;
		sendAjaxComm("functions.php?networkCommentSubmit=1&MemberId="+MemberId+"&UpdateId="+UpdateId+"&Content="+Content,processAjax);
		
		var MemberId = document.NetworkPostForm.CurrMember.value;
		networkTimeout = window.setTimeout('networkActivitiesList('+MemberId+',0)',60000);
		
	}
	
	function networkActivitiesComments(UpdateId,DisplayAll) {
		
		currDiv = 'networkActivitiesComments'+UpdateId;
		sendAjaxComm("functions.php?networkActivitiesComments=1&UpdateId="+UpdateId+"&DisplayAll="+DisplayAll,processAjax);
		
		clearTimeout(networkTimeout);
		var MemberId = document.NetworkPostForm.CurrMember.value;
		networkTimeout = window.setTimeout('networkActivitiesList('+MemberId+',0)',60000);
		
	}
	
	function forumPostsCommentsAdd(MemberId,PostId) {
	
		currPost = PostId;
	
		currDiv = 'postsCommentsAdd'+PostId;
		if (document.getElementById('CommentCounter'+PostId).value == 0) {
			document.getElementById('postsComments'+PostId).style.display = "block";
			document.getElementById('postsComments'+PostId).style.paddingTop = "10px";
		}
		secondaryFunction = "document.getElementById('Content"+PostId+"').focus()";
		sendAjaxComm("functions.php?forumPostsCommentsAdd=1&MemberId="+MemberId+"&PostId="+PostId,processAjax);
		clearTimeout(networkTimeout);
		
	}
	
	function forumPostsComment() {
		
		if (currPostClose == 1) {
			if ((document.getElementById('postsCommentsAdd'+currPost)) && (document.getElementById('Content'+currPost))) {
				if (((document.getElementById('Content'+currPost).value == '') || (document.getElementById('Content'+currPost).value == 'Add comments...'))) {
			
					var MemberId = document.ForumPostForm.CurrMember.value;
					
					document.getElementById('postsCommentsAdd'+currPost).innerHTML = '';
					if (document.getElementById('CommentCounter'+currPost).value == 0) {
						document.getElementById('postsComments'+currPost).style.display = "inline";
						document.getElementById('postsComments'+currPost).style.paddingTop = "0px";
					} else {
						currDiv = 'postsCommentsAdd'+currPost;
						sendAjaxComm("functions.php?forumPostsCommentsAdd=1&MemberId="+MemberId+"&PostId="+currPost,processAjax);
					}
				
				}
			}
		}
		
	}
	
	function forumPostsCommentSubmit(MemberId,PostId) {
		
		var Content = document.getElementById('Content'+currPost).value;
		Content = Content.replace(/\n/g,'<br />');
		Content = Content.replace(/&/g,"--amp;");
		Content = Content.replace(/'/g,"---39;");
		
		currDiv = 'postsComments'+PostId;
		sendAjaxComm("functions.php?forumPostsCommentSubmit=1&MemberId="+MemberId+"&PostId="+PostId+"&Content="+Content,processAjax);
		
	}
	
	function forumPostsComments(PostId,DisplayAll) {
		
		currDiv = 'postsComments'+PostId;
		sendAjaxComm("functions.php?forumPostsComments=1&PostId="+PostId+"&DisplayAll="+DisplayAll,processAjax);
		
	}
	
	function closePostComment() {
		
		if (currPostClose == 1) {
			if ((document.getElementById('postsCommentsAdd'+currPost)) && (document.getElementById('Content'+currPost))) {
				if (((document.getElementById('Content'+currPost).value == '') || (document.getElementById('Content'+currPost).value == 'Add comments...'))) {
			
					var MemberId = document.ForumPostForm.CurrMember.value;
					
					document.getElementById('postsCommentsAdd'+currPost).innerHTML = '';
					if (document.getElementById('CommentCounter'+currPost).value == 0) {
						document.getElementById('postsComments'+currPost).style.display = "inline";
						document.getElementById('postsComments'+currPost).style.paddingTop = "0px";
					} else {
						currDiv = 'postsCommentsAdd'+currPost;
						sendAjaxComm("functions.php?forumPostsCommentsAddTemp=1&MemberId="+MemberId+"&PostId="+currPost,processAjax);
					}
				
				}
			}
		}
		
	}
	
	function displayHoverBox(divName) {
		document.getElementById(divName).style.visibility = 'visible';
	}
	
	function hideHoverBox(divName) {
		window.setTimeout("document.getElementById('"+divName+"').style.visibility = 'hidden'",200);
	}
	
	function setOpportunityCategory(CatName) {
		document.OpportunityFind.CategoryName.value = CatName.replace('&amp;','&');
	}
	
	function setForumCategory(CatName) {
		document.ForumCategoryFind.CategoryName.value = CatName.replace('&amp;','&');
	}
	
	function setContactLocation(LocationName) {
		document.ContactFind.Location.value = LocationName;
	}
	
	function searchPopulateLocations(MemberId) {
		
		Keyword = document.ContactFind.Location.value;
		
		currDiv = 'locationsBox';
		sendAjaxComm("functions.php?searchPopulateLocations=1&MemberId="+MemberId+"&Keyword="+Keyword,processAjax);
		
	}
	
	function setContactPosition(PositionName) {
		document.ContactFind.Position.value = PositionName;
	}
	
	function searchPopulatePositions(MemberId) {
		
		Keyword = document.ContactFind.Position.value;
		
		currDiv = 'positionsBox';
		sendAjaxComm("functions.php?searchPopulatePositions=1&MemberId="+MemberId+"&Keyword="+Keyword,processAjax);
		
	}
	
	function setContactType(TypeName) {
		document.ContactFind.OrganisationType.value = TypeName;
	}
	
	function searchPopulateTypes(MemberId) {
		
		Keyword = document.ContactFind.OrganisationType.value;
		
		currDiv = 'typesBox';
		sendAjaxComm("functions.php?searchPopulateTypes=1&MemberId="+MemberId+"&Keyword="+Keyword,processAjax);
		
	}
	
	function setContactInterest(InterestName) {
		document.ContactFind.TopicName.value = InterestName;
	}
	
	function searchPopulateInterests(MemberId) {
		
		Keyword = document.ContactFind.TopicName.value;
		
		currDiv = 'interestsBox';
		sendAjaxComm("functions.php?searchPopulateInterests=1&MemberId="+MemberId+"&Keyword="+Keyword,processAjax);
		
	}
	
	function setCompaniesLocation(LocationName) {
		document.CompaniesFind.Location.value = LocationName;
	}
	
	function searchPopulateCompaniesLocations(MemberId) {
		
		Keyword = document.CompaniesFind.Location.value;
		
		currDiv = 'locationsBox';
		sendAjaxComm("functions.php?searchPopulateCompaniesLocations=1&MemberId="+MemberId+"&Keyword="+Keyword,processAjax);
		
	}
	
	function setCompanies(Company) {
		document.CompaniesFind.Keyword.value = Company;
	}	
	function searchPopulateCompanies(MemberId) {
		
		Keyword = document.CompaniesFind.Keyword.value;
		
		currDiv = 'companiesPopBox';
		sendAjaxComm("functions.php?searchPopulateCompanies=1&MemberId="+MemberId+"&Keyword="+Keyword,processAjax);
		
	}
	
	function setCompaniesCategory(CategoryName) {
		document.CompaniesFind.CategoryName.value = CategoryName;
	}
	
	function searchPopulateCategories(MemberId) {
		
		Keyword = document.CompaniesFind.CategoryName.value;
		
		currDiv = 'categoriesBox';
		sendAjaxComm("functions.php?searchPopulateCategories=1&MemberId="+MemberId+"&Keyword="+Keyword,processAjax);
		
	}
	
	function setCompaniesType(TypeName) {
		document.CompaniesFind.OrganisationType.value = TypeName;
	}
	
	function searchPopulateCompaniesTypes(MemberId) {
		
		Keyword = document.CompaniesFind.OrganisationType.value;
		
		currDiv = 'typesBox';
		sendAjaxComm("functions.php?searchPopulateCompaniesTypes=1&MemberId="+MemberId+"&Keyword="+Keyword,processAjax);
		
	}
	
	function networkActivitiesListMore(MemberId,MemberDisp) {
		
		clearTimeout(networkTimeout);
		
		var activitiesCounterTotal = document.getElementById('activitiesCounterTotal').value*1;
		var activitiesCounter = document.getElementById('activitiesCounter').value*1;
		
		var CurrResults = activitiesCounter*15;
		
		//alert((CurrResults+15)+' '+activitiesCounterTotal);
		
		if ((CurrResults+15) > activitiesCounterTotal) {
			
			document.getElementById('activitiesMore').style.visibility = "hidden";
			
		}
		
		document.getElementById('activitiesCounter').value = activitiesCounter+1;
	
		currDiv = 'networkActivitiesList'+activitiesCounter;
		//alert(document.getElementById(currDiv));
		sendAjaxComm("functions.php?networkActivitiesList=1&MemberId="+MemberId+"&MemberDisp="+MemberDisp+"&Counter="+CurrResults,processAjax);
		
	}
	
	function networkActivitiesListMain(MemberId) {
		
		clearTimeout(networkTimeout);
		
		var activitiesCounterTotal = document.getElementById('activitiesCounterTotal').value*1;
		var activitiesCounter = document.getElementById('activitiesCounter').value*1;
		
		activitiesCounter--;
		
		var CurrResults = activitiesCounter*15;
		
		//alert((CurrResults+15)+' '+activitiesCounterTotal);
		
		if ((CurrResults+15) > activitiesCounterTotal) {
			
			document.getElementById('activitiesMore').style.visibility = "hidden";
			
		}
		
		document.getElementById('activitiesCounter').value = activitiesCounter+1;
	
		currDiv = 'networkActivitiesList';
		//alert(document.getElementById(currDiv));
		sendAjaxComm("functions.php?networkActivitiesList=1&MemberId="+MemberId+"&Counter="+CurrResults,processAjax);
		
	}
	
	function contactsSearchAdvanced() {
		
		var newContent	= '<a href="javascript: nothing()" onfocus="this.blur()" style="color: #999" onclick="contactsSearchSimple()">';
		newContent		+= 'classic search';
		newContent		+= '</a>';
		
		document.getElementById('contactSearchFindLink').style.visibility = 'hidden';
		document.getElementById('contactSearchOption').innerHTML = newContent;
		document.getElementById('contactSearchFind').style.height = '115px';
		document.getElementById('contactSearchFind').style.overflow = 'visible';
		document.getElementById('contactSearchFindAdvanced').style.visibility = 'visible';
		
	}
	
	function contactsSearchSimple() {
		
		var newContent	= '<a href="javascript: nothing()" onfocus="this.blur()" style="color: #999" onclick="contactsSearchAdvanced()">';
		newContent		+= 'advanced search';
		newContent		+= '</a>';
		
		document.getElementById('contactSearchFindLink').style.visibility = 'visible';
		document.getElementById('contactSearchOption').innerHTML = newContent;
		document.getElementById('contactSearchFind').style.height = '45px';
		document.getElementById('contactSearchFind').style.overflow = 'hidden';
		document.getElementById('contactSearchFindAdvanced').style.visibility = 'hidden';
		
		//alert(document.getElementById('contactSearchFind').style.overflow);
		
	}
	
	function removeNetworkItem(UpdateId,MemberId) {
	
		currDiv = 'networkItem'+UpdateId;
		sendAjaxComm("functions.php?removeNetworkItem=1&UpdateId="+UpdateId+"&MemberId="+MemberId,processAjax);
		
	}
	
	function displayNetworkItem(UpdateId,MemberId) {
	
		currDiv = 'networkItem'+UpdateId;
		sendAjaxComm("functions.php?displayNetworkItem=1&UpdateId="+UpdateId+"&MemberId="+MemberId,processAjax);
		
	}
	
	function selectContacts() {
		
		var ContactCounter = document.popupContactsForm.ContactCounter.value*1;
		
		var ContactsListOrig = ','+document.MessageForm.Contacts.value+',';
		
		var tempContact = '';
		var FullName = '';
		
		for (var i = 0; i < ContactCounter; i++) {
			
			if (eval('document.popupContactsForm.SelectContact'+i).checked) {
				tempContact = eval('document.popupContactsForm.SelectContact'+i).value;
				FullName = eval('document.popupContactsForm.SelectContactName'+i).value;
				
				if (ContactsListOrig.indexOf(','+tempContact+',') == -1) {
					setContact(tempContact,FullName);
				}
				
			}
			
		}
		
		closePopup();
		
	}
	
	function actionItem(ActionType) {
	
		document.ActionForm.ActionType.value = ActionType;
		document.ActionForm.submit();
	
	}
	
	function setChecked(num) {
		
		var itemField = eval('document.popupContactsForm.SelectContact'+num);
		
		var Contact = eval('document.popupContactsForm.SelectContact'+num).value*1;
		var FullName = eval('document.popupContactsForm.SelectContactName'+num).value;
		
		var i = 0;
	
		if (itemField.checked == true) {
		
			var Contacts = document.getElementById('MessageContacts').innerHTML;
			var temp = new Array();
			
			if (Contacts.indexOf(',') != -1) {
			
				temp = Contacts.split(',');
				
				for (i = 0; i < temp.length; i++) {
					
					ContactId = eval('document.MessageForm.Contact'+i).value*1;
					
					if (Contact == ContactId) {
						var newNum = i;
					}
					
				}
			
			} else {
				newNum = i;
			}
			
			itemField.checked = false;
			removeMessageContact(newNum);
		} else {
			itemField.checked = true;
			setContact(Contact,FullName);
		}
	
	}
	
	function uploadImage() {
		
		document.getElementById('imageUploadField').style.visibility = "hidden";
		document.getElementById('imageUploadLoading').style.visibility = "visible";
		
	}
	
	function loadProfileImage(ImageName) {
	
		//currDiv = 'profileImageEdit';
		//sendAjaxComm("functions.php?profileImageEdit=1&ImageName="+ImageName,processAjax);
		
		if (parent.document.ProfileForm) {
		parent.document.ProfileForm.NewImage.value = ImageName.substr(5,((ImageName.length*1)-5));
		} else if (parent.document.EventForm) {
		parent.document.EventForm.NewImage.value = ImageName;
		} else {
		parent.document.RegisterForm.NewImage.value = ImageName.substr(5,((ImageName.length*1)-5));
		}
		
		document.getElementById('profileImageFrame').style.height = "350px";
		document.getElementById('profileImageFrameContent').style.height = "350px";
		document.getElementById('profileImage').style.height = "350px";
		
	}
	
	function profileCropImage() {
		
		var Type = document.profileImageUpload.Type.value;
		var crop_x = document.profileImageUpload.crop_x.value*1;
		var crop_y = document.profileImageUpload.crop_y.value*1;
		var crop_width = document.profileImageUpload.crop_width.value*1;
		var crop_height = document.profileImageUpload.crop_height.value*1;
		var ImageName = document.profileImageUpload.ImageName.value;
	
		//alert(Type);
		
		parent.profileCropImageLoad(crop_x,crop_y,crop_width,crop_height,ImageName,Type);
		
	}
	
	function profileCropImageLoad(crop_x,crop_y,crop_width,crop_height,ImageName,Type) {
	
		currDiv = 'profileImageEdit';
		sendAjaxComm("functions.php?profileCropImage=1&ImageName="+ImageName+"&crop_x="+crop_x+"&crop_y="+crop_y+"&crop_width="+crop_width+"&crop_height="+crop_height+"&Type="+Type,parent.processAjax);
		
		document.getElementById('profileImageFrame').style.height = "30px";
		document.getElementById('profileImageFrameContent').style.height = "30px";
		document.getElementById('profileImage').style.height = "30px";
		
		if (document.ProfileForm) {
		document.ProfileForm.NewImage.value = ImageName.substr(5,((ImageName.length*1)-5));
		} else if (document.EventForm) {
		document.EventForm.NewImage.value = ImageName;
		} else {
		document.RegisterForm.NewImage.value = ImageName.substr(5,((ImageName.length*1)-5));
		}
		//alert(crop_x+' '+crop_y+' '+crop_width+' '+crop_height);
		
	}
	
	function moveImageBox() {
		
		imageBoxStartLeft = tempMouseX;
		imageBoxStartTop = tempMouseY;
		
		currFunction = "followImageBox()";
		
	}
	
	function followImageBox() {
	
		var moveDirection = document.getElementById('moveDirection').value*1;
		var tempWidth = document.getElementById('tempWidth').value*1;
		var tempHeight = document.getElementById('tempHeight').value*1;
		
		if (moveDirection == 1) {
		
			var limitLeft = (tempWidth - 64);
			var newLeft = (tempMouseX-imageBoxStartLeft);
			
			//alert(newLeft);
			
			if ((newLeft > limitLeft) || (newLeft < (limitLeft*(-1)))) {
				imageBoxLeft = (tempMouseX-imageBoxStartLeft);
			}
			
		} else {
		
			var limitTop = (tempHeight - 64);
			var newTop = (tempMouseY-imageBoxStartTop);
			
			if ((newTop > limitTop) || (newTop < (limitTop*(-1)))) {
				imageBoxTop = (tempMouseX-imageBoxStartTop);
			}
			
		}
		
		document.getElementById('imageBoxMove').style.left = imageBoxLeft+"px";
		document.getElementById('imageBoxMove').style.top = imageBoxTop+"px";
	
	}
	
	function viewEventMembers() {
	
		var attendingTotal = document.getElementById('attendingTotal').value*1;
		var attendingOpen = document.getElementById('attendingOpen').value*1;
	
		if (attendingOpen == 0) {
		
			var newHeight = Math.ceil(attendingTotal/2)*92;	
			
			document.getElementById('eventsMembersList').style.height = newHeight+"px";	
			document.getElementById('eventsMembersLink').innerHTML = "collapse";
			document.getElementById('attendingOpen').value = 1;
			
		} else {
			
			document.getElementById('eventsMembersList').style.height = "276px";
			document.getElementById('eventsMembersLink').innerHTML = "view all";
			document.getElementById('attendingOpen').value = 0;	
			
		}
	
	}
	
	function sendInvite(MemberId) {
		
		var sendOk = 1;
		
		var FirstName = document.InvitationForm.FirstName.value;
		var LastName = document.InvitationForm.LastName.value;
		var Email = document.InvitationForm.Email.value;
		
		var SendCopy = 0;
		
		if (document.InvitationForm.SendCopy.checked) {
			SendCopy = 1;	
		}
		
		if ((FirstName == '') || (FirstName == 'Colleague name')) {
			document.InvitationForm.FirstName.style.borderColor = 'red';
			sendOk = 0;
		} else {
			document.InvitationForm.FirstName.style.borderColor = '#CCC';
		}
		
		if ((LastName == '') || (LastName == 'Colleague surname')) {
			document.InvitationForm.LastName.style.borderColor = 'red';
			sendOk = 0;
		} else {
			document.InvitationForm.LastName.style.borderColor = '#CCC';
		}
				
		if ((Email == '') || (Email == 'Colleague email address')) {
			sendOk = 0;
			document.InvitationForm.Email.style.borderColor = 'red';
		} else if (!check_email(Email)) {
			sendOk = 0;
			document.InvitationForm.Email.style.borderColor = 'red';
		} else {
			document.InvitationForm.Email.style.borderColor = '#CCC';
		}
		
		if (sendOk == 1) {
			
			document.InvitationForm.FirstName.value = 'Colleague name';
			document.InvitationForm.FirstName.style.color = '#CCC';
			document.InvitationForm.LastName.value = 'Colleague surname';
			document.InvitationForm.LastName.style.color = '#CCC';
			document.InvitationForm.Email.value = 'Colleague email address';
			document.InvitationForm.Email.style.color = '#CCC';
			
			currDiv = 'inviteForm';
			sendAjaxComm("functions.php?sendInvite=1&MemberId="+MemberId+"&FirstName="+FirstName+"&LastName="+LastName+"&Email="+Email+"&SendCopy="+SendCopy,processAjax);
		
		}
		
	}
	
	function profileAddTopic(TypeId,MemberId) {
		
		popupWidth = 410;
		popupHeight = 300;
		
		ajaxWorking = 1;
		
		noLoading = 1;
	
		setPopupSec();
		
		currDiv = 'popupMainSec';
		
		//alert(document.getElementById(currDiv).style.left);
		sendAjaxComm("functions.php?profileAddTopic=1&TypeId="+TypeId+"&MemberId="+MemberId,processAjax);
		
	}
	
	function profileAddTopicConfirm(TypeId,MemberId) {
		
		closePopup();
		
		currDiv = 'topicName'+TypeId+'_'+MemberId;
		
		//alert(document.getElementById(currDiv).style.left);
		sendAjaxComm("functions.php?profileAddTopicConfirm=1&TypeId="+TypeId+"&MemberId="+MemberId,processAjax);
		
	}
	
	function removeWork(MemberCompId) {
		
		popupWidth = 410;
		popupHeight = 300;
		
		ajaxWorking = 1;
		
		noLoading = 1;
	
		setPopupSec();
		
		currDiv = 'popupMainSec';
		
		//alert(document.getElementById(currDiv).style.left);
		sendAjaxComm("functions.php?removeWork=1&MemberCompId="+MemberCompId,processAjax);
		
	}
	
	function removeEdu(MemEduId) {
		
		popupWidth = 410;
		popupHeight = 300;
		
		ajaxWorking = 1;
		
		noLoading = 1;
	
		setPopupSec();
		
		currDiv = 'popupMainSec';
		
		//alert(document.getElementById(currDiv).style.left);
		sendAjaxComm("functions.php?removeEdu=1&MemberEduId="+MemEduId,processAjax);
		
	}
	
	function removeOpportunity(OpportunityId) {
		
		popupWidth = 410;
		popupHeight = 300;
		
		ajaxWorking = 1;
		
		noLoading = 1;
	
		setPopupSec();
		
		currDiv = 'popupMainSec';
		
		//alert(document.getElementById(currDiv).style.left);
		sendAjaxComm("functions.php?removeOpportunity=1&OpportunityId="+OpportunityId,processAjax);
		
	}
	
	function removeTopic(TopicId) {
		
		popupWidth = 410;
		popupHeight = 300;
		
		ajaxWorking = 1;
		
		noLoading = 1;
	
		setPopupSec();
		
		currDiv = 'popupMainSec';
		
		//alert(document.getElementById(currDiv).style.left);
		sendAjaxComm("functions.php?removeTopic=1&TopicId="+TopicId,processAjax);
		
	}
	
	function addOpportunityCategory(num) {
		
		var CategoryCounter = document.OpportunityForm.CategoryCounter.value*1;
		
		var CategoryId = document.OpportunityForm.CategoryId.value;
		var CategoryText = document.OpportunityForm.CategoryId.options[document.OpportunityForm.CategoryId.options.selectedIndex].text;
		
		var newHeight = ((CategoryCounter+1)*20)+10;
		
		document.getElementById('formItem'+num).style.height = newHeight+"px";
		document.getElementById('formField'+num).style.height = newHeight+"px";
		document.getElementById('formInput'+num).style.height = newHeight+"px";
		
		var currContent = document.getElementById('formInput'+num).innerHTML;
		
		var newContent = '<div id="categoryItem'+(CategoryCounter+1)+'" style="width: 400px; height: 20px;">';
		newContent += '<div style="padding-top: 3px;">';
		newContent += '<input type="hidden" name="CategoryId'+(CategoryCounter+1)+'" value="'+CategoryId+'">';
		newContent += '<input type="hidden" name="CategoryName'+(CategoryCounter+1)+'" value="'+CategoryText+'">';
		newContent += CategoryText;
		newContent += ' - <a href="javascript: nothing()" onclick="removeOpportunityCategory('+num+','+(CategoryCounter+1)+')" onfocus="this.blur()">';
		newContent += 'remove';
		newContent += '</a>';
		newContent += '</div>';
		newContent += '</div>';
		
		document.getElementById('formInput'+num).innerHTML = currContent+newContent;
		
		document.OpportunityForm.CategoryCounter.value = (CategoryCounter+1);
		
	}
	
	function removeOpportunityCategory(num,itemNum) {
		
		var CategoryCounter = document.OpportunityForm.CategoryCounter.value*1;
		
		var currContent = document.getElementById('CategoryContent').innerHTML;
		var newContent = '';
		var newCounter = 2;
		var CategoryName = '';
		var CategoryId = 0;
		var i = 2;
		
		for (i; i <= CategoryCounter; i++) {
			
			if (i != itemNum) {
				
				CategoryId = eval('document.OpportunityForm.CategoryId'+i).value;
				CategoryName = eval('document.OpportunityForm.CategoryName'+i).value;
				
				newContent += '<div id="categoryItem'+newCounter+'" style="width: 400px; height: 20px;">';
				newContent += '<div style="padding-top: 3px;">';
				newContent += '<input type="hidden" name="CategoryId'+newCounter+'" value="'+CategoryId+'">';
				newContent += '<input type="hidden" name="CategoryName'+newCounter+'" value="'+CategoryName+'">';
				newContent += CategoryName;
				newContent += ' - <a href="javascript: nothing()" onclick="removeOpportunityCategory('+num+','+newCounter+')" onfocus="this.blur()">';
				newContent += 'remove';
				newContent += '</a>';
				newContent += '</div>';
				newContent += '</div>';
				
				newCounter++;
				
			}
			
		}
		
		var newHeight = ((newCounter-1)*20)+10;
		
		document.getElementById('formItem'+num).style.height = newHeight+"px";
		document.getElementById('formField'+num).style.height = newHeight+"px";
		document.getElementById('formInput'+num).style.height = newHeight+"px";
		
		currContent = '<div id="CategoryContent">'+currContent+'</div>';
		
		document.getElementById('formInput'+num).innerHTML = currContent+newContent;
		
		document.OpportunityForm.CategoryCounter.value = (newCounter-1);
		
	}
	
	function dispWorkDetails(num,setHeight) {
		
		if (num == 0) {
		
			document.getElementById('workDetailsItem').style.height = setHeight+"px";
			
		} else {
		
			document.getElementById('workDetailsItem').style.height = "30px";
			
		}
		
	}
	
	function forumPostsEdit(PostId) {
		
		currDiv = 'PostEdit'+PostId;
		
		var TopicId = document.ForumPostForm.TopicId.value*1;
		var Keyword = document.ForumPostForm.Keyword.value;
		var CurrResults = document.ForumPostForm.CurrResults.value*1;
		var SortOrder = document.ForumPostForm.SortOrder.value;
		
		//alert(document.getElementById(currDiv).style.left);
		sendAjaxComm("functions.php?forumPostsAdd=1&PostId="+PostId+"&TopicId="+TopicId+"&Keyword="+Keyword+"&CurrResults="+CurrResults+"&SortOrder="+SortOrder,processAjax);
		
	}
	
	function forumPostsListItem(PostId) {
		
		currDiv = 'PostEdit'+PostId;
		
		var TopicId = document.ForumPostForm.TopicId.value*1;
		var Keyword = document.ForumPostForm.Keyword.value;
		var CurrResults = document.ForumPostForm.CurrResults.value*1;
		var SortOrder = document.ForumPostForm.SortOrder.value;
		
		//alert(document.getElementById(currDiv).style.left);
		sendAjaxComm("functions.php?forumPostsListItem=1&PostId="+PostId+"&TopicId="+TopicId+"&Keyword="+Keyword+"&CurrResults="+CurrResults+"&SortOrder="+SortOrder,processAjax);
		
	}
	
	function networkUpdateEdit(UpdateId) {
		
		currDiv = 'networkItem'+UpdateId;
		
		//alert(document.getElementById(currDiv).style.left);
		sendAjaxComm("functions.php?networkUpdate=1&UpdateId="+UpdateId,processAjax);
		
	}
	
	function networkActivitiesItem(UpdateId) {
		
		currDiv = 'networkItem'+UpdateId;
		
		//alert(document.getElementById(currDiv).style.left);
		sendAjaxComm("functions.php?networkActivitiesItem=1&UpdateId="+UpdateId,processAjax);
		
	}
		
	function rotateProducts(direction) {
		
		if (rotating == 0) {
			
			rotating = 1;
			
			var prevProduct = 0;
			var divName = '';
			
			clearTimeout(productTimeVar);
			
			var itemsTotal = document.getElementById('itemsTotal').value*1;
			
			if (itemsTotal != 1) {
			
				prevProduct = currProduct;
				if (direction == 0) {
					if (currProduct == 1) {
						currProduct = itemsTotal;
					} else {
						currProduct--;
					}
				} else {
					if (currProduct == itemsTotal) {
						currProduct = 1;
					} else {
						currProduct++;
					}
				}
				
				/*
				var sponsorName = document.getElementById('sponsorName'+currSponsor).value;
				var sponsorId = document.getElementById('sponsorId'+currSponsor).value*1;
				
				if (document.getElementById('sponsorTitle'+currSponsor)) {
					var sponsorTitle = document.getElementById('sponsorTitle'+currSponsor).value;	
					document.getElementById('SponsorTitle').innerHTML = sponsorTitle;
				}
				*/
				
				//displayOpacity(divName,value,increment,limit,num)
				divName = 'productItem'+prevProduct;
				document.getElementById(divName).style.zIndex = 0;
				document.getElementById(divName).style.visibility = 'hidden';
				divName = 'productItemTitle'+prevProduct;
				document.getElementById(divName).style.zIndex = 0;
				document.getElementById(divName).style.visibility = 'hidden';
				//displayOpacity(divName,9,-1,0,0);
				divName = 'productItem'+currProduct;
				setOpacity(divName,0);
				document.getElementById(divName).style.zIndex = 1;
				document.getElementById(divName).style.visibility = 'visible';
				divName = 'productItemTitle'+currProduct;
				document.getElementById(divName).style.zIndex = 0;
				document.getElementById(divName).style.visibility = 'visible';
				//var newContent = '<a href="'+root_link+'/sponsors.php" class="sponsorLink">'+sponsorName+'</a>';
				window.setTimeout("rotateProductTimer('productItem"+prevProduct+"')",100);
			
			}
		
		}
		
	}
	
	function rotateProductTimer(divName) {
		
		//alert(divName);
		
		clearTimeout(productTimeVar);
		
		rotating = 0;
		divName = 'productItem'+currProduct;
		displayOpacity(divName,1,1,10,1);			
		//document.getElementById('sponsorName').innerHTML = newContent;
		productTimeVar = window.setTimeout('rotateProducts(1)',4000);
		
	}
	
	function dispPopular() {
		
		clearTimeout(opacityTimeoutVar[10]);
		
		document.getElementById('premiumContent'+currPopular).style.visibility = "hidden";
		document.getElementById('premiumContentTemp').style.visibility = "visible";
		
		if (currPopular == 1) {
			currPopular = 2;
			document.getElementById('premiumTitle').innerHTML = "Popular companies";
		} else {
			currPopular = 1;
			document.getElementById('premiumTitle').innerHTML = "Premium companies";
		}
		
		opacityTimeoutVar[10] = window.setTimeout('dispPopularSwitch()',500);
		
	}
	
	function dispPopularSwitch() {
		document.getElementById('premiumContentTemp').style.visibility = "hidden";
		document.getElementById('premiumContent'+currPopular).style.visibility = "visible";
		opacityTimeoutVar[10] = window.setTimeout('dispPopular()',3600);
	}
		
		/********************/
		// CARS21 FUNCTIONS //
		/********************/
		
		/*
	
		function carsLogin() {
			
			//alert(document.LoginForm.LoginCorrect.value);
					
			if (document.LoginForm.LoginCorrect.value==1) {
				document.LoginForm.submit();
			} else {
				check_errors('LoginForm');
			}
		}
		
		
		function verifySubmit(keyCode,formName) {
		
			if (keyCode == 13) {
				if (formName == 'RegisterForm') {
					check_errors(formName);	
				} else if (formName == 'LoginForm') {
					check_errors(formName);	
				} else if (formName == 'ContactFindList') {
					popupContactsList();	
				} else {
					if (formName == 'StartRegisterForm') {
						verifyEmail(document.StartRegisterForm.Email);
						window.setTimeout("eval('document."+formName+"').submit()",500);
					} else {
						eval('document.'+formName).submit();
					}
				}
			}
		
		}
		
		*/
		
		
		function subscribeTop() {
			
			//document.getElementById('subscribeTopLink').style.backgroundColor='#80807f';
			document.getElementById('searchTopBox').style.visibility = "hidden";
			document.getElementById('subscribeTopBox').style.visibility = "visible";
			document.getElementById('subscribeTopLink').style.color = "#3399cc"
		}
		
		function searchTop() {
			
			//document.getElementById('subscribeTopLink').style.backgroundColor='#80807f';
			document.getElementById('subscribeTopBox').style.visibility = "hidden";
			document.getElementById('searchTopBox').style.visibility = "visible";
			
		}
		
		function closeSubscribe() {
			
			//document.getElementById('subscribeTopLink').style.backgroundColor='#80807f';
			document.getElementById('subscribeTopBox').style.height = "33px";
			document.getElementById('subscribeTopBox').style.visibility = "hidden";
			document.getElementById('subscribeMessage').innerHTML = "&nbsp;";
			
		}
		
		function closeSearch() {
			
			//document.getElementById('subscribeTopLink').style.backgroundColor='#80807f';
			document.getElementById('searchTopBox').style.visibility = "hidden";
			
		}
		
		function dispNavSub(SetNav,CurrNavDisp) {
			
			clearTimeout(currNavTimeout);
			
			if (CurrNavDisp != CurrNav) {
				hideNavSub(CurrNav);
			}
			
			hideNavSub(CurrNavDisp);
			
			CurrNav = SetNav;
			
			ImageName = document.getElementById('ImageNameNav'+CurrNav).value;
			//eval('document.Nav'+CurrNav).src= root_link+'/images/menu/'+ImageName+'-on.jpg';
		
			document.getElementById('topNavSub'+SetNav).style.visibility = 'visible';
		
		}
		
		function dispNavSubSec(SetNav,CurrNavDisp) {
			
			clearTimeout(currNavTimeout);
			
			if (CurrNavDisp != CurrNav) {
				hideNavSub(CurrNav);
			}
			
			hideNavSub(CurrNavDisp);
			
			CurrNav = SetNav;
			
			ImageName = document.getElementById('ImageNameNav'+CurrNav).value;
			eval('document.Nav'+CurrNav).src= root_link+'/images/menu/'+ImageName+'-on.gif';
		
			document.getElementById('topNavSub'+SetNav).style.visibility = 'visible';
		
		}
		
		function hideNavSub(SetNav) {
			
			ImageName = document.getElementById('ImageNameNav'+SetNav).value;
		//	eval('document.Nav'+SetNav).src= root_link+'/images/menu/'+ImageName+'.gif';
			document.getElementById('topNavSub'+SetNav).style.visibility = 'hidden';
		
		}
		
		function hideNavSubDelay(SetNav) {
			
			currNavTimeout = window.setTimeout("dispNavSub("+SetNav+","+CurrNav+")",500);
			
		}
		
		function loginFormBox(text,oclass,sendURL) {
			
			currDiv = 'loginFormBox';
			sendAjaxComm("functions.php?loginFormBox=1&text="+text+"&class="+oclass+"&sendURL='"+sendURL,processAjax);
			
		}
		
		/********************/
		// CARS21 FUNCTIONS //
		/********************/
		
		
		
		function displayCompanies() {
			currDiv = 'addProducts';
			sendAjaxComm("functions.php?disCompanies=1",processAjax);
		}
