
//This function is used to Change Header Menu Background
function ChangeHeaderNav(MenuID,Action)
{
	if(Action==1)
	{
		$(MenuID).src="image/"+MenuID+"-focus.gif";
	}
	else
	{
		$(MenuID).src="image/"+MenuID+".gif";
	}
}


function CheckPostComment(MyForm)
{
	if(MyForm.comments.value=="")
	{	
		alert("Please enter your comment!")
		return false
	}
	
	var comment=MyForm.comments.value;
	comment=comment.replace(/\r\n/g, "MyChangeLineBR"); 
	
	//make the ajax call  
	var req = new Request
	({  
		method: 'post',  
		url: "post_comment.asp?gameid="+gameid+"&Version="+Math.random(),  
		data: { "comment":comment },  
		headers: { 'If-Modified-Since':'0' },  
		onRequest: function() 
		{
		    MyForm.SubmitButton.value="Posting now...";
		    MyForm.SubmitButton.disabled=true;
		},  
		onSuccess: function(txt)
		{
		    $("CommentStatus").setStyle("display","block");
		    MyForm.SubmitButton.value="Post comment";
		    MyForm.SubmitButton.disabled=false;
		    MyForm.comments.value="";
		    window.setTimeout("ClearCommentStatus();", 10000);
		    ShowComments(1);
		},
		onFailure: function()
		{
			alert("Your comment post failed, please try again!");
		    MyForm.SubmitButton.value="Post comment";
		    MyForm.SubmitButton.disabled=false;
		}
	});
	req.send();
}

function ClearCommentStatus()
{
    $("CommentStatus").setStyle("display","none");
}

function ShowComments(pageno)
{
	//make the ajax call  
	var req = new Request
	({  
		method: 'get',  
		url: "show_comment.asp?gameid="+gameid+"&pageno="+pageno+"&Version="+Math.random(),  
		data: { },  
		headers: { 'If-Modified-Since':'0' },  
		onRequest: function() 
		{

		},  
		onSuccess: function(txt)
		{  
		    $("ShowCommentsDIV").innerHTML=txt;
		},
		onFailure: function()
		{}
	});
	req.send();
}


function QuickJump()
{
    var SelectedValue=$("quickjump").value;
    if(SelectedValue.length>0)
    {
        window.location.href="playgame.asp?gameid="+SelectedValue;
    }
}


function ResetSearchKeywordField(ActionName)
{
    var q=document.SearchGameForm.q.value.trim();
    
    if(ActionName=="onClick")
    {
        if(q=="Search Games")
        {
            document.SearchGameForm.q.value="";
        }
    }
    else
    {
        if(q=="")
        {
            document.SearchGameForm.q.value="Search Games";
        }
    }
}


function HideLoadingFlashPlayerDIV()
{
    $("LoadingFlashPlayerDIV").setStyle("display","none");
}