// JavaScript Document
var chkVal;
function join_fanclub(id, mid, uid, chk_link)
{
	chkVal = chk_link;
	var randomnumber=Math.floor(Math.random()*110);
	url = HOST+MEMBERS+"/fanclub_action.php?cid="+id+"&moduleid="+mid+"&uid="+uid+"&randomnumber="+randomnumber;
	http.open('get', url);
	http.onreadystatechange = join_fanclub_response;
	http.send(null);
	
}

function join_fanclub_response()
{
	if (http.readyState == 4)
	{
		try
		{
			if(chkVal == 1)
			{
				document.getElementById("div_club").innerHTML = '';
				document.getElementById("div_club").innerHTML = 'My Fanclub';
			}
			else
			{
				document.getElementById("fanclubimg").src = HOST+"/images/club.gif";
				document.getElementById("fanclubimg").alt = "";
			}
			
			tableBusy = false;
			
		} // end try 
		catch(e)
		{
			alert("Error: " + e) ;
		} // end try catch
	} // end if readystate 4
} // end tableresponse function



function add_topic()
{
	document.getElementById('show_topic').style.display = "block";
	return false;
}

function close_add_topic()
{
	document.getElementById('show_topic').style.display = "none";
	return false;
}

function check_topic_form()
{
	if(document.getElementById('_txtTitle').value=='')	
	{
		alert('Please enter a title.');
		document.getElementById('_txtTitle').focus();
		return false;
	}
	else
	{
		document._frmNewTopic.submit();
		document.getElementById('show_topic').style.display = "none";
	}
	
}


function chk_topic_comment()
{
	if(document.getElementById('_txtComment').value=='')	
	{
		alert('Please enter a comment.');
		document.getElementById('_txtComment').focus();
		return false;
	}
	else
	{
		document._frmAddTopicComment.submit();
		document.getElementById('_txtComment').value=='';
	}	
}


function show_quote_div(commentId)
{
	
	
}


function show_quote_div(commentId)
{
	var randomnumber=Math.floor(Math.random()*110);
	document.getElementById('_hdTopicCommentId').value = commentId
	var url = HOST+"/mov/omd_fanclub_topic_quote_ajax.php?cmt="+commentId+"&randomnumber="+randomnumber
	http.open('GET', url);
	http.onreadystatechange = statechanged;
	http.send('NULL');
	return false;
}

function statechanged()
{
	if (http.readyState==4 || http.readyState=="complete") 
   	{ 
		document.getElementById("display_comment_quote").style.display = 'block'
		document.getElementById("display_comment_quote").innerHTML=http.responseText;
    }
}

function delete_fanclub_item(fanclubid)
{
	if(!confirm('Are you sure you want to remove the item from this fanclub?'))
	{
		return;
	}
	else
	{
		var url = HOST+MEMBERS+"/fanclub_action.php?mode=delete&fanclubid="+fanclubid+"&redirect="+window.document.URL.toString();
		window.location.href = url;
	}
}

function delete_comments_item(commentid)
{
	if(!confirm('Are you sure you want to remove this comment?'))
	{
		return;
	}
	else
	{
		var url = HOST+MEMBERS+"/fanclub_action.php?mode=deletecomment&commentid="+commentid+"&redirect="+window.document.URL.toString();
		window.location.href = url;
	}
}


function joinFanclub(mid,uid)
{
	var randomnumber=Math.floor(Math.random()*110);
	if(mid==1)
	{
		var cid = document.getElementById('movie').value;
		url = HOST+MEMBERS+"/fanclub_action.php?mode=group&cid="+cid+"&moduleid="+mid+"&uid="+uid+"&randomnumber="+randomnumber;
	}
	else if(mid==2)
	{
		var cid = document.getElementById('celebrity').value;
		url = HOST+MEMBERS+"/fanclub_action.php?mode=group&cid="+cid+"&moduleid="+mid+"&uid="+uid+"&randomnumber="+randomnumber;
	}
	//alert(url)
	window.location.href = url;
}