$(function() {
		//var free=false; //no show while ani
		
		
		setTimeout(function(){
			$(".attentionbutton.bounce").effect('bounce',{},500,callbackBounce);
		},2000); 
		
		
		function callbackBounce(){
			//free=true; //no show while ani
		};
		
		function callbackFadeIn(){
			$(this).css("display", "");
			$(this).css("visibility", "visible");
		};
		function callbackFadeOut(){
			$(this).css("display", "");
			$(this).css("visibility", "hidden");
		};
		$(".attentionbutton").mouseover(function(){
			/*if(free==true) //no show while ani!
			{*/
			if($(this).children(".infobox").css("visibility")=="hidden"){
				//$(this).children(".infobox").fadeIn("def",callbackFadeIn); //result: bugs (because display:none instead of visibility (box isn't in attentionbutton))!
				$(this).children(".infobox").css("visibility","visible");
				}
			//}
		}).mouseout(function(){
				if($(this).children(".infobox").css("visibility")=="visible"){
					$(this).children(".infobox").css("visibility","hidden");
					//$(this).children(".infobox").fadeOut("def",callbackFadeOut); //result: bugs (because display:none instead of visibility (box isn't in attentionbutton))!
				}
		});
		
		$("#insertMatchButton").click(function(){
			$("#insertMatchBox").css("visibility","visible");
		});
		
		$("#iM_cancel").click(function(){
			$("#insertMatchBox").css("visibility","hidden");
			
		});
		
		$("#iM_doit").click(function(){
			$("#insertMatchBox").css("visibility","hidden");
			var newMatch = "<table style=\"width: 240px;\" align=\"center\"><tr><td style=\"background-color: #d2d2d2;\" colspan=\"3\" align=\"center\"><strong>"+$("#im_time").attr("value")+"</strong></td><tr>";
			newMatch+="<td style=\"width: 105px; background-color: #d2d2d2;\">[flag="+$("#im_team1land").attr("value")+"] <strong>"+$("#im_team1").attr("value")+"</strong></td>";
			newMatch+="<td style=\"background-color: #d2d2d2;\">vs</td>";
			newMatch+="<td style=\"width: 105px; background-color: #d2d2d2;\">[flag="+$("#im_team2land").attr("value")+"] <strong>"+$("#im_team2").attr("value")+"</strong></td></tr><tr>";
			newMatch+="<td style=\"background-color: #d2d2d2; text-align: center;\" colspan=\"3\"><a href=\"steam://connect/"+$("#im_srcTV").attr("value")+"\"> "+$("#im_srcTV").attr("value")+"</a></td></tr>";
			if(document.getElementById("im_asTV").checked==true)
				newMatch+="<tr><td style=\"background-color: #d2d2d2; text-align: center;\" colspan=\"3\"><a href=\"http://www.alpenscene.com/tv\"target=\"_blank\">Live auf alpenScene TV</a></td></tr>";
			newMatch+="</table><p>&nbsp;</p>";
			var testFrame = document.getElementById("ib_text_ifr");
			var doc = testFrame.contentDocument;
			if (doc == undefined || doc == null)
				doc = testFrame.contentWindow.document;
			var body=doc.getElementById("tinymce");
			$(body).html($(body).html()+newMatch)
		});
		

	});
