	function showOrHideSection(id)
	{
		try
		{
			var div = document.getElementById(id);

			if(div.style.display=='none')
			{
				div.style.display = 'block';
			}else{
				div.style.display='none';
			}
		}catch(err){
			// Do nothing because this just a display effect
		}
	}

	function hideDiv(id)
	{
		try
		{
			document.getElementById(id).style.display='none';
		}catch(err){
			// Do nothing because this just a display effect
		}
	}

	function ajaxFunction()
	{
		var xmlHttp = null;

		try {    // Firefox, Opera 8.0+, Safari
			xmlHttp=new XMLHttpRequest();
		}	catch (e)	{    // Internet Explorer
			try {
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
				try {
					xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e) {
					alert("Your browser does not support AJAX!");
				}
			}
		}
		return xmlHttp;
	}



	function showPopupWindowEventComment(contentID, eventTemplateID, eventID, commentID)
	{
		document.getElementById('commentFrame').src = '/PopupLoading.jsp';
		document.getElementById('commentFrame').src = '/CreateComment.do?eventTemplateID=' + eventTemplateID + '&eventID=' + eventID + '&commentID=' + commentID;
		
		showPopupWindow(contentID);
	}

	function showPopupWindowEventLike(eventTemplateID, eventID)
	{
		replaceContnetAJAX('likePopupInnerContent', '/EventLike.do?eventTemplateID=' + eventTemplateID + '&eventID=' + eventID)
		
		showPopupWindow('likePopupContent');
	}



	function showPopupWindow(contentID)
	{
		document.getElementById('popupTable').style.display = 'block';
		document.getElementById('popupContent').innerHTML = document.getElementById(contentID).innerHTML;

		if (document.body && (document.body.scrollWidth || document.body.scrollHeight)) 
		{
				var pageWidth = document.body.scrollWidth + "px";
				var pageHeight = document.body.scrollHeight + "px";
		} else if (document.body.offsetWidth) {
				var pageWidth = document.body.offsetWidth + "px";
				var pageHeight = document.body.offsetHeight + "px";
		} else {
				var pageWidth = "100%";
				var pageHeight = "100%";
		}
		
		document.getElementById("popupBG").style.height = pageHeight;
		document.getElementById("popupBG").style.width = pageWidth;
		document.getElementById('popupBG').style.display = 'block';

		window.scrollTo(0, 0);
	}
	
	function hidePopupWindow()
	{
		document.getElementById('popupTable').style.display = 'none';
		document.getElementById('popupBG').style.display = 'none';
		document.getElementById('popupContent').innerHTML = '';
	}
	
	function closeAndRefresh()
	{
		hidePopupWindow();
		document.location.reload();
	}
	
	
	function resizeBGDiv()
	{
		try
		{
			if (document.body && (document.body.scrollWidth || document.body.scrollHeight)) 
			{
					var pageWidth = document.body.scrollWidth + "px";
					var pageHeight = document.body.scrollHeight + "px";
			} else if (document.body.offsetWidth) {
					var pageWidth = document.body.offsetWidth + "px";
					var pageHeight = document.body.offsetHeight + "px";
			} else {
					var pageWidth = "100%";
					var pageHeight = "100%";
			}

			document.getElementById("popupBG").style.height = pageHeight;
			document.getElementById("popupBG").style.width = pageWidth;
		}catch(error){}		
	}

function replaceContnetAJAX(divName, url)
{
	var xmlHttp = ajaxFunction();

	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			var divObject = document.getElementById(divName);

			divObject.innerHTML=xmlHttp.responseText;
		}
	}

	xmlHttp.open('GET', url, true);
	xmlHttp.send(null);
}