

function showDetails(id) {
	//alert(id);
	if(id!=0){
		$$('div.details').invoke('hide');
		$('details').show();
		$('details').innerHTML = '<img src="fileadmin/templates/img/ajax-loader.gif">';
		
		new Ajax.Request(
			'index.php?eID=raid',
			{
				method:'post',
				parameters:'detailID='+id,
				onComplete:detail_procRetVal
			}
		);
	}
}

detail_procRetVal = function(retVal) {
	myResponse = retVal.responseText.split('|');
	$('details').innerHTML='';
	$('details').hide();
	$('details').innerHTML = myResponse[1];
	new Effect.BlindDown('details',{duration:0.6});
	
}

anmelden_procRetVal = function(retVal) {
	myResponse = retVal.responseText;
	$('anmelden').innerHTML = myResponse;
	showDetails(raidid);
	
}

function subscribe(id){
	$('anmelden').innerHTML = '<img src="fileadmin/templates/img/ajax-loader.gif">';
	new Ajax.Request(
		'index.php?eID=raid',
		{
			method:'post',
			parameters:'anmeldenID='+id,
			onComplete:anmelden_procRetVal
		}
	);
}

function saveSubscription(raidID){
	new Ajax.Request(
		'index.php?eID=raid',
		{
			method:'post',
			parameters:'savecharID='+$F('selectBox')+'&saveraidID='+raidID,
			onComplete:function(retVal) {
				myResponse = retVal.responseText;
				$('anmelden').innerHTML = myResponse;
				showDetails(raidID);
				$('anmeldung_'+raidID).innerHTML = Number($('anmeldung_'+raidID).innerHTML)+1;
			}
		}
	)
}

function removeChar(charid,raidid) {
	new Ajax.Request(
		'index.php?eID=raid',
		{
			method:'post',
			parameters:'removeChar='+charid+'&removeraidID='+raidid,
			onComplete:
				function(retVal) {
					$('charblock_'+charid).innerHTML = '';
					showDetails(raidid);
					$('anmeldung_'+raidid).innerHTML = Number($('anmeldung_'+raidid).innerHTML)-1;
				}
		}
	)
}
