//+++++++++++++++++++++++ form validation function +++++++++++++++++++++
function comment_valid()
{
	if(document.comment.name.value=="")
	{
		alert("الرجاء كتابة الإسم");
		document.comment.name.focus();
	}
	else if(document.comment.email.value=="")
	{
		alert("الرجاء كتابة البريد الإلكتروني");
		document.comment.email.focus();
	}
	else if(document.comment.subject.value=="")
	{
		alert("الرجاء كتابة عنوان التعليق");
		document.comment.subject.focus();
	}
	else if(document.comment.text.value=="")
	{
		alert("الرحاء كتابة نص التعليق");
		document.comment.text.focus();
	}
	else
		document.comment.submit();
}
function friend_valid()
{
	document.friend.submit();
}


function ajax_page(page)
{
document.getElementById("content").innerHTML="";
//document.getElementById(id).style.visibility='visible';
//document.getElementById(img_id).src = img_src;
//document.getElementById(img_id).alt="show";
//document.getElementById(id).className=class_name;
xmlhttp.open("GET",page);
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("content").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.send(null);
}
/**
 * create add to bookmark link
 * @return
 */
function CreateBookmarkLink(url) 
{
		title = document.title;
		if (window.sidebar) { // Mozilla Firefox Bookmark
			window.sidebar.addPanel(title, url,"");
		} 
		else if( window.external ) { // IE Favorite
			window.external.AddFavorite( url, title); 
		}
		else if(window.opera && window.print) { // Opera Hotlist
			return true; }
}
//check order type
order = 'desc';
function commentsOrdering(group_id)
{
	if(order == 'desc')
	{
		$('#comments').load('../templates/sort_comments.php?order=1&group_id='+group_id);
		document.getElementById('ordering').src = '../images/down.png';
		order = 'asc';
		document.getElementById('comments').style.postion = 'auto';
	}
	else 
	{
		$('#comments').load('../templates/sort_comments.php?group_id='+group_id);
		document.getElementById('ordering').src = '../images/up.png';
		order = 'desc';
	}
}
/*
 * get the ajax page for other group service
 */
function getOtherGroup(id,group_id)
{
	ajaxPage(id,'../templates/other_group.php','group_id='+group_id);
	document.getElementById(id).style.visibility  = 'visible';
	$('#'+id).show('slow');
	document.getElementById(id).style.marginLeft  = "-205px";
}
/**
 * hide box after in show on getOtherGroup() function
 * @param id
 * @return
 */
function hideBox(id)
{
	$('#'+id).hide('slow');
}
