
function hideElementOnAction(actionElement, actionElement_value, elementToHide)
{
	if (document.getElementById('actionElement').value == actionElement_value)
		hideElement(elementToHide);
}

function redirectValues(page, form)
{
	document.getElementById(form).action = page;
	document.getElementById(form).submit();
}


function testVideoUploadForm(){
	var retval = true;
	
	if( $('video_title').value.length < 3 ){
	
		$('noTitle').style.display = 'block';
		retval = false;
		
	} else {
	
		if($('noTitle').style.display == 'block'){
			$('noTitle').style.display = 'none';
		}		
		
	}
	
	if( $('video_description').value.length < 3 ){
	
		$('noDescr').style.display = 'block';
		retval = false;
		
	} else {	
	
		if($('noDescr').style.display == 'block'){
			$('noDescr').style.display = 'none';
		}	
		
	}
	
	if(!retval){
	
		$('JError').style.display = 'block';		
		
	} else {

		if($('JError').style.display == 'block'){
			$('JError').style.display = 'none';
		}			
	
	}
	
	return retval;
}



function checkInput(id_element,id_text_element,error_msg)
{
	if (document.getElementById(id_element).value == ""){
		document.getElementById(id_text_element).innerHTML = error_msg;
		return false;
		}
	else
		return true;
	
}

function getHtml(load,query, contentId) 
{

	var my = new Ajax.Updater(contentId, load + "?" + query, {asynchronous:true, method: 'post'});
}

function followClubNewsAutoCompleter(text, li) {

	
	var cid = li.id;
	$('club').value = cid;

}

function followClubsAutoCompleter(text, li) {

	var cid = li.id;
	
	$('joinclub').style.display = 'block';
	$('joinclub_link').href = "club_profile.php?cid=" + cid;

}

function followSearchClubAutoCompleter(text, li) {

	$('clubName').value = li.innerHTML;

}

function followSearchForenameAutoCompleter(text, li) {

	$('forename').value = li.innerHTML;

}

function followSearchSurnameAutoCompleter(text, li) {

	$('surname').value = li.innerHTML;

}

function followSearchCityAutoCompleter(text, li) {

	$('city').value = li.innerHTML;

}

function followSearchZipAutoCompleter(text, li) {

	$('zip').value = li.innerHTML;

}



function disableUploadAvatarNotify(uid) {
	
	if($('reShowUploadForm').checked == true) {
	
		var qstr = 	"uid=" + uid +
					"&option=0" +
					"&nocache="+new Date().getTime();

	} else {
		
		var qstr = 	"uid=" + uid +
					"&option=1" +
					"&nocache="+new Date().getTime();
		
	} 
	
	var url = 'actionDisableUploadAvatarNotify.php';
	var options = {method:'post', parameters:qstr}; 
	var myAjax = new Ajax.Request(url, options);
	
}


function checkCheckbox(checkbox) {
	if($(checkbox).checked == true)
		$(checkbox).checked = false;
	else 
		$(checkbox).checked = true;
}

function checkSelect(select) {

	if(select.value == '-1') {
		switchElements('gidtext','gidselect');
	}
	
}

function checkCategorySelect(select) {

	if(select.value == '-1') {
		switchElements('cattext','catselect');
	}
	
}

// Funktion fuer die Abstimmung bei den Teams fuer die Zusagen/Absagen
function voteAppointment(apid, vote){
	var url = 'actionVoteAppointment.php';
	var qstr = 	"ap_id=" + apid +
				"&vote=" + vote
				"&nocache="+new Date().getTime();
	
	var options = {method:'post', parameters:qstr, onComplete:followvoteAppointment(apid, vote)}; 													
	var myAjax = new Ajax.Request(url, options);
}

function followvoteAppointment(apid, vote) {
	//switchElements('demod_' + apid, 'mod_' + apid)
	hideElement('poll_' + apid);
	if($('poll_yes_' + apid)){
		if(vote == 1){
			var cnt = parseInt($('poll_yes_' + apid).innerHTML);
			cnt = cnt +1;
			$('poll_yes_' + apid).innerHTML = cnt;	
		} else {
			var cnt = parseInt($('poll_no_' + apid).innerHTML);
			cnt = cnt +1;
			$('poll_no_' + apid).innerHTML = cnt;
		}
	} else {
		showElement('poll_' + apid + '_voted');
	}
}
/*
 *  Flackern im IE verhindern
*/
 
 try {
		document.execCommand("BackgroundImageCache", false, true);
	 } 
		catch(err) {}
		
/*
 *	Enables/disables a form element.
 */
function switchEnableField(id){
	$(id).disabled =! ($(id).disabled);
}

function switchVisibility(id) {
	
	if ($(id).style.display == 'none') {
		$(id).style.display = 'block';
	}else{
		$(id).style.display = 'none';
	}
}



// ***********************************************************************
// BEG: CLUB MANAGEMENT
// clubs/manage.tpl
// ***********************************************************************

function clubRevokeModerator(cid,uid) {
	
	var url = 'actionEditMemberInClub.php';
	var qstr = 
		"user_id=" + uid +
		"&club_id=" + cid +
		"&action=demod" +
		"&nocache="+new Date().getTime();
	
	var options = {method:'post', parameters:qstr,onComplete:followClubRevokeModerator(uid)}; 													
	var myAjax = new Ajax.Request(url, options);
}

function followClubRevokeModerator(uid) {

	switchElements('mod_' + uid, 'demod_' + uid);
	switchElements('admin_' + uid, 'deadmin_' + uid);
	$('member_' + uid).innerHTML = 'Mitglied';
	
}


function clubGrantModerator(cid,uid) {
	
	var url = 'actionEditMemberInClub.php';
	var qstr = 
		"user_id=" + uid +
		"&club_id=" + cid +
		"&action=addmod" +
		"&nocache="+new Date().getTime();
	
	var options = {method:'post', parameters:qstr,onComplete:followClubGrantModerator(uid)}; 													
	var myAjax = new Ajax.Request(url, options);
}

function followClubGrantModerator(uid) {

	switchElements('demod_' + uid, 'mod_' + uid);
	switchElements('admin_' + uid, 'deadmin_' + uid);
	$('member_' + uid).innerHTML = 'Moderator';
	
}

// ************

function clubRevokeAdministrator(cid,uid) {
	
	var url = 'actionEditMemberInClub.php';
	var qstr = 
		"user_id=" + uid +
		"&club_id=" + cid +
		"&action=deadmin" +
		"&nocache="+new Date().getTime();
	
	var options = {method:'post', parameters:qstr,onComplete:followClubRevokeAdministrator(uid)}; 													
	var myAjax = new Ajax.Request(url, options);
}

function followClubRevokeAdministrator(uid) {

	switchElements('mod_' + uid, 'demod_' + uid);
	switchElements('admin_' + uid, 'deadmin_' + uid);
	
	$('member_' + uid).innerHTML = 'Mitglied';
	
}


function clubGrantAdministrator(cid,uid) {
	
	var url = 'actionEditMemberInClub.php';
	var qstr = 
		"user_id=" + uid +
		"&club_id=" + cid +
		"&action=addadmin" +
		"&nocache="+new Date().getTime();
	
	var options = {method:'post', parameters:qstr,onComplete:followClubGrantAdministrator(uid)}; 													
	var myAjax = new Ajax.Request(url, options);
}

function followClubGrantAdministrator(uid) {

	switchElements('demod_' + uid, 'mod_' + uid);
	switchElements('deadmin_' + uid, 'admin_' + uid);
	hideElement('demod_' + uid);
	hideElement('mod_' + uid);
	$('member_' + uid).innerHTML = 'Administrator';
	
}

// ************

