		
		var root_link = "http://www.hydrocarbons21.com";
		
		var tempContent = "";
		
		var loadedContent = 1;
		
		var rotateTimer = 4000;
		
		var rotateTimeout = "";
		var currTimeout = "";
		
		var currLib	= "";
		
		var loaded	= 0;
		
		var waitFunction = "";
		
		var noLoading = 0;
		
		var playerHeight = 0;
		
		var commentsOn = 0;
		
		var currRegion = 0;
		
		var currDiv = "";
		var currFeat = 1;
		var currAnchor = "";
		var currFunction = "";
		var secondaryFunction = "";
		var ajaxTimeout = 0;
		
		var scrolling = 0;
		var scrollingTop = 26;
		
		var currItem = 0;
		
		var currProduct = 0;
		
		var currSection = 0;
		var currSubSection = 0;
		
		var CurrNav = 0;
		var currNavTimeout = "";
		
		var currCircleLeft = 0;
		var currCircleTop = 0;
		var currCircleTimeout = "";
		
		var currPartner = 1;
		var currPartnerWide = 1;
		var partnerRotateTimeout = null;
		var partnerRotateTimeoutMain = null;
		
		var CurrInfoBox = -1;
		var LinkInfoBoxOpen = 0;
		var LinkInfoBoxTimer = 0;
		var AbortCloseBox = 0;
		
		var divCount = 2;
		var currDiv = 0;
		var openDiv = 0;
		
		var currFeature = 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
		
		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 (document.getElementById('thisMapOffsetLeft')) {
		  	mapCoord(0);
		  }
		  
		  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) {
			
			if (value == 10) {
				setOpacity(divName,value);
				clearTimeout(opacityTimeoutVar);
			} else {
				setOpacity(divName,value);
				opacityTimeoutVar = window.setTimeout("displayOpacity('"+divName+"',"+(value+1)+")",50);
			}
			
		}
		
		function init(resize) {
			
			if (document.getElementById('currLib')) {
				currLib = document.getElementById('currLib').value;
				//alert(currLib);
			}
			
			if (document.getElementById('partnersRotateDiv')) {
				window.setTimeout('partnerOpacityStart(10)',rotateTimer);
			}
			
			//window.setTimeout('PartnerRotateWide(1)',4000);
			
			setWindowProps();
			
			loaded = 1;
			
			setVisit();
			
			if (document.getElementById('mapContent')) {
				//populateMap();	
			}
			
			if (document.getElementById('directoryListingInfo')) {
				document.getElementById('directoryListingInfo').style.visibility = "visible";
			}
			
			if (document.getElementById('directoryMapLoading')) {
				document.getElementById('directoryMapLoadingTopCircle').style.visibility = "visible";
				document.getElementById('directoryMapLoading').style.visibility = "visible";
				document.getElementById('directoryMapLoader').style.visibility = "visible";
			}
			
			if (document.getElementById('directoryListingContent')) {

				if (document.getElementById('directoryStartCompany').value != 0) {
					directoryStartCompanyAnchor = 0;
					directoryListingCompany(document.getElementById('directoryStartCompany').value);
					directoryStartCompany = document.getElementById('directoryStartCompany').value*1;
				} else {
					listingPartners(1,1);
				}
			
			}
			
			if (document.getElementById('resultsListContent')) {
				secondaryFunction = 'drawMaps()';
			}
			
		}
		
		function setVisit() {
		
			currIp = document.getElementById('CurrIp').value;
			currMember = document.getElementById('CurrMem').value;
			currSession = document.getElementById('CurrSession').value;
			
			currType = 0;
			currItem = 0;
			
			if (document.getElementById('ViewTypeId')) {
				currType = document.getElementById('ViewTypeId').value;
				currItem = document.getElementById('ViewItemId').value;
			}
		
			currHref = document.location.href;
		
			//alert(currHref);
		
			questionLocation = currHref.indexOf('?');
			
			variables = '';
			currPage = currHref;
			
			if (questionLocation != -1) {
				variables = currHref.split('?');
				currPage = variables[0];
				variables = variables[1].split('&');
			}
			
			//alert("functions.php?PageView=1&currPage="+currPage+"&variables="+variables+"&currMember="+currMember+"&currIp="+currIp+"&currSession="+currSession);
			
			currDiv = 'test';
			sendAjax("functions.php?PageView=1&currPage="+currPage+"&variables="+variables+"&currMember="+currMember+"&currIp="+currIp+"&currSession="+currSession+"&currType="+currType+"&currItem="+currItem,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 defaultField(fieldValue,fieldObject,fieldState) {
			
			if ((fieldState == 0) && (fieldObject.value == fieldValue)) {
				fieldObject.value = '';	
			} else if ((fieldState == 1) && (fieldObject.value == '')) {
				fieldObject.value = fieldValue;	
			}
		
		}

		function nothing() {}
		
		function displayLoading() {
		
			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>';
			
		}
		
		function sendAjax(urlContent,returnFunc) {
		
			if (loaded == 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);
				
				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>';
			
				}
			
				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 (currDiv == 'directoryListingInfo') {
						//alert(trim(request.responseText));
					}
				
					//alert(trim(request.responseText));
				
					if((document.getElementById(currDiv)) && (trim(request.responseText) != '')) {
						//alert(document.getElementById('hoverMain').innerHTML);
						document.getElementById(currDiv).innerHTML = trim(request.responseText);
						
						if (setCurrVisible == 1) {						
							document.getElementById(currDiv).style.visibility = "visible";
						}
						setCurrVisible = 1;
						//setOpacity(currDiv,9.7);
						/*
						clearTimeout(opacityTimeoutVar);
						displayOpacity(currDiv,1);
						*/
						//document.getElementById(currDiv).style.visibility = "visible";
						
						if (currDiv == 'imageMapZoom3') {
							//alert(document.getElementById('worldMap').useMap);	
							//alert(currFunction);
							//alert(document.getElementById('worldMap').useMap);
							//alert(document.getElementById(currDiv).style.zIndex);
							//alert(trim(request.responseText));
						}
						
						if (ajaxFunctionCounter > 0) {
							/*
							alert(ajaxFunctionCounter);
							*/
							ajaxFunctionCounter--;
							thisFunction = ajaxFunction[ajaxFunctionCounter];
							ajaxFunction[ajaxFunctionCounter] = '';
							eval(thisFunction);
						}
						
						if (secondaryFunction != '') {
							thisFunction = secondaryFunction;
							secondaryFunction = '';
							eval(thisFunction);
						}
						
						if (currAnchor != '') {
							document.location.href = currAnchor;
							currAnchor = '';
						}
						
						tempContent = '';
						loadedContent = 1;
						noLoading = 0;
						
						if (document.getElementById('directoryMapLoader') && (currDiv != 'mapContentCompanies') && (loadingStart == 0)) {
							document.getElementById('directoryMapLoader').style.visibility = 'hidden';	
						}
						
						if (currDiv == 'mapContentCompanies') {
							//alert(document.getElementById(currDiv).style.zIndex+ ' ' +document.getElementById(currDiv).style.visibility);
							//alert(ajaxFunctionCounter);
							window.setTimeout("document.getElementById('directoryMapLoader').style.visibility='hidden'",2000);
							loadingStart = 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 print_page(pageLink) {
			myRef = window.open(''+pageLink,'mywin','left=20,top=20,width=760,height=500,toolbar=0,resizable=0,scrollbars=1;');
		}
		
		function check_errors(formName) {
			
			var submitOk = 1;
			var formatErrorMessage = 1;
			var errorContent = '<div style="font-weight: bold; padding-bottom: 5px;">The following fields have not been entered:</div>';
			
			if (formName == 'RegistrationForm') {
			
				var PrefixId = document.RegistrationForm.PrefixId.value;
				var FirstName = document.RegistrationForm.FirstName.value;
				var LastName = document.RegistrationForm.LastName.value;
				var Email = document.RegistrationForm.Email.value;
				var Username = document.RegistrationForm.Username.value;
				var UsernameValid = document.RegistrationForm.UsernameValid.value;
				var Password = document.RegistrationForm.Password.value;
				var PasswordRepeat = document.RegistrationForm.PasswordRepeat.value;
				
				var Company = document.RegistrationForm.Company.value;
				
				if (PrefixId == 0) {
					submitOk = 0;
					errorContent += 'Please select your title<br>';
				}
				
				if (FirstName == '') {
					submitOk = 0;
					errorContent += 'Please enter your first name<br>';
				}
				
				if (LastName == '') {
					submitOk = 0;
					errorContent += 'Please enter your last name<br>';
				}
				
				if (Company.indexOf('google') != -1) {
					submitOk = 0;
					errorContent += 'Please enter a valid organisation<br>';
				}
				
				if ((Email == '')) {
					submitOk = 0;
					errorContent += 'Please enter your email address<br>';
				} else if (!check_email(Email)) {
					submitOk = 0;
					errorContent += 'Please enter a valid email address<br>';
				}
				
				/*else {
				
					if (EmailValid == 0) {
						submitOk = 0;
						errorContent += 'Please enter a valid username<br>';
					}
				
				}*/
				
				if (Username == '') {
					submitOk = 0;
					errorContent += 'Please enter a username of at least 4 characters<br>';
				} else {
				
					if (UsernameValid == 0) {
						submitOk = 0;
						errorContent += 'Please enter a valid username of at least 4 characters<br>';
					}
				
				}
				
				if (Password.length < 6) {
					submitOk = 0;
					errorContent += 'Please enter a password of at least 6 characters<br>';
				}
				
				if (Password != PasswordRepeat) {
					submitOk = 0;
					errorContent += 'Your passwords do not match!<br>';
				}
				
				if (!document.RegistrationForm.terms.checked) {
					submitOk = 0;
					errorContent += 'Please confirm that you have read our terms and conditions<br>';
				}
			
			} else if (formName == 'PartnerRequest') {
			
				var FirstName = document.PartnerRequest.FirstName.value;
				var LastName = document.PartnerRequest.LastName.value;
				var Email = document.PartnerRequest.Email.value;
				var Company = document.PartnerRequest.Company.value;
				var Message = document.PartnerRequest.Message.value;
				
				formatErrorMessage = 0;
				
				if (FirstName == '') {
					submitOk = 0;
					errorContent += 'Please enter your first name<br>';
				}
				
				if (LastName == '') {
					submitOk = 0;
					errorContent += 'Please enter your last name<br>';
				}
				
				if ((Email == '')) {
					submitOk = 0;
					errorContent += 'Please enter your email address<br>';
				} else if (!check_email(Email)) {
					submitOk = 0;
					errorContent += 'Please enter a valid email address<br>';
				}
				
				if ((Company == '')) {
					submitOk = 0;
					errorContent += 'Please enter a valid company name<br>';
				} else if (Company.indexOf('google') != -1) {
					submitOk = 0;
					errorContent += 'Please enter a valid company name<br>';
				}
				
				if (Message == '') {
					submitOk = 0;
					errorContent += 'Please enter your request text<br>';
				} else if ((Message.toLowerCase().indexOf('href') != -1) || (Message.toLowerCase().indexOf('<a') != -1) || (Message.toLowerCase().indexOf('http') != -1) || (Message.toLowerCase().indexOf('www') != -1)) {
					submitOk = 0;
					errorContent += 'Please do not include links in your text<br>';
				}
			
			} else if (formName == 'ContactRequest') {
				
				var FirstName = document.ContactRequest.FirstName.value;
				var LastName = document.ContactRequest.LastName.value;
				var Email = document.ContactRequest.Email.value;
				var Company = document.ContactRequest.Company.value;
				var Message = document.ContactRequest.Message.value;
				
				formatErrorMessage = 0;
				
				if (FirstName == '') {
					submitOk = 0;
					errorContent += 'Please enter your first name<br>';
				}
				
				if (LastName == '') {
					submitOk = 0;
					errorContent += 'Please enter your last name<br>';
				}
				
				if ((Email == '')) {
					submitOk = 0;
					errorContent += 'Please enter your email address<br>';
				} else if (!check_email(Email)) {
					submitOk = 0;
					errorContent += 'Please enter a valid email address<br>';
				}
				
				if ((Company == '')) {
					submitOk = 0;
					errorContent += 'Please enter a valid company name<br>';
				} else if (Company.indexOf('google') != -1) {
					submitOk = 0;
					errorContent += 'Please enter a valid company name<br>';
				}
				
				if (Message == '') {
					submitOk = 0;
					errorContent += 'Please enter your enquiry text<br>';
				} else if ((Message.toLowerCase().indexOf('href') != -1) || (Message.toLowerCase().indexOf('<a') != -1) || (Message.toLowerCase().indexOf('http') != -1) || (Message.toLowerCase().indexOf('www') != -1)) {
					submitOk = 0;
					errorContent += 'Please do not include links in your text<br>';
				}
			
			} else if (formName == 'SubscriptionForm') {
			
				var FirstName = document.SubscriptionForm.FirstName.value;
				var LastName = document.SubscriptionForm.LastName.value;
				var Email = document.SubscriptionForm.Email.value;
				
				if (FirstName == '') {
					submitOk = 0;
					errorContent += 'Please enter your first name<br>';
				}
				
				if (LastName == '') {
					submitOk = 0;
					errorContent += 'Please enter your last name<br>';
				}
				
				if ((Email == '')) {
					submitOk = 0;
					errorContent += 'Please enter your email address<br>';
				} else if (!check_email(Email)) {
					submitOk = 0;
					errorContent += 'Please enter a valid email address<br>';
				}
			
			} else if (formName == 'ProfileForm') {
			
				var PrefixId = document.ProfileForm.PrefixId.value;
				var FirstName = document.ProfileForm.FirstName.value;
				var LastName = document.ProfileForm.LastName.value;
				var Email = document.ProfileForm.Email.value;
				var Username = document.ProfileForm.Username.value;
				var UsernameValid = document.ProfileForm.UsernameValid.value;
				var Password = document.ProfileForm.Password.value;
				var PasswordRepeat = document.ProfileForm.PasswordRepeat.value;
				/*
				var Password = document.RegistrationForm.Password.value;
				var PasswordRepeat = document.RegistrationForm.PasswordRepeat.value;
				*/
				if (PrefixId == 0) {
					submitOk = 0;
					errorContent += 'Please select your title<br>';
				}
				
				if (FirstName == '') {
					submitOk = 0;
					errorContent += 'Please enter your first name<br>';
				}

				
				if (LastName == '') {
					submitOk = 0;
					errorContent += 'Please enter your last name<br>';
				}
				
				if ((Email == '')) {
					submitOk = 0;
					errorContent += 'Please enter your email address<br>';
				} else if (!check_email(Email)) {
					submitOk = 0;
					errorContent += 'Please enter a valid email address<br>';
				}
				
				if (Username == '') {
					submitOk = 0;
					errorContent += 'Please enter a username of at least 4 characters<br>';
				} else {
				
					if (UsernameValid == 0) {
						submitOk = 0;
						errorContent += 'Please enter a valid username of at least 4 characters<br>';
					}
				
				}
				
				if (Password != '') {
				
					if (Password.length < 6) {
						submitOk = 0;
						errorContent += 'Please enter a password of at least 6 characters<br>';
					}
					
					if (Password != PasswordRepeat) {
						submitOk = 0;
						errorContent += 'Your passwords do not match!<br>';
					}
				
				}
			
			} else if (formName == 'PaperForm') {
			
				var Title = document.PaperForm.Title.value;
				
				var Year = document.PaperForm.Year.value;
				var Pages = document.PaperForm.Pages.value;
				var SectorCount = document.PaperForm.SectorCount.value;
				var TopicCount = document.PaperForm.TopicCount.value;
				var AuthorCount = document.PaperForm.AuthorCount.value;
				var OrgCount = document.PaperForm.OrgCount.value;
				
				var SectorId = document.PaperForm.SectorId.value;
				var TopicId = document.PaperForm.TopicId.value;
				var AuthorId = document.PaperForm.AuthorId.value;
				var AuthorNew = document.PaperForm.AuthorNew.value;
				var OrgId = document.PaperForm.OrgId.value;
				var OrgNew = document.PaperForm.OrgNew.value;
				
				var FileSource = document.PaperForm.FileSource.value;
				
				document.getElementById('loaderPaper').style.visibility = "visible";
				
				//errorContent = '';
				
				var fileExt = FileSource.substring((FileSource.length-4),FileSource.length);
				
				if (Title == '') {
					submitOk = 0;
					errorContent += 'Please enter the title of your paper<br>';
				}
				
				if ((Year == '') || (Year == 0)) {
					submitOk = 0;
					errorContent += 'Please enter the year of publication of your paper<br>';
				}
				
				if ((Pages == '') || (Pages == 0)) {
					submitOk = 0;
					errorContent += 'Please enter the number of pages in your paper<br>';
				}
				
				if ((SectorCount == 1) && (SectorId == 0)) {
					submitOk = 0;
					errorContent += 'Please add at least 1 sector<br>';
				}
				
				if ((TopicCount == 1) && (TopicId == 0)) {
					submitOk = 0;
					errorContent += 'Please add at least 1 topic<br>';
				}
				
				if ((AuthorCount == 1) && (AuthorId == 0) && (AuthorNew == '')) {
					submitOk = 0;
					errorContent += 'Please select at least 1 author<br>';
				}
				
				if ((OrgCount == 1) && (OrgId == 0) && (OrgNew == '')) {
					submitOk = 0;
					errorContent += 'Please select at least 1 organisation<br>';
				}
				
				if (FileSource == '') {
					submitOk = 0;
					errorContent += 'Please choose your file before submitting<br>';
				}
				
				if ((fileExt != '.pdf') && (fileExt != '.ppt') && (fileExt != '.doc') && (fileExt != '.xls')) {
					submitOk = 0;
					errorContent += 'Please upload a file of "pdf format", "powerpoint", "document" or "excel"<br>';
				}
			
			} else if (formName == 'ProfileNewsForm') {
			
				var SourceId = document.ProfileNewsForm.SourceId.value;
				var SourceNew = document.ProfileNewsForm.SourceNew.value;
				var Title = document.ProfileNewsForm.Title.value;
				var Synopsis = document.ProfileNewsForm.Synopsis.value;
				var AttachCount = document.ProfileNewsForm.AttachCount.value;
				
				var Title = document.ProfileNewsForm.AttachCount.value;
				
				document.getElementById('loaderNews').style.visibility = "visible";
				
				InvalidDoc = 0;
				
				for (i = 1; i < AttachCount; i++) {
				
					if (eval('document.ProfileNewsForm.AttachFile_'+i)) {
						FileSource = eval('document.ProfileNewsForm.AttachFile_'+i).value;
						fileExt = FileSource.substring((FileSource.length-4),FileSource.length);
						if (fileExt != '.pdf'){
							InvalidDoc = 1;
						}
					}
				
				}
				
				//errorContent = '';
				//var fileExt = FileSource.substring((FileSource.length-4),FileSource.length);
				
				if ((SourceNew == '') && (SourceId == 0)) {
					submitOk = 0;
					errorContent += 'Please enter the source of your news article<br>';
				}
				
				if (Title == '') {
					submitOk = 0;
					errorContent += 'Please enter the title of your news article<br>';
				}
				
				if ((Synopsis == '') || (Synopsis.length > 300)) {
					submitOk = 0;
					errorContent += 'Please enter the summary for your news article, without exceeding 300 characters<br>';
				}
				
				if (InvalidDoc == 1) {
					submitOk = 0;
					errorContent += 'Please add attachments of "pdf format" only<br>';
				}
				
				if (document.getElementById('AttachDocContent_'+AttachCount).style.visibility == 'visible') {
					submitOk = 0;
					errorContent += 'Please click on the Attach button to add your file or link before sharing your news<br>';
				}
				
				/*
				if (FileSource == '') {
					submitOk = 0;
					errorContent += 'Please choose your file before submitting<br>';
				}
				
				if ((fileExt != '.pdf') && (fileExt != '.ppt') && (fileExt != '.doc') && (fileExt != '.xls')) {
					submitOk = 0;
					errorContent += 'Please upload a file of "pdf format", "powerpoint", "document" or "excel"<br>';
				}*/
				
			} else if (formName == 'ProfileDocForm') {
			
				var Title = document.ProfileDocForm.Title.value;
				var FileName = document.ProfileDocForm.FileName.value;
				
				if (Title == '') {
					submitOk = 0;
					errorContent += 'Please enter the document title<br>';
				}
				
				if (FileName == '') {
					submitOk = 0;
					errorContent += 'Please specify the file you wish to upload<br>';
				}
			
			} else if (formName == 'ProfileInviteForm') {
			
				var FirstName = document.ProfileInviteForm.FirstName.value;
				var LastName = document.ProfileInviteForm.LastName.value;
				var Email = document.ProfileInviteForm.Email.value;
				var Message = document.ProfileInviteForm.Message.value;
				
				if (FirstName == '') {
					submitOk = 0;
					errorContent += 'Please enter the first name of the person you wish to invite<br>';
				}
				
				if (LastName == '') {
					submitOk = 0;
					errorContent += 'Please enter the last name of the person you wish to invite<br>';
				}
				
				if (Email == '') {
					submitOk = 0;
					errorContent += 'Please enter the email address of the person you wish to invite<br>';
				}
				
				if (Message == '') {
					submitOk = 0;
					errorContent += 'Please enter a brief message to accompany your invitation<br>';
				}
			
			} else if (formName == 'CommentForm') {
			
				var Comment = document.CommentForm.Comment.value;
				var SecurityWord = document.CommentForm.SecurityWord.value;
				var SecurityWordVerify = document.CommentForm.SecurityWordVerify.value;
				
				if (document.CommentForm.Email) {
					
					var Email = document.CommentForm.Email.value;
								
					if (trim(Email) == '') {
						submitOk = 0;
						errorContent += 'Please enter your email address before submitting<br>';
					}
					
				}
								
				if (trim(Comment) == '') {
					submitOk = 0;
					errorContent += 'Please enter a comment before submitting<br>';
				}
				
				if ((Comment.indexOf('<a') != -1) || (Comment.indexOf('<A') != -1) || (Comment.indexOf('http://') != -1) || (Comment.indexOf('www.') != -1)) {
					submitOk = 0;
					errorContent += 'Please do not enter any links in your comment<br>';
				}
				
				if (SecurityWord != SecurityWordVerify) {
					submitOk = 0;
					errorContent += 'Your security word is not correct!<br>';
				}
							
			} else if (formName == 'LoginForm') {
			
				document.LoginForm.LoginUrl.value=document.location.href;
							
			} else if (formName == 'ForumPostForm') {
			
				var Title = document.ForumPostForm.Title.value;
				
				if (trim(Title) == '') {
					submitOk = 0;
					errorContent += 'Please enter a subject before submitting<br>';
				}
							
			} else if (formName == 'GroupPostForm') {
			
				var Title = document.GroupPostForm.Title.value;
				
				if (trim(Title) == '') {
					submitOk = 0;
					errorContent += 'Please enter a subject before submitting<br>';
				}
							
			} else if (formName == 'GroupShareFileForm') {
			
				var Title = document.GroupShareFileForm.Title.value;
				var File = document.GroupShareFileForm.File.value;
				var Link = document.GroupShareFileForm.Link.value;
				
				var checkFile = 1;
				
				if ((document.GroupShareFileForm.MemberDocument) && (document.GroupShareFileForm.MemberDocument.selectedIndex != 0)) {
					checkFile = 0;	
				}
				
				if (checkFile == 1) {
				
					if (trim(Title) == '') {
						submitOk = 0;
						errorContent += 'Please enter a file title<br>';
					}
				
					if ((trim(File) == '') && ((trim(Link) == '') || (trim(Link) == 'http://'))) {
						submitOk = 0;
						errorContent += 'Please choose a file through the browser or enter a link url<br>';
					}
				
				}
							
			} else if (formName == 'GroupMemberForm') {
			
				var Name = document.GroupMemberForm.Name.value;
				var Email = document.GroupMemberForm.Email.value;
				
				if (trim(Name) == '') {
					submitOk = 0;
					errorContent += 'Please enter the full name of the person you wish to invite<br>';
				}
			
				if (trim(Email) == '') {
					submitOk = 0;
					errorContent += 'Please enter the email address of the person you wish to invite<br>';
				}
			
			} else if (formName == 'GroupMeetingForm') {
			
				var Name = document.GroupMeetingForm.Name.value;
				var Location = document.GroupMeetingForm.Location.value;
				var StartDate = document.GroupMeetingForm.StartDate.value;
				var EndDate = document.GroupMeetingForm.EndDate.value;
				
				if (trim(Name) == '') {
					submitOk = 0;
					errorContent += 'Please enter the name of the meeting<br>';
				}
			
				if (trim(Location) == '') {
					submitOk = 0;
					errorContent += 'Please enter the location of the meeting <br>';
				}
			
				if (trim(StartDate) == '') {
					submitOk = 0;
					errorContent += 'Please enter the start date of the meeting <br>';
				}
			
				if (trim(EndDate) == '') {
					submitOk = 0;
					errorContent += 'Please enter the end date of the meeting <br>';
				}
							
			} else if (formName == 'GroupThreadForm') {
			
				var Name = document.GroupThreadForm.Name.value;
				var Synopsis = document.GroupThreadForm.Synopsis.value;
				
				if (trim(Name) == '') {
					submitOk = 0;
					errorContent += 'Please enter the subject of your thread<br>';
				}
			
				if (trim(Synopsis) == '') {
					submitOk = 0;
					errorContent += 'Please enter the message of your thread <br>';
				}
							
			} else if (formName == 'GroupDocForm') {
			
				var Title = document.GroupDocForm.Title.value;
				var Synopsis = document.GroupDocForm.Synopsis.value;
				
				if (trim(Title) == '') {
					submitOk = 0;
					errorContent += 'Please enter the title of the document<br>';
				}
			
				if (trim(Synopsis) == '') {
					submitOk = 0;
					errorContent += 'Please enter the description of the document <br>';
				}
							
			} else if (formName == 'GroupDocSectionForm') {
			
				var Title = document.GroupDocSectionForm.Title.value;
				var Synopsis = document.GroupDocSectionForm.Synopsis.value;
				
				if (trim(Title) == '') {
					submitOk = 0;
					errorContent += 'Please enter the name of the section<br>';
				}
			
				if (trim(Synopsis) == '') {
					submitOk = 0;
					errorContent += 'Please enter the description of the section <br>';
				}
							
			} else if (formName == 'ContactInquiry') {
			
				var FirstName = document.ContactInquiry.FirstName.value;
				var LastName = document.ContactInquiry.LastName.value;
				var Email = document.ContactInquiry.Email.value;
				var Comments = document.ContactInquiry.Comments.value;
				
				if (FirstName == '') {
					submitOk = 0;
					errorContent += 'Please enter your first name<br>';
				}
				
				if (LastName == '') {
					submitOk = 0;
					errorContent += 'Please enter your last name<br>';
				}
				
				if ((Email == '')) {
					submitOk = 0;
					errorContent += 'Please enter your email address<br>';
				} else if (!check_email(Email)) {
					submitOk = 0;
					errorContent += 'Please enter a valid email address<br>';
				}
				
				if (Comments == '') {
					submitOk = 0;
					errorContent += 'Please enter your comments<br>';
				}
				
			} else if (formName == 'GroupSuggest') {
			
				var Name = document.GroupSuggest.Name.value;
				var Synopsis = document.GroupSuggest.Synopsis.value;
				
				if (Name == '') {
					submitOk = 0;
					errorContent += 'Please enter the group name<br>';
				}
				/*
				if (Synopsis == '') {
					submitOk = 0;
					errorContent += 'Please enter a description of the group<br>';
				}
				*/
				
			} else if (formName == 'ProfileMessageForm') {
			
				var Contact_1 = document.ProfileMessageForm.Contact_1.value;
				var Subject = document.ProfileMessageForm.Subject.value;
				
				//alert(Contact_1);
				
				if (Contact_1 == 0) {
					submitOk = 0;
					errorContent += 'Please select at least on contact<br>';
				}
				if (Subject == '') {
					submitOk = 0;
					errorContent += 'Please enter the subject of your message<br>';
				}
				/*
				if (Synopsis == '') {
					submitOk = 0;
					errorContent += 'Please enter a description of the group<br>';
				}
				*/
				
			}
			
			if (submitOk == 1) {
				return true;	
			} else {
				
				if (document.getElementById('loaderPaper')) {
				document.getElementById('loaderPaper').style.visibility = "hidden";
				}
				
				if (document.getElementById('loaderNews')) {
				document.getElementById('loaderNews').style.visibility = "hidden";
				}
				
				document.location.href = '#formErrors';
				if (formatErrorMessage == 1) {
				document.getElementById('formErrorsDiv').style.padding = "10px 5px 5px 0px";
				document.getElementById('formErrorsDiv').style.display = "block";
				document.getElementById('formErrorsDiv').style.color = "#CC0000";
				}
				document.getElementById('formErrorsDiv').innerHTML = errorContent;
				return false;
			}
			
		}
		
		function dispNavSub(SetNav,CurrNavDisp) {
			
			//alert(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 hideNavSub(SetNav) {
			
			if (SetNav != -1) {
			
			ImageName = document.getElementById('ImageNameNav'+SetNav).value;
			eval('document.Nav'+SetNav).src= root_link+'/images/menu/'+ImageName+'.jpg';
			document.getElementById('topNavSub'+SetNav).style.visibility = 'hidden';
		
			}
		
		}
		
		function hideNavSubDelay(SetNav) {
			
			currNavTimeout = window.setTimeout("dispNavSub("+SetNav+","+CurrNav+")",500);
			
		}
		
		function setNavLinks(SectionId,SubSectionId) {
			
			noLoading = 1;
			currDiv = 'topNav';
			sendAjax("functions.php?setNavLinks=1&SectionId="+SectionId+"&SubSectionId="+SubSectionId,processAjax);
			
		}
		
		function displayFeat(featNum,type,Id) {
			
			if (currFeat != featNum) {
				
				clearTimeout(currCircleTimeout);
				
				//alert(document.getElementById('FeatText'+currFeat));
				document.getElementById('FeatText'+currFeat).style.visibility = "hidden";
				
				currFeat = featNum;
				
				document.getElementById('FeatText'+currFeat).style.visibility = "visible";
				
				if (featNum == 1) {
					//document.getElementById('featCircle').style.left = "0px";
					//document.getElementById('featCircle').style.top = "0px";
					moveFeatCircle(0,0,16);
				} else if (featNum == 2) {
					//document.getElementById('featCircle').style.left = "141px";
					//document.getElementById('featCircle').style.top = "0px";
					moveFeatCircle(141,0,16);
				} else if (featNum == 3) {
					//document.getElementById('featCircle').style.left = "0px";
					//document.getElementById('featCircle').style.top = "79px";
					moveFeatCircle(0,79,16);
				} else if (featNum == 4) {
					//document.getElementById('featCircle').style.left = "141px";
					//document.getElementById('featCircle').style.top = "79px";
					moveFeatCircle(141,79,16);
				}
				//alert(document.getElementById('featCircle').style.left);
				currDiv = 'featContent';
							
				/*
			
				document.getElementById('featArrow'+currFeat).style.visibility = "hidden";
			
				waitFunction = 'displayFeat('+featNum+','+type+','+Id+')';
				
				window.clearTimeout(rotateTimeout);
				document.getElementById('featIcon'+currFeat).style.opacity = 6/10;
				document.getElementById('featIcon'+currFeat).style.filter = 'alpha(opacity=' + 6*10 + ')';
				document.getElementById('featIcon'+currFeat).style.backgroundColor = '#FFF';
				currFeat = featNum;
				document.getElementById('featIcon'+currFeat).style.opacity = 10/10;
				document.getElementById('featIcon'+currFeat).style.filter = 'alpha(opacity=' + 10*10 + ')';
				document.getElementById('featIcon'+currFeat).style.backgroundColor = '#912422';
				currDiv = 'featContent';
				
				tempContent = document.getElementById(currDiv).innerHTML;
				
				document.getElementById('featArrow'+featNum).style.visibility = "visible";
				
				*/
				
				loadedContent = 0;
				//alert("functions.php?featureSpaceContent=1&type=");
				sendAjax("functions.php?featureSpaceContent=1&type="+type+"&Id="+Id,processAjax);
							
			}
			
		}
		
		function show_star(num){
			
			//alert(num);
			
			for (i = 1; i <= num; i++) {
				//alert(document.getElementById('star'+i));
				document.getElementById('star'+i).src = root_link + '/images/main/star_on.gif';
			}
			
		}
		
		function hide_star(){
			
			for (i = 1; i <= 5; i++) {
				document.getElementById('star'+i).src = root_link + '/images/main/star_off.gif';
			}
			
		}
		
		function setRating(TypeId,Id,Num,UserId) {
			
			currDiv = 'ratingDisp';
			//alert("functions.php?setRating=1&TypeId="+TypeId+"&Id="+Id+"&Num="+Num+"&UserId="+UserId);
			sendAjax("functions.php?setRating=1&TypeId="+TypeId+"&Id="+Id+"&Num="+Num+"&UserId="+UserId,processAjax);
		}
		
		function PartnerRotateWide(num) {
			
			if (document.getElementById('partnerDiv'+currPartnerWide)) {
			
				//document.getElementById('partnerDiv'+currPartnerWide).style.visibility = "hidden";
				
				opacityDiv('partnerDiv'+currPartnerWide,10,0);
				
				if (num == 0) {
					if (currPartnerWide > 1) {
						currPartnerWide--;
					} else {
						currPartnerWide = (document.getElementById('partnersWideTotal').value*1);
					}
				}
				else {
					if (currPartnerWide < (document.getElementById('partnersWideTotal').value*1)) {
						currPartnerWide++;
					} else {
						currPartnerWide = 1;
					}
				}
				
				currPackage = document.getElementById('packageId'+currPartnerWide).value*1;
				//alert(currPackage + ' ' + currPartnerWide);
				currBg = document.getElementById('partnerBg'+currPackage).value;
				currTitle = document.getElementById('partnerTitle'+currPackage).value;
				//currBorder = document.getElementById('partnerBorder'+currPackage).value;
				
				//document.getElementById('partnerBg').style.backgroundColor = "#"+currBg;
				//document.getElementById('partnerBorder').style.backgroundColor = "#"+currBg;
				
				//rotateDiv('partnerDiv'+currPartnerWide,8,-300,0);
				//document.getElementById('partnerDiv'+currPartnerWide).style.visibility = "visible";
	
				clearTimeout(partnerRotateTimeoutMain);
				
				//partnerRotateTimeoutMain = window.setTimeout('PartnerRotateWide(1)',4000);
				
			}
			
		}
		
		function partnerOpacityStart(opacityValue) {
		
			setOpacity('partnerDiv'+currPartnerWide,opacityValue);
			
			opacityValue--;
			
			if (opacityValue >= 0) {
				window.setTimeout("partnerOpacityStart("+opacityValue+")",80);
			} else {
				var totalDivs = document.getElementById('partnersTopTotal').value;
				var packageId = document.getElementById('package'+currPartnerWide).value;			
				document.getElementById('partnerDiv'+currPartnerWide).style.visibility = 'hidden';
				document.getElementById('partnerLogo'+packageId).style.visibility = 'hidden';
			
				if (currPartnerWide == totalDivs) {
					currPartnerWide = 1;
				} else {
					currPartnerWide++;
				}
			
				packageId = document.getElementById('package'+currPartnerWide).value;			
				//document.getElementById('partnerDiv'+currPartnerWide).style.visibility = 'visible';
				document.getElementById('partnerLogo'+packageId).style.visibility = 'visible';
				partnerOpacityEnd(0);				
			}
		
		}
		
		function partnerOpacityEnd(opacityValue) {
		
			setOpacity('partnerDiv'+currPartnerWide,opacityValue);
			document.getElementById('partnerDiv'+currPartnerWide).style.visibility = 'visible';
			
			opacityValue++;
			
			if (rotateTimer == 4000) {
				rotateTimer = 3000;
			} else if (rotateTimer == 3000) {
				rotateTimer = 2000;
			} else {
				rotateTimer = 4000;
			}
			
			if (opacityValue <= 10) {
				window.setTimeout("partnerOpacityEnd("+opacityValue+")",50);
			} else {
				window.setTimeout('partnerOpacityStart(10)',rotateTimer);
			}
		
		}
		
		function opacityDiv(divName,opacityValue,direction) {
		
			setOpacity(divName,opacityValue);
			
			if (direction == 1) {
				if (opacityValue < 10) {
					window.setTimeout("opacityDiv('"+divName+"','"+(opacityValue+1)+"',"+direction+")",120);
				} else {
					partnerRotateTimeoutMain = window.setTimeout('PartnerRotateWide(1)',(4000));
				}
			} else {
				if (opacityValue > 0) {
					window.setTimeout("opacityDiv('"+divName+"','"+(opacityValue-1)+"',"+direction+")",50);
				} else {
					document.getElementById(divName).style.visibility = "hidden";
					opacityDiv('partnerDiv'+currPartnerWide,0,1);
					document.getElementById('partnerDiv'+currPartnerWide).style.visibility = "visible";
				}
			}
		
		}
	
		function openBoxInfo(num) {
			
			if (CurrInfoBox != num) {
			
				CurrInfoBox = num;
			
				AbortCloseBox = 1;
				
				document.getElementById('linkInfoBox').style.visibility = "visible";
				
				document.getElementById('linkInfoContent').innerHTML = document.getElementById('linkInfoContent'+num).innerHTML;
				
				if (LinkInfoBoxOpen == 0) {
					expandBoxInfo('linkInfoBox',10,300);
				} else {
					clearTimeout(LinkInfoBoxTimer);
					LinkInfoBoxTimer = window.setTimeout("closeBoxInfo('linkInfoBox',300,0)",10000);
				}
				
				window.setTimeout("AbortCloseBox = 0",200);
			
			}
			
		}
			
		function expandBoxInfo(DivId,Width,ThisLimit) {
			
			window.clearTimeout(LinkInfoBoxTimer);
			
			document.getElementById(DivId).style.visibility = "visible";
		
			if (Width >= ThisLimit) {
			document.getElementById(DivId).style.left=((ThisLimit*(-1))-1)+"px";		
			document.getElementById(DivId).style.width=ThisLimit+"px";		
			LinkInfoBoxOpen = 1;
			LinkInfoBoxTimer = window.setTimeout("closeBoxInfo('linkInfoBox',300,0)",10000);
			} else {
			document.getElementById(DivId).style.left=((Width*(-1))-1)+"px";	
			document.getElementById(DivId).style.width=Width+"px";
			Width+=20;
			LinkInfoBoxTimer = window.setTimeout("expandBoxInfo('"+DivId+"',"+Width+","+ThisLimit+")",10);
			}/**/
			//alert(LinkInfoBoxOpen);
		
		}
			
		function closeBoxInfo(DivId,Width,ThisLimit) {
			
			//alert(LinkInfoBoxOpen);
			
			if ((LinkInfoBoxOpen == 1) && (AbortCloseBox == 0)) {
		
				window.clearTimeout(LinkInfoBoxTimer);
			
				if (Width <= ThisLimit) {
				document.getElementById(DivId).style.left=((ThisLimit*(-3))-1)+"px";		
				document.getElementById(DivId).style.width=ThisLimit+"px";		
				LinkInfoBoxOpen = 0;
				document.getElementById(DivId).style.visibility = "hidden";
				} else {
				//alert(Width);
				document.getElementById(DivId).style.left=((Width*(-1))-1)+"px";	
				document.getElementById(DivId).style.width=Width+"px";
				Width-=20;
				LinkInfoBoxTimer = window.setTimeout("closeBoxInfo('"+DivId+"',"+Width+","+ThisLimit+")",10);
				}
				
				CurrInfoBox = -1;
				
			}
		
		}
		
		function moveFeatCircle(endLeft,endTop,interval) {
			
			if (Math.abs(currCircleLeft - endLeft) < interval) {
				currCircleLeft = endLeft;
				moveFeatCircleVert(endTop,10);
			} else {
			
				if (currCircleLeft > endLeft) {
					currCircleLeft -= interval;
				} else {
					currCircleLeft += interval;
				}
				
				if (interval > 3) {
					interval--;
				}
				currCircleTimeout = window.setTimeout("moveFeatCircle("+endLeft+","+endTop+","+interval+")",10);
				
			}
			
			document.getElementById('featCircle').style.left = currCircleLeft + "px";
			
		}
		
		function moveFeatCircleVert(endTop,interval) {
			
			if (Math.abs(currCircleTop - endTop) < interval) {
				currCircleTop = endTop;
			} else {
			
				if (currCircleTop > endTop) {
					currCircleTop -= interval;
				} else {
					currCircleTop += interval;
				}
				
				if (interval > 3) {
					interval--;
				}
				currCircleTimeout = window.setTimeout("moveFeatCircleVert("+endTop+","+interval+")",10);
				
			}
			
			document.getElementById('featCircle').style.top = currCircleTop + "px";
			
		}
		
		function saveSubscribe() {
			
			clearTimeout(LinkInfoBoxTimer);
		
			var Email = document.getElementById('subscribeEmail').value;
			var Ip = document.getElementById('subscribeIp').value;
		
			//alert(Email);
		
			if (!check_email(Email)) {
				document.getElementById('subscribeMessage').innerHTML = 'Invalid email, please try again.';
			} else {
				currDiv = 'subscribeMessage';
				sendAjax("functions.php?saveSubscribe=1&Email="+Email+"&Ip="+Ip,processAjax);
				document.getElementById('subscribeEmail').value = '';
			}
			
			expandSubscribeBox('subscribeTopBox',33,75);
			LinkInfoBoxTimer = window.setTimeout("closeSubscribeBox('subscribeTopBox',75,33)",8000);
			/*
			*/
		
		}
			
		function expandSubscribeBox(DivId,Height,ThisLimit) {
		
			if (Height >= ThisLimit) {	
			document.getElementById(DivId).style.height=ThisLimit+"px";		
			} else {
			document.getElementById(DivId).style.height=Height+"px";
			Height+=10;
			LinkInfoBoxTimer = window.setTimeout("expandSubscribeBox('"+DivId+"',"+Height+","+ThisLimit+")",10);
			}
		
		}
		
		function closeSubscribeBox(DivId,Height,ThisLimit) {
		
			if (Height <= ThisLimit) {	
			document.getElementById(DivId).style.height=ThisLimit+"px";
			} else {
			//alert(Width);
			document.getElementById(DivId).style.height=Height+"px";
			Height-=10;
			LinkInfoBoxTimer = window.setTimeout("closeSubscribeBox('"+DivId+"',"+Height+","+ThisLimit+")",10);
			}
		
		}
		
		function changeTextsize(num) {
			
			if (!document.getElementById('textContent').style.fontSize) {
				document.getElementById('textContent').style.fontSize = "13px";	
			}
		
			currFontSize = (document.getElementById('textContent').style.fontSize.substr(0,(document.getElementById('textContent').style.fontSize.length-2)))*1;
			currLineHeight = (document.getElementById('textContent').style.lineHeight.substr(0,(document.getElementById('textContent').style.lineHeight.length-2)))*1;
			
			currFontSize += num;
		
			if ((currFontSize > 8) && (currFontSize < 17)) { 
		
			document.getElementById('textContent').style.fontSize = (currFontSize) + "px";
			document.getElementById('textContent').style.lineHeight = (currLineHeight+num) + "px";
			
			}
		
		}
		
		function paperResults(Fields,CurrResults) {
			
			currDiv = 'paperResults';
			//alert(Fields);
			//alert("functions.php?setRating=1&TypeId="+TypeId+"&Id="+Id+"&Num="+Num+"&UserId="+UserId);
			sendAjax("functions.php?paperResults=1&Fields="+Fields+"&CurrResults="+CurrResults,processAjax);
			
		}
		
		function partnerTabs(PartnerId,MemberId,TabId) {
			
			currDiv = 'partnerTabs';
			//alert(currDiv);
			sendAjax("functions.php?partnerTabs=1&PartnerId="+PartnerId+"&ThisMemberId="+MemberId+"&TabId="+TabId,processAjax);
			
		}
		
		function goToFeature() {
		
			currLink = document.getElementById('featureLink'+currFeat).value;
			//alert(currLink);
			document.location = currLink;
		
		}
		
		function subscribeTop() {
			
			//document.getElementById('subscribeTopLink').style.backgroundColor='#80807f';
			document.getElementById('searchTopBox').style.visibility = "hidden";
			document.getElementById('subscribeTopBox').style.visibility = "visible";
			
		}
		
		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 setCategories(TypeId,divHeight) {
			
			secondaryFunction = 'setProducts(0,'+divHeight+')';
			
			currDiv = 'catsList';
			noLoading = 1;
			displayLoading();
			//alert(Category);
			//alert('sendAjax("functions.php?productsCompList=1&Category='+Category+'&divHeight='+divHeight+'",processAjax)');
			sendAjax("functions.php?productsCompCats=1&TypeId="+TypeId+"&divHeight="+divHeight,processAjax);			
			
		}
		
		function setProducts(CategoryId,divHeight) {
			
			secondaryFunction = 'setProductsTab('+CategoryId+')';
			
			currDiv = 'productList';
			noLoading = 1;
			displayLoading();
			//alert(Category);
			//alert('sendAjax("functions.php?productsCompList=1&Category='+Category+'&divHeight='+divHeight+'",processAjax)');
			sendAjax("functions.php?productsCompList=1&CategoryId="+CategoryId+"&divHeight="+divHeight,processAjax);			
			
		}
		
		function setProductsTab(CategoryId) {
			
			currDiv = 'productTab';
			sendAjax("functions.php?productsComponentsTab=1&CategoryId="+CategoryId,processAjax);			
			
		}
		
		function setProductsFlash(ProductId) {
			
			if (currProduct != 0) {
			document.getElementById('flashProduct'+currProduct).style.visibility='hidden';
			}
			
			currProduct = ProductId;
			
			document.getElementById('flashProduct'+currProduct).style.visibility='visible';
			displayOpacity('flashProduct'+currProduct,1);
			
		}
		
		function scrollList(divName,direction,limit) {
			
			if (scrolling == 1) {
			
				var newscrollingTop = scrollingTop + ((direction)*10);
				
				//alert(newscrollingTop+ ' ' +limit*(-1));
				
				if ((newscrollingTop >= (limit*(-1))) && (newscrollingTop <= 26)) {
					scrollingTop = newscrollingTop;
					document.getElementById(divName).style.top = scrollingTop + "px";
					window.setTimeout("scrollList('"+divName+"',"+direction+","+limit+")",50);
				}
			
			}
			
		}
		
		function openEmailBox(DivId,Height,ThisLimit) {
		
			document.getElementById(DivId).style.visibility = 'visible';
		
			//alert(Height);
		
			if (Height >= ThisLimit) {	
			document.getElementById(DivId).style.height=ThisLimit+"px";		
			} else {
			document.getElementById(DivId).style.height=Height+"px";
			Height+=10;
			LinkInfoBoxTimer = window.setTimeout("openEmailBox('"+DivId+"',"+Height+","+ThisLimit+")",10);
			}
		
		}
		
		function closeEmailBox(DivId,Height,ThisLimit) {
		
			if (Height <= ThisLimit) {	
			document.getElementById(DivId).style.height=ThisLimit+"px";
			document.getElementById(DivId).style.visibility = 'hidden';
			} else {
			//alert(Width);
			document.getElementById(DivId).style.height=Height+"px";
			Height-=10;
			LinkInfoBoxTimer = window.setTimeout("closeEmailBox('"+DivId+"',"+Height+","+ThisLimit+")",10);
			}
		
		}
		
		function viewGallery(GalleryId,ItemId,PartnerId) {
		
			hideFlashItems();
		
			getScrollOffset();
			document.body.scroll="no";
			document.body.style.overflow="hidden";
			setWindowProps();
			currDiv = 'temp';
			//alert(document.getElementById(currDiv));
			document.getElementById(currDiv).style.top = tempY + "px";
			//alert(document.getElementById(currDiv).style.top);
			setCurrVisible = 1;
			sendAjax("functions.php?viewGallery=1&GalleryId="+GalleryId+"&ItemId="+ItemId+"&PartnerId="+PartnerId+"&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;
			currCounter = document.getElementById('galleryItemCounter'+ItemId).value;
			document.getElementById('galleryItemCounter').value = currCounter*1;
			
			document.getElementById('galleryContentThumb'+ImageOn).style.backgroundColor = 'transparent';
			
			document.getElementById('galleryImageOn').value = ItemId;
			document.getElementById('galleryContentThumb'+ItemId).style.backgroundColor = '#ED2024';
			
			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="'+root_link+'/images/galleries/'+GalleryName+'/400/'+ImageName+'" border="0" hspace="0" vspace="0" style="border: solid 0px #912422" onload="dispGalleryImage(this.height,this.width)"><br>';
			
			//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() {
			
			displayFlashItems();
			
			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 viewGallery(GalleryId,ItemId) {
		
			setWindowProps();
			currDiv = 'temp';
			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 = '#ED2024';
			
			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="'+root_link+'/images/galleries/'+GalleryName+'/400/'+ImageName+'" border="0" hspace="0" vspace="0" style="border: solid 0px #912422" onload="dispGalleryImage(this.height,this.width)"><br>';
			
			//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.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 sendPartnerRequest(PartnerId,MemberId,TypeId,ItemId) {
			
			currDiv = 'partnerTabContent';
			TabId = document.getElementById('currPartnerTab').value;
			//alert(document.getElementById('currPartnerTab'));
			//document.getElementById(currDiv).innerHTML = 'test';
			//alert("functions.php?partnerRequest=1&PartnerId="+PartnerId+"&MemberId="+MemberId+"&TabId="+TabId);
			sendAjax("functions.php?partnerRequest=1&PartnerId="+PartnerId+"&MemberId="+MemberId+"&TypeId="+TypeId+"&ItemId="+ItemId+"&TabId="+TabId,processAjax);			
			
		}
		
		function sendProductPartnerRequest(PartnerId,MemberId,TypeId,ItemId) {
			
			currDiv = 'productpartnerTabContent';
			sendAjax("functions.php?partnerRequest=1&PartnerId="+PartnerId+"&MemberId="+MemberId+"&TypeId="+TypeId+"&ItemId="+ItemId,processAjax);			
			
		}
		
		function displayMapArea(num) {
			
			clearTimeout(currTimeout);
			
			if (currRegion != num) {
			
				//alert(num);
			
				currRegion = num;
			
				getScrollOffset();
				
				//topOffset = Math.round((winH-60)/2) + tempY;
				topOffset = (tempMouseY-30);
				if ((num == 1) || (num == 2)) {
					leftOffset = (tempMouseX+10);
				} else {
					leftOffset = (tempMouseX-160);
				}
				
				//alert(document.getElementById('region'+num));
				
				document.getElementById('temp').innerHTML = document.getElementById('region'+num).innerHTML;
				document.getElementById('temp').style.top = topOffset + "px";
				document.getElementById('temp').style.left = leftOffset + "px";
				document.getElementById('temp').style.visibility = "visible";
			
			}
			
		}
		
		function hideMapArea() {
			
			currRegion = 0;
			
			document.getElementById('temp').innerHTML = "";
			document.getElementById('temp').style.top = "0px";
			document.getElementById('temp').style.left = "0px";
			document.getElementById('temp').style.visibility = "hidden";
			
		}
		
		function viewFAQItem(ItemId) {
		
			if (currItem != ItemId) {
			
				currItem = ItemId;
				
				//alert(document.getElementById('FAQItem'+currItem).style.overflow);
				
				document.getElementById('FAQItem'+currItem).style.height = "auto";
				
			} else {
				hideFAQItem(currItem);
				currItem = 0;
			}
		
		}
		
		function hideFAQItem(ItemId) {
			
			document.getElementById('FAQItem'+ItemId).style.height = "21px";
			
		}
		
		function hideFlashItems() {
			
			var counter = 1;
			
			while (document.getElementById('flashContent'+counter)) {
				document.getElementById('flashContent'+counter).style.visibility = "hidden";
				counter++;
			}
			
		}
		
		function displayFlashItems() {
			
			var counter = 1;
			
			while (document.getElementById('flashContent'+counter)) {
				document.getElementById('flashContent'+counter).style.visibility = "visible";
				counter++;
			}
			
		}