$(document).ready(function() {

	if( $(".commentwrap").length > 0 )
        {
		$(".sk-pagecomments-counter .commlink").addClass("commentlink");
		
		// if not logged in: show register div
		if( $("#skpagecommentform").length == 0 )
		{
			$("#commenthide").after('<div class="onlyregistered">Die Kommentar-Funktion steht nur Nutzern eines Pokeraction-Logins offen. Um selbst einen Kommentar abgeben zu können, musst Du <a href="/index.php?id=455">hier ein Pokeraction-Profil beantragen</a>.</div>');
		}
	}
	else 
        {
		$(".sk-pagecomments-counter .commlink").hide();
		$(".sk-pagecomments-counter_ifzero").show();
		
		// if not logged in: show register div
		if( $("#skpagecommentform").length == 0 )
		{
			$(".sk-pagecomments-counter_ifzero").after('<div class="onlyregistered">Die Kommentar-Funktion steht nur Nutzern eines Pokeraction-Logins offen. Um selbst einen Kommentar abgeben zu können, musst Du <a href="/index.php?id=455">hier ein Pokeraction-Profil beantragen</a>.</div>');
		}
	}
	
	// hide comments, style comment link
	$("#commenthide, #skpagecommentform, .onlyregistered").hide();
	
	// kommentare
	$(".sk-pagecomments-counter .commlink, .sk-pagecomments-counter_ifzero").click(function(){
		
		// $("#commenthide").css("display") == "none" ||
		if( $("#commenthide").css("display") == "none" || $("#skpagecommentform").css("display") == "none" || $(".onlyregistered").css("display") == "none")
			$("#commenthide, #skpagecommentform, .onlyregistered").show();
		else
			$("#commenthide, #skpagecommentform, .onlyregistered").hide();
		
	});

	// liveblog
	$("#liveblog_start, .liveblog_start, .anzeige, #liveblog_start img").click( function(){
		
		$.blockUI({
			message: '<div style="position: absolute; right: 20px; background: transparent; text-align: right; font-size: 10px; padding: 2px 5px 2px 0;color: white; cursor: pointer;" id="close_liveblog">Liveblog schliessen</div><iframe id="blogframe" frameborder="0" width="100%" height="' + ($(window).height()-50) + '" src="http://www.pokeraction.info/index.php?id=430"></iframe>',
			css: {
				width: '700px',
				top:  ($(window).height() - ($(window).height()-30)) /2 + 'px', 
		                left: ($(window).width() - 700) /2 + 'px',
		                border: '0'
			}
		}); 
		
		$(".blockOverlay, #close_liveblog").click( function(){
			$.unblockUI(); 
		});
	});
	
	// chancen rechner
	$("#teaser_oddcalc").click( function(){
	
		$.blockUI({
			message: '<div style="height: 698; width: 961px; background: transparent url(fileadmin/templates/images/poker-loader.gif) no-repeat 280px 234px;"><object height="698" width="961" align="top" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"><param value="transparent" name="wmode"/><param value="always" name="allowScriptAccess"/><param value="http://www.intellipoker.de/code/global/swf/oddsCalc/swf/PokerOddsCalc_v3_02.swf?languageXmlPath=http://www.intellipoker.de/data/de/oddscalc/language.xml&amp;language=de&amp;sharinglink=http://www.intellipoker.de/tools/oddsCalc/&amp;servicePath=http://services.intellipoker.com/webservices/oddscalc/ipcalc.dll" name="movie"/><param value="false" name="menu"/><param value="high" name="quality"/><param value="#FFFFFF" name="bgcolor"/><embed height="698" width="961" align="top" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" play="true" loop="false" scale="showall" wmode="transparent" devicefont="false" bgcolor="#FFFFFF" name="oddsCalc" menu="false" allowfullscreen="false" allowscriptaccess="sameDomain" src="http://www.intellipoker.de/code/global/swf/oddsCalc/swf/PokerOddsCalc_v3_02.swf?languageXmlPath=http://www.intellipoker.de/data/de/oddscalc/language.xml&amp;language=de&amp;sharinglink=http://www.intellipoker.de/tools/oddsCalc/&amp;servicePath=http://services.intellipoker.com/webservices/oddscalc/ipcalc.dll" salign="top" type="application/x-shockwave-flash"/><a href="http://www.intellipoker.de/code/global/swf/oddsCalc/swf/PokerOddsCalc_v3_02.swf?languageXmlPath=http://www.intellipoker.de/data/de/oddscalc/language.xml&amp;language=de&amp;sharinglink=http://www.intellipoker.de/tools/oddsCalc/&amp;servicePath=http://services.intellipoker.com/webservices/oddscalc/ipcalc.dll" class="xrhrayhbelddywrtjgaz" title="Klicken Sie hier, um dieses Objekt mit Adblock Plus zu blockieren" style="left: 898px ! important; top: 698px ! important;"/><a href="http://www.intellipoker.de/code/global/swf/oddsCalc/swf/PokerOddsCalc_v3_02.swf?languageXmlPath=http://www.intellipoker.de/data/de/oddscalc/language.xml&amp;language=de&amp;sharinglink=http://www.intellipoker.de/tools/oddsCalc/&amp;servicePath=http://services.intellipoker.com/webservices/oddscalc/ipcalc.dll" class="xrhrayhbelddywrtjgaz"/></object></div>',
			css: {
				width: '961px',
				height: '698px',
				centerY: 'true',
				background: 'transparent',
				top:  ($(window).height() - ($(window).height()-30)) /2 + 'px', 
		                left: ($(window).width() - 961) /2 + 'px',
		                border: '0'
			}
		}); 
		
		$('.blockUI.blockPage').css('position','absolute'); 
		
		$(".blockOverlay").click( function(){
			$.unblockUI(); 
		});
	
	});
	
        // Pokertoday Teaser
        $("#pokertoday object embed").attr("width", "218");
        $("#pokertoday").css("cursor", "pointer");
        
        
	$("#pokertoday, #pokertoday embed").click( function(){
	
		var video = $("#pokertoday object").clone().find("embed").attr("width", "450px").attr("height", "300px");
		
		$.blockUI({
			message: video.parent().html(),
			css: {
				width: '460px',
				height: '300px',
				centerY: 'true',
				background: 'black',
				top:  ($(window).height() - ($(window).height()-30)) /2 + 'px', 
		                left: ($(window).width() - 450) /2 + 'px',
		                border: '0'
			}
		}); 
		
		
		//$('.blockUI.blockPage').css('position','absolute'); 
		
		$(".blockOverlay").click( function(){
			$.unblockUI(); 
		});
	
	});

/*Twitter Feed*/
$(".wttwitter_feed li:even").addClass("twitter_even");

//Tippspiel
//$('.singlephase:not(:has(table))').append('<div>Begegnung steht noch nicht fest</div>');
//$("").append('<div>Begegnung steht noch nicht fest</div>');		
});

