// JavaScript Document
function chkCommentTxt()
{
	if(document.getElementById("txt_comment_main").value == "")
	{
			alert("Please enter review text.");
			return false;
	}
	else
	{
			document.getElementById("txt_comment_new").value = document.getElementById("txt_comment_main").value;
			return true;	
	}
}//fun


function chkBlogCommentTxt(tmp_user_id)
{
	if(tmp_user_id == "0" || tmp_user_id.length == "undefined")
	{
			
			alert("Please login to the site to post a comment.");
			return false;
	}
	else if(tmp_user_id > 0 && document.getElementById("txt_comment_main").value == "")
	{
			alert("Please enter comment text.");
			document.getElementById("txt_comment_main").focus();
			return false;
	}
	else 
	{
			document.getElementById("txt_comment_new").value = document.getElementById("txt_comment_main").value;
			return true;	
	}
}

function chkBlogCommentTxt_withlogin(tmp_user_id)
{
	if(tmp_user_id > 0 && document.getElementById("txt_comment_main").value == "")
	{
			alert("Please enter comment text.");
			document.getElementById("txt_comment_main").focus();
			return false;
	}
	else 
	{
			document.getElementById("txt_comment_new").value = document.getElementById("txt_comment_main").value;
			return true;	
	}
}


// for removing loging protection in blog comment.
function chkBlogCommentTxt_new()
{
	if(document.getElementById("user_name").value == "")
	{
		alert("Please enter Name");
		return false;
	}	
	else if(document.getElementById("email").value == "")
	{
		alert("Please enter Email");
		return false;
	}
	else if(document.getElementById("txt_comment_main").value == "")
	{
		alert("Please enter Comment");
		return false;
	}
	else if(document.getElementById("email").value.indexOf('@')==-1 || document.getElementById("email").value.indexOf('.')==-1 || document.getElementById("email").value.indexOf('@')!=document.getElementById("email").value.lastIndexOf('@') || document.getElementById("email").value.indexOf('@')>document.getElementById("email").value.lastIndexOf('.') || document.getElementById("email").value.length-document.getElementById("email").value.lastIndexOf('.')<=1)
	{
		alert('Please enter a valid email address.');
		document.getElementById("email").select();
		return false;
	}
	else 
	{
		document.getElementById("txt_comment_new").value = document.getElementById("txt_comment_main").value;
		return true;	
	}
}

function chk_validation()
{
	if(document.getElementById("user_name") == "")
		alert("Please enter Name");
		
	if(document.getElementById("email") == "")
		alert("Please enter Email");
}
//-----------------------------------------------------
function chkBookReviewCommentTxt(tmp_user_id)
{
	if(tmp_user_id == "0" || tmp_user_id.length == "undefined")
	{
			alert("Please login to the site to post a review.");
			return false;
	}
	else if(tmp_user_id > 0 && document.getElementById("txt_comment_main").value == "")
	{
			alert("Please enter review text.");
			return false;
	}
	else
	{
			document.getElementById("txt_comment_new").value = document.getElementById("txt_comment_main").value;
			return true;	
	}
}//fun





function chkCommentTxtForum()
{
	if(document.getElementById("txt_comment_main").value == "")
	{
			alert("Please enter topic text.");
			return false;
	}
	else
	{
			document.getElementById("txt_comment_new").value = document.getElementById("txt_comment_main").value;
			return true;	
	}
}//fun
function chkCommentTxtInner(id)
{
	//alert("i m here");
	
	var txtName	= "txt_comment_"+id;
	document.getElementById("txt_id").value = id;
	if(document.getElementById(txtName).value == "")
	{
			alert("Please enter comment text.");
			return false;
	}
	else
		document.getElementById("txt_comment_new").value = document.getElementById(txtName).value;
	//	alert(document.getElementById("txt_comment_new").value);
}//fun


function hideshow(id,plusMinusId)
{
	//alert(plusMinusId);
	var act;
	act	= document.getElementById(id).style.display;
	if(act == "none") {
		document.getElementById(id).style.display	= "block";
		document.getElementById(plusMinusId).innerHTML		= "<img src=\"images/minus_icon.gif\" border=\"0\" />";
	}
	if(act == "block") {
		document.getElementById(id).style.display	= "none";
		document.getElementById(plusMinusId).innerHTML		= "<img src=\"images/add_event_icon.gif\" border=\"0\" />";
		
	}
	
}


// Following function is added for Author Details Page 3:42 PM 1/12/2011
function show_delete(id)
{
	if(confirm('Are you sure to delete this comment ?'))
	{
		var frmname = document.getElementById(id);
		frmname.submit(); 
	}
	
	if(prompt('Please enter your email id',''))
	{
		var mail = document.getElementById(id);
		var currentmail = document.getElementById(email_id).value;
		alert (currentmail);
		if(currentmail == mail)
		{
			//frmname.submit(); 
			alert (currentmail);
		}
	}
}

function user_email(cid,bid)
{
	//alert(cid+"====="+bid);
	var user_mail = document.getElementById('email_id_'+cid).value;
	var email =prompt('Please enter your email id','');
	if(user_mail == email)
	{
		//alert('?cId='+cid+'&blogId='+bid);
		window.location.href = '?cId='+cid+'&blogId='+bid;
	}
	else
	{
		alert('Please Enter valid email to delete the comment');											
	}
}
