/*------------------------- Check all Childs Check box) if the (all Check box) is checked -------------------------*/
function CheckAll(chkCheckbox,bolChecked) 
{
	if(chkCheckbox.length!=null)
		for(i=0;i<chkCheckbox.length;i++)
		{
			chkCheckbox[i].checked=bolChecked;
			
			if(bolChecked)
				HilightRow(chkCheckbox[i].parentElement.parentElement,'selectedGrid')
			else
				{
				if(i%2==0)myClassName = 'grid1';
				else myClassName = 'grid2';
				HilightRow(chkCheckbox[i].parentElement.parentElement,myClassName);
				}
		}
	else
		chkCheckbox.checked=bolChecked;
}
/*----------------------------- UnCheck the (all Check box) if any child not checked -------------------------------*/
function CheckStatus(chkParentCheckbox,chkChildCheckbox) 
{
	if(chkChildCheckbox.length!=null)
	{
		var i = 0;
		for(i=0;i<chkChildCheckbox.length;i++)
		{
			if(!chkChildCheckbox[i].checked)
			{
				chkParentCheckbox.checked = false;
				i--;
				break;
			}
		}
		if(i==chkChildCheckbox.length)chkParentCheckbox.checked = true;
	}
	else
		chkParentCheckbox.checked = chkChildCheckbox.checked;
}

/*----------------------------- Disable Delete Button if no Check box are checked ---------------------------------*/
function CheckButtonStatus(chkChildCheckbox,btn)
{
	if(chkChildCheckbox.length!=null)
	{
		var i = 0;
		for(i=0;i<chkChildCheckbox.length;i++)
			{
				if(chkChildCheckbox[i].checked)
				{
					btn.disabled = false;
					break;
				}
			}
			if(i==chkChildCheckbox.length)
			{
				btn.disabled = true;
			}
	}
	else
	{
		btn.disabled = !chkChildCheckbox.checked;
	}
}
/*----------------------------- Disable Approve Button if no Check box are checked ---------------------------------*/
function CheckUsersButtonStatus(chkChildCheckbox,btn,btn2)
{
	if(chkChildCheckbox.length!=null)
	{
		var i = 0;
		for(i=0;i<chkChildCheckbox.length;i++)
			{
				if(chkChildCheckbox[i].checked)
				{
					btn.disabled = false;
					btn2.disabled = false;
					break;
				}
			}
			if(i==chkChildCheckbox.length)
			{
				btn.disabled = true;
				btn2.disabled = true;
			}
	}
	else
	{
		btn.disabled = !chkChildCheckbox.checked;
		btn2.disabled = !chkChildCheckbox.checked;
	}
}
/*----------------------------- Check the entered keys ---------------------------------*/
function CheckChr(keyCode, Chrs)
{
	if(keyCode==13)return true;
	var strKeyCode=String.fromCharCode(keyCode)
	if(Chrs.indexOf(strKeyCode)!=-1)return true;
}
/*----------------------------- Validate Required Fields ---------------------------------*/
function ValidateRequiredFields(frmTheForm,reqFields,reqMsgs)
	{
		if(reqFields=="")return true;
		var arReqFields = reqFields.split(',');
		var arReqMsgs = reqMsgs.split(',');
		for(var i=0;i<arReqFields.length;i++){
			if(removeSpaces(eval('document.'+frmTheForm+'.'+arReqFields[i]+'.value'))==''){
				eval('document.'+frmTheForm+'.'+arReqFields[i]+'.focus();');
				//eval("document.getElementById('spn"+arReqFields[i]+"').style.visibility='visible';");
				alert(arReqMsgs[i]);
				return false;
			}
		}
		return true;
	}
/*----------------------------------- Start Validators -------------------------------------*/
/*function validateRequired(value,spn)
{
	if(removeSpaces(value)=='')
		eval("document.getElementById('"+spn+"').style.visibility='visible';");
	else
		eval("document.getElementById('"+spn+"').style.visibility='hidden';");
}
/*-----------------------------------------------------------------------------------------*/
/*function validateEmail(value,spn)
{	
//	alert(value)
	if (removeSpaces(value)=='' || !((value.indexOf("@")==value.lastIndexOf("@"))&&(value.indexOf("@")!=-1)&&(value.lastIndexOf("@")!=value.length-1)))
		eval("document.getElementById('"+spn+"').style.visibility='visible';");
	else
		eval("document.getElementById('"+spn+"').style.visibility='hidden';");
}
/*-----------------------------------------------------------------------------------------*/
/*function validateCompare(value1,value2,operator,spn)
{
if(eval(value1)+operator+eval(value2))
		eval("document.getElementById('"+spn+"').style.visibility='visible';");
	else
		eval("document.getElementById('"+spn+"').style.visibility='hidden';");
}
/*-----------------------------------------------------------------------------------------*/
/*function validateRange(value1,value2,operator,spn)
{
	
	if(Number(eval(value1))+operator+Number(eval(value2)))
		eval("document.getElementById('"+spn+"').style.visibility='visible';");
	else
		eval("document.getElementById('"+spn+"').style.visibility='hidden';");
}
/*-----------------------------------------------------------------------------------------*/
/*----------------------------------- End Validators -----------------/--------------------*/
/*-----------------------------------------------------------------------------------------*/
/*----------------------------------- remove spaces ------------------//-------------------*/
function removeSpaces(string)
{
	var newString = '';
	for (var i = 0; i < string.length; i++) {
	if (string.charAt(i) != ' ') newString += string.charAt(i);
	}
	return newString;
}
/*---------------------------------------------------------------------------------------*/
function HilightRow(tr, cls)
{
	tr.className = cls;
}
/*---------------------------------------------------------------------------------------*/
/*---------------------------------- Site PopUp wind.------------------------------------*/
/*---------------------------------------------------------------------------------------*/
	function AddToFavorite(FavoriteUserID)
	{			
		if(confirm("Are you sure you want to add this member ?  هل تريد إضافة هذا العضو إلى المفضلة ؟"))
			window.open('addtofavorite.php?FavoriteUserID='+FavoriteUserID+'',"Add_Favorite_User",'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,close=0,resizable=0,copyhistory=no,width=454,height=200,left=250,top=150,border=0');
	}
	function DelFavorite(FavoriteUserID)
	{
		if(confirm("Are you sure you want to remove this member ?  هل تريد حذف هذا العضو من المفضلة ؟"))
			window.open('delfavorite.php?FavoriteUserID='+FavoriteUserID+'',"DelFavorite",'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,close=0,resizable=0,copyhistory=no,width=454,height=200,left=250,top=150,border=0');
	}
	function MsgSend(ToUserID,ToName)
	{			
		window.open('msgsend.php?ToUserID='+ToUserID+'&ToName='+ToName+'',"Send_Msg",'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,close=0,resizable=0,copyhistory=no,width=454,height=220,left=250,top=150,border=0');
	}
	function SendToFriend(FromName,FromEmail,ToViewName,ToViewUserID)
	{			
		window.open('sendtofriend.php?FromName='+FromName+'&FromEmail='+FromEmail+'&ToViewName='+ToViewName+'&ToViewUserID='+ToViewUserID+'',"Send_Msg",'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,close=0,resizable=0,copyhistory=no,width=454,height=220,left=250,top=150,border=0');
	}
	function Block(BlockUserID)
	{			
		if(confirm("Are you sure you want to block this member ?  هل تريد إضافة هذا العضو إلى قائمة الحجب ؟"))
			window.open('blocksender.php?BlockUserID='+BlockUserID+'',"Block",'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,close=0,resizable=0,copyhistory=no,width=454,height=200,left=250,top=150,border=0');
	}
	function UnBlock(BlockUserID)
	{			
		if(confirm("Are you sure you want to unblock this member ?  هل تريد إزالة الحجب عن هذا العضو ؟"))
			window.open('unblocksender.php?BlockUserID='+BlockUserID+'',"UnBlock",'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,close=0,resizable=0,copyhistory=no,width=454,height=200,left=250,top=150,border=0');
	}
	function WarningSend(ToEmail,ToName)
	{			
		window.open('user/warning.php?ToEmail='+ToEmail+'&ToName='+ToName+'',"Send_Warning",'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,close=0,resizable=0,copyhistory=no,width=520,height=250,left=250,top=150,border=0');
	}
	
<!------------------------------------ Right Menu Always On Top ---------------------------------------------->
	var timer
	function scrolltop()
	{
		document.getElementById('scrollmenu').style.pixelTop = document.body.scrollTop
		if(document.body.scrollTop>120)
			document.getElementById('scrollmenu').style.position="absolute"
		else
			document.getElementById('scrollmenu').style.position="relative"
		timer=setTimeout("scrolltop()",1)
	}
	function stoptimer()
	{
		clearTimeout(timer)
	}
