function get_forumChkCount(txt)	
{
	f1 = document.forum_step2;
	var cnt=0;
	for(i=0;i< f1.length;i++)
	{
		var x=f1[i].name;
		
		if( x.indexOf(txt) >=0  &&  f1[i].type=='checkbox'  && f1[i].checked==true)
				cnt++;
	}	
	return cnt;
}//get_reviewChkCount


function check_forum_step2(frm)
{
	if(get_forumChkCount('forum_category') == 0 )
	{
      	alert('Please select category');
		return false;
	}
	if(get_forumChkCount('forum_category') > 1)
	{
      	alert("Please select maximum of 1 categorires");
		return false;
	}
	if(document.getElementById("Subject").value.trim() == "")
	{
		alert("Please enter subject");
		document.getElementById("Subject").focus();
		return false;
	}//if
	if(document.getElementById("Message").value.trim() == "")
	{
		alert("Please enter Message");
		document.getElementById("Message").focus();
		return false;
	}//if
	/*if(document.getElementById("ComputerModel").value.trim() == "")
	{
		alert("Please enter computer model");
		document.getElementById("ComputerModel").focus();
		return false;
	}//if
	if(document.getElementById("OSsystem").value.trim() == "")
	{
		alert("Please enter OS system");
		document.getElementById("OSsystem").focus();
		return false;
	}//if*/
	document.getElementById("Post").disabled='true';
	hidden_span = document.getElementById('hide_stuff');
	hidden_span.style.display = 'block';
	return true;		
}//check_review_step2()

function Check_Forum_Reply()
{
	if(document.getElementById("Subject").value.trim() == "")
	{
		alert("Please enter subject");
		document.getElementById("Subject").focus();
		return false;
	}//if
	if(document.getElementById("Message").value.trim() == "")
	{
		alert("Please enter Message");
		document.getElementById("Message").focus();
		return false;
	}//if
	if(document.getElementById("ComputerModel").value.trim() == "")
	{
		alert("Please enter computer model");
		document.getElementById("ComputerModel").focus();
		return false;
	}//if
	if(document.getElementById("OSsystem").value.trim() == "")
	{
		alert("Please enter OS system");
		document.getElementById("OSsystem").focus();
		return false;
	}//if
	document.getElementById("Post").disabled='true';
	hidden_span = document.getElementById('hide_stuff');
	hidden_span.style.display = 'block';
	return true;		
}//check_review_step2()

function Check_Forum_Email()
{
	if(document.getElementById("ToName").value.trim() == "")
	{
		alert("Please enter to name");
		document.getElementById("ToName").focus();
		return false;
	}//if
	if(document.getElementById("ToEmail").value.trim() == "")
	{
		alert("Please enter to email address");
		document.getElementById("ToEmail").focus();
		return false;
	}//if
	if(document.getElementById("ToEmail").value.trim() != "")
	{
		if(emailCheck(document.getElementById("ToEmail").value) == false)
		{
			alert("Please enter vald to email address");
			document.getElementById("ToEmail").focus();
			return false;
		}
	}//if
}//check_review_step2()

function redirect_editForum_post(forum_id )
{
	var next ="com_forum_post|step3";		
	window.location.href = "http://www.macdirectory.com/component/option,com_forum3/task,editForum/forum_id,"+forum_id +"/next,"+next+"/";
}

function ChangeForumStatus(forum_id,ForumStatus)
{
	window.location.href = "http://www.macdirectory.com/component/option,com_forum3/task,UpdateStatus/forum_id,"+forum_id +"/ForumStatus,"+ForumStatus+"/";
}


function ListCategoryForums()
{
	var category = document.getElementById("category").value;
	
	if(category == "all")
		window.location.href = "http://www.macdirectory.com/component/option,com_forum/task,viewAll/";
	else if(category == "Hardware" || category == "Software" || category == "MacDirectory__Talk" || category == "Special__Topics")
		window.location = "http://www.macdirectory.com/component/option,com_forum1/task,viewCategory/catName,"+category+"/";
	else
		window.location = "http://www.macdirectory.com/component/option,com_forum1/task,searchCategory/catName,"+category+"/";
		
}//

function ListCategoryForums1()
{
	var category = document.getElementById("category1").value;
	
	if(category == "all")
		window.location.href = "http://www.macdirectory.com/component/option,com_forum/task,viewAll/";
	else if(category == "Hardware" || category == "Software" || category == "MacDirectory__Talk" || category == "Special__Topics")
		window.location = "http://www.macdirectory.com/component/option,com_forum1/task,viewCategory/catName,"+category+"/";
	else
		window.location = "http://www.macdirectory.com/component/option,com_forum1/task,searchCategory/catName,"+category+"/";
		
}//

function get_EditForumChkCount(txt)	
{
	f1 = document.forum_step2;
	var cnt=0;
	for(i=0;i< f1.length;i++)
	{
		var x=f1[i].name;
		
		if( x.indexOf(txt) >=0  &&  f1[i].type=='checkbox'  && f1[i].checked==true)
				cnt++;
	}	
	return cnt;
}//get_reviewChkCount


function check_forum_edit(frm)
{
	if(get_EditForumChkCount('forum_category') == 0 )
	{
      	alert('Please select category');
		return false;
	}
	if(get_EditForumChkCount('forum_category') > 1)
	{
      	alert("Please select maximum of 1 categorires");
		return false;
	}
	if(document.getElementById("Subject").value.trim() == "")
	{
		alert("Please enter subject");
		document.getElementById("Subject").focus();
		return false;
	}//if
	if(document.getElementById("Message").value.trim() == "")
	{
		alert("Please enter message");
		document.getElementById("Message").focus();
		return false;
	}//if
	document.getElementById("Post").disabled='true';
	hidden_span = document.getElementById('hide_stuff');
	hidden_span.style.display = 'block';
	return true;		
}//check_review_step2()