function closeTransparentMainDiv(){	
	$("#transparent_main_div_frame").slideUp('normal');
	return false;
}
function closeTransparentMainRightDiv(){	
	$("#transparent_main_right_div_frame").slideUp('normal');
	return false;
}


function showPollStat(pollid,pollanswer){
	
	$.post("ajax_results.php", {pollid: pollid, pollanswer: pollanswer}, function(result) {
           // format and output result	    	   	    	   
    	   $("#transparent_main_div_content").html(result);	
    	   $("#transparent_main_div_frame").slideDown('normal');    	  
    });			
	return false;
}

function showTopUsers(choice,selectObject){		
	if( selectObject ){
		fixture = selectObject.options[selectObject.selectedIndex].value;				
	}
	$.post("ajax_results.php", {showTopUsers:choice, fixture:fixture}, function(result) {
           // format and output result	    	
			$("#transparent_main_right_div_upper_content").html("");
    	   $("#transparent_main_right_div_content").html(result);	
    	   $("#transparent_main_right_div_frame").slideDown('normal');    	  
    });			
	return false;
}


function showUserStatFrame(userid,stat,selectObject){
	var fixture = "";
	if( !stat ){
		stat = "";		
	}
	if( selectObject ){
		fixture = selectObject.options[selectObject.selectedIndex].value;				
	}
	
	
	$("#ajaxloader").show();	
	//reset content div
	$("#transparent_main_right_div_content").html("");
	
	$.post("ajax_results.php", {showuserstattop:userid}, function(result) {
        // format and output result	    	   	    	   
 	   $("#transparent_main_right_div_upper_content").html(result);	
 	   //$("#transparent_main_right_div_content").html(''); 	   
	});	
	$.post("ajax_results.php", {showuserstat:userid,stat:stat,fixture:fixture}, function(result) {
        // format and output result	    	  
 	   $("#transparent_main_right_div_content").html(result);
 	   $("#transparent_main_right_div_frame").slideDown('normal');    
 	   $("#ajaxloader").fadeOut("normal");  
	});	
	
	return false;
}

function displayUserStat(userid,stat,fixture){	
	if( !stat ){
		stat = "";		
	}
	if( !fixture ){
		fixture = "";		
	}
	
	$.post("ajax_results.php", {showuserstat:userid,stat:stat,fixture:fixture}, function(result) {
        // format and output result	    	  
 	   $("#transparent_main_right_div_content").html(result); 	     	   
	});	
	return false;	
}



function showMatchStat(fixture,game){
	$.post("ajax_results.php", {matchstat: 1, fixture:fixture, game:game}, function(result) {

        // format and output result	    	   	    	   
 	   $("#transparent_main_div_content").html(result);	
 	   $("#transparent_main_div_frame").slideDown('normal');    	  
	});			
	return false;	
}


function showPlayerStat(playerid){
	
	$.post("ajax_results.php", {playerstatid: playerid}, function(result) {

           // format and output result	    	   	    	   
    	   $("#transparent_main_div_content").html(result);	
    	   $("#transparent_main_div_frame").slideDown('normal');    	  
    });			
	return false;
}

function showPlayerStatFixture(playerid){
	
	$.post("ajax_results.php", {playerstatidFixtureStats: playerid}, function(result) {
           // format and output result	    	   	    	   
    	   $("#playerStatData").html(result);    	     	  
    });			
	return false;
}

function showPlayerStatYear(playerid){	
	$.post("ajax_results.php", {playerstatidYear: playerid}, function(result) {
           // format and output result	    	   	    	   
    	   $("#playerStatData").html(result);    	     	  
    });			
	return false;
}




function showLeague(showleague){		
	$.post("ajax_results.php", {showleague: showleague}, function(result) {

           // format and output result	    	   	    	   
    	   $("#transparent_main_div_content").html(result);	
    	   $("#transparent_main_div_frame").slideDown('normal');    	  
    });			
	return false;
}

function joinLeague(showleague){	
	var joinleaguename = $("input#joinleaguename").val();	
	var joinleaguepassword = $("input#joinleaguepassword").val();	
	
	$.post("ajax_results.php", {joinleaguename: joinleaguename,joinleaguepassword: joinleaguepassword}, function(result) {   	   	    	   
    	   $("#joinleagueresult").html(result);	    	       	  
    });	
	$("input#joinleaguepassword").val("");		
	return false;
}

function showNews(){
	
	$.post("ajax_results.php", {news: 1}, function(result) {

           // format and output result	    	   	    	   
    	   $("#transparent_main_div_content").html(result);	
    	   $("#transparent_main_div_frame").slideDown('normal');    	  
    });			
	return false;
}
