var ROOT = "http://www.gamessphere.de/";

function NewMenueItem(url, menuename, menue_id, targetlink){
	var color = "";
	
	if (menue_id == 0){
		color = "#c34b3c";
	}
	if (menue_id == 1){
		color = "#54809e";
	}
	if (menue_id == 2){
		color = "#c48d3c";
	}
	if (menue_id == 3){
		color = "#9cc83e";
	}
	if (menue_id == 4){
		color = "#bfb33b";
	}
	if (menue_id == 5){
		color = "#848997";
	}
	if (menue_id == 6){
		color = "#a17eb0";
	}
	
	if (color == ""){
		color = "#ffffff";
	}
	
	if (targetlink == ""){
		return('<span style="color: '+color+'">»</span> <a href="'+url+'" style="color: #edf1f7;">'+menuename+'</a>&nbsp;&nbsp;&nbsp;&nbsp;');
	}
	else{
		return('<span style="color: '+color+'">»</span> <a href="'+url+'" target="'+targetlink+'" style="color: #edf1f7;">'+menuename+'</a>&nbsp;&nbsp;&nbsp;&nbsp;');
	}
}
function ShowMenue(id){
	var html_string = "";
	
	if (id == 0){
		html_string+= NewMenueItem(ROOT+"index.html?op=_search", "Spielsuche", id, "");
		html_string+= NewMenueItem(ROOT+"screenshots.html", "Screenshot Galerie", id, "");
		html_string+= NewMenueItem(ROOT+"games.php/top_games/index.html", "Top Spiele", id, "");
		html_string+= NewMenueItem(ROOT+"index.html?op=write_news", "News einsenden", id, "");
		html_string+= NewMenueItem(ROOT+"index.html?op=register_game", "Spiel einsenden", id, "");
		html_string+= NewMenueItem(ROOT+"index.html?op=show_events", "Events", id, "");
		//html_string+= NewMenueItem(ROOT+"index.html?op=jobs", "Jobs", id, "");
	}
	if (id == 1){
		html_string = NewMenueItem(ROOT+"index.html?op=news_list", "News&uuml;bersicht", id, "");
		html_string+= NewMenueItem(ROOT+"index.html?op=articles", "Artikel&uuml;bersicht", id, "");
		html_string+= NewMenueItem(ROOT+"index.html?op=gsontour", "Videoberichte", id, "");
		html_string+= NewMenueItem(ROOT+"rss/rss.xml", "RSS: Newsfeed", id, "new");
		html_string+= NewMenueItem(ROOT+"index.html?op=newsfeed", "Newsfeed f&uuml;r Webseiten", id, "");
	}
	if (id == 2){
		html_string = NewMenueItem(ROOT+"index.html?op=new_games", "Neue Spiele", id, "");
		html_string+= NewMenueItem(ROOT+"index.html?op=_search", "Spielsuche", id, "");
		html_string+= NewMenueItem(ROOT+"games.php/top_games/index.html", "Top Spiele", id, "");
		html_string+= NewMenueItem(ROOT+"trailer.html", "Spieletrailer", id, "");
		html_string+= NewMenueItem(ROOT+"screenshots.html", "Screenshot Galerie", id, "");
		html_string+= NewMenueItem(ROOT+"rss/newestgames.xml", "RSS: Neuste Spiele", id, "new");
	}
	if (id == 3){
		html_string = NewMenueItem(ROOT+"index.html?op=vote", "F&uuml;r ein Spiel voten", id, "");
	}
	if (id == 4){
		html_string = NewMenueItem(ROOT+"board/index.php", "Forum", id, "");
		html_string+= NewMenueItem(ROOT+"index.html?op=view_highscore", "Highscore: News", id, "");
		html_string+= NewMenueItem(ROOT+"index.html?op=view_highscore&mode=1", "Highscore: Kommentare", id, "");
		html_string+= NewMenueItem(ROOT+"index.html?op=polls", "Umfragen", id, "");
		html_string+= NewMenueItem(ROOT+"fusion.php", "GS-Fusion", id, "");
		html_string+= NewMenueItem(ROOT+"newsletter/?id=last", "Aktueller Newsletter", id, "new");
	}
	if (id == 5){
		html_string = NewMenueItem(ROOT+"fusion.php", "Was ist GS-FUSION?", id, "");
		html_string+= NewMenueItem(ROOT+"fusion.php/partner/?__=charts", "Beliebteste", id, "");
		html_string+= NewMenueItem(ROOT+"fusion.php/partner/?__=Action", "Action", id, "");
		html_string+= NewMenueItem(ROOT+"fusion.php/partner/?__=Fun", "Fun", id, "");
		html_string+= NewMenueItem(ROOT+"fusion.php/partner/?__=Manager", "Manager", id, "");
		html_string+= NewMenueItem(ROOT+"fusion.php/partner/?__=Rollenspiel", "RPG", id, "");
		html_string+= NewMenueItem(ROOT+"fusion.php/partner/?__=Simulation", "Simulation", id, "");
		html_string+= NewMenueItem(ROOT+"fusion.php/partner/?__=Strategie", "Strategie", id, "");
	}
	if (id == 6){
		html_string = NewMenueItem(ROOT+"download_games/", "Start", id, "");
		html_string+= NewMenueItem(ROOT+"download_games/casual_strategy/page_1.html", "Strategiespiele", id, "");
		html_string+= NewMenueItem(ROOT+"download_games/casual_puzzles/page_1.html", "Puzzlespiele", id, "");
		html_string+= NewMenueItem(ROOT+"download_games/casual_action/page_1.html", "Action & Sportspiele", id, "");
		html_string+= NewMenueItem(ROOT+"download_games/casual_cards/page_1.html", "Brett & Kartenspiele", id, "");
	}
	
	$("#sub_menue").html(html_string);
}

function GS_FUSION_FIELDS(){

	if ($("#check_fusion").attr("checked") == 1){
		//Aktivieren
		$("#fusion_username").attr("readonly", ""); $("#fusion_username").attr("class", "flat");
		$("#fusion_username2").attr("readonly", ""); $("#fusion_username2").attr("class", "flat");
		$("#fusion_username3").attr("readonly", ""); $("#fusion_username3").attr("class", "flat");
		$("#fusion_pwd1").attr("readonly", ""); $("#fusion_pwd1").attr("class", "flat");
		$("#fusion_pwd2").attr("readonly", ""); $("#fusion_pwd2").attr("class", "flat");
		$("#fusion_strasse").attr("readonly", ""); $("#fusion_strasse").attr("class", "flat");
		$("#fusion_hausnummer").attr("readonly", ""); $("#fusion_hausnummer").attr("class", "flat");
		$("#fusion_plz").attr("readonly", ""); $("#fusion_plz").attr("class", "flat");
		$("#fusion_ort").attr("readonly", ""); $("#fusion_ort").attr("class", "flat");
		
		$("#fusion_gender").attr("disabled", ""); $("#fusion_gender").attr("class", "");
		$("#fusion_birthday").attr("disabled", ""); $("#fusion_birthday").attr("class", "");
		$("#fusion_birthmonth").attr("disabled", ""); $("#fusion_birthmonth").attr("class", "");
		$("#fusion_birthyear").attr("disabled", ""); $("#fusion_birthyear").attr("class", "");
	}
	else{
		$("#fusion_username").attr("readonly", "readonly"); $("#fusion_username").attr("class", "flatdisabled");
		$("#fusion_username2").attr("readonly", "readonly"); $("#fusion_username2").attr("class", "flatdisabled");
		$("#fusion_username3").attr("readonly", "readonly"); $("#fusion_username3").attr("class", "flatdisabled");
		$("#fusion_pwd1").attr("readonly", "readonly"); $("#fusion_pwd1").attr("class", "flatdisabled");
		$("#fusion_pwd2").attr("readonly", "readonly"); $("#fusion_pwd2").attr("class", "flatdisabled");
		$("#fusion_strasse").attr("readonly", "readonly"); $("#fusion_strasse").attr("class", "flatdisabled");
		$("#fusion_hausnummer").attr("readonly", "readonly"); $("#fusion_hausnummer").attr("class", "flatdisabled");
		$("#fusion_plz").attr("readonly", "readonly"); $("#fusion_plz").attr("class", "flatdisabled");
		$("#fusion_ort").attr("readonly", "readonly"); $("#fusion_ort").attr("class", "flatdisabled");
		
		$("#fusion_gender").attr("disabled", "true"); $("#fusion_gender").attr("class", "disabled");
		$("#fusion_birthday").attr("disabled", "true"); $("#fusion_birthday").attr("class", "disabled");
		$("#fusion_birthmonth").attr("disabled", "true"); $("#fusion_birthmonth").attr("class", "disabled");
		$("#fusion_birthyear").attr("disabled", "true"); $("#fusion_birthyear").attr("class", "disabled");
	}
}

function check_comment_and_submit(){
	comment_string = new String($("#new_comment").val());
	
	if(comment_string.length < 15 || comment_string.length > 1000){
		alert("Dein Kommentar/Meinung sollte aus mindestens 15 Zeichen und nicht mehr als 1000 Zeichen bestehen. Derzeit verwendest du "+comment_string.length+" Zeichen.");
		return false;
	}
	else{
		document.forms["comment_form"].submit();
	}
}