ï»¿/* Pokernews */

function showOtherSites() {
		var s = '<div class="headerDropdown" dir="ltr"><div class="ctr"></div><div class="cbl"></div><div class="cbr"></div>';
		var startCol = '<ul class="localSitesColumn">';
		var endCol = '</ul>';
		function it(lang,country,title) {
			return '<li id="localSiteLink-' + country + '"><a href="http://' + country + '.pokernews.com/"><img src="/img/flags/flag_' + country + '.png" width="20" height="13" alt="" /><span xml:lang="' + lang + '">' + title + '</span></a></li>';
		}

		s += startCol;
		s += '<li id="globalSiteLink"><a href="http://www.pokernews.com/"><img src="/img/flags/logo_global.png" width="18" height="18" alt="" /><span xml:lang="en">Poker News Global</span></a></li>';
		s += it('en', 'uk', 'United Kingdom');
		s += it('nl', 'nl', 'Nederland');
		s += it('de', 'de', 'Deutschland');
		s += it('fr', 'fr', 'France');
		s += it('it', 'it', 'Italia');
		s += it('pt', 'pt', 'Portugal');
		s += it('es', 'es', 'EspaÃ±a');
		s += it('pt', 'br', 'Brasil');
		s += it('et', 'ee', 'Eesti');
		s += it('lt', 'lt', 'Lietuva');
		s += (endCol + startCol);
		s += it('ru', 'ru', 'Ð Ð¾Ñ?Ñ?Ð¸Ñ?');
		s += it('cs', 'cz', 'Ä?esko');
		s += it('bg', 'bg', 'Ð?Ñ?Ð»Ð³Ð°Ñ?Ð¸Ñ?');
		s += it('sl', 'si', 'Slovenija');
		s += it('sr', 'yu', 'Balkan');
		s += it('pl', 'pl', 'Polska');
		s += it('hu', 'hu', 'Magyar');
		s += it('ro', 'ro', 'RomÃ¢nia');
		s += it('el', 'gr', 'Î?Î»Î»Î¬Î´Î±');
		s += it('no', 'no', 'Norge');
		s += it('da', 'dk', 'Danmark');
		s += it('sv', 'se', 'Sverige');
		s += it('fi', 'fi', 'Suomi');
		s += (endCol + startCol);
		s += it('tr', 'tr', 'TÃ¼rkiye');
		s += it('he', 'il', '×?×©×¨×?×?');
		s += (endCol + startCol);
		s += it('ko', 'kr', 'í??êµ­');
		s += it('ja', 'jp', 'æ?¥æ?¬');
		s += it('zh-Hans', 'china', 'ä¸­å??');
		s += it('zh-Hant', 'tw', 'è?ºç?£');
		s += '<li id="localSiteLink-pokernetwork"><a href="http://www.pokernetwork.com/" target="_blank"><img src="/img/flags/flag_au.png" width="20" height="13" alt="" /><span xml:lang="en">PokerNetwork</span></a></li>';
		s += endCol;

		s += '</ul><!-- <a href="" class="hideDropdown" onclick="return(!($(this).parent().parent().removeClass(\'expanded\')));" title="Close"><span class="a11y">Close</span></a> --></div>';

		//jQuery('#localSitesLink').after(s);
		jQuery('#localSitesLink').click(function (){
			if (!jQuery('#globalSiteLink').size()) {
				jQuery(this).after(s);
			}
			this.blur();
			return(!($(this).parent().siblings().removeClass('expanded') && $(this).parent().toggleClass('expanded')) );
			});
	}
jQuery(document).ready(showOtherSites);

//zebra
jQuery(document).ready(
	function () {
		jQuery(".article table tr:even").addClass('even');
		jQuery(".article table tr:odd").addClass('odd');
	}
);

/**
 * jQuery.placeholder - Placeholder plugin for input fields
 * Written by Blair Mitchelmore (blair DOT mitchelmore AT gmail DOT com)
 * Licensed under the WTFPL (http://sam.zoy.org/wtfpl/).
 * Date: 2008/10/14
 *
 * Modified by Rimas Kudelis to account for form reset possibility
 * Date: 2010/03/02
 *
 * @author Blair Mitchelmore
 * @version 1.0.2
 *
 **/
new function($) {
    $.fn.placeholder = function(settings) {
        settings = settings || {};
        var key = settings.dataKey || "placeholderValue";
        var attr = settings.attr || "placeholder";
        var className = settings.className || "placeholder";
        var values = settings.values || [];
        var block = settings.blockSubmit || false;
        var blank = settings.blankSubmit || false;
        var submit = settings.onSubmit || false;
        var value = settings.value || "";
        var position = settings.cursor_position || 0;

        
        return this.filter(":input[placeholder]").each(function(index) { 
            $.data(this, key, values[index] || $(this).attr(attr)); 
        }).each(function() {
            if (($.trim($(this).val()) === "") || ($.trim($(this).val()) === $.data(this, key)))
                $(this).addClass(className).val($.data(this, key));
        }).focus(function() {
            if ($.trim($(this).val()) === $.data(this, key)) {
            	$(this).removeClass(className).val(value);
                if ($.fn.setCursorPosition) {
                  $(this).setCursorPosition(position);
                }
			}
        }).blur(function() {
            if ($.trim($(this).val()) === value)
                $(this).addClass(className).val($.data(this, key));
        }).each(function(index, elem) {
            new function(e) {
                $(e.form).bind("reset", function() {
                    setTimeout(function() { $(e).trigger('blur'); }, 0);
                });
			}(elem);
            if (block)
                new function(e) {
                    $(e.form).submit(function() {
                        return $.trim($(e).val()) != $.data(e, key)
                    });
                }(elem);
            else if (blank)
                new function(e) {
                    $(e.form).submit(function() {
                        if ($.trim($(e).val()) == $.data(e, key)) 
                            $(e).removeClass(className).val("");
                        return true;
                    });
                }(elem);
            else if (submit)
                new function(e) { $(e.form).submit(submit); }(elem);
        });
    };
}(jQuery);

/* Only add placeholders if the browser does not support them */
function fixPlaceholders() {
	//pridedam placeholder (is title)
	$(':input.hasPlaceholder').each(function () {$(this).attr('placeholder', $(this).attr('title')).removeAttr('title').removeClass('hasPlaceholder')});
	//toliau aktyvuojam
	var i = document.createElement('input');
	if (!('placeholder' in i)) {
		// ignoruojam textarea elementus, nes jais tenka operuoti ir per JS.
		$('input[placeholder]').placeholder({blankSubmit: true});
	}
}
$(document).ready(fixPlaceholders);

/* Audrius (2010-05). Track ext, download links */
function trackOutgoing()
{
	if (typeof(trackOutgoing.init) != 'undefined') {
		return ;
	}
	if (document.domain && document.domain == "www.pokernews.com") {
		// kad crazyegg patikrinti, isjungiam laikinai
	    return;
	}
	trackOutgoing.init = 1;
	var trackFunc =function(e) {

        var clickedEl = e.srcElement ? e.srcElement : e.target;
		var nameEl = '';
		var go = true;
	    while (clickedEl && clickedEl.nodeName && go) {
	    	nameEl = clickedEl.nodeName.toUpperCase();
	    	switch (nameEl) {

				case 'A':
                    var aHref = clickedEl.href.toLowerCase();

					if (aHref.indexOf("/ext/") > -1 || aHref.indexOf("/download/") > -1 || aHref.indexOf("/r/") > -1) {
						if (typeof(pageTracker) != "undefined") {
							aHref = window.location.href;
							aHref = aHref.substring(aHref.indexOf('/',10) + 1);
							if (aHref == "") {
								aHref = "homepage";
							}
							var referer = typeof(trackPageReferer) != "undefined" ? trackPageReferer : "";

							/*if (typeof(encodeURIComponent) != "undefined") {
								aHref = encodeURIComponent(aHref);
								referer = encodeURIComponent(referer);
							}*/
							aHref = (clickedEl.href.indexOf('?')>-1 ? '&' : '?') + 'Page=' + aHref;
							if (referer) {
								aHref += '&PrevPage=' + referer;
							}
							//alert('+' + clickedEl.href + aHref);
							//return false;
							pageTracker._trackPageview(clickedEl.href + aHref);
						}
					}
					go = false;
					break;

				case 'BODY':
				case 'DIV':
					go = false;
					break;

				default:


	    	}
	    	clickedEl = clickedEl.parentNode;
	    }
	}
	jQuery(document.body).bind('click',trackFunc);
}

//system.mailcheck.js
jQuery(document).ready(function() {
	if (typeof mc_url_msg == 'undefined') {return;}
	if (typeof mc_c_msgs != 'undefined') {
		set_messages_count(mc_c_msgs);
	} else {
		get_messages_count();
	}
	setInterval('get_messages_count()', mc_tmr_delay);
});
function set_messages_count(msg) {
	msg = parseInt(msg);
	msg = isNaN(msg) ? 0 : msg;
	jQuery('#msg_ico').attr('src', (msg > 0 ? mc_img_new : mc_img_empty));
	jQuery('#messageCount').text(msg);
}
function get_messages_count() {
	jQuery.ajax({
		type: "GET",
		url: mc_url_msg,
		dataType: 'json',
		timeout: 30000,
		success: function(resp) {
			if (typeof resp.msg == 'undefined') {
				return;
			}
			set_messages_count(resp.msg);
		},
		error: function() {
		}
	});
}

/* Audrius (2009-02). Adjust iframe height */
function iframeFix(iframe, stop)
{
	var hThis = 0;
	if (!iframe.style) return;
	if (typeof(stop)=="undefined") stop = 0;
	iframe.style.height = '1px';
    if (iframe.contentDocument && iframe.contentDocument.document) {
		hThis = iframe.contentDocument.body.scrollHeight;
	} else if (iframe.contentWindow && iframe.contentWindow.document) {
		hThis = iframe.contentWindow.document.body.scrollHeight;
		if (!hThis && stop<10) {
			setTimeout(function(){iframeFix(iframe,stop+1)},2000);
			return;
		}
	}
	if (hThis>0) {
		iframe.style.height = (15+hThis) + 'px';
	}
}

/* Rimas (2010-06). Resize the widget in main content column to fully occupy available height */
function centralWidgetFix() {
	if(($('.w200').length == 1) && ($('.w740 > .widget').length == 2)) { // first .widget is the breadcrumb widget
		setTimeout( function() {
			if($('.w200')[0].clientHeight > $('.w740')[0].clientHeight) {
				if(navigator.userAgent.indexOf('MSIE 6') == -1) {
					$('.w740 > .widget > .widgetInner')[1].style.minHeight = $('.w740 > .widget')[1].clientHeight + $('.w200')[0].clientHeight - $('.w740')[0].clientHeight - 20 + 'px';
				} else {
					$('.w740 > .widget > .widgetInner')[1].style.height = $('.w740 > .widget')[1].clientHeight + $('.w200')[0].clientHeight - $('.w740')[0].clientHeight - 20 + 'px';
				}
			}
		}, 1000)
	}
}
$(document).ready(centralWidgetFix);