function clubActivateUser(cid,uid) {
	
	var url = 'actionEditMemberInClub.php';
	var qstr = 
		"user_id=" + uid +
		"&club_id=" + cid +
		"&action=act" +
		"&nocache="+new Date().getTime();
	
	var options = {method:'post', parameters:qstr,onComplete:followClubActivateUser(uid)}; 													
	var myAjax = new Ajax.Request(url, options);
}

function followClubActivateUser(uid) {
	
	switchElements('deact_' + uid, 'act_' + uid);
	switchElements('mod_' + uid, 'demod_' + uid);
	switchElements('admin_' + uid, 'deadmin_' + uid);
	$('member_' + uid).innerHTML = 'Mitglied';
	
}


function clubDeactivateUser(cid,uid) {
	
	var url = 'actionEditMemberInClub.php';
	var qstr = 
		"user_id=" + uid +
		"&club_id=" + cid +
		"&action=deact" +
		"&nocache="+new Date().getTime();
	
	var options = {method:'post', parameters:qstr,onComplete:followClubDeactivateUser(uid)}; 													
	var myAjax = new Ajax.Request(url, options);
}

function followClubDeactivateUser(uid) {
	
	switchElements('act_' + uid,'deact_' + uid)
	hideElement('mod_' + uid);
	hideElement('demod_' + uid);
	hideElement('admin_' + uid);
	hideElement('deadmin_' + uid);
	$('member_' + uid).innerHTML = 'Deaktiviert';
	
	
}

// ************

function clubDeleteUser(cid,uid){

	var url = 'actionDeleteMemberInClub.php';
	var qstr = 
		"user_id=" + uid +
		"&club_id=" + cid +
		"&nocache="+new Date().getTime();
	
	var options = {method:'post', parameters:qstr,onComplete:followDeleteUser(uid)}; 													
	var myAjax = new Ajax.Request(url, options);

}

function followDeleteUser(uid){

	hideElement('act_' + uid);
	hideElement('deact_' + uid);
	hideElement('del_' + uid);
	hideElement('mod_' + uid);
	hideElement('demod_' + uid);
	hideElement('admin_' + uid);
	hideElement('deadmin_' + uid);
	
	$('member_' + uid).innerHTML = 'Gel&ouml;scht';

}

// ***********************************************************************
// END: CLUB MANAGEMENT
// ***********************************************************************




// ***********************************************************************
// BEG: CHECK VIDEO PROGRESS
// profile_addvideo.tpl
// ***********************************************************************


function checkVideoProgress(clubVideo) {	
	
	var userVideo = true;
	
	// php function to save content   followCheckVideoProgress(vid)
	if(typeof clubVideo != "undefined"){
		userVideo = false;
	}
	
	var qstr = 
		"?nocache="+new Date().getTime();
	var url = 'actionCheckVideoUpload.php' + qstr;
	
	// ***AJAX***	
	var myAjax = new Ajax.PeriodicalUpdater('debug', url, {frequency:10, onSuccess: followCheckVideoProgress });


	function followCheckVideoProgress (req) {
		
		if(req.responseText != "") {
			//window.location.href = "profile_detailvideo.php?vid=" + req.responseText;
			
			if(userVideo){
				window.location.href = "profile_videos.php?vid=" + req.responseText;
			} else {
				window.location.href = "club_detailphoto.php?cid=" + clubVideo + "&vid=" + req.responseText;
			}
			$('upload').innerHTML = 'Fertig';
		} else {
			// $('upload').innerHTML = 'Einen Moment, Ihr Video wird verarbeitet...';
		}
			
	}
}

// ***********************************************************************
// END: CHECK VIDEO PROGRESS
// ***********************************************************************

// ***********************************************************************
// BEG: ADD COMMENT
// comments.tpl
// ***********************************************************************

function addComment(text, pid, entry_id, host_uid, guest_uid, name) {	
	
	var qstr = 
		"?nocache="+new Date().getTime();
	var url = 'actionAddComment.php' + qstr;
	var options = {
		method:'post',
		postBody: "message="+text+"&pid="+pid+"&entry_id="+entry_id+"&host_uid="+host_uid+"&guest_uid="+guest_uid+"&name="+name,
		onSuccess: followAddComment
	}
	// ***AJAX***	
	var myAjax = new Ajax.Request(url, options);

}

function followAddComment (req) {
	
	$('comments').innerHTML = '';
	$('comments').innerHTML = req.responseText;
		
}
// ***********************************************************************
// END: ADD COMMENT
// ***********************************************************************


// ***********************************************************************
// BEG: DELETE COMMENT
// comments.tpl
// ***********************************************************************

function deleteComment(cid, pid, entry_id) {	
	
	var qstr = 
		"?nocache="+new Date().getTime();
	var url = 'actionDeleteComment.php' + qstr;
	var options = {
		method:'post',
		postBody: "pid="+pid+"&entry_id="+entry_id+"&cid="+cid,
		onSuccess: followDeleteComment
	}
	// ***AJAX***	
	var myAjax = new Ajax.Request(url, options);

}

function followDeleteComment (req) {
	
	$('comments').innerHTML = '';
	$('comments').innerHTML = req.responseText;
		
}
// ***********************************************************************
// END: DELETE COMMENT
// ***********************************************************************


// ***********************************************************************
// BEG: NEW CAPTCHA
// All Forms
// ***********************************************************************

function newCaptcha(form_name) {	
	
	img_id = 'captcha'; // The ID of the Captcha Image
	
	$(img_id).src = 'captcha.php?n='+form_name;
	
}

// ***********************************************************************
// END: NEW CAPTCHA
// ***********************************************************************

// ***********************************************************************
// BEG: SAVE PERSONAL NOTE
// profile_personaldata.tpl
// ***********************************************************************

function savePersonalNote(user_id,replace_id) {
	
	// content of textarea
	var note = $(replace_id).value;
	
	// alert(note);
	
	// php function to save content
	var url = 'actionSavePersonalNote.php';
	var qstr = 
	
		"uid=" + user_id +
		"&note=" + note +
		"&nocache="+new Date().getTime();
	
	// ***AJAX***
	var options = {method:'post', parameters:qstr,onComplete:followSavePersonalNote}; 													
	var myAjax = new Ajax.Request(url, options);			

}

function followSavePersonalNote() {

	// change link under textarea
	switchElements('done_link','save_link');

}
// ***********************************************************************
// END: SAVE PERSONAL NOTE
// ***********************************************************************	

// ***********************************************************************
// BEG: BE MEMBER IN CLUB
// clubs/profile.tpl
// ***********************************************************************

function beMemberInClub(form) {

	var notifier = function(t){
			//alert(t.responseText);
			if(t.responseText == "joined" || t.responseText == "pending"){
				window.location.reload();
			}
			else {
				if(t.responseText == "denied"){
					showElement('div_denied_message_container');
				}
				else{
					showElement('div_error_message_container');
				}
				hideElement('club_member_big');
				hideElement('club_member_small');
			}
	}
	// php function to save content
	var url = 'actionBeMemberInClub.php';
	var qstr = 
	
		Form.serialize((document.forms[form])) +
		"&nocache="+new Date().getTime();
	
	// ***AJAX***
	var options = {method:'post', parameters:qstr, onComplete:notifier}; 													
	var myAjax = new Ajax.Request(url, options);			

}
// ***********************************************************************
// END: BE MEMBER IN CLUB
// ***********************************************************************	

// ***********************************************************************
// BEG: DELETE MEMBER IN CLUB
// clubs/profile.tpl
// ***********************************************************************

function deleteMemberInClub(club_id, user_id) {

	// php function
	var url = 'actionDeleteMemberInClub.php';
	var qstr = 
	
		"club_id=" + club_id +
		"&user_id=" + user_id +
		"&nocache="+new Date().getTime();
	
	// ***AJAX***
	var options = {method:'post', parameters:qstr,onComplete:followDeleteMemberInClub}; 													
	var myAjax = new Ajax.Request(url, options);			

}

function followDeleteMemberInClub(t) {
	if(t.responseText == "success"){
		// change link under textarea
		window.location.reload();
	}
	else {
		if(t.responseText == "admin"){
			showElement('div_admin_message_container');
		}
		else{
			showElement('div_error_message_container');
		}
	}
}

// ***********************************************************************
// END: DELETE MEMBER IN CLUB
// ***********************************************************************	

// ***********************************************************************
// BEG: FRIEND REQUEST
// profile_personaldata.tpl (Outside View)
// ***********************************************************************

function saveFriendRequest(host_id,guest_id,page) {
	
	// php function to save content
	var url = 'actionSaveFriendRequest.php';
	
	var qstr = 
	
		"host_id=" + host_id +
		"&guest_id=" + guest_id +
		"&page=" + page +
		"&nocache="+new Date().getTime();
	
	//alert(qstr);
	
	
	
	// ***AJAX***	
	var options = {method:'post', parameters:qstr, onComplete:followSaveFriendRequest(guest_id,page)}; 													
	var myAjax = new Ajax.Request(url, options);			
 return true;
}


function deleteFriendFromList(friendship_id, forname) {
	
	// php function to delete content
	var url = 'actionDeleteFriend.php';
	var qstr = 
	
		"friendship_id=" + friendship_id +
		"&nocache="+new Date().getTime();
	
	// ***AJAX***	
	var options = {method:'post', parameters:qstr,onComplete:followDeleteFriendFromList(forname)}; 													
	var myAjax = new Ajax.Request(url, options);	
}

function followDeleteFriendFromList(forname){
	document.getElementById('delete_message').innerHTML = forname + " wurde von deiner Freundesliste entfernt.";
}


function followSaveFriendRequest(guest_id,page) {
	
	if (page == 'profile') {
	
		//switchElements('pending_button','request_button');
		//new Effect.SlideUp('request_button');
		//new Effect.SlideDown('pending_button', { queue: 'end'});
	
	} else {
	
		if(guest_id != "") { 
			/*var requests = document.getElementsById('request_button_'+guest_id);
			var pendings = document.getElementsById('pending_button_'+guest_id);
			pendings.style.display = 'block';
			requests.style.display = 'none';*/
			
			//switchElements('pending_button_'+guest_id,'request_button_'+guest_id);
		} else {
		
			// change button view
			//switchElements('pending_button','request_button');
		
		}
	
	}

}
// ***********************************************************************
// END: FRIEND REQUEST
// ***********************************************************************

// ***********************************************************************
// BEG: MULTI FRIEND REQUEST
// search_details.tpl (Outside View)
// ***********************************************************************

function saveMultiFriendRequest(host_id,guest_id) {
	
	// php function to save content
	var url = 'actionSaveFriendRequest.php';
	var qstr = 
	
		"host_id=" + host_id +
		"&guest_id=" + guest_id +
		"&nocache="+new Date().getTime();
	
	// ***AJAX***	
	var options = {method:'post', parameters:qstr,onComplete:followSaveMultiFriendRequest(guest_id)}; 													
	var myAjax = new Ajax.Request(url, options);			

}

function followSaveMultiFriendRequest(guest_id) {

	// change link under textarea
	requests = document.getElementsByName('request_button_'+guest_id);
	pendings = document.getElementsByName('pending_button_'+guest_id);

	for(var i=0; i<=requests.length;i++) { 
		if(requests[i]) {
			requests[i].style.display = 'none';
		}
		if(pendings[i]) {
			pendings[i].style.display = 'block';
		}
	}
}
// ***********************************************************************
// END: MULTI FRIEND REQUEST
// ***********************************************************************

// ***********************************************************************
// BEG: ADD FRIEND after REQUEST
// startseite.tpl
// ***********************************************************************

function addFriendAfterRequest(host_id,guest_id,request_id,message_id,trigger) {
	
	// php function to save content
	var url = 'actionAddFriendAfterRequest.php';
	var qstr = 
	
		"host_id=" + host_id +
		"&guest_id=" + guest_id +
		"&message_id=" + message_id +
		"&nocache="+new Date().getTime();
	
	// ***AJAX***	
	var options = {method:'post', parameters:qstr,onComplete:setTimeout(function() { followAddFriendAfterRequest(request_id,message_id,trigger) },1000)}; 													
	var myAjax = new Ajax.Request(url, options);			

}

function followAddFriendAfterRequest(request_id,message_id,trigger) {
	
	// delete friend requests
	deleteFriendRequest(request_id,message_id,trigger);
	
}
// ***********************************************************************
// END: ADD FRIEND after REQUEST
// ***********************************************************************

// ***********************************************************************
// BEG: DELETE FRIEND REQUEST after ADD/DECLINE  
// startseite.tpl
// ***********************************************************************

function deleteFriendRequest(request_id,message_id,trigger) {
	
	// alert('Deleting Friend Request');
	
	// php function to save content
	var url = 'actionDeleteFriendRequest.php';
	var qstr = 
	
		"request_id=" + request_id +
		"&message_id=" + message_id +
		"&nocache="+new Date().getTime();
	
	// ***AJAX***	
	var options = {method:'post', parameters:qstr,onComplete:setTimeout(function() { followDeleteFriendRequest(request_id,trigger) },1000)}; 													
	var myAjax = new Ajax.Request(url, options);			

}

function followDeleteFriendRequest(request_id,trigger) {

	// alert('Switching DIVs: ' + request_id);

	if (trigger == 'yes') {

		switchElements('confirm_' + request_id, 'friend_request_buttons');

		// redirect to friends view
		setTimeout("window.location.href='profile_friends.php'",1000);

	} else if (trigger == 'no') {
	
		switchElements('decline_' + request_id, 'friend_request_buttons');
		
		// redirect to messages
		setTimeout("window.location.href='mysite_inbox.php'",1000);
	
	}

}

// ***********************************************************************
// END: DELETE FRIEND REQUEST after ADD/DECLINE 
// ***********************************************************************

// ***********************************************************************
// BEG: DELETE FRIEND 
// startseite.tpl
// ***********************************************************************

function deleteFriend(friendship_id) {
	
	// php function to delete content
	var url = 'actionDeleteFriend.php';
	var qstr = 
	
		"friendship_id=" + friendship_id +
		"&nocache="+new Date().getTime();
	
	// ***AJAX***	
	var options = {method:'post', parameters:qstr,onComplete:followDeleteFriend(friendship_id)}; 													
	var myAjax = new Ajax.Request(url, options);			

}

function followDeleteFriend(friendship_id) {

	// alert('Switching DIVs: ' + request_id);
	hideElement('friend_' + friendship_id);
	
}

// ***********************************************************************
// END: DELETE FRIEND 
// ***********************************************************************

// ***********************************************************************
// BEG: DELETE CAREER ENTRY 
// profile_career.tpl
// ***********************************************************************

function deleteCareerEntry(id) {
	
	// php function to delete content
	var url = 'actionDeleteCareerEntry.php';
	var qstr = 
	
		"id=" + id +
		"&nocache="+new Date().getTime();
	
	// ***AJAX***	
	var options = {method:'post', parameters:qstr,onComplete:followDeleteCareerEntry(id)}; 													
	var myAjax = new Ajax.Request(url, options);			

}

function followDeleteCareerEntry(id) {

	// alert('Switching DIVs: ' + request_id);
	hideElement('entry_' + id);
	
}

// ***********************************************************************
// END: DELETE FRIEND 
// ***********************************************************************

// ***********************************************************************
// BEG: DELETE ACHIEVEMENT ENTRY 
// ***********************************************************************

function deleteAchievementEntry(id) {
	
	// php function to delete content
	var url = 'actionDeleteAchievementEntry.php';
	var qstr = 
	
		"id=" + id +
		"&nocache="+new Date().getTime();
	
	// ***AJAX***	
	var options = {method:'post', parameters:qstr,onComplete:followDeleteAchievementEntry(id)}; 													
	var myAjax = new Ajax.Request(url, options);			

}

function followDeleteAchievementEntry(id) {

	// alert('Switching DIVs: ' + request_id);
	hideElement('entry_' + id);
	
}

// ***********************************************************************
// END: DELETE ACHIEVEMENT 
// ***********************************************************************

// ***********************************************************************
// BEG: DELETE CLUB ACHIEVEMENT ENTRY 
// ***********************************************************************

function deleteClubAchievementEntry(id) {
	
	// php function to delete content
	var url = 'actionDeleteClubAchievementEntry.php';
	var qstr = 
	
		"id=" + id +
		"&nocache="+new Date().getTime();
	
	// ***AJAX***	
	var options = {method:'post', parameters:qstr,onComplete:followDeleteAchievementEntry(id)}; 													
	var myAjax = new Ajax.Request(url, options);			

}

// ***********************************************************************
// END: DELETE CLUB ACHIEVEMENT 
// ***********************************************************************




// ***********************************************************************
// BEG: DELETE CONTACT 
// mailbox_details.tpl
// ***********************************************************************

function deleteContact(host_uid, uid) {
	
	// php function to save content
	var url = 'actionDeleteContact.php';
	var qstr = 
	
		"host_uid=" + host_uid +
		"&guest_uid=" + uid +
		"&nocache="+new Date().getTime();
	
	// ***AJAX***	
	var options = {method:'post', parameters:qstr,onComplete:followDeleteContact()}; 													
	var myAjax = new Ajax.Request(url, options);			

}

function followDeleteContact() {

	// alert('Switching DIVs: ' + request_id);
	hideElement('deleteContact');
	showElement('deletedContact');

}

// ***********************************************************************
// END: DELETE CONTACT 
// ***********************************************************************

// ***********************************************************************
// BEG: REGISTER ABUSE
// mailbox_details.tpl
// ***********************************************************************

function registerAbuse(mid) {
	
	// php function to save content
	var url = 'actionRegisterAbuse.php';
	var qstr = 
	
		"mid=" + mid +
		"&nocache="+new Date().getTime();
	
	// ***AJAX***	
	var options = {method:'post', parameters:qstr,onComplete:followRegisterAbuse()}; 													
	var myAjax = new Ajax.Request(url, options);			

}

function followRegisterAbuse() {

	// alert('Switching DIVs: ' + request_id);
	hideElement('registerAbuse');
	showElement('registeredAbuse');

}

// ***********************************************************************
// END: REGISTER ABUSE
// ***********************************************************************

// ***********************************************************************
// BEG: DEAL WITH USER IN GROUP
// new_groups_editmembers.tpl
// ***********************************************************************

function dealWithUserInGroup(uid,gid,action) {
	
	// php function to save content
	var url = 'actionDealWithUserInGroup.php';
	var qstr = 
	
		"uid=" + uid +
		"&gid=" + gid +
		"&action=" + action +
		"&nocache="+new Date().getTime();
	
	// ***AJAX***	
	var options = {method:'post', parameters:qstr,onComplete:followDealWithUserInGroup(uid,action)}; 													
	var myAjax = new Ajax.Request(url, options);			

}

function followDealWithUserInGroup(uid,action) {

	// alert('Hi!');
	if (action == 2) {
	
		switchElements('deal_on_2_' + uid,'deal_off_' + uid);
	
	} else if (action == 3) {
	
		switchElements('deal_on_3_' + uid,'deal_off_' + uid);
	
	} else if (action == 1) {
	
		if ($('deal_on_2_' + uid).style.display == 'block') {
		
			switchElements('deal_off_' + uid,'deal_on_2_' + uid);
		
		} else {
		
			switchElements('deal_off_' + uid,'deal_on_3_' + uid);
		
		}
	
	}

}

// ***********************************************************************
// END: DEAL WITH USER IN GROUP
// ***********************************************************************

// ***********************************************************************
// BEG: CHANGE ADMIN LEVEL IN GROUP
// new_groups_editmembers.tpl
// ***********************************************************************

function changeAdminLevelInGroup(uid,gid,level) {
	
	// php function to save content
	var url = 'actionChangeAdminLevelInGroup.php';
	var qstr = 
	
		"uid=" + uid +
		"&gid=" + gid +
		"&level=" + level +
		"&nocache="+new Date().getTime();
	
	// ***AJAX***	
	var options = {method:'post', parameters:qstr,onComplete:followChangeAdminLevelInGroup(uid,level)}; 													
	var myAjax = new Ajax.Request(url, options);			

}

function followChangeAdminLevelInGroup(uid,level) {

	if (level == 1) {
	
		switchElements('deal_on_admin_' + uid,'deal_off_' + uid);
	
	} else {
	
		hideElement('deal_on_admin_' + uid);
		followDealWithUserInGroup(uid,1);
	
	}

}

// ***********************************************************************
// END: CHANGE ADMIN LEVEL IN GROUP
// ***********************************************************************

// ***********************************************************************
// BEG: SAVE CLUB CANJOIN SETTINGS 
// clubs/settings.tpl
// ***********************************************************************

function saveCanjoinSettings(cid,button) {
	
	// checkbox #1
	
	var radio = document.getElementsByName('canjoin');
	
	for (i=0;i<radio.length;i++) {
	
		if (radio[i].checked == true) {
		
			var setting = radio[i].value;
		
		}
	
	}
	
	// alert(setting);
	
	// php function to save content
	var url = 'actionSaveCanjoinSettings.php';
	var qstr = 
	
		"cid=" + cid +
		"&setting=" + setting +
		"&nocache="+new Date().getTime();
	
	// ***AJAX***	
	var options = {method:'post', parameters:qstr,onComplete:followSaveCanjoinSettings(button)}; 													
	var myAjax = new Ajax.Request(url, options);			

}

function followSaveCanjoinSettings(button) {

	deactivateButton('send' + button);
	deactivateButton('cancel' + button);

}

// ***********************************************************************
// END: SAVE CLUB CANJOIN SETTINGS  
// ***********************************************************************

// ***********************************************************************
// BEG: SAVE CLUB CANEDIT SETTINGS 
// clubs/settings.tpl
// ***********************************************************************

function saveCaneditSettings(cid,button) {
	
	// checkbox #1
	var radio = document.getElementsByName('canedit');
	
	for (i=0;i<radio.length;i++) {
	
		if (radio[i].checked == true) {
		
			var setting = radio[i].value;
		
		}
	
	}
	
	// alert(setting);
	
	// php function to save content
	var url = 'actionSaveCaneditSettings.php';
	var qstr = 
	
		"cid=" + cid +
		"&setting=" + setting +
		"&nocache="+new Date().getTime();
	
	// ***AJAX***	
	var options = {method:'post', parameters:qstr,onComplete:followSaveCaneditSettings(button)}; 													
	var myAjax = new Ajax.Request(url, options);			

}

function followSaveCaneditSettings(button) {

	//deactivateButton('send' + button);
	//deactivateButton('cancel' + button);	
	//showElement("success_canedit");
	new Effect.Appear('success_canedit');
	new Effect.Fade('success_canedit', { delay: 5});

}

// ***********************************************************************
// END: SAVE CLUB CANEDIT SETTINGS  
// ***********************************************************************

// ***********************************************************************
// BEG: SAVE CLUB CANACTIVATE SETTINGS 
// clubs/settings.tpl
// ***********************************************************************

function saveCanactivateSettings(cid,button) {
	
	// checkbox #1
	
	var radio = document.getElementsByName('canactivate');
	
	for (i=0;i<radio.length;i++) {
	
		if (radio[i].checked == true) {
		
			var setting = radio[i].value;
		
		}
	
	}
	
	// alert(setting);
	
	// php function to save content
	var url = 'actionSaveCanactivateSettings.php';
	var qstr = 
	
		"cid=" + cid +
		"&setting=" + setting +
		"&nocache="+new Date().getTime();
	
	// ***AJAX***	
	var options = {method:'post', parameters:qstr,onComplete:followSaveCanactivateSettings(button)}; 													
	var myAjax = new Ajax.Request(url, options);			

}

function followSaveCanactivateSettings(button) {

	//deactivateButton('send' + button);
	//deactivateButton('cancel' + button);	
	//showElement("success_auser");
	new Effect.Appear('success_auser');
	new Effect.Fade('success_auser', { delay: 5});

}

// ***********************************************************************
// END: SAVE CLUB CANACTIVATE SETTINGS  
// ***********************************************************************

// ***********************************************************************
// BEG: SAVE PRIVACY SETTINGS 
// profile_privacy.tpl
// ***********************************************************************

function savePrivacySettings(uid,button) {
	
	// checkbox #1
	
	var radio = document.getElementsByName('privacy');
	
	for (i=0;i<radio.length;i++) {
	
		if (radio[i].checked == true) {
		
			var setting = radio[i].value;
		
		}
	}
	
	// alert(setting);
	
	// php function to save content
	var url = 'actionSavePrivacySettings.php';
	var qstr = 
	
		"uid=" + uid +
		"&setting=" + setting +
		"&nocache="+new Date().getTime();
	
	// ***AJAX***	
	var options = {method:'post', parameters:qstr,onComplete:followSavePrivacySettings(button)}; 													
	var myAjax = new Ajax.Request(url, options);			

}

function followSavePrivacySettings(button) {

	deactivateButton('send' + button);
	//showElement('success_message');
	new Effect.Appear('success_message');
	new Effect.Fade('success_message', { delay: 5});
}

// ***********************************************************************
// END: SAVE PRIVACY SETTINGS  
// ***********************************************************************

// ***********************************************************************
// BEG: SAVE FOOTPRINTS SETTINGS 
// profile_privacy.tpl
// ***********************************************************************

function saveFootprintsSettings(uid,button) {
	
	// checkbox #1
	
	var radio = document.getElementsByName('footprints');
	
	for (i=0;i<radio.length;i++) {
	
		if (radio[i].checked == true) {
		
			var setting = radio[i].value;
		
		}
	
	}
	
	// alert(setting);
	
	// php function to save content
	var url = 'actionSaveFootprintsSettings.php';
	var qstr = 
	
		"uid=" + uid +
		"&setting=" + setting +
		"&nocache="+new Date().getTime();
	
	// ***AJAX***	
	var options = {method:'post', parameters:qstr,onComplete:followSaveFootprintsSettings(button)}; 													
	var myAjax = new Ajax.Request(url, options);			

}

function followSaveFootprintsSettings(button) {

	deactivateButton('send' + button);
	//showElement('success_footprint');
	new Effect.Appear('success_footprint');
	new Effect.Fade('success_footprint', { delay: 5});

}

// ***********************************************************************
// END: SAVE FOOTPRINTS SETTINGS  
// ***********************************************************************

// ***********************************************************************
// BEG: SAVE FRIEND REQUEST SETTINGS 
// profile_privacy.tpl
// ***********************************************************************

function saveFriendsRequestNotifySettings(uid,button) {
	
	// checkbox #1
	
	var radio = document.getElementsByName('friendsRequestNotify');
	
	for (i=0;i<radio.length;i++) {
	
		if (radio[i].checked == true) {
		
			var setting = radio[i].value;
		
		}
	
	}
	
	// alert(setting);
	
	// php function to save content
	var url = 'actionSaveFriendsRequestNotifySettings.php';
	var qstr = 
	
		"uid=" + uid +
		"&setting=" + setting +
		"&nocache="+new Date().getTime();
	
	// ***AJAX***	
	var options = {method:'post', parameters:qstr,onComplete:followSaveFriendsRequestNotifySettings(button)}; 													
	var myAjax = new Ajax.Request(url, options);			

}

function followSaveFriendsRequestNotifySettings(button) {

	deactivateButton('send' + button);

}

// ***********************************************************************
// END: SAVE FRIEND REQUEST NOTIFY SETTINGS  
// ***********************************************************************


// ***********************************************************************
// BEG: SAVE MAILBOX NOTIFY SETTINGS 
// profile_privacy.tpl
// ***********************************************************************

function saveNewMessageNotifySettings(uid,button) {
	
	// checkbox #1
	
	var radio = document.getElementsByName('newMessageNotify');
	
	for (i=0;i<radio.length;i++) {
	
		if (radio[i].checked == true) {
		
			var setting = radio[i].value;
		
		}
	
	}
	
	// alert(setting);
	
	// php function to save content
	var url = 'actionSaveNewMessageNotifySettings.php';
	var qstr = 
	
		"uid=" + uid +
		"&setting=" + setting +
		"&nocache="+new Date().getTime();
	
	// ***AJAX***	
	var options = {method:'post', parameters:qstr,onComplete:followSaveNewMessageNotifySettings(button)}; 													
	var myAjax = new Ajax.Request(url, options);			

}

function followSaveNewMessageNotifySettings(button) {

	deactivateButton('send' + button);
	//showElement('success_mailmessage');
	new Effect.Appear('success_mailmessage');
	new Effect.Fade('success_mailmessage', { delay: 5});

}

// ***********************************************************************
// END: SAVE MAILBOX NOTIFY SETTINGS  
// ***********************************************************************

// ***********************************************************************
// BEG: SAVE MAILBOX GROUP NOTIFY SETTINGS 
// profile_privacy.tpl
// ***********************************************************************

function saveNewGroupMessageNotifySettings(uid,button) {
	
	// checkbox #1
	
	var radio = document.getElementsByName('newGroupMessageNotify');
	
	for (i=0;i<radio.length;i++) {
	
		if (radio[i].checked == true) {
		
			var setting = radio[i].value;
		
		}
	
	}
	
	// alert(setting);
	
	// php function to save content
	var url = 'actionSaveNewGroupMessageNotifySettings.php';
	var qstr = 
	
		"uid=" + uid +
		"&setting=" + setting +
		"&nocache="+new Date().getTime();
	
	// ***AJAX***	
	var options = {method:'post', parameters:qstr,onComplete:followSaveNewGroupMessageNotifySettings(button)}; 													
	var myAjax = new Ajax.Request(url, options);			

}

function followSaveNewGroupMessageNotifySettings(button) {

	deactivateButton('send' + button);
	//showElement('success_mailgroupmessage');
	new Effect.Appear('success_mailgroupmessage');
	new Effect.Fade('success_mailgroupmessage', { delay: 5});

}

// ***********************************************************************
// END: SAVE MAILBOX GROUP NOTIFY SETTINGS  
// ***********************************************************************


// ***********************************************************************
// BEG: SAVE NEWSLETTER SETTINGS
// profile_privacy.tpl
// ***********************************************************************

function saveNewsletterNotifySettings(uid,button) {
	
	// checkbox #1
	
	var radio = document.getElementsByName('NewsletterNotify');
	
	for (i=0;i<radio.length;i++) {
	
		if (radio[i].checked == true) {
		
			var setting = radio[i].value;
		
		}
	
	}
	
	// alert(setting);
	
	// php function to save content
	var url = 'actionSaveNewsletterSettings.php';
	var qstr = 
	
		"uid=" + uid +
		"&setting=" + setting +
		"&nocache="+new Date().getTime();
	
	// ***AJAX***	
	var options = {method:'post', parameters:qstr,onComplete:followSaveNewsletterNotifySettings(button)}; 													
	var myAjax = new Ajax.Request(url, options);			

}

function followSaveNewsletterNotifySettings(button) {

	deactivateButton('send' + button);
	//showElement('success_newsletter');
	new Effect.Appear('success_newsletter');
	new Effect.Fade('success_newsletter', { delay: 5});
}

// ***********************************************************************
// END: SAVE NEWSLETTER SETTINGS
// ***********************************************************************

// ***********************************************************************
// BEG: GET MORE FORMER CLUBS
// new_sports_soccer.tpl
// ***********************************************************************

function getMoreFormerClubs(current,dir) {
	
	// php function to show new forms
	var url = 'actionGetMoreFormerClubs.php';
	var qstr = 
	
		"current=" + current +
		"&dir=" + dir +
		"&nocache="+new Date().getTime();
	
	// ***AJAX***	
	var options = {method:'post', parameters:qstr}; 													
	var myAjax = new Ajax.Updater({success:'former_clubs'},url, options);			

}

function getAnotherClub(current,dir) {

	if (dir == 'plus') {

		hideElement('link_' + current);
		
		showElement('link_' + (current+1));
		showElement('table_' + (current+1));

	} else if (dir == 'minus') {
		
		showElement('link_' + (current-1));
		showElement('table_' + (current-1));		
		
		$('input_' + current).value = "";
		hideElement('link_' + (current));
		hideElement('table_' + (current));		
	
	}

}

// ***********************************************************************
// END: GET FORMER CLUBS FORMS  
// ***********************************************************************

// ***********************************************************************
// BEG: CHECK REGISTER FORM
// register.tpl
// ***********************************************************************

function checkRegisterEntries() {

	var error_count = 0;
	
	/*
	var illegalChars = /\W/; // allow letters, numbers, and underscores
	
	// check if forename contains illegal characters
	if (illegalChars.test($('username').value)) {
	
		showElement('error_1');
		error_count++;
	
	} else {
	
		hideElement('error_1');
	
	}
	*/
	
	// check if username is empty
	if ($('username').value == "") {
	
		error_count++;
		showElement('error_2');
		showElement('error_2_2');
	
	} else {
	
		hideElement('error_2');
		hideElement('error_2_2');
	
	}
	
	// check if email is empty
	if ($('email').value == "") {
	
		error_count++;
		showElement('error_3');
		showElement('error_3_3');
	
	} else {
	
		hideElement('error_3');
		hideElement('error_3_3');
	
	}
	
	// check if termsofuse is checked
	if ($('termsofuse').checked == false) {
	
		error_count++;
		showElement('error_4');
	
	} else {
	
		hideElement('error_4');
	
	 }
	
	// if error-count is still 0, submit form
	if (error_count == 0) {
	
		document.register_form.submit();		
	
	}		

}

// ***********************************************************************
// END: CHECK REGISTER FORM
// register.tpl
// ***********************************************************************

// ***********************************************************************
// BEG: CHECK SPORTS IN SPORTSELECTION
// sportselection.tpl
// ***********************************************************************

var sport_count = 0;

function checkSports(id) {

	if ($('sport_' + id).checked == true) {
	
		sport_count++;	
		// alert(sport_count + 'dudechecked');
	
	} else {
	
		sport_count--;
		// alert(sport_count + 'dudeunchecked');
	
	}
	
	if (sport_count > 2) {
	
		var total = 61;
	
		var all = document.getElementsByName('sport[]');	
	
		for (i=0;i<all.length;i++) {
		

			if (all[i].checked != true) {	
			
				all[i].disabled = true;
			
			}
			
		
		}
	
	} else if (sport_count < 3) {
	
		var total = 61;
		
		var all = document.getElementsByName('sport[]');	
	
		for (i=0;i<all.length;i++) {
		

			if (all[i].checked != true) {	
			
				all[i].disabled = false;
			
			}
			
		
		}		
	
	}

}

function checkSportSelection() {

	var error_count = 0;
	
	/*
	var illegalChars = /\W/; // allow letters, numbers, and underscores
	*/
	var monthcheck = new Array();
	monthcheck[1]  = 31;
	monthcheck[2]  = 29;
	monthcheck[3]  = 31;
	monthcheck[4]  = 30;
	monthcheck[5]  = 31;
	monthcheck[6]  = 30;
	monthcheck[7]  = 31;
	monthcheck[8]  = 31;
	monthcheck[9]  = 30;
	monthcheck[10] = 31;
	monthcheck[11] = 30;
	monthcheck[12] = 31;
	// check if at least 1 sport selected
	if (sport_count == 0) {
	
		showElement('error_5');
		error_count++;
	
	} else {
	
		hideElement('error_5');
	
	}
	
	// check if forename is empty
	if ($('forename').value == "") {
	
		showElement('error_1');
		error_count++;
	
	} else {
	
		hideElement('error_1');
	
	}
	
	// check if surname is empty
	if ($('surname').value == "") {
	
		showElement('error_2');
		error_count++;
	
	} else {
	
		hideElement('error_2');
	
	}
	
	if ($('city').value == "" || $('zipcode').value == "") {
	
		showElement('error_6');
		error_count++;
	
	} else {
	
		hideElement('error_6');
	
	}
	
	if(parseInt($('day').value) > monthcheck[parseInt($('month').value)]){
	
		showElement('error_7');
		error_count++;
	
	} else {
	
		hideElement('error_7');
	
	}
	/*
	// check if forename contains illegal characters
	if (illegalChars.test($('forename').value)) {
	
		showElement('error_3');
		error_count++;
	
	} else {
	
		hideElement('error_3');
	
	}
	
	// check if surname contains illegal characters
	if (illegalChars.test($('surname').value)) {
	
		showElement('error_4');
		error_count++;
	
	} else {
	
		hideElement('error_4');
	
	}
	*/	
	
	// if error-count is still 0, submit form
	if (error_count == 0) {
	
		document.sportselection_form.submit();		
	
	}	

}

// ***********************************************************************
// END: CHECK SPORTS IN SPORTSELECTION
// ***********************************************************************

// ***********************************************************************
// BEG: VALIDATE PASSWORD
// profile_preferences.tpl
// ***********************************************************************
function validatePassword() {

	var oldpass 		= $('oldpass').value;
	//var oldpass_repeat 	= $('oldpass_repeat').value;
	var newpass 		= $('newpass').value;
	var newpass_repeat 	= $('newpass_repeat').value;

	var error_count 	= 0;
	/*
	if (oldpass != "" && oldpass_repeat != "") {

		if (oldpass != oldpass_repeat) {
		
			error_count++;
		
		}
	
	} else {
	
		error_count++;
	
	}
	*/
	if (oldpass != "" /* && oldpass_repeat != ""*/ ) {
	
		if (newpass != newpass_repeat) {
		
			error_count++;
		
		}
	
	} else {
	
		error_count++;
	
	}
	
	if (error_count == 0) {
	
		hideElement('error_5');
		document.getElementById("preferences_form").submit();
	
	} else {
	
		showElement('error_5');
	
	}

}
// ***********************************************************************
// END: VALIDATE PASSWORD
// ***********************************************************************

// ***********************************************************************
// BEG: VALIDATE EMAIL
// profile_preferences.tpl
// ***********************************************************************

