/* jQuery Plugin - Slider (modified 'Slide News 1.1') */
jQuery.fn.slider=function(settings){settings=jQuery.extend({scrollByItem:"auto",itemWidth:"auto",scrollSpeed:"slow"},settings);return this.each(function(i){var itemLength=jQuery(".item",this).length;if(settings.itemWidth!="auto"){var containerWidth=itemLength*settings.itemWidth;var itemWidth=settings.itemWidth}else{var itemWidth=jQuery(".item",this).width();var containerWidth=itemLength*itemWidth}if(settings.scrollByItem!="auto"){var scrollByItem=settings.scrollByItem;var scrollSpeed=settings.scrollSpeed}else{var scrollByItem=1;itemWidth=jQuery(".container",this).width()}jsContainerWidth=itemLength*jQuery(".item",this).width();jQuery(".container",this).css("width",containerWidth+"px");jQuery(".next",this).show();animating=false;jQuery(".next",this).click(function(){thisParent=jQuery(this).parent();if(animating==false){animating=true;animateLeft=parseInt(jQuery(".container",thisParent).css("left"))-(itemWidth*scrollByItem);if(animateLeft+parseInt(jQuery(".container",thisParent).css("width"))>0){jQuery(".prev",thisParent).show();jQuery(".container",thisParent).animate({left:animateLeft},scrollSpeed,function(){jQuery(this).css("left",animateLeft);if(parseInt(jQuery(".container",thisParent).css("left"))+parseInt(jQuery(".container",thisParent).css("width"))<=itemWidth*scrollByItem){jQuery(".next",thisParent).fadeOut("fast")}animating=false})}else{animating=false}}return false});jQuery(".prev",this).click(function(){thisParent=jQuery(this).parent();if(animating==false){animating=true;animateLeft=parseInt(jQuery(".container",thisParent).css("left"))+(itemWidth*scrollByItem);if((animateLeft+parseInt(jQuery(".container",thisParent).css("width")))<=parseInt(jQuery(".container",thisParent).css("width"))){jQuery(".next",thisParent).show();jQuery(".container",thisParent).animate({left:animateLeft},scrollSpeed,function(){jQuery(this).css("left",animateLeft);if(parseInt(jQuery(".container",thisParent).css("left"))==0){jQuery(".prev",thisParent).fadeOut("fast")}animating=false})}else{animating=false}}return false})})};

/* Image Gallery */
var ImageGallery = {
  
  init:function() {

    if ($(".image-slider").size() == 0) return;
    
    var options = {
      scrollByItem: "auto",
      itemWidth: 100,
      scrollSpeed: "slow"
    }; 
    $(".image-slider").slider(options);
    
    $(".image-slider .item a").click(function() {
      
      var imageSrc = $(this).attr('href');
      var imageTitle = $(this).attr('title');
      
      // var tags = '<img src="' + imageSrc + '" alt="" />';
      
      if (imageSrc.indexOf("_m.jpg") == -1) {
      
        $(".image-slider .full-size img").attr("src",imageSrc);
      } else {
        
        var imageFullSrc = imageSrc.replace(new RegExp("_m.jpg"), ".jpg");
        
        $(".image-slider .full-size a").attr("href",imageFullSrc);
        $(".image-slider .full-size a img").attr("src",imageSrc);
      }
      
      $(".image-slider .full-size p").empty().append('<p>' + imageTitle + '</p>');

      return false;
    });
  }
}
$(document).ready(function(){ ImageGallery.init(); });

