// JavaScript Document
var http_request = false;
function makePOSTRequest(url, parameters, ref) {
  http_request = false;
  if (window.XMLHttpRequest) { // Mozilla, Safari,...
	 http_request = new XMLHttpRequest();
	/* if (http_request.overrideMimeType) {
		http_request.overrideMimeType('text/xml');
	 }*/
  } else if (window.ActiveXObject) { // IE
	 try {
		http_request = new ActiveXObject("Msxml2.XMLHTTP");
	 } catch (e) {
		try {
		   http_request = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (e) {}
	 }
  }
  if (!http_request) {
	 alert('Cannot create XMLHTTP instance');
	 return false;
  }
  
  switch (ref)
  {
		case 'joinBp':
			http_request.onreadystatechange = bpJoinConfirm;		
			break;
		
		case 'showContact':
			http_request.onreadystatechange = showContactConfirm;		
			break;
			
		case 'sendMsg':
			http_request.onreadystatechange = sendMsgConfirm;
			break;
			
		case 'viewPreview':
			http_request.onreadystatechange = viewPreviewConfirm;		
			break;
		
		case 'showBlogEntry':
			http_request.onreadystatechange = showBlogEntryConfirm;		
			break;
			
		case 'loadBlogComments':
			http_request.onreadystatechange = loadBlogCommentsConfirm;		
			break;
		
		case 'addBlogComment':
			http_request.onreadystatechange = addBlogCommentConfirm;		
			break;
		
		case 'viewBpBlog':
			http_request.onreadystatechange = viewBpBlogConfirm;		
			break;
			
		case 'showArticle':
			http_request.onreadystatechange = showArticleConfirm;		
			break;
			
		case 'viewBpArticles':
			http_request.onreadystatechange = viewBpArticlesConfirm;		
			break;
			
		case 'showAlbums':
			http_request.onreadystatechange = showAlbumsConfirm;		
			break;
		
		case 'showGallery':
			http_request.onreadystatechange = showGalleryConfirm;		
			break;
			
		case 'showPhoto':
			http_request.onreadystatechange = showPhotoConfirm;		
			break;
			
		case 'newTestimonials':
			http_request.onreadystatechange = newTestimonialsConfirm;		
			break;
			
		case 'showTestimonials':
			http_request.onreadystatechange = showTestimonialsConfirm;		
			break;
			
		case 'showResources':
			http_request.onreadystatechange = showResourcesConfirm;		
			break;
			
		case 'showMembers':
			http_request.onreadystatechange = showMembersConfirm;		
			break;
			
		case 'showAllProducts':
			http_request.onreadystatechange = showAllProductsConfirm;		
			break;
			
		case 'showProductDetail':
			http_request.onreadystatechange = showProductDetailConfirm;		
			break;
			
		case 'addComments':
			http_request.onreadystatechange = addCommentsConfirm;		
			break;
			
		
		case 'eventDetails':
			http_request.onreadystatechange = eventDetailsConfirm;		
			break;
			
		case 'joinEvent':
			http_request.onreadystatechange = joinEventConfirm;		
			break;
			
		case 'loadLocalBpRequestForm':
			http_request.onreadystatechange = loadLocalBpRequestFormConfirm;		
			break;
			
		case 'changeLocation':
			http_request.onreadystatechange = changeLocationConfirm;		
			break;
		
		case 'sendlocalBpRequest':
			http_request.onreadystatechange = sendlocalBpRequestConfirm;		
			break;
			
		case 'showLocalBps':
			http_request.onreadystatechange = showLocalBpsConfirm;		
			break;
			
		case 'viewMore':
			http_request.onreadystatechange = viewMoreConfirm;		
			break;
			
		case 'loadMembers':
			http_request.onreadystatechange = loadMembersConfirm;		
			break;
		
		case 'loadTopicCategories':
			http_request.onreadystatechange = loadTopicCategoriesConfirm;		
			break;
			
		case 'showForumTopics':
			http_request.onreadystatechange = showForumTopicsConfirm;		
			break;
			
		case 'createTopic':
			http_request.onreadystatechange = createTopicConfirm;		
			break;
			
		case 'viewTopic':
			http_request.onreadystatechange = viewTopicConfirm;		
			break;
			
		case 'createpost':
			http_request.onreadystatechange = createpostConfirm;		
			break;
			
		case 'loadEventCalHomePage':
			http_request.onreadystatechange = loadEventCalHomePageConfirm;		
			break;
			
		case 'loadEventCal':
			http_request.onreadystatechange = loadEventCalConfirm;		
			break;
			
		case 'loadEvents':
			http_request.onreadystatechange = loadEventsConfirm;		
			break;
			
		case 'addEventComments':
			http_request.onreadystatechange = addEventCommentsConfirm;		
			break;
		
		case 'quoteForumPost':
			http_request.onreadystatechange = quoteForumPostConfirm;		
			break;
			
		
  }
  
  
  http_request.open('POST', url, true);
  http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  http_request.setRequestHeader("Content-length", parameters.length);
  http_request.setRequestHeader("Connection", "close");
  http_request.send(parameters);
}
function joinBp()
{
	makePOSTRequest('/templateAjaxProcess1.php','sec=joinBp','joinBp');	
}
function bpJoinConfirm()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{
			
			result = http_request.responseText;			
			document.getElementById('joinConfirm').innerHTML = result;
			document.getElementById('friendsList').innerHTML = '<img src="images/combo_refresh.gif" border="0" />';
			loadMembers();
		} else {
			alert('There was a problem with the request.');
		 }
    }
}
function showContact(heading)
{
	showLoader();
	makePOSTRequest('/templateAjaxProcess1.php','sec=showContact&heading='+escape(heading),'showContact');	
}
function showContactConfirm()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{			
			result = http_request.responseText;
			hideLoader();
			document.getElementById('body').innerHTML =result;
		
		} else {
			alert('There was a problem with the request.');
		 }
    }
}
function contactOwner()
{
	var email;
	email = new String(document.getElementById('txtEmail').value);	
	if(trim(document.getElementById('txtFullName').value)=='')
	{
		alert('Please type the full name');
		document.getElementById('txtFullName').focus();
	}
	else if(trim(document.getElementById('txtSubject').value)=='')
	{
		alert('Please type the subject');
		document.getElementById('txtSubject').focus();
	}
	else if(trim(email)=='')
	{
		alert('Please type the email address');
		document.getElementById('txtEmail').focus();
	}	
	else if(!emailCheck(trim(email)))
	{
		document.getElementById('txtEmail').focus();
	}
	else if(trim(document.getElementById('txtMsg').value)=='')
	{
		alert('Please type the message');
		document.getElementById('txtMsg').focus();
	}
	else
	{
		showLoader();
		makePOSTRequest('/templateAjaxProcess1.php','sec=sendMsg&subject='+escape(document.getElementById('txtSubject').value)+'&msg='+escape(document.getElementById('txtMsg').value)+'&email='+escape(document.getElementById('txtEmail').value),'sendMsg');	
	}
}
function sendMsgConfirm()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{			
			result = http_request.responseText;			
			hideLoader();
			document.getElementById('confirm').innerHTML = result;         
			
			document.getElementById('txtSubject').value='';
			document.getElementById('txtEmail').value='';
			document.getElementById('txtMsg').value='';
			document.getElementById('txtSubject').focus();
		} else {
			alert('There was a problem with the request.');
		 }
    }
}
function viewBlogs(ref)
{
	showLoader();
	makePOSTRequest('/templateAjaxProcess1.php','sec=viewBlogs&ref='+ref,'viewPreview');	
}
function viewPreviewConfirm()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{			
			result = http_request.responseText;
			
			
			
			newStr = new String(result);
			newArr = newStr.split("~~");
			
			var bView=document.getElementById('mainView');
			var fTop = (screen.height)/3 -200;
			var fLeft = ((screen.width)-500)/2;
			
			if(navigator.appName == "Netscape") 
			{
				bView.style.top = window.pageYOffset+fTop+'px';
				bView.style.left = window.pageXOffset+fLeft+'px';	
			} 
			
			else 
			{
				bView.style.top = document.documentElement.scrollTop+fTop+'px';
				bView.style.left = document.documentElement.scrollLeft+fLeft+'px';
			}
				
			hideLoader();
			bView.style.display="inline";
			
			document.getElementById('modulePrvHead').innerHTML = newArr[0];
			
			document.getElementById('modulePreview').innerHTML = newArr[1];
			
		} else {
			alert('There was a problem with the request.');
		 }
    }
}
function colaps(id)
{
	var bView=document.getElementById(id);
	bView.style.display="none";
}
function showBlogEntry(bId,entryId,u,heading)
{
	showLoader();
	makePOSTRequest('/templateAjaxProcess1.php','sec=showBlogEntry&heading='+escape(heading)+'&bId='+bId+'&eId='+entryId+'&u='+u,'showBlogEntry');
}
function showBlogEntryConfirm()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{			
			result = http_request.responseText;
			hideLoader();
			newStr = new String(result);
			newArr = newStr.split("~");
					
			document.getElementById('body').innerHTML = newArr[1];
			loadBlogComments(newArr[0]);				
			
		} else {
			alert('There was a problem with the request.');
		 }
    }
}
function loadBlogComments(entryId)
{
	document.getElementById('commentsList').innerHTML = '<img src="images/combo_refresh.gif" border="0" />';
	makePOSTRequest('/templateAjaxProcess1.php','sec=loadBlogComments&&eId='+entryId,'loadBlogComments');
}
function loadBlogCommentsConfirm()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{
			
			result = http_request.responseText;			
			document.getElementById('commentsList').innerHTML = result;            
		} else {
			alert('There was a problem with the request.');
		 }
    }
}
function addBlogComment()
{
	if(document.frmAddComment.txtSubject.value=='')
	{
		alert('Invalid subject');
		document.frmAddComment.txtSubject.focus();
	}
	else if(document.frmAddComment.txtMessage.value=='')
	{
		alert('Invalid message');
		document.frmAddComment.txtMessage.focus();
	}
	else
	{
		makePOSTRequest('/templateAjaxProcess1.php','sec=addBlogComment&sub='+escape(document.frmAddComment.txtSubject.value)+'&msg='+escape(document.frmAddComment.txtMessage.value)+'&threadId='+document.getElementById('eId').value,'addBlogComment');
	}
}
function addBlogCommentConfirm()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{			
			result = http_request.responseText;
			newStr = new String(result);
			newArr = newStr.split("~");
			if(newArr[0]=='ERROR')
			{
				document.getElementById('succs').innerHTML = 'Error occured while adding the comment.';	
			}
			else
			{
				document.getElementById('succs').innerHTML = 'The comment successfully added.';	
			}			
			loadBlogComments(newArr[1]);
			document.frmAddComment.txtSubject.value='';
			document.frmAddComment.txtMessage.value='';
			
			
		} else {
			alert('There was a problem with the request.');
		 }
    }
}
function viewBpBlog(ref)
{
	showLoader();
	//makePOSTRequest('/templateAjaxProcess1.php','sec=viewBpBlog','viewBpBlog');	
	makePOSTRequest('/templateAjaxProcess1.php','sec=viewBpBlog&tellafrndlink='+ref,'viewBpBlog');	
}
function viewBpBlogConfirm()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{			
			result = http_request.responseText;			
			hideLoader();
			
			if(document.getElementById('delSucessTemp'))
			{
				msg = document.getElementById('delSucessTemp').innerHTML;
				document.getElementById('delSucessTemp').innerHTML='&nbsp;';
			}
			else
			{
				msg = '&nbsp;';	
			}
			
			document.getElementById('body').innerHTML = result;			
			document.getElementById('delSucess').innerHTML=msg;
			
		} else {
			alert('There was a problem with the request.');
		 }
    }
}
function viewArticle(ref)
{
	showLoader();
	makePOSTRequest('/templateAjaxProcess1.php','sec=viewArticle&ref='+ref,'viewPreview');
}
function showArticle(ref,heading,tellfre)
{
	
	showLoader();
	makePOSTRequest('/templateAjaxProcess1.php','sec=showArticle&heading='+escape(heading)+'&ref='+ref+'&tellfrsen='+escape(tellfre),'showArticle');	
}
function showArticleConfirm()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{			
			result = http_request.responseText;
			hideLoader();
			document.getElementById('body').innerHTML = result;
			
		} else {
			alert('There was a problem with the request.');
		 }
    }
}
function viewBpArticles(heading,tellfremain)
{
	showLoader();
	makePOSTRequest('/templateAjaxProcess1.php','sec=viewBpArticles&heading='+escape(heading)+'&tellfrsenmain='+escape(tellfremain),'viewBpArticles');	
}
function viewBpArticlesConfirm()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{			
			
			result = http_request.responseText;
			hideLoader();
			document.getElementById('body').innerHTML = result;
			
		} else {
			alert('There was a problem with the request.');
		 }
    }
}
function showAlbums(page,heading)
{	
	showLoader();
	makePOSTRequest('../templateAjaxProcess1.php','sec=showAlbums&heading='+escape(heading),'showAlbums');
}
function showAlbumsConfirm()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{			
			result = http_request.responseText;			
			hideLoader();
			document.getElementById('body').innerHTML = result;			
			
		} 
		else
		{
			alert('There was a problem with the request.');
		}
    }
}
function showGallery(ref,page,heading)
{	
	showLoader();
	makePOSTRequest('/templateAjaxProcess1.php','sec=showGallery&heading='+escape(heading)+'&ref='+ref+'&page='+page,'showGallery');
}
function showGalleryConfirm()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{			
			result = http_request.responseText;
			hideLoader();
			
			newStr = new String(result);
			newArr = newStr.split("~");
			
			
			document.getElementById('body').innerHTML = newArr[0];
			showPhoto(newArr[1]);
			
		} else {
			alert('There was a problem with the request.');
		 }
    }
}
function showPhoto(ref,heading)
{
	showLoader();
	makePOSTRequest('/templateAjaxProcess1.php','sec=showPhoto&heading='+escape(heading)+'&ref='+ref,'showPhoto');	
}
function showPhotoConfirm()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{			
			result = http_request.responseText;
			hideLoader();
				
			newStr = new String(result);
			newArr = newStr.split("~");
			
			document.getElementById('originalImg').src = newArr[0];
			document.getElementById('photDesc').innerHTML = newArr[1];
			
			
		} else {
			alert('There was a problem with the request.');
		 }
    }
}
function newTestimonials(heading)
{
	showLoader();
	makePOSTRequest('/templateAjaxProcess2.php','sec=newTestimonials&heading='+escape(heading),'newTestimonials');	
}
function newTestimonialsConfirm()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{			
			result = http_request.responseText;
			hideLoader();
			
			document.getElementById('body').innerHTML =result;
		
		} else {
			alert('There was a problem with the request.');
		 }
    }
}
function showTestimonials(heading)
{
	showLoader();
	makePOSTRequest('/templateAjaxProcess2.php','sec=showTestimonials&heading='+escape(heading),'showTestimonials');			
}
function showTestimonialsConfirm()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{			
			result = http_request.responseText;
			hideLoader();
			
			document.getElementById('body').innerHTML =result;
		
		} else {
			alert('There was a problem with the request.');
		 }
    }
}
function showResources(tab1,tab2,tab3,heading)
{
	showLoader();
	makePOSTRequest('/templateAjaxProcess2.php','sec=showResources&heading='+escape(heading)+'&tab1='+tab1+'&tab2='+tab2+'&tab3='+tab3,'showResources');			
}
function showResourcesConfirm()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{			
			result = http_request.responseText;
			hideLoader();
			document.getElementById('body').innerHTML =result;
			
			startajaxtabs("maintab");
			ajaxpage('/templateAjaxProcess2.php', 'ajaxcontentarea', '','view_1');
		
		} else {
			alert('There was a problem with the request.');
		 }
    }
}
function showMembers(heading)
{
	showLoader();
	makePOSTRequest('/templateAjaxProcess2.php','sec=showMembers&heading='+escape(heading),'showMembers');
}
function showMembersConfirm()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{			
			result = http_request.responseText;
			hideLoader();
			document.getElementById('body').innerHTML =result;
			
		
		} else {
			alert('There was a problem with the request.');
		 }
    }
}
function showAllProducts(heading,bid)
{
	showLoader();
	makePOSTRequest('/templateAjaxProcess2.php','sec=showAllProducts&heading='+escape(heading)+'&id='+bid,'showAllProducts');
}
function showAllProductsConfirm()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{			
			result = http_request.responseText;
			hideLoader();
			document.getElementById('body').innerHTML =result;
		} else {
			alert('There was a problem with the request.');
		}
    }
}
function showProductDetail(pid,heading)
{
	showLoader();
	makePOSTRequest('/templateAjaxProcess2.php','sec=showProductDetail&heading='+escape(heading)+'&id='+pid,'showProductDetail');
}
function showProductDetailConfirm()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{			
			result = http_request.responseText;
			hideLoader();
			document.getElementById('body').innerHTML =result;
		} else {
			alert('There was a problem with the request.');
		}
    }
}
function addComments(id) 
{
	if(document.getElementById('txtComments').value=="")
	{
		alert('Please enter your comment');
		document.getElementById('txtComments').focus();
		return false;
	}
	else if(document.getElementById('txtComments').value.length > 1000)	{
		alert("Comments cannot be greater than 1000 characters.");
		document.getElementById('txtComments').focus();
		return false;
	}
	var user = document.getElementById("hdVisitorId").value;
	if(user == 0) {
		alert("Please Login as a member to add comments");
		return false;
	}
	var comm = escape(document.getElementById('txtComments').value);
	
	document.getElementById('dvComments').innerHTML = '<img src="images/combo_refresh.gif" border="0" />';
	makePOSTRequest('/templateAjaxProcess2.php','sec=addComments&productId='+id+'&userId='+user+'&txtComment='+comm,'addComments');
}
function addCommentsConfirm() {
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{			
			result = http_request.responseText;
			document.getElementById('dvComments').innerHTML = result;
			document.getElementById('txtComments').value = "";
		} else {
			alert('There was a problem with the request.');
		 }
    }
}
function loadLocalBpRequestForm()
{
	showLoader();
	makePOSTRequest('/templateAjaxProcess2.php','sec=loadLocalBpRequestForm','loadLocalBpRequestForm');
}
function loadLocalBpRequestFormConfirm()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{			
			result = http_request.responseText;
			hideLoader();
			document.getElementById('body').innerHTML =result;
		} else {
			alert('There was a problem with the request.');
		 }
    }
}
function changeLocation(ref)
{
	document.getElementById('place').innerHTML = '<img src="images/combo_refresh.gif" border="0" />';
	makePOSTRequest('/templateAjaxProcess2.php','sec=changeLocation&ref='+ref,'changeLocation');
}
function changeLocationConfirm()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{			
			result = http_request.responseText;						
			document.getElementById('place').innerHTML = result;
			
		} else {
			alert('There was a problem with the request.');
		 }
    }
}
function sendlocalBpRequest(country,city)
{
	document.getElementById('status').innerHTML = '<img src="images/combo_refresh.gif" border="0" />';
	makePOSTRequest('/templateAjaxProcess2.php','sec=sendlocalBpRequest&country='+country+'&city='+city,'sendlocalBpRequest');		
}
function sendlocalBpRequestConfirm()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{			
			result = http_request.responseText;	
			newStr = new String(result);
			newArr = newStr.split("~");
			if(newArr[0]=='ERROR')
			{
				document.getElementById('status').innerHTML = newArr[1];
			}
			else
			{			
				document.getElementById('status').innerHTML = newArr[1];
			}
			
		} else {
			alert('There was a problem with the request.');
		 }
    }
}
function showLocalBps(type,ref)
{
	showLoader();
	makePOSTRequest('/templateAjaxProcess2.php','sec=showLocalBps&subSec='+type+'&ref='+ref,'showLocalBps');
}
function showLocalBpsConfirm()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{			
			result = http_request.responseText;
			hideLoader();
			document.getElementById('body').innerHTML =result;
		
		} else {
			alert('There was a problem with the request.');
		 }
    }
}
function viewMore()
{
	showLoader();
	makePOSTRequest('/templateAjaxProcess2.php','sec=viewMore','viewMore');	
}
function viewMoreConfirm()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{			
			result = http_request.responseText;
			hideLoader();
			document.getElementById('body').innerHTML =result;
			
		
		} else {
			alert('There was a problem with the request.');
		 }
    }
}
function loadMembers()
{
	document.getElementById('friendsList').innerHTML = '<img src="images/combo_refresh.gif" border="0" />';
	makePOSTRequest('/templateAjaxProcess2.php','sec=loadMembers','loadMembers');	
}
function loadMembersConfirm()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{			
			result = http_request.responseText;
			document.getElementById('friendsList').innerHTML =result;
			
		
		} else {
			alert('There was a problem with the request.');
		 }
    }
}
function userValidate(ref,url)
{
	if(ref==2)
	{
		var obj=document.getElementById("eventJoinConfirm");	
	}
	else if(ref==4)
	{
		var obj=document.getElementById("eventJoinConfirm");	
	}
	else
	{
		var obj=document.getElementById("joinConfirm");
	}
	
	obj.innerHTML = "<div style=\"height:20px\">Please <a class=\"moreLink\" href=\"javascript:strDivOpen(); timer("+ref+");\">Login</a> as a member or <a class=\"moreLink\" href=\"/main.php?ref="+ref+"&redirect="+escape(url)+"\">Sign up</a></div>";	
}
function strDivOpen()
{
	var bgId = document.getElementById('overlay');
	new Effect.Appear('overlay', { duration: overlayDuration, from: 0.0, to: 0.91 });
	
	
}
function timer(ref)
{
setTimeout('showLogin('+ref+');',300);	
}
function showLogin(ref)
{
	var url;
	url = 'templateLogin.php?join='+ref;
	
	document.getElementById('loginBox').innerHTML = '<iframe frameborder="0" height="169px" width="315px" src="'+url+'" scrolling="no"></iframe>';
	
	if(document.getElementById('loginBox').style.display=='none')
	{
		document.getElementById('loginBox').style.display='block';
				
	}
	else
	{
		document.getElementById('loginBox').style.display='none';
	}
}
function strDivClose()
{
	new Effect.Fade('overlay', { duration: overlayDuration});
}
function hideLogin()
{
	var hLog = document.getElementById('loginBox');	
	hLog.style.display = "none";
}
function forgotPassOpen()
{
	var fPass = document.getElementById('forgotPass');
	fPass.style.display = "inline";
	
}
function forgotPassClose()
{
	var fPass = document.getElementById('forgotPass');	
	fPass.style.display = "none";
}
function enddiv()
{
	if(document.getElementById('loginBox').style.display=='block')
	{
	
	}
	else
	{
	new Effect.Fade('overlay', { duration: overlayDuration});
	}
}
function checkTestimonial()
{
	if(frmTestimonials.txt_Name.value == '') {
		alert("Please input Name") ;
		return false ;
	}
	if(frmTestimonials.txtComment.value == '') {
		alert("Please input Comment") ;
		return false ;
	}
}
function loadTopicCategories()
{		
	showLoader();
	makePOSTRequest('/templateAjaxProcess3.php',"sec=loadTopicCategories",'loadTopicCategories');
}
function loadTopicCategoriesConfirm()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{			
			result = http_request.responseText;
			hideLoader();
			
			document.getElementById('body').innerHTML = result;
	
		} else {
			alert('There was a problem with the request.');
		 }
    }
}
function showForumTopics(catId,p)
{
	showLoader();
	makePOSTRequest('/templateAjaxProcess3.php',"sec=showForumTopics&categoryId="+catId+"&p="+p,'showForumTopics');
}
function showForumTopicsConfirm()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{			
			result = http_request.responseText;
			hideLoader();
			resultArr = result.split('<split>');
						
			document.getElementById('body').innerHTML =resultArr[0];
			
			if(resultArr[1]==1)
			{
				document.getElementById('dvMessage').innerHTML = 'Topic Created Successfully';
			}
		} else {
			alert('There was a problem with the request.');
		 }
    }
}
function createTopic(foId,catId) 
{
	if(trim(document.getElementById('txtTitle').value)=='')
	{
		alert('Topic title field is empty');
		document.getElementById('txtTitle').focus();
		return false;
	}		
	else if(document.getElementById('txtTitle').value.length > 100)	
	{
		alert("Topic Title cannot be greater than 100 characters.");
		document.getElementById('txtTitle').focus();
		return false;
	}
	else if(trim(document.getElementById('txtDesc').value)=='')
	{
		alert('Topic description field is empty');
		document.getElementById('txtDesc').focus();
		return false;
	}
	else if(document.getElementById('txtDesc').value.length > 255)	
	{
		alert("Topic Description cannot be greater than 255 characters.");
		document.getElementById('txtDesc').focus();
		return false;
	}
	else
	{	
		var user = document.getElementById("hdVisitorId").value;
		var title = trim(document.getElementById('txtTitle').value);
		var desc = trim(document.getElementById('txtDesc').value);
		var qstring = "sec=createTopic&fId="+foId+"&catId="+catId+"&uId="+user+"&txtTtl="+escape(title)+"&txtDes="+escape(desc);
		
		showLoader();
		makePOSTRequest('/templateAjaxProcess3.php',qstring,'createTopic');
	}
}
function createTopicConfirm()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{			
			result = http_request.responseText;
			hideLoader();
			cat = trim(result);
			showForumTopics(cat);
			
		} else {
			alert('There was a problem with the request.');
		 }
    }
}
function viewTopic(p,ref,cat)
{
	showLoader();
	makePOSTRequest('/templateAjaxProcess3.php','sec=viewTopic&p='+p+'&top='+ref+'&catId='+cat,'viewTopic');
}
function viewTopicConfirm()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{			
			result = http_request.responseText;			
			hideLoader();
			document.getElementById('body').innerHTML =result;
			//resultArr = result.split('<split>');			
			//document.getElementById('body').innerHTML =resultArr[0];
			
			//if(resultArr[1]==1)
			//{
				//document.getElementById('dvMessage').innerHTML = 'Your Post Added Successfully';
			//}
			
		} else {
			alert('There was a problem with the request.');
		 }
    }
}
function createPost() 
{
	if(trim(document.getElementById('txtTitle').value)=='')
	{
		alert('Post title field is empty');
		document.getElementById('txtTitle').focus();
	}
	else if(document.getElementById('txtTitle').value.length > 100)	
	{
		alert("Post title cannot be greater than 100 characters.");
		document.getElementById('txtTitle').focus();
	}
	else if(trim(document.getElementById('txtPost').value)=='')
	{
		alert('Post field is empty');
		document.getElementById('txtPost').focus();
	}
	else
	{
		var tid = document.getElementById("hdTopicId").value;
		var categoryId = document.getElementById("catId").value;
		var title = escape(document.getElementById('txtTitle').value);
		var post = escape(document.getElementById('txtPost').value);
		
		var qstring = "sec=createpost&tId="+tid+"&category="+categoryId+"&txtTtl="+title+"&txtPos="+post;
		makePOSTRequest('/templateAjaxProcess3.php',qstring,'createpost');
	}
}
function createpostConfirm()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{			
			result = http_request.responseText;			
			resultArr = result.split('<split>');
			viewTopic(1,resultArr[1],resultArr[2]);
			
		} else {
			alert('There was a problem with the request.');
		 }
    }
}
function eventDetails(ref,heading)
{
	showLoader();
	makePOSTRequest('/templateAjaxProcess3.php',"sec=eventDetails&eventId="+ref+"&heading="+heading,'eventDetails');
}
function eventDetailsConfirm()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{			
			result = http_request.responseText;
			hideLoader();
			document.getElementById("body").innerHTML = result;			
			
		} else {
			alert('There was a problem with the request.');
		 }
    }
}
function joinEvent(ref,heading)
{
	showLoader();
	makePOSTRequest('/templateAjaxProcess3.php',"sec=joinEvent&eventId="+ref+"&heading="+heading,'joinEvent');
}
function joinEventConfirm()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{			
			result = http_request.responseText;			
			hideLoader();
			resultArr = result.split("<split>");
			
			if(resultArr[0]=="ok")
			{
				alert('You have successfully join to the selected event');	
				eventDetails(resultArr[1],resultArr[2]);	
			}
			else if(resultArr[0]=="error")
			{
				alert('You have already join to the selected event');	
				eventDetails(resultArr[1],resultArr[2]);	
			}
			else
			{
				eventDetails(resultArr[1],resultArr[2]);
			}
			
		} else {
			alert('There was a problem with the request.');
		 }
    }
}
function loadEventCalHomePage(day,month,year,bp,heading)
{
	document.getElementById('dvCalendar').innerHTML = '<img src="images/combo_refresh.gif" border="0" />';
	makePOSTRequest('/templateAjaxProcess3.php',"sec=loadEventCalHomePage&day="+day+"&month="+month+"&year="+year+"&bp="+bp+'&heading='+heading,'loadEventCalHomePage');	
}
function loadEventCalHomePageConfirm()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{			
			result = http_request.responseText;	
			document.getElementById('dvCalendar').innerHTML = result;
			
		} else {
			alert('There was a problem with the request.');
		 }
    }
}
function loadEventCal(day,month,year,bp,heading)
{
	showLoader();
	makePOSTRequest('/templateAjaxProcess3.php',"sec=loadEventCal&day="+day+"&month="+month+"&year="+year+"&bp="+bp+'&heading='+heading,'loadEventCal');	
}
function loadEventCalConfirm()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{			
			result = http_request.responseText;			
			hideLoader();
			
			resultArr = result.split("<split>");
			document.getElementById('body').innerHTML = resultArr[0];
			
			
			day = resultArr[1];	
			month=resultArr[2];
			year=resultArr[3];
			bp=resultArr[4];			
			headingx=resultArr[5];
			
			
			loadEvents(day,month,year,bp,headingx);
			
		} else {
			alert('There was a problem with the request.');
		 }
    }
}
function loadEvents(day1,month1,year1,bp1,heading)
{
	document.getElementById('dvCalDetail').innerHTML = '<img src="images/combo_refresh.gif" border="0" />';
	makePOSTRequest('/templateAjaxProcess3.php',"sec=loadEvents&day="+day1+"&month="+month1+"&year="+year1+"&bp="+bp1+"&heading="+escape(heading),'loadEvents');	
}
function loadEventsConfirm()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{			
			result = http_request.responseText;				
			document.getElementById('dvCalDetail').innerHTML = result;			
			
		} else {
			alert('There was a problem with the request.');
		 }
    }
}
function addEventComments(id) 
{
	var user = document.getElementById("hdVisitorId").value;
	if(user == 0) 
	{
		alert("Please Login as a member to add comments");		
	}	
	else if(trim(document.getElementById('txtComments').value)=="")
	{
		alert("Comment is empty.");
		document.getElementById('txtComments').focus();		
	}
	else if(document.getElementById('txtComments').value.length > 1000)	
	{
		alert("Comments cannot be greater than 1000 characters.");
		document.getElementById('txtComments').focus();		
	}
	else
	{
		document.getElementById('dvMessage').innerHTML = '<img src="images/combo_refresh.gif" border="0" />';
		
		var comm = escape(document.getElementById('txtComments').value);
	
		var qstring = "sec=addEventComments&eId="+id+"&txtComm="+comm;
		makePOSTRequest('/templateAjaxProcess3.php',qstring,'addEventComments');
	}
}
function addEventCommentsConfirm()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{			
			result = http_request.responseText;
			resultArr = result.split("<split>");
			
			document.getElementById('dvMessage').innerHTML = resultArr[0];
			document.getElementById("dvComments").innerHTML = resultArr[1];			
			document.getElementById('txtComments').value = "";
			
		} else {
			alert('There was a problem with the request.');
		 }
    }
}
function quoteForumPost(topic,post)
{
	showLoader();
	var qstring = "sec=quoteForumPost&topicId="+topic+"&postId="+post;
	makePOSTRequest('/templateAjaxProcess3.php',qstring,'quoteForumPost');
}
function quoteForumPostConfirm()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{			
			result = http_request.responseText;
			hideLoader();
			if(result != '<UNAUTHORISED />')
			{					
				resultArr = result.split("<split>");
				
				document.getElementById('quo_'+resultArr[0]).innerHTML = '';
				document.getElementById('txtPost').value = resultArr[1];		
				document.getElementById('txtPost').focus();
			}
		} else {
			alert('There was a problem with the request.');
		 }
    }
}
function showLoader()
{
	var fTop = (screen.height) / 15 - 56;
	
		if(navigator.appName == "Netscape") 
		{
			document.getElementById("template_loading").style.top = window.pageYOffset+fTop+'px';
			document.getElementById('template_loading').style.display='block';
		} 
		else 
		{
			document.getElementById("template_loading").style.top = document.documentElement.scrollTop+fTop+'px';
			document.getElementById('template_loading').style.display='block';
		}
}
function hideLoader()
{
	document.getElementById('template_loading').style.display='none';
}
function changeCost(curr) {
	var sCost = document.getElementById('cmbLoc').value;
	var uPr = document.getElementById('uPrice').value;
	var tCost = parseInt(sCost) + parseInt(uPr);
	document.getElementById('dvShipCost').innerHTML = sCost+" "+curr;
	document.getElementById('dvTotalCost').innerHTML = tCost+" "+curr;
	document.getElementById('amount').value = tCost;
	
}

