
function saveComment ()
{
	variables = $('commentForm').serialize();
	url = '/community/extensions/community/comments/ajax/addComment.php';
	new Ajax.Updater('newComment', url, {method: 'post', asynchronous:true, parameters: variables, onComplete: function () { Effect.BlindDown('newComment'); }  });
	
	$('commentForm').style.display = "none";
	
	return false;
}

function saveModComment (cId)
{
	variables = $('modCommentForm' + cId).serialize();
	url = '/community/extensions/community/comments/ajax/addModComment.php';
	new Ajax.Updater('modComment' + cId, url, {method: 'post', asynchronous:true, parameters: variables });
	
	$('modCommentForm' + cId).style.display = "none";
	
	return false;
}

function deleteComment (userId,kommentarId,cId,area)
{
	variables = "userId="+userId+"&kommentarId="+kommentarId+"&cid="+cId+"&area="+area;
	url = '/community/extensions/community/comments/ajax/delComment.php';
	new Ajax.Request(url, { method: 'post', parameters: variables, onSuccess: function(transport) { alert(i18n[lang]['kommentar_geloescht']); location.reload(); } });
}

function addToFavourites (cid,type)
{
	variables = "cid="+cid+"&type="+type;
	url = '/community/extensions/community/profile/ajax/addFavourite.php';
	new Ajax.Request(url, { method: 'post', parameters: variables, onSuccess: function(transport) { alert(i18n[lang]['favoriten_hinzugefuegt']); } });
}


/* Admin */

function adminDeletePhoto (userid,picid)
{
	variables = "userid="+userid+"&photoid="+picid;
	url = '/community/extensions/community/photo/ajax/adminDeletePhoto.php';
	new Ajax.Request(url, { method: 'post', parameters: variables, onSuccess: function(transport) { alert(i18n[lang]['photo_geloescht']); } });
}

function adminDeleteVideo (userid,vidid)
{
	variables = "userid="+userid+"&videoid="+vidid;
	url = '/community/extensions/community/video/ajax/adminDeleteVideo.php';
	new Ajax.Request(url, { method: 'post', parameters: variables, onSuccess: function(transport) { alert(i18n[lang]['video_geloescht']); } });
}

function adminDeleteBlog (userid,blogid) 
{
	variables = "userid="+userid+"&blogid="+blogid;
	url = '/community/extensions/community/blog/ajax/adminDeleteBlog.php';
	new Ajax.Request(url, { method: 'post', parameters: variables, onSuccess: function(transport) { alert(i18n[lang]['blog_geloescht']); } });
}


function activitiessummer (select,photoid)
{
	selectedFields = "";
	
	options = select.getElementsByTagName('option');
	for(i=0;i<options.length;i++)
	{
		if(options[i].selected == true)
		{
			selectedFields += options[i].value + ",";
		}
	}
	
	document.getElementById('activitiesummer_' + photoid).value = selectedFields;
}

function activitieswinter (select,photoid)
{
	selectedFields = "";
	
	options = select.getElementsByTagName('option');
	for(i=0;i<options.length;i++)
	{
		if(options[i].selected == true)
		{
			selectedFields += options[i].value + ",";
		}
	}
	
	document.getElementById('activitiewinter_' + photoid).value = selectedFields;
}


function switchTabs(el, tabContainer, tabContentContainer)
{
	currentTab = el;
	tabContainer			= $$(tabContainer);
	tabContentContainer	= $$(tabContentContainer);
	
	
	for(var i = 0; i<tabContainer[0].childNodes.length;i++)
	{
		if(tabContainer[0].childNodes[i].style)
		{
			tabContainer[0].childNodes[i].className = '';
		}
	}
	
	currentTab.parentNode.className = "active";
	
	
	tabContent = $$( "div." + currentTab.getAttribute("rel"));
	for(var i = 0; i<tabContentContainer[0].childNodes.length;i++)
	{
		if(tabContentContainer[0].childNodes[i].style)
		{
			tabContentContainer[0].childNodes[i].style.display = 'none';
		}
	}
	tabContent[0].style.display = 'block';
}

function checkGmap ()
{
	if(GXml)
	{
		window.onunload = GUnload;
	}
}


window.setTimeout("checkGmap()",3000);



