/************************************************************************************/
	/*	Function to To check whether page is selected or not, to change it's contents	*/
/************************************************************************************/
function CheckPageSelect()
	{
	if( document.getElementById("PageId").value == "" )
		{
		alert("Please Select Page to edit its contents.");
		document.getElementById("PageId").focus();
		return false;
		}
	}
	
/************************************************************************************/
	/*	Function to To check whether page url is blank.											*/
/************************************************************************************/
function CheckPageTitle()
	{
	if( document.getElementById("PageTitle").value == "" )
		{
		alert("Page Title should not be blank.");
		document.getElementById("PageTitle").focus();
		return false;
		}
	}
/************************************************************************************/
	/*	Function to To check Admin change password Form details onClick Submit 			*/
/************************************************************************************/
// validation functions to check change password form fields.	START HERE
function CheckChangeAdminPasswordDetails(frm)
	{
	var SpaceCheck= " ";	
	if( document.getElementById("oldpassword").value == "" )
		{
		alert("Please enter old password.");
		document.getElementById("oldpassword").focus();
		return false;
		}
	else
		{
		var oldpassword = document.getElementById("oldpassword").value;
		len = oldpassword.length;
		for(i=0;i<len;i++)		
			{
			ch1=oldpassword.charAt(i);
			rtn1 = SpaceCheck.indexOf(ch1);
			//alert(rtn1);
			if(rtn1==0)
				{
				alert("Please enter valid password.");
				document.getElementById("oldpassword").focus();	
				return false;
				}
			}
		/*	
		flag=checkValidCompare(oldpassword,5,"Less");
		if(flag==false)
			{
			alert("Password should have minimum 5 characters.");
			document.getElementById("password").focus();
			return false;
			}
		*/	
		}
		
		
	if( document.getElementById("newpassword").value == "" )
		{
		alert("Please enter new password.");
		document.getElementById("newpassword").focus();
		return false;
		}
	else
		{
		var newpassword = document.getElementById("newpassword").value;
		len = newpassword.length;
		for(i=0;i<len;i++)		
			{
			ch1=newpassword.charAt(i);
			rtn1 = SpaceCheck.indexOf(ch1);
			//alert(rtn1);
			if(rtn1==0)
				{
				alert("Please enter valid new password.");
				document.getElementById("newpassword").focus();	
				return false;
				}
			}
			
		flag=checkValidCompare(newpassword,5,"Less");
		if(flag==false)
			{
			alert("New password should have minimum 5 characters.");
			document.getElementById("newpassword").focus();
			return false;
			}
		}	
	if( document.getElementById("confirmpassword").value == "" )
		{
		alert("Please enter Confirm Password.");
		document.getElementById("confirmpassword").focus();
		return false;
		}
	else
		{
		if(document.getElementById("newpassword").value != document.getElementById("confirmpassword").value)
			{
			alert("New Password and Confirm Password should be same.");
			document.getElementById("newpassword").value="";
			document.getElementById("confirmpassword").value="";
			document.getElementById("newpassword").focus();
			return false;
			}
		}
	}
	
/* It is compare the condition (equal,greater,less) 
Parameter : Objname,
comparision value
condition pass 'Equal', 'Greater','Less'
*/
function checkValidCompare(obj,comparewithvalue,condition)
	{
		if(obj)
		{
			val=obj.length;
			flag=false;
			if(condition=='Equal' && val==comparewithvalue)
				flag=true;
			if(condition=='Greater' && val >= comparewithvalue)
				flag=true;
			if(condition=='Less' && val< comparewithvalue)
				flag=true;
			if(condition=='LessEqual' && val<= comparewithvalue)
				flag=true;
			
			if(flag==true)
				return false;
			//else
				//return true;	
		}
		else
			return false;	
	}	
