jQuery(document).ready(function(){
	jQuery(function() {
		jQuery('img.rounded').roundImg(10);
	});
	jQuery(function() {
		jQuery('#DDSlider li a img').roundImg(10);
	});	
	
	jQuery("ol.pNav li").hover(function(){
		jQuery(this).children("div").show();
		},function(){
		jQuery(this).children("div").hide();
	});
	jQuery('#tn-playerZone').attr('target','_blank');
	jQuery('#tn-affiliates').attr('target','_blank');
	jQuery('#tn-casinojoy').attr('target','_blank');
	jQuery('#flashdownload').click(function(){ 
	  jQuery('#download-popup').trigger("click"); 
   	});
	jQuery('#FlashID').click(function(){ 
	  jQuery('#download-popup').trigger("click"); 
   	});
	jQuery('#download span a').click(function(){ 
	  jQuery('#download-popup').trigger("click"); 
   	});
	jQuery('#actions .download_btn a').click(function(){ 
	  jQuery('#download-popup').trigger("click"); 
   	});
				
		//jQuery(document).ready(function() {																																																									
	var t=new Date();
	jQuery.getJSON("/jackpot.php",{time:t},function(json) {
		var namematch=[
			{"name":"fortunesofegypt","potname":"Formula X Grand Jackpot $1.00"},
			{"name":"formulax","potname":"Formula X Grand Jackpot $1.00"},
			{"name":"fireburner","potname":"Fire Burner Grand Jackpot $1.00"},
			{"name":"mysticfortune","potname":"Fire Burner Grand Jackpot $1.00"},
			{"name":"knightsofglory","potname":"Fire Burner Grand Jackpot $1.00"},
			{"name":"spacetale","potname":"Fire Burner Grand Jackpot $1.00"},
			{"name":"romanempire","potname":"Fire Burner Grand Jackpot $1.00"},
			{"name":"luxortemple","potname":"Fire Burner Grand Jackpot $1.00"},
			{"name":"irishmagic","potname":"Fire Burner Grand Jackpot $1.00"},
			{"name":"hotpursuit","potname":"Fire Burner Grand Jackpot $1.00"},
			{"name":"ambersky","potname":"Money Miner Diamond"},
			{"name":"moneyminer","potname":"Money Miner Diamond"},
			{"name":"junglejim","potname":"Jungle Jim Grand Jackpot $1.00"},
			{"name":"baypatrol","potname":"Jungle Jim Grand Jackpot $1.00"},
			{"name":"hellsbells","potname":"Hells Bells Jackpot $1.00"},
			//{"name":"burningocean","potname":"Jackpot Poker $5"},
			//{"name":"jackpotpoker","potname":"Jackpot Poker $5"},
			//{"name":"superseven","potname":"Super 7 Jackpot $1.00"},
			{"name":"supersevensuper","potname":"Super 7 Super Jackpot $1.00"},
			{"name":"aladdinslamp","potname":"Alladin's Lamp $5"},
			{"name":"jackinthebox","potname":"Jack in the Box $5"},
			{"name":"hauntedhouse","potname":"Haunted House $5"}];
			//{"name":"caribbeanstudpoker","potname":"Caribbean Stud Poker"}];
		var i=0;
		for(i=0; i<19; i++){
			for (var j=0;j<json.items.length;j++){
				if(json.items[j].name==namematch[i].potname){
					namematch[i].potvalue=parseFloat(json.items[j].value.substring(1).replace(',',''));
					namematch[i].node=jQuery("."+namematch[i].name).detach();
					//if(i==5){
						//alert(namematch[i].potname);
					//}
				}
			}
		}
		function sortnamematch(a, b){
			return ( b.potvalue - a.potvalue );
		}
		namematch.sort(sortnamematch);
		for(var i=0; i<19; i++){
			namematch[i].node.appendTo(jQuery("#toptag"));
			//if(i==5){
				//alert(namematch[i].node);
			//}
			if(namematch[i].potvalue>1000000){
				var potstring=(namematch[i].potvalue-namematch[i].potvalue%100000)/1000000;
				if((namematch[i].potvalue%100000)/1000000>10000){
					potstring=potstring+(namematch[i].potvalue%100000)/100000+',';   
				}else{
					potstring=potstring+'0'+(namematch[i].potvalue%100000)/100000+',';   
				}
				if(namematch[i].potvalue%1000>100){
					potstring=potstring+namematch[i].potvalue%1000;   
				}else{
					potstring=potstring+'0'+namematch[i].potvalue%1000;   
				}
			}else if(namematch[i].potvalue>10000){
				var potstring=(namematch[i].potvalue-namematch[i].potvalue%1000)/1000+',';
				if(namematch[i].potvalue%1000>100){
					potstring=potstring+namematch[i].potvalue%1000;   
				}else{
					potstring=potstring+'0'+namematch[i].potvalue%1000;   
				}
			}else{
				var potstring=namematch[i].potvalue;
			}            var potstring = potstring.split("."); 
			jQuery("."+namematch[i].name+" .jac_status").html("€"+potstring[0]+'.'+potstring[1].substring(0,2));
		};
		
	});
});