(function(a){a.extend(a.fn,{livequery:function(b,c,d){var e=this,f;if(a.isFunction(b)){d=c;c=b;b=undefined}a.each(a.livequery.queries,function(g,h){if(e.selector==h.selector&&e.context==h.context&&b==h.type&&(!c||c.$lqguid==h.fn.$lqguid)&&(!d||d.$lqguid==h.fn2.$lqguid))return(f=h)&&false});f=f||new a.livequery(this.selector,this.context,b,c,d);f.stopped=false;f.run();return this},expire:function(b,c,d){var e=this;if(a.isFunction(b)){d=c;c=b;b=undefined}a.each(a.livequery.queries,function(f,g){if(e.selector==
g.selector&&e.context==g.context&&(!b||b==g.type)&&(!c||c.$lqguid==g.fn.$lqguid)&&(!d||d.$lqguid==g.fn2.$lqguid)&&!this.stopped)a.livequery.stop(g.id)});return this}});a.livequery=function(b,c,d,e,f){this.selector=b;this.context=c||document;this.type=d;this.fn=e;this.fn2=f;this.elements=[];this.stopped=false;this.id=a.livequery.queries.push(this)-1;e.$lqguid=e.$lqguid||a.livequery.guid++;if(f)f.$lqguid=f.$lqguid||a.livequery.guid++;return this};a.livequery.prototype={stop:function(){var b=this;if(this.type)this.elements.unbind(this.type,
this.fn);else this.fn2&&this.elements.each(function(c,d){b.fn2.apply(d)});this.elements=[];this.stopped=true},run:function(){if(!this.stopped){var b=this,c=this.elements,d=a(this.selector,this.context),e=d.not(c);this.elements=d;if(this.type){e.bind(this.type,this.fn);c.length>0&&a.each(c,function(f,g){a.inArray(g,d)<0&&a.event.remove(g,b.type,b.fn)})}else{e.each(function(){b.fn.apply(this)});this.fn2&&c.length>0&&a.each(c,function(f,g){a.inArray(g,d)<0&&b.fn2.apply(g)})}}}};a.extend(a.livequery,
{guid:0,queries:[],queue:[],running:false,timeout:null,checkQueue:function(){if(a.livequery.running&&a.livequery.queue.length)for(var b=a.livequery.queue.length;b--;)a.livequery.queries[a.livequery.queue.shift()].run()},pause:function(){a.livequery.running=false},play:function(){a.livequery.running=true;a.livequery.run()},registerPlugin:function(){a.each(arguments,function(b,c){if(a.fn[c]){var d=a.fn[c];a.fn[c]=function(){var e=d.apply(this,arguments);a.livequery.run();return e}}})},run:function(b){if(b!=
undefined)a.inArray(b,a.livequery.queue)<0&&a.livequery.queue.push(b);else a.each(a.livequery.queries,function(c){a.inArray(c,a.livequery.queue)<0&&a.livequery.queue.push(c)});a.livequery.timeout&&clearTimeout(a.livequery.timeout);a.livequery.timeout=setTimeout(a.livequery.checkQueue,20)},stop:function(b){b!=undefined?a.livequery.queries[b].stop():a.each(a.livequery.queries,function(c){a.livequery.queries[c].stop()})}});a.livequery.registerPlugin("append","prepend","after","before","wrap","attr",
"removeAttr","addClass","removeClass","toggleClass","empty","remove");a(function(){a.livequery.play()});var i=a.prototype.init;a.prototype.init=function(b,c){var d=i.apply(this,arguments);if(b&&b.selector){d.context=b.context;d.selector=b.selector}if(typeof b=="string"){d.context=c||document;d.selector=b}return d};a.prototype.init.prototype=a.prototype})(jQuery);
var FtpWebClientViewer = {

	init:function() {
		if ($('.online-now').size() == 0) return;
		
		$('a.online-show-client').click(function(event) {
			event.preventDefault(); 
			var href=$(".online-show-client").attr('href');
			window.open(href,'ftpwebpoker','menubar=0,location=0,toolbar=0,width=798px,height=557px');
		});

		var target = $.browser.msie ? 'object' : 'embed';

		$('div.main-content div.video-player-skin-container ' + target + ':visible').livequery(function() {
			$('.online-now').hide();
		})

		$('div.main-content div.video-player-skin-container ' + target + ':not(:visible)').livequery(function() {
			$('.online-now').show();
		})
	
		
    }
	
}

$(document).ready(function(){FtpWebClientViewer.init();});

var BioNav = {
	init:function() {
		if ($('div.bio-nav').size() == 0) return;
		
		if ($.browser.mozilla) {
			$('div#content').css('margin-top','-18px');
		}
		
		$('div.bio-nav li').hover(function() {
			$(this).addClass('active');
		}, function () {
			if (!$(this).is('.clicked')) {
				$(this).removeClass('active');
			}
		});
	}
}
$(document).ready(function(){ BioNav.init(); });
/* Target Attribute Fix */
var TargetAttribute = {
	init:function() {
		$('a[rel="internal"], a[rel="external"], a[rel="external nofollow"]').attr('target', '_blank');
					$('#footer').addClass('us');
			}
}
$(document).ready(function(){ TargetAttribute.init();});