function validateEmail() {

	var oldemail 			= $('oldemail').value;
	// var oldemail_repeat 	= $('oldemail_repeat').value;
	var newemail 			= $('newemail').value;
	var newemail_repeat 	= $('newemail_repeat').value;

	var error_count 		= 0;
	/*
	if (oldemail != "" && oldemail_repeat != "") {

		if (oldemail != oldemail_repeat) {
		
			error_count++;
			// alert('1_' + error_count);
		
		}
	
	} else {
	
		error_count++;
		// alert('2' + error_count);
	
	}
	*/
	if (oldemail != "" /* && oldemail_repeat != ""*/) {
	
		if (newemail != newemail_repeat) {
		
			error_count++;
			// alert('3' + error_count);
		
		}
	
	} else {
	
		error_count++;
		// alert('4' + error_count);
	
	}
	
	if (error_count == 0) {
	
		hideElement('error_email5');
		document.email_form.submit();
	
	} else {
	
		showElement('error_email5');
	
	}

}
// ***********************************************************************
// END: VALIDATE EMAIL
// ***********************************************************************

// ***********************************************************************
// BEG: LOAD SWF
// profile_videodetail.tpl
// ***********************************************************************
function loadSWF(video){
	
	document.write('<object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" id="obj1" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" border="0" width="196" height="93">\n');

		document.write('<param name="movie" value="' + video  + '">\n');
		document.write('<param name="quality" value="High">\n');
		document.write('<embed src="flash/flvplayer3.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="obj1" width="196" height="93">\n');

	document.write('</object>\n');

}
// ***********************************************************************
// END: LOAD SWF
// profile_videodetail.tpl
// ***********************************************************************


// ***********************************************************************
// BEG: GET RATING
// Videos / Photos
// ***********************************************************************

function getRating(table, id) {
	
	// php function to save content
	var url = 'actionGetRating.php';
	var qstr = 
	
		"table=" + table +
		"&id=" + id +
		"&nocache="+new Date().getTime();
	
	// ***AJAX***	
	var options = {method:'post', parameters:qstr}; 													
	var myAjax = new Ajax.Request(url, options);			

}

// ***********************************************************************
// END: GET RATING
// ***********************************************************************

// ***********************************************************************
// BEG: DO RATING
// Videos / Photos
// ***********************************************************************

function doRating(table, id, rating) {
	
	// php function to save content
	var url = 'actionDoRating.php';
	var qstr = 
	
		"table=" + table +
		"&id=" + id +
		"&rating=" + rating +
		"&nocache="+new Date().getTime();
	
	// ***AJAX***	
	var options = {method:'post', parameters:qstr,onComplete:followDoRating}; 													
	var myAjax = new Ajax.Request(url, options);			

}

function followDoRating(text) {
	var ret = text.responseText;
	
	$('rating_1').style.cursor = 'default';
	$('rating_2').style.cursor = 'default';
	$('rating_3').style.cursor = 'default';
	$('rating_4').style.cursor = 'default';
	$('rating_5').style.cursor = 'default';
	$('rating_1').click = '';
	$('rating_2').click = '';
	$('rating_3').click = '';
	$('rating_4').click = '';
	$('rating_5').click = '';
	$('finalrating').style.cursor = 'default';
	
	if(ret.indexOf("1") != -1) {
		$('star1').src = "_images/blauer-stern.gif";
		$('star2').src = "_images/blauer-stern-rand.gif";
		$('star3').src = "_images/blauer-stern-rand.gif";
		$('star4').src = "_images/blauer-stern-rand.gif";
		$('star5').src = "_images/blauer-stern-rand.gif";
	}
	else if(ret.indexOf("2") != -1) {
		$('star1').src = "_images/blauer-stern.gif";
		$('star2').src = "_images/blauer-stern.gif";
		$('star3').src = "_images/blauer-stern-rand.gif";
		$('star4').src = "_images/blauer-stern-rand.gif";
		$('star5').src = "_images/blauer-stern-rand.gif";
	}
	else if(ret.indexOf("3") != -1) {
		$('star1').src = "_images/blauer-stern.gif";
		$('star2').src = "_images/blauer-stern.gif";
		$('star3').src = "_images/blauer-stern.gif";
		$('star4').src = "_images/blauer-stern-rand.gif";
		$('star5').src = "_images/blauer-stern-rand.gif";
	}
	else if(ret.indexOf("4") != -1) {
		$('star1').src = "_images/blauer-stern.gif";
		$('star2').src = "_images/blauer-stern.gif";
		$('star3').src = "_images/blauer-stern.gif";
		$('star4').src = "_images/blauer-stern.gif";
		$('star5').src = "_images/blauer-stern-rand.gif";
	}
	else if(ret.indexOf("5") != -1) {
		$('star1').src = "_images/blauer-stern.gif";
		$('star2').src = "_images/blauer-stern.gif";
		$('star3').src = "_images/blauer-stern.gif";
		$('star4').src = "_images/blauer-stern.gif";
		$('star5').src = "_images/blauer-stern.gif";
	}
	
	switchElements('finalrating','singlerating');
	switchElements('currentrating','newrating');
	
}
// ***********************************************************************
// END: DO RATING
// ***********************************************************************

// ***********************************************************************
// BEG: USER ONLINE
// basics/footer.tpl
// ***********************************************************************
/*
window.onload = function() {
	getUserOnline();
}

function getUserOnline() {
	var url = 'actionGetUserOnline.php';
	var myAjax = new Ajax.Updater('useronline', url, {frequency:10});
}
*/
// ***********************************************************************
// END: USER ONLINE
// ***********************************************************************

// ***********************************************************************
// BEG: USER ONLINE
// basics/footer.tpl
// ***********************************************************************
function classifiedsSelectionChange() {
	if ($F('classifiedsSid')>0) {
		getClassifiedsCategories($F('classifiedsSid'));
		$('classifiedsCatContainer').innerHtml = '';
		$('classifiedsCatContainer').style.display = '';
		$('classifiedsCatMsg').style.display = 'none';
	} else {
		$('classifiedsCatMsg').style.display = '';
		$('classifiedsCatContainer').style.display = 'none';
	}
}
function getClassifiedsCategories(sid) {

	// php function to show new forms
	var url = 'actionGetClassifiedsCategories.php';
	var qstr = 
	
		"sid=" + sid +
		"&nocache="+new Date().getTime();
	
	// ***AJAX***	
	var options = {method:'post', parameters:qstr}; 													
	var myAjax = new Ajax.Updater({success:'classifiedsCatContainer'},url, options);			

}
// ***********************************************************************
// END: USER ONLINE
// ***********************************************************************



// ***********************************************************************
// BEG: CLUB MANAGEMENT
// clubs/manage.tpl
// ***********************************************************************





// ***********************************************************************
// BEG: FRIEND IMAGE LINKS
// profile/profile_videos.tpl
// ***********************************************************************

function saveFriendImageLink(uid, from_uid, x, y, PID) {


	
	// php function to save content
	var url = 'actionSaveFriendImageLink.php';
	var qstr = 	
		"uid=" + uid +
		"&from_uid=" + from_uid +
		"&x=" + x +
		"&y=" + y +
		"&PID=" + PID;
 	
	// ***AJAX***
	var options = {method:'post', parameters:qstr}; 													
	var myAjax = new Ajax.Request(url, options);			

}

function deleteFriendImageLink(uid, PID) {

	// php function to delete link
	var url = 'actionDeleteFriendImageLink.php';
	var qstr = 	
		"uid=" + uid +
		"&PID=" + PID;
 	
	// ***AJAX***
	var options = {method:'post', parameters:qstr}; 													
	var myAjax = new Ajax.Request(url, options);	

}

function checkLastFriendImageLink(PID) {

	// php function to delete link
	var url = 'actionCheckLastFriendImageLink.php';
	var qstr = 	
		"PID=" + PID;
 	
	// ***AJAX***
	var options = {method:'post', parameters:qstr, onComplete: followCheckLink}; 													
	var myAjax = new Ajax.Request(url, options);
}
 
function followCheckLink(req) {
	
	if (req.responseText == 0) {
		document.getElementById('linkEntfernenHolder').style.display = 'none';
		document.getElementById('bearbeitenAbbrechenHolder').style.display = 'none';
	}
	
}

function getPersonById(uid) {

	var url = 'actionGetUser.php';
	var qstr = 'uid=' + uid;
	
	var options = {method:'post', parameters:qstr, onSuccess: followGetPerson}; 													
		
	var myAjax =  new Ajax.Request(url, options);
}

function followGetPerson(req) {
	document.getElementById('friendInfoHolder').innerHTML += req.responseText;	
}


// ***********************************************************************
// END: FRIEND IMAGE LINKS
// ***********************************************************************


// ***********************************************************************
// BEG: CLUB IMAGE LINKS
// club/club_detailphoto.tpl
// ***********************************************************************

function saveClubImageLink(uid, from_uid, x, y, PID, cid) {


	
	// php function to save content
	var url = 'actionSaveClubImageLink.php';
	var qstr = 	
		"uid=" + uid +
		"&from_uid=" + from_uid +
		"&x=" + x +
		"&y=" + y +
		"&PID=" + PID +
		"&cid=" + cid;
 	
	// ***AJAX***
	var options = {method:'post', parameters:qstr}; 													
	var myAjax = new Ajax.Request(url, options);			

}

function deleteClubImageLink(uid, PID) {

	// php function to delete link
	var url = 'actionDeleteClubImageLink.php';
	var qstr = 	
		"uid=" + uid +
		"&PID=" + PID;
 	
	// ***AJAX***
	var options = {method:'post', parameters:qstr}; 													
	var myAjax = new Ajax.Request(url, options);	

}

function checkLastClubImageLink(PID) {

	// php function to delete link
	var url = 'actionCheckLastClubImageLink.php';
	var qstr = 	
		"PID=" + PID;
 	
	// ***AJAX***
	var options = {method:'post', parameters:qstr, onComplete: followCheckLink}; 													
	var myAjax = new Ajax.Request(url, options);
}
 
function followCheckLink(req) {
	
	if (req.responseText == 0) {
		document.getElementById('linkEntfernenHolder').style.display = 'none';
		document.getElementById('bearbeitenAbbrechenHolder').style.display = 'none';
	}
	
}

function getPersonById(uid) {

	var url = 'actionGetUser.php';
	var qstr = 'uid=' + uid;
	
	var options = {method:'post', parameters:qstr, onSuccess: followGetPerson}; 													
		
	var myAjax =  new Ajax.Request(url, options);
}

function followGetPerson(req) {
	document.getElementById('friendInfoHolder').innerHTML += req.responseText;	
}


// ***********************************************************************
// END: CLUB IMAGE LINKS
// ***********************************************************************




// ***********************************************************************
// BEG: SAVE ACTIVITY
// everywhere
// ***********************************************************************

function saveActivity(type) {

	// activity types:
	// 0 = error
	// 1 = clicks
	// 2 = messages
	// 3 = comments
	// 4 = photouploads_profile
	// 5 = videouploads_profile
	// 6 = photouploads_team
	// 7 = videouploads_team
	
	// php function to save content
	var url = 'actionSaveActivity.php';
	var qstr = 	
		"type=" + type +
		"&nocache="+new Date().getTime();
 	
	// ***AJAX***
	var options = {method:'post', parameters:qstr}; 													
	var myAjax = new Ajax.Request(url, options);			

}
// ***********************************************************************
// END: SAVE ACTIVITY
// ***********************************************************************



// ***********************************************************************
// BEG: SAVE ACTIVITY
// everywhere
// ***********************************************************************

function saveUserMap(page_id) {
	
	// php function to save content
	var url = 'actionSaveUserMap.php';
	var qstr = 
	
		"page_id=" + page_id +
		"&nocache="+new Date().getTime();
	
	// ***AJAX***
	var options = {method:'post', parameters:qstr}; 													
	var myAjax = new Ajax.Request(url, options);			

}
// ***********************************************************************


// END: SAVE ACTIVITY
// ***********************************************************************


function checkCookie() {
   setCookie("CookieTest", "OK");
   if (!getCookie("CookieTest")) {
      return false;
   } else {
      eraseCookie("CookieTest");
      return true;
   }
}

function setCookie(name, wert, domain, expires, path, secure){
   var cook = name + "=" + unescape(wert);
   cook += (domain) ? "; domain=" + domain : "";
   cook += (expires) ? "; expires=" + expires : "";
   cook += (path) ? "; path=" + path : "";

   cook += (secure) ? "; secure" : "";
   document.cookie = cook;
}

function getCookie(name) {
	var i=0;  //Suchposition im Cookie
	   var suche = name + "=";
	   while (i<document.cookie.length) {
	   		if (document.cookie.substring(i, i + suche.length) == suche){
	   			var ende = document.cookie.indexOf(";", i + suche.length);	   			
	   			ende = (ende > -1) ? ende :
	   			document.cookie.length;
         var cook = document.cookie.substring(i
            + suche.length, ende);
         return unescape(cook);
         }
      i++;
   }
   return "";
}

function eraseCookie(name, domain, path) {
   var cook="name=; expires=Thu, 01-Jan-70 00:00:01 GMT";
   cook += (domain) ? "domain=" + domain : "";
   cook += (path) ? "path=" + path : "";
   document.cookie = cook;
}
// ***********************************************************************
// BEG: NEWS RATING
// ***********************************************************************		

function rateNews(rating, newsid, newscat) {

	var ausgabe = 'rating: '+rating+', newsid: '+newsid+', newscat: '+newscat;
	
	//alert(ausgabe);
	
	// php function to save content
	var url = 'actionSaveNewsRating.php';
	var qstr = 
	
		"rating=" + rating +
		"&newsid=" + newsid +
		"&newscat="+newscat;
	
	// ***AJAX***	
	//var options = {method:'post', parameters:qstr,onComplete:followSaveNewGroupMessageNotifySettings(button)};
	var options = {method:'post', parameters:qstr, onComplete:followRateNews}; 													
	var myAjax = new Ajax.Request(url, options);			
	
	// === subfunctions =======================
	function followRateNews(req) {
		
		var main_part = req.responseText.split('##########');
	
		if (main_part[0] == "vote_false") {
		
			//alert(main_part[0]);
			new Effect.Appear('rating_error_'+newsid);
			new Effect.Fade('rating_error_'+newsid, { delay: 5});
			new Effect.Appear('lrating_error_'+newsid);
			new Effect.Fade('lrating_error_'+newsid, { delay: 5});
		
		}
		
		var cnt_ratings = main_part[2];
		/*
		if ($('count_ratings').innerHTML != cnt_ratings) {
			$('count_ratings').innerHTML = cnt_ratings;
			if (cnt_ratings == '1') {
				$('count_ratings_word').innerHTML = 'Stimme';
			}else{
				$('count_ratings_word').innerHTML = 'Stimmen';
			}
		}
		*/
		if (main_part[0] == "vote_true") {
			
			var new_rating_ol = main_part[3];
			
			$('newsrating_'+newsid).innerHTML = new_rating_ol;
			$('lnewsrating_'+newsid).innerHTML = new_rating_ol;
			
		}
		
	}
	
	

}


// ***********************************************************************
// END: NEWS RATING
// ***********************************************************************		

