
function handle_geolocation_query(position){
var countries = new Array(); 
		countries['United Kingdom'] = '/uk/';
		countries['South Africa'] = '/sa/';
		countries['Australia'] = '/au/';
		countries['Russia'] = '/ru/';
		countries['Portugal'] = '/po/';
		countries['Spain'] = '/es/';
		countries['Greece'] = '/gr/';
		countries['Turkey'] = '/tr/';
		countries['United Kingdom'] = '/uk/';
		countries['France'] = '/fr/';
		countries['Italy'] = '/it/';
		
		yqlgeo.get(position.coords.latitude,position.coords.longitude,function(o){
			if(countries[o.place.country.content]){
				window.location = countries[o.place.country.content];
			}
		});
	}
		
function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

	
		$(document).ready(function() {
		
			//initiate_geolocation();
		
           /*setTimeout(function(){
		$('div#partner-popup-bg').fadeIn();
		$('div#partner-popup').fadeIn();
	}, 1000*30);
	
	$("#close-partner").click(
		function(){
			$('div#partner-popup').fadeOut();
			$('div#partner-popup-bg').fadeOut();
		}
	);*/
    
			if( $('.deposit_now') ) {
				
				$('.deposit_now').hover(
				
					function() {
						$(this).attr('src','images/cashier/deposit_now_on.png');
					}
					,
					function() {
						$(this).attr('src','images/cashier/deposit_now.png');
					}
				
				);
				
			}
			
			if( $('#winners') ) {
				
				$('#winners').vTicker({
   					speed: 500,
   					pause: 3000,
   					showItems: 3,
   					animation: 'fade',
   					mousePause: false,
   					height: 0,
   					direction: 'up'
				});
				
			}
			
			if( $('.promotion_box') ) {
				
				$('.promotion_box').hover(
				
					function(){
						$(this).children('div').animate({opacity: 'toggle'},200);
					}
					,
					function(){
						$(this).children('div').animate({opacity: 'toggle'},200);
					}
				
				);
				
			}
			
			if( $('#cashiers') ){
				
				$.localScroll();
				
			}
		
			$('.middle').hover(
				
				function() {
					$(this).stop().animate({ backgroundPosition:"0px -260px" }, 500);
				},
				
				function() {
					$(this).stop().animate({ backgroundPosition:"0px 0px"}, 500);
				}

			);
			
			jQuery('#games').jcarousel({			
        		wrap: 'circular',
				easing: 'easeOutSine',
				animation: 2000,
        		initCallback: mycarousel_initCallback
			});
			
			jQuery('#promos').jcarousel({			
        		auto: 2,
				wrap: 'circular',
				easing: 'easeOutSine',
				animation: 2000,
				scroll: 1
			});
			
			$('#download_btn').hover(
				function() {
					$(this).stop().animate({ 'width':'125px' , 'height':'125px' }, 300, 'easeOutSine');
				}
				,
				function(){
					$(this).stop().animate({ 'width':'120px' , 'height':'120px' }, 300, 'easeOutSine');
				}
			);
			
			$('#dwnbtn_1').hover(
				function() {
					$(this).stop().animate({ 'width':'310px' , 'height':'103px' }, 300, 'easeOutSine');
				}
				,
				function(){
					$(this).stop().animate({ 'width':'300px' , 'height':'100px' }, 300, 'easeOutSine');
				}
			);
			
			$('#instant_btn').hover(
				function() {
					$(this).stop().animate({ 'width':'125px' , 'height':'125px' }, 300, 'easeOutSine');
				}
				,
				function(){
					$(this).stop().animate({ 'width':'120px' , 'height':'120px' }, 300, 'easeOutSine');
				}
			);
			
				
				current = new Array('1','2','3','4','5','6','7');
				//easing = 'easeOutBounce';
				easing = 'easeOutQuad';
				time = 1000;
				
				$('#gallery_left').click(
					function(){
						$('#li' + current[0]).animate({ 'width':'298px', 'height':'200px', 'left':'240px', 'top':'30px', opacity:0.4 }, time, easing);
						$('#li' + current[0]).css('z-index','2');
						$('#li' + current[0] + ' img').animate({ 'width':'298px', 'height':'200px' }, time, easing);
						$('#li' + current[0] + ' img').attr('src',images[0]);
						var imgtmp = images.shift();
						images[images.length + 1] = imgtmp;
						
						$('#li' + current[1]).animate({ 'width':'298px', 'height':'200px', 'left':'0px', 'top':'30px', opacity:0.4 }, time, easing);
						$('#li' + current[1]).css('z-index','1');
						$('#li' + current[1] + ' img').animate({ 'width':'298px', 'height':'200px' }, time, easing);
						
						$('#li' + current[2]).animate({ 'width':'318px', 'height':'220px', 'left':'30px', 'top':'19px', opacity:0.6 }, time, easing);
						$('#li' + current[2]).css('z-index','3');
						$('#li' + current[2] + ' img').animate({ 'width':'318px', 'height':'220px' }, time, easing);
						
						$('#li' + current[3]).animate({ 'width':'338px', 'height':'238px', 'left':'60px', 'top':'10px', opacity:0.8 }, time, easing);
						$('#li' + current[3]).css('z-index','5');
						$('#li' + current[3] + ' img').animate({ 'width':'338px', 'height':'238px' }, time, easing);
						
						$('#li' + current[4]).animate({ 'width':'358px', 'height':'258px', 'left':'90px', 'top':'0px', opacity:1 }, time, easing);
						$('#li' + current[4]).css('z-index','7');
						$('#li' + current[4] + ' img').animate({ 'width':'358px', 'height':'258px' }, time, easing);
						
						$('#li' + current[5]).animate({ 'width':'338px', 'height':'238px', 'left':'140px', 'top':'10px', opacity:0.8 }, time, easing);
						$('#li' + current[5]).css('z-index','6');
						$('#li' + current[5] + ' img').animate({ 'width':'338px', 'height':'238px' }, time, easing);
						
						$('#li' + current[6]).animate({ 'width':'318px', 'height':'220px', 'left':'190px', 'top':'19px', opacity:0.6 }, time, easing);
						$('#li' + current[6]).css('z-index','4');
						$('#li' + current[6] + ' img').animate({ 'width':'318px', 'height':'220px' }, time, easing);
						
						var temp = current.shift();
						current[6] = temp;
					}
				);
				
				$('#gallery_right').click(
					function(){
						$('#li' + current[5]).animate({ 'width':'298px', 'height':'200px', 'left':'240px', 'top':'30px', opacity:0.4 }, time, easing);
						$('#li' + current[5]).css('z-index','2');
						$('#li' + current[5] + ' img').animate({ 'width':'298px', 'height':'200px' }, time, easing);
						
						
						$('#li' + current[6]).animate({ 'width':'298px', 'height':'200px', 'left':'0px', 'top':'30px', opacity:0.4 }, time, easing);
						$('#li' + current[6]).css('z-index','1');
						$('#li' + current[6] + ' img').animate({ 'width':'298px', 'height':'200px' }, time, easing);
						$('#li' + current[6] + ' img').attr('src',images[0]);
						var imgtmp = images.pop();
						images.unshift(imgtmp);
						
						$('#li' + current[0]).animate({ 'width':'318px', 'height':'220px', 'left':'30px', 'top':'19px', opacity:0.6 }, time, easing);
						$('#li' + current[0]).css('z-index','3');
						$('#li' + current[0] + ' img').animate({ 'width':'318px', 'height':'220px' }, time, easing);
						
						$('#li' + current[1]).animate({ 'width':'338px', 'height':'238px', 'left':'60px', 'top':'10px', opacity:0.8 }, time, easing);
						$('#li' + current[1]).css('z-index','5');
						$('#li' + current[1] + ' img').animate({ 'width':'338px', 'height':'238px' }, time, easing);
						
						$('#li' + current[2]).animate({ 'width':'358px', 'height':'258px', 'left':'90px', 'top':'0px', opacity:1 }, time, easing);
						$('#li' + current[2]).css('z-index','7');
						$('#li' + current[2] + ' img').animate({ 'width':'358px', 'height':'258px' }, time, easing);
						
						$('#li' + current[3]).animate({ 'width':'338px', 'height':'238px', 'left':'140px', 'top':'10px', opacity:0.8 }, time, easing);
						$('#li' + current[3]).css('z-index','6');
						$('#li' + current[3] + ' img').animate({ 'width':'338px', 'height':'238px' }, time, easing);
						
						$('#li' + current[4]).animate({ 'width':'318px', 'height':'220px', 'left':'190px', 'top':'19px', opacity:0.6 }, time, easing);
						$('#li' + current[4]).css('z-index','4');
						$('#li' + current[4] + ' img').animate({ 'width':'318px', 'height':'220px' }, time, easing);
						
						var temp = current.pop();
						current.unshift(temp);
					}
				);
				
				function trim(s) {
	        s = s.replace(/(^\s*)|(\s*$)/gi,"");
        	s = s.replace(/[ ]{2,}/gi," ");
        	s = s.replace(/\n /,"\n");
        	return s;
        }
        
          function addCommas(nStr)
{
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	return x1 + x2;
}
	if($.browser.msie){	
		$.ajax({
			type: "GET",
	      		url: "/public/jackpot-total",
			cache: true,	
      			success: function(xml) {
				//console.log("success");
				xml = trim(xml);
	      			xmlDoc = jQuery.parseXML(xml);
      				major = jQuery(xmlDoc).find('jackpot-total').attr('value');
			        major = (major.replace(",",""));
			        major = (major.replace(",",""));
			        major = parseFloat(major);
				//console.log(major);
			        setInterval(function(){
				        major = major + Math.random() * 2;
			                jQuery("#jackpot").html("$ " + addCommas(major.toFixed(2)));
		    		},1000);
			}
	      	});
	} else {
	       $.ajax({
         	        type: "GET",
                        url: "http://box24casino.com/public/jackpot-total",
                        success: function(xml) {
		        	//console.log("success");
	                  	xml = trim(xml);
        	                xmlDoc = jQuery.parseXML(xml);
                	        major = jQuery(xmlDoc).find('jackpot-total').attr('value');
			        major = (major.replace(",",""));
			        major = (major.replace(",",""));
			        major = parseFloat(major);
				//console.log(major);
			        setInterval(function(){
			              major = major + Math.random() * 2;
			              jQuery("#jackpot").html("$ " + addCommas(major.toFixed(2)));
		                },1000);
	                }
              }); 
	}
				
				$('#floatingbox').floating();
				$('#close').click( function(){ $('#floatingbox').fadeOut(); });
		
		});
	

