/* Shared Scripts
----------------------------- */
$(document).ready(function() {

    /*Added By Vicky */

    var path = window.location.href;
    var pagewext = path.substring(path.lastIndexOf('/') + 1);
    var pagewoext = pagewext.substring(0, pagewext.indexOf('.'));

    if (pagewoext == 'pressrelease') {
        $('ul.nav').find('a.primary[href="/pressreleases.aspx?pid=1"]').removeClass('primary').addClass('primary_selected');
    }
    $('.primary_selected').addClass('current').siblings('ul').addClass('active');
    $('ul.active').find('.selected').parent().addClass('sub_active');
    $('a.selected').parent().addClass('sub_active').parent().addClass('active').show().siblings('a').addClass('current');
    $('ul.tertiary.active').siblings('a').removeClass('current').addClass('selected').parent().addClass('sub_active').parent().addClass('active').show().siblings('a').addClass('current');

    /*End Added By Vicky*/
	
	/*Nav*/
	$("ul.nav li .active").show();
	$("ul.nav li a").not("ul.nav li ul li a").hover(function(){
		$("ul.nav li a").addClass('removeBg');
	}, function(){
		$("ul.nav li a").removeClass("removeBg");
	});
	
	/*Great Games Larger Thumbnail Preview*/
	$("ul.thumb li").not("ul.thumb li:last-child").hover(function(){
		$(this).css({'z-index' : '10'});
		$(this).find('img').addClass("hover").stop()
		.animate({
			marginTop: '-66px', 
			marginLeft: '-86px', 
			top: '40px', 
			left: '52px', 
			width: '211px', 
			height: '149px'
		}, 200);
			}, function() {
			$(this).css({'z-index' : '0'});
			$(this).find('img').removeClass("hover").stop()
				.animate({
					marginTop: '0', 
					marginLeft: '0',
					top: '0', 
					left: '0', 
					width: '137px', 
					height: '104px'
			}, 400);
		});
	
	/*Alt Rows*/
	$(".results tr:odd").addClass("odd");
	$(".results tr:even").addClass("even");
	
	/*Remove margin bottom*/
	$("fieldset:last, .box3:last").css({'margin-bottom':0});
	
	/*Remove margin right*/
	$(".center img:last").css({'margin-right':0});
	
	/*Remove padding right*/
	$(".center img:nth-child(3n)").css({'padding-right':0});
	
	/*Remove padding bottom*/
	$('.row .right .box2 img:last-child, .box3 .right img:last-child, .box3 p:last-child, .box3 ul:last-child, .row:last').css({'padding-bottom':0});

	$(".rowImg ul.thumb li:last-child").css({"padding-right":0,"width":77});

	/*Back to top*/
	$('a.top').click(function(){
    	$('html, body').animate({scrollTop: '0px'}, 300);
     	return false;
	});
	
	/*Button Fades*/
	$('.buttons, .search, .video')
    .removeClass('highlight')
    .find('a')
    .append('<span class="hover" />').each(function(){
    	var $span = $('> span.hover', this).css('opacity', 0);
		$(this).hover(function(){
			$span.stop().fadeTo(500, 1);
        }, function(){
            $span.stop().fadeTo(500, 0);
            });
		});
	
	/*Add & remove search input field content*/
	$('.search input').each(function(){
    	var default_value = this.value;
    	$(this).focus(function(){
        	if(this.value == default_value){
            	//this.value = '';
				this.select();
        		}
    	});
    	$(this).blur(function(){	  
        	if(this.value == ''){
            	this.value = default_value;
				}
		});
	});

	/*Great Games Equal Box Heights*/
	var collection = $(".left");
	for(var i = 0;i< collection.length;i++)
	{
		var height = Number(collection.eq(i).parent().height());
		collection.eq(i).siblings(".right").children(".box2").css("height",(height-12)+"px");
		collection.eq(i).children(".box1").css("height",height+"px");
	}
	
/*End Tag*/
});

/*Added by Vicky*/

function myMGSTickersLoaded() { 
	$('.progressiveCasinoListLogo').children('img').attr('title', function(i){return $(this).attr('alt');});
}

function myPokerRoomsListLoaded() {
	$('.pokerListLogo').children('img').attr('title', function(i){return $(this).attr('alt');});
}

/*End Added by Vicky*/

/*
Auto center window script- Eric King (http://redrival.com/eak/index.shtml)
Permission granted to Dynamic Drive to feature script in archive
For full source, usage terms, and 100's more DHTML scripts, visit http://dynamicdrive.com
*/
var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = 150;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable=0'
win = window.open(mypage,myname,settings); win.window.focus();
}

