// JavaScript Document for Player DB
function checkBrowser() {
	
	var ua = navigator.userAgent.toLowerCase();
	var iebrowser = (ua.indexOf("msie") > -1 && ua.indexOf("opera") == -1);
	
	return iebrowser;
}

function showMailForm() {
	
	//set div StatusMessage = none
	$("StatusMessage").hide();
	
	var obj = $("WriteMessage");
		
	//Check if Browser = IE and disable features
	if(checkBrowser()) {
		
		obj.style.display = (obj.style.display) ? '' : 'none';
			
		if(obj.style.display == '') {
			
			$("SMessage").focus();
		}
	}
	else {
			
		(obj.style.display) ? new Effect.BlindDown(obj, {duration: 0.7}) : new Effect.BlindUp(obj, {duration: 0.7});
	}
}

function changeMailContent() {
	
	var d = $("StatusMessage");
	
	d.update('Nachricht erfolgreich gesendet.');
	
	if(checkBrowser()) {
	
		d.show();
	}
	else {
		
		new Effect.Appear(d);
	}
	
	//Check if Browser = IE and disable features
	if(checkBrowser()) {
	
		$("WriteMessage").hide();
	}
	else {
		
		new Effect.BlindUp(document.getElementById("WriteMessage"), {duration: 0.7, queue: 'end'});
	}
	
	$("SMessage").value = '';
}


function AJAXSendMessage(email) {
	
	new Ajax.Request("Includes/send_message.php", {
			  parameters: "message=" + encodeURI($("SMessage").value) + "&email=" + encodeURI(email),
		      onCreate: function() {
			    
						  $("StatusMessage").update('<font>wird gesendet...</font>');
			  },
			  onSuccess: changeMailContent
		});
}

function AJAXgetProfile(id) {
	
	new Ajax.Request("Includes/data.php?id="+id, {
		  onCreate: function() {
					   
					   $("MainContent").update('<font>wird geladen...</font>');
		  },
		  onSuccess: function(transport) {
					   
					   if(checkBrowser()) {  
						 
						 $("MainContent").update(transport.responseText);
					   }
					   else {
						
						 var d = $("MainContent");
						 
						 d.hide();
						 d.update(transport.responseText);
						 
						 Effect.Appear('MainContent', { queue: 'end' });
					   }
					 }
	});
}

function highlightTR(myrow, myclass) {
	
	$(myrow).className = myclass;
}

function showLoginBox() {
	
	var obj = $('LoginBox');
	
	//Check if Browser = IE and disable features
	if(checkBrowser()) {
	
		obj.toggle();
	}
	else {
		
		(obj.style.display) ? new Effect.BlindDown(obj, {duration: 0.7}) : new Effect.BlindUp(obj, {duration: 0.7});
	}
}