// JavaScript Document
function CreateCountriesBar(){
	html='';
	html+='<div style="clear:both; width:735px; font:bold 11pt verdana; color:black;">';
		html+='<div style="float:left; width:635px;">Choose Your Country</div>';
		html+='<div style="float:right;">';
			html+='<a class="normalDarkblue" id="international_sites_close" href="javascript:void(0);" onclick="CloseCountriesBar();">Close</a>';
		html+='</div>';
	html+='</div>';
	html+='<div style="width:735px; padding-top:5px; margin-bottom:8px; clear:both; border-bottom:1px #CCCCCC solid; line-height:0px;">&#160;</div>';
	html+='<img src="'+script_path+'images/earth.gif"/>&#160;<span style="color:blue; font:normal 9pt verdana;">International</span>';
	html+='<div style="width:735px; padding-top:8px; margin-bottom:8px; clear:both; border-bottom:1px #CCCCCC solid; line-height:0px;">&#160;</div>';
	
	html+='<div class="floater">';
		html+='<div style="width:130px; clear:both; padding-bottom:4px;"><a href="http://www.onlinecasinosreports.info"><img src="'+script_path+'images/flags/australia.gif"/></a>&#160;<a class="normalDarkblue" style="font:normal 9pt verdana;" href="http://www.onlinecasinosreports.info">Australia</a></div>';
		html+='<div style="width:130px; clear:both; padding-bottom:4px;"><a href="http://www.onlinecasinoreports.ca"><img src="'+script_path+'images/flags/canada.gif"/></a>&#160;<a class="normalDarkblue" style="font:normal 9pt verdana;" href="http://www.onlinecasinoreports.ca">Canada</a></div>';
	html+='</div>';
	html+='<div class="floater">';
		html+='<div style="width:130px; clear:both; padding-bottom:4px;"><a href="http://www.onlinecasinoreports.in"><img src="'+script_path+'images/flags/india.gif"/></a>&#160;<a class="normalDarkblue" style="font:normal 9pt verdana;" href="http://www.onlinecasinoreports.in">India</a></div>';
		html+='<div style="width:130px; clear:both; padding-bottom:4px;"><a href="http://www.onlinecasinoreports.ie"><img src="'+script_path+'images/flags/ireland.gif"/></a>&#160;<a class="normalDarkblue" style="font:normal 9pt verdana;" href="http://www.onlinecasinoreports.ie">Ireland</a></div>';
	html+='</div>';
	html+='<div class="floater">';
		html+='<div style="width:130px; clear:both; padding-bottom:4px;"><a href="http://www.onlinecasinoreports.com.jm"><img src="'+script_path+'images/flags/jm.gif"/></a>&#160;<a class="normalDarkblue" style="font:normal 9pt verdana;" href="http://www.onlinecasinoreports.com.jm">Jamaica</a></div>';
		html+='<div style="width:130px; clear:both; padding-bottom:4px;"><a href="http://www.onlinecasinoreports.co.nz"><img src="'+script_path+'images/flags/newzealand.gif"/></a>&#160;<a class="normalDarkblue" style="font:normal 9pt verdana;" href="http://www.onlinecasinoreports.co.nz">New Zealand</a></div>';
		
	html+='</div>';
	html+='<div class="floater">';
		html+='<div style="width:130px; clear:both; padding-bottom:4px;"><a href="http://www.onlinecasinoreports.ph"><img src="'+script_path+'images/flags/philippines.gif"/></a>&#160;<a class="normalDarkblue" style="font:normal 9pt verdana;" href="http://www.onlinecasinoreports.ph">Philippines</a></div>';
		html+='<div style="width:130px; clear:both; padding-bottom:4px;"><a href="http://www.onlinecasinoreports.sg"><img src="'+script_path+'images/flags/singapore.gif"/></a>&#160;<a class="normalDarkblue" style="font:normal 9pt verdana;" href="http://www.onlinecasinoreports.sg">Singapore</a></div>';
	html+='</div>';
	html+='<div class="floater">';
		html+='<div style="width:130px; clear:both; padding-bottom:4px;"><a href="http://www.onlinecasinoreports.co.za"><img src="'+script_path+'images/flags/southafrica.gif"/></a>&#160;<a class="normalDarkblue" style="font:normal 9pt verdana;" href="http://www.onlinecasinoreports.co.za">South Africa</a></div>';
		html+='<div style="width:130px; clear:both; padding-bottom:4px;"><a href="http://www.onlinecasinosreports.co.uk"><img src="'+script_path+'images/flags/uk.gif"/></a>&#160;<a class="normalDarkblue" style="font:normal 9pt verdana;" href="http://www.onlinecasinosreports.co.uk">UK</a></div>';
	html+='</div>';
	html+='<div style="width:735px; padding-top:5px; margin-bottom:4px; clear:both; border-bottom:1px #CCCCCC solid; line-height:0px;">&#160;</div>';
	html+='<div class="floater">';
		html+='<div style="width:130px; clear:both; padding-bottom:4px;"><a href="http://www.onlinecasinoreports.com.ar"><img src="'+script_path+'images/flags/argentina.gif"/></a>&#160;<a class="normalDarkblue" style="font:normal 9pt verdana;" href="http://www.onlinecasinoreports.com.ar">Argentina</a></div>';
		html+='<div style="width:130px; clear:both; padding-bottom:4px;"><a href="http://www.onlinecasinoreports.at"><img src="'+script_path+'images/flags/austria.gif"/></a>&#160;<a class="normalDarkblue" style="font:normal 9pt verdana;" href="http://www.onlinecasinoreports.at">Austria</a></div>';
		html+='<div style="width:130px; clear:both; padding-bottom:4px;"><a href="http://www.onlinecasinoreports.be"><img src="'+script_path+'images/flags/belgium.gif"/></a>&#160;<a class="normalDarkblue" style="font:normal 9pt verdana;" href="http://www.onlinecasinoreports.be">Belgium</a></div>';
		html+='<div style="width:130px; clear:both; padding-bottom:4px;"><a href="http://www.onlinecasinoreports.com.br"><img src="'+script_path+'images/flags/brazil.gif"/></a>&#160;<a class="normalDarkblue" style="font:normal 9pt verdana;" href="http://www.onlinecasinoreports.com.br">Brazil</a></div>';
		html+='<div style="width:130px; clear:both; padding-bottom:4px;"><a href="http://www.onlinecasinoreports.cz"><img src="'+script_path+'images/flags/czechrepublic.gif"/></a>&#160;<a class="normalDarkblue" style="font:normal 9pt verdana;" href="http://www.onlinecasinoreports.cz">Czech</a></div>';
		html+='<div style="width:130px; clear:both; padding-bottom:4px;"><a href="http://www.onlinecasinoreports.dk"><img src="'+script_path+'images/flags/denmark.gif"/></a>&#160;<a class="normalDarkblue" style="font:normal 9pt verdana;" href="http://www.onlinecasinoreports.dk">Denmark</a></div>';
	html+='</div>';
	html+='<div class="floater">';
		html+='<div style="width:130px; clear:both; padding-bottom:4px;"><a href="http://www.onlinecasinoreports.co.ee"><img src="'+script_path+'images/flags/estonia.gif"/></a>&#160;<a class="normalDarkblue" style="font:normal 9pt verdana;" href="http://www.onlinecasinoreports.co.ee">Estonia</a></div>';
		html+='<div style="width:130px; clear:both; padding-bottom:4px;"><a href="http://www.onlinecasinoreports.fi"><img src="'+script_path+'images/flags/finland.gif"/></a>&#160;<a class="normalDarkblue" style="font:normal 9pt verdana;" href="http://www.onlinecasinoreports.fi">Finland</a></div>';
		html+='<div style="width:130px; clear:both; padding-bottom:4px;"><a href="http://www.onlinecasinoreports.fr"><img src="'+script_path+'images/flags/france.gif"/></a>&#160;<a class="normalDarkblue" style="font:normal 9pt verdana;" href="http://www.onlinecasinoreports.fr">France</a></div>';
		html+='<div style="width:130px; clear:both; padding-bottom:4px;"><a href="http://www.onlinecasinosreports.de"><img src="'+script_path+'images/flags/germany.gif"/></a>&#160;<a class="normalDarkblue" style="font:normal 9pt verdana;" href="http://www.onlinecasinosreports.de">Germany</a></div>';
		html+='<div style="width:130px; clear:both; padding-bottom:4px;"><a href="http://www.onlinecasinoreports.gr"><img src="'+script_path+'images/flags/greece.gif"/></a>&#160;<a class="normalDarkblue" style="font:normal 9pt verdana;" href="http://www.onlinecasinoreports.gr">Greece</a></div>';
		html+='<div style="width:130px; clear:both; padding-bottom:4px;"><a href="http://www.onlinecasinoreports.hk"><img src="'+script_path+'images/flags/hongkong.gif"/></a>&#160;<a class="normalDarkblue" style="font:normal 9pt verdana;" href="http://www.onlinecasinoreports.hk">Hong Kong</a></div>';
	html+='</div>';
	html+='<div class="floater">';
		html+='<div style="width:130px; clear:both; padding-bottom:4px;"><a href="http://www.onlinecasinoreports.hu"><img src="'+script_path+'images/flags/hungary.gif"/></a>&#160;<a class="normalDarkblue" style="font:normal 9pt verdana;" href="http://www.onlinecasinoreports.hu">Hungary</a></div>';
		html+='<div style="width:130px; clear:both; padding-bottom:4px;"><a href="http://www.onlinecasinoreports.it"><img src="'+script_path+'images/flags/italy.gif"/></a>&#160;<a class="normalDarkblue" style="font:normal 9pt verdana;" href="http://www.onlinecasinoreports.it">Italy</a></div>';
		html+='<div style="width:130px; clear:both; padding-bottom:4px;"><a href="http://www.onlinecasinoreports.jp"><img src="'+script_path+'images/flags/japan.gif"/></a>&#160;<a class="normalDarkblue" style="font:normal 9pt verdana;" href="http://www.onlinecasinoreports.jp">Japan</a></div>';
		html+='<div style="width:130px; clear:both; padding-bottom:4px;"><a href="http://www.onlinecasinoreports.com.mx"><img src="'+script_path+'images/flags/mexico.gif"/></a>&#160;<a class="normalDarkblue" style="font:normal 9pt verdana;" href="http://www.onlinecasinoreports.com.mx">Mexico</a></div>';
		html+='<div style="width:130px; clear:both; padding-bottom:4px;"><a href="http://www.onlinecasinoreports.nl"><img src="'+script_path+'images/flags/netherlands.gif"/></a>&#160;<a class="normalDarkblue" style="font:normal 9pt verdana;" href="http://www.onlinecasinoreports.nl">Netherlands</a></div>';
		html+='<div style="width:130px; clear:both; padding-bottom:4px;"><a href="http://www.onlinecasinoreports.no"><img src="'+script_path+'images/flags/norway.gif"/></a>&#160;<a class="normalDarkblue" style="font:normal 9pt verdana;" href="http://www.onlinecasinoreports.no">Norway</a></div>';
	html+='</div>';
	html+='<div class="floater">';
		html+='<div style="width:130px; clear:both; padding-bottom:4px;"><a href="http://www.onlinecasinoreports.pl"><img src="'+script_path+'images/flags/poland.gif"/></a>&#160;<a class="normalDarkblue" style="font:normal 9pt verdana;" href="http://www.onlinecasinoreports.pl">Poland</a></div>';
		html+='<div style="width:130px; clear:both; padding-bottom:4px;"><a href="http://www.onlinecasinoreports.com.pt"><img src="'+script_path+'images/flags/portugal.gif"/></a>&#160;<a class="normalDarkblue" style="font:normal 9pt verdana;" href="http://www.onlinecasinoreports.com.pt">Portugal</a></div>';
		html+='<div style="width:130px; clear:both; padding-bottom:4px;"><a href="http://www.onlinecasinoreports.qc.com"><img src="'+script_path+'images/flags/quebec.gif"/></a>&#160;<a class="normalDarkblue" style="font:normal 9pt verdana;" href="http://www.onlinecasinoreports.qc.com">Quebec</a></div>';
		html+='<div style="width:130px; clear:both; padding-bottom:4px;"><a href="http://www.onlinecasinosreports.net"><img src="'+script_path+'images/flags/saudiarbia.gif"/></a>&#160;<a class="normalDarkblue" style="font:normal 9pt verdana;" href="http://www.onlinecasinosreports.net">Saudi Arabia</a></div>';
		html+='<div style="width:130px; clear:both; padding-bottom:4px;"><a href="http://www.onlinecasinoreports.sk"><img src="'+script_path+'images/flags/slovak.gif"/></a>&#160;<a class="normalDarkblue" style="font:normal 9pt verdana;" href="http://www.onlinecasinoreports.sk">Slovakia</a></div>';
		html+='<div style="width:130px; clear:both; padding-bottom:4px;"><a href="http://www.onlinecasinoreports.es"><img src="'+script_path+'images/flags/spain.gif"/></a>&#160;<a class="normalDarkblue" style="font:normal 9pt verdana;" href="http://www.onlinecasinoreports.es">Spain</a></div>';
	html+='</div>';
	html+='<div class="floater">';
		html+='<div style="width:130px; clear:both; padding-bottom:4px;"><a href="http://www.onlinecasinoreports.se"><img src="'+script_path+'images/flags/sweden.gif"/></a>&#160;<a class="normalDarkblue" style="font:normal 9pt verdana;" href="http://www.onlinecasinoreports.se">Sweden</a></div>';
		html+='<div style="width:130px; clear:both; padding-bottom:4px;"><a href="http://www.onlinecasinoreports.ro"><img src="'+script_path+'images/flags/romania.gif"/></a>&#160;<a class="normalDarkblue" style="font:normal 9pt verdana;" href="http://www.onlinecasinoreports.ro">Romania</a></div>';
		html+='<div style="width:130px; clear:both; padding-bottom:4px;"><a href="http://www.onlinecasinoreports.ru"><img src="'+script_path+'images/flags/russia.gif"/></a>&#160;<a class="normalDarkblue" style="font:normal 9pt verdana;" href="http://www.onlinecasinoreports.ru">Russia</a></div>';
		html+='<div style="width:130px; clear:both; padding-bottom:4px;"><a href="http://www.onlinecasinoreports.com.tw"><img src="'+script_path+'images/flags/taiwan.gif"/></a>&#160;<a class="normalDarkblue" style="font:normal 9pt verdana;" href="http://www.onlinecasinoreports.com.tw">Taiwan</a></div>';
		html+='<div style="width:130px; clear:both; padding-bottom:4px;"><a href="http://www.onlinecasinoreports.info"><img src="'+script_path+'images/flags/turkey.gif"/></a>&#160;<a class="normalDarkblue" style="font:normal 9pt verdana;" href="http://www.onlinecasinoreports.info">Turkey</a></div>';
	html+='</div>';
	
	$("#international_site_container").html(html);
}

// Polls
function PollPreviouslyVoted(){
	$("#vote_error").html('You\'ve already voted.');
	$("#vote_error").fadeIn(1000, function () {
    	$(this).fadeOut(4000, function(){ });
    });
}

function VotePoll(usr,ip,poll,location){
		var answer='';
	$("input[name='poll_answer']").each(function(){
		//if ($(":checked").val())
		if($(this).attr("checked")==true){
			answer = $(this).val();
		}
	});

	if(answer!=''){
		$.ajax({
		   type: "POST",
		   url: script_path+'includes/admin/general_information.php?method=vote_poll',
		   data: 'poll='+poll+'&answer='+answer+'&usr='+usr+'&ip='+ip+'&location='+location,
		   success: function(msg){
		   	 $("#poll_results").fadeOut("fast",function(){
		   	 	$("#poll_results").html(msg);
		   	 	$("#poll_results").fadeIn("slow");
		   	 });
		   }
		});
	}else{ // error message
		$("#vote_error").html('Select an answer for voting.');
		$("#vote_error").fadeIn(1000, function () {
	    	$(this).fadeOut(4000, function(){ });
	    });
	}
}

function ViewPollById(id,size,location){
	$.ajax({
	   type: "POST",
	   url: script_path+'includes/admin/general_information.php?method=view_poll_by_id',
	   data: 'id='+id+'&size='+size+'&location='+location,
	   success: function(msg){
	   	 $("#poll_results").fadeOut("fast",function(){
	   	 	$("#poll_results").html(msg);
	   	 	$("#poll_results").fadeIn("slow");
	   	 });
	   }
	});
}

function ViewPoll(logged,user,ip,id){
	$.ajax({
	   type: "POST",
	   url: script_path+'includes/admin/general_information.php?method=view_poll',
	   data: 'logged='+logged+'&id='+id+'&user='+user+'&ip='+ip,
	   success: function(msg){
	   	 $("#poll_results").fadeOut("fast",function(){
	   	 	$("#poll_results").html(msg);
	   	 	$("#poll_results").fadeIn("slow");
	   	 });
	   }
	});
}

function searchBonusClip(id){
	//alert(id)
	$.getJSON(script_path+'includes/admin/general_information.php?method=search_bonus_clip&id='+id,function(msg){
		$("#banner_text").fadeOut('normal', function() {
		     $("#banner_text").html(msg[1]);
	   		 $("#banner_text").fadeIn("Normal");
		  });
		  $(".bonusClipSearch").each(function(){
		  	$(this).unbind('click');
		  });
		  
		  $(".bonusClipSearch").each(function(){
		  	$(this).attr('onclick',"searchBonusClip("+msg[0]+")");
		  	$(this).bind('click', function() {
			  searchBonusClip(msg[0]);
			});
		  });
	});
}

var MainTimer = 0;
var SecondMainTimer=0;
timer=180;

$(document).ready(function(){ // jQuery
	
	// Search Input box
	$("#google_site_search").css('background-image','none');
	
	if($("#google_site_search").val()=='Search'){
		$("#google_site_search").css('color','#666666');
	}else{
		$("#google_site_search").css('color','black');
	}
	
	$("#google_site_search").focus(function(){
		$(this).css('background-image','none');
		$("#google_site_search").css('color','black');
		if($(this).val()=='Search'){
			$(this).val('');
		}
	});
	
	$("#google_site_search").blur(function(){
		$("#google_site_search").css('background-image','none');
		if($(this).val()=='' || $(this).val()==' '){
			$("#google_site_search").css('color','#666666');
			$(this).val('Search');
		}
	});
	
	$("#google_site_search").css('padding-right','20px');
	
	// Worldwide
	$("#international_sites").click(function(){
		if($("#international_site_container").html()=="&nbsp;"){
			CreateCountriesBar();
		}
		$("#international_site_container").slideToggle("fast");
	});
	
	// Services
	$("#main_index_services_container > #index_services_container > #index_services1").click(function(){ window.location=script_path+'services/maxbonus/'; });
	$("#main_index_services_container > #index_services_container > #index_services2").click(function(){ window.location=script_path+'services/freegames/'; });
	$("#main_index_services_container > #index_services_container > #index_services3").click(function(){ window.location=script_path+'services/payouts/'; });
	$("#main_index_services_container > #index_services_container > #index_services4").click(function(){ window.location=script_path+'services/poker/'; });
	$("#main_index_services_container > #index_services_container > #index_services5").click(function(){ window.location=script_path+'services/bingo/'; });
	$("#main_index_services_container > #index_services_container > #index_services6").click(function(){ window.location=script_path+'services/compare/'; });
	$("#main_index_services_container > #index_services_container > #index_services7").click(function(){ window.location=script_path+'services/slots/'; });
	$("#main_index_services_container > #index_services_container > #index_services8").click(function(){ window.location=script_path+'services/winners/'; });

   // index services selector
   $("#index_services_container > .index_services_bottons").mouseout(function(){
	   if(MainTimer){
			clearTimeout(MainTimer);
			MainTimer=0;
	   }
   });

   $("#index_services_container > .index_services_bottons2").mouseout(function(){
	   if(SecondMainTimer){
			clearTimeout(SecondMainTimer);
			SecondMainTimer=0;
	   }
   });

   $("#index_services_container > .index_services_bottons").mouseover(function(){ // mouse over service buttons
   		obj_this = $(this);
   		if(!MainTimer){
			 MainTimer = setTimeout(function(){
			 	if($("#index_services_data").css("display")=="none"){ // open the data box
				   	$("#index_services_data2").slideUp("slow");
		   			$("#index_services_data").slideDown("slow");
			    }
			    // show info boxes and change css
			    obj_this.css("background-image",'url('+script_path+'images/service_box_opened.gif)');
			    var id = obj_this.attr("id");
			    if(id=="index_services4"){ // last element
			     	obj_this.css("background-image",'url('+script_path+'images/service_box_opened_last.gif)');
			    }

			    $('#index_services_container > .index_services_bottons[id!='+id+']').each(function(){
			     	$(this).css("background-image",'url('+script_path+'images/service_box.gif)');
			    });

			    $('#index_services_container > .index_services_bottons2').each(function(){
			     	$(this).css("background-image",'url('+script_path+'images/service_box.gif)');
			    });

				switch(obj_this.attr("id")){ // which box we moved on ?
					case "index_services1":{
						$("#index_data_services1").css("display","block");
						$('#main_index_services_container > #index_services_container > #index_services_data > .data_index_service[id!=index_data_services1]').each(function(){
						    $(this).css("display","none");
					    });
					}
					break;

					case "index_services2":{
						$("#index_data_services2").css("display","block");
						$('#main_index_services_container > #index_services_container > #index_services_data > .data_index_service[id!=index_data_services2]').each(function(){
						    $(this).css("display","none");
					    });
					}
					break;

					case "index_services3":{
						$("#index_data_services3").css("display","block");
						$('#main_index_services_container > #index_services_container > #index_services_data > .data_index_service[id!=index_data_services3]').each(function(){
						    $(this).css("display","none");
					    });
					}

					break;

					case "index_services4":{
						$("#index_data_services4").css("display","block");
						$('#main_index_services_container > #index_services_container > #index_services_data > .data_index_service[id!=index_data_services4]').each(function(){
						    $(this).css("display","none");
					    });
					}
					break;
				}
			 }, 180);
		}
    });

    // second raw
    $("#index_services_container > .index_services_bottons2").mouseover(function(){ // mouse over service set #2 buttons
    	obj_this2 = $(this);
   		if(!SecondMainTimer){
			 SecondMainTimer = setTimeout(function(){
			 	switch(obj_this2.attr("id")){
					case "index_services5":{
						$("#index_data_services5").css("display","block");
						$('#main_index_services_container > #index_services_container > #index_services_data2 > .data_index_service2[id!=index_data_services5]').each(function(){
						    $(this).css("display","none");
					    });
					}
					break;

					case "index_services6":{
						$("#index_data_services6").css("display","block");
						$('#main_index_services_container > #index_services_container > #index_services_data2 > .data_index_service2[id!=index_data_services6]').each(function(){
						    $(this).css("display","none");
					    });
					}
					break;

					case "index_services7":{
						$("#index_data_services7").css("display","block");
						$('#main_index_services_container > #index_services_container > #index_services_data2 > .data_index_service2[id!=index_data_services7]').each(function(){
						    $(this).css("display","none");
					    });
					}
					break;

					case "index_services8":{
						$("#index_data_services8").css("display","block");
						$('#main_index_services_container > #index_services_container > #index_services_data2 > .data_index_service2[id!=index_data_services8]').each(function(){
						    $(this).css("display","none");
					    });
					}
					break;
				}

		   		if($("#index_services_data2").css("display")=="none"){ // close/open
		   			$("#index_services_data").slideUp("slow");
		   			$("#index_services_data2").slideDown("slow");
			     }

			     obj_this2.css("background-image",'url('+script_path+'images/service_box_opened.gif)');
			     var id = obj_this2.attr("id");
			     if(id=="index_services8"){ // last element
			     	obj_this2.css("background-image",'url('+script_path+'images/service_box_opened_last.gif)');
			     }

			     $('#index_services_container > .index_services_bottons2[id!='+id+']').each(function(){
			     	$(this).css("background-image",'url('+script_path+'images/service_box.gif)');
			     });

			     $('#index_services_container > .index_services_bottons').each(function(){
			     	$(this).css("background-image",'url('+script_path+'images/service_box.gif)');
			     });
			 }, timer);
   		}
    });
    
    $("#index_services1").mouseover(); // auto load the bunos huntet service box
    
    // YouTube Box
    function createYoutubeBox(){
		var id = $(".youtubebox").attr('id');
		$("#"+id).html('<object width="342" height="218"><param name="movie" value="http://www.youtube.com/v/'+id+'&hl=en&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><param name="wmode" value="transparent"><embed src="http://www.youtube.com/v/'+id+'&hl=en&fs=1&" type="application/x-shockwave-flash" wmode="transparent" allowscriptaccess="always" allowfullscreen="true" width="342" height="218"></embed></object>');
	}
	createYoutubeBox();
	
	// Front Page - All You Need Games Box
	$("ul.gamesMenu li").click(function () {
		$("#gamesBox .gamesMenuContent").each (function () {$(this).fadeOut()});
		$("ul.gamesMenu li").each (function () {$(this).css("border-right","1px #c7c7c7 solid"); $(this).css("color","#A7A7A7")});
		$(this).css("border-right","none");
		$(this).css("color","#006291");
		var gameID = $(this).attr("value");
		$("#gameData"+gameID).fadeIn();
		
	});
	
	// Front Page - Our News Box Mouse Over
	$("#ourNewsBox li").hover(function () {
		$("#ourNewsBox li").each(function () {
			$(this).css("background-color","#ffffff")
		});
		$(this).css("background-color","#EFF5F8")
	});
	
	// Front Page - Our News Box Click
	$("#ourNewsBox li img").click(function () {
		var id = $(this).attr('id').replace(/id/,'');
		// Load Headlines YouTube/Articles images on the fly.
		if($(".newsBoxYoutube"+id).attr('id') && $(".newsBoxYoutube"+id).attr('src').indexOf('images/spacer.gif')!=-1){
			var youtubeImg = 'http://img.youtube.com/vi/'+$(".newsBoxYoutube"+id).attr('id').replace(/yt_/,'')+'/default.jpg';
			loadHeadlinesImage(".newsBoxYoutube"+id,youtubeImg);
		}
		
		if($(".newsBox"+id).attr('id') && $(".newsBox"+id).attr('src').indexOf('images/spacer.gif')!=-1){
			var headlineImg = script_path+$(".newsBox"+id).parent().attr('class').replace(/:/ig,'/');
			loadHeadlinesImage(".newsBox"+id,headlineImg);
		}
		
		var clickedImgSrc = $(this).attr("src");
		if (clickedImgSrc.indexOf('max.gif')){
			// Close all the rest and change image
			$("#ourNewsBox li div").each(function () {
				$(this).slideUp();
				var otherImgSrc = $(this).parent().children('img').attr("src");
				if (otherImgSrc.indexOf('min.gif')){
					otherImgSrc = otherImgSrc.replace(/min.gif/i,"max.gif");
					$(this).parent().children('img').attr("src",otherImgSrc);
				}
			});
			// Open Div
			$(this).parent().find('div').slideDown();
			// Replace Image
			clickedImgSrc = clickedImgSrc.replace(/max.gif/i,"min.gif");
			$(this).attr("src",clickedImgSrc);
		}
	});
	
	// Front page - load youtube/article images on a blank img when a user click a + button of an article.
	function loadHeadlinesImage(src,img){
		$(src).attr('src',img);
		$(src).css('width','75px');
		$(src).css('height','62px');
		$(src).css('float','right');
		$(src).css('border','1px black solid');
		$(src).css('margin','5px 10px');
	}
	
	// Front Page - Opens first box of news and Services (bonus hunter)
	$("#ourNewsBox li img:first").click();
	
	// Drop Box Code
	$(".dropdown dt a").click(function() {
		var dropDownId = $(this).parents("dl:first").attr("id");
		$("#"+dropDownId+" dd ul").toggle();
	});

	$(".dropdown dd ul li a").click(function() {
		var dropDownId = $(this).parents("dl:first").attr("id");
		var text = $(this).html();
		$("#"+dropDownId+" dt a span").html(text);
		$("#"+dropDownId+" dd ul").hide();
	});

	$(document).bind('click', function(e) {
		var $clicked = $(e.target);
		if (! $clicked.parents().hasClass("dropdown"))
		$(".dropdown dd ul").hide();
	});
	
	// Front Page - Top Promotions Table
	$("#promotionsSelect li a").click(function (){
		var sectionId = $(this).parent().attr("value");
		var h2Title = "Top 10 Online Casinos";
		switch (sectionId)
		{
			case 40: h2Title = "Top 10 Online Casinos"; break; // Casino
			case 41: h2Title = "Top 10 Poker Sites"; break; // Poker
			case 42: h2Title = "Top 10 Bingo Sites"; break; // Bingo
			case 44: h2Title = "Top 10 Sportsbooks"; break; // Sport
		}
		$.post(script_path+"includes/admin/front-promotions.php", {action:1, sectionId:sectionId},
		function(data){
			$("#top10").html(h2Title);
			$("#topPromotions").html(data);
		});
	});
});
