// Validate contact us form
function ValidateContactUs(frm)
{
	with(frm)
    {
    	if(!IsEmpty(contact_name, ContactNameeEmpty))
        {
			return false;
        }
    	if(!IsEmpty(contact_email, ContactEmailEmpty))
        {
			return false;
        }
		if(!IsEmail(contact_email, ContactEmailValid))
		{
			return false;
		}
        return true;
    }
}
// Validate contact us form
function ValidateFeedback(frm)
{
	with(frm)
    {
    	if(!IsEmpty(feedback_name, FeedbackNameeEmpty))
        {
			return false;
        }
    	if(!IsEmpty(feedback_email, FeedbackEmailEmpty))
        {
			return false;
        }
		if(!IsEmail(feedback_email, FeedbackEmailValid))
		{
			return false;
		}
        return true;
    }
}
//====================================================================================================
//	Function Name	:	Delete_Click()
//----------------------------------------------------------------------------------------------------
function Change_Category(frm)
{
	with(frm)
	{
		alert("Here");
		alert(mpcat_title.value)			
	}
}
//====================================================================================================
//	Function Name	:	Validate_Form()
//----------------------------------------------------------------------------------------------------
function Validate_frmMarketPlace(frm)
{
	with(document.frmMarketPlace)
    {
		if(!IsEmpty(mp_companyname,MarketPlaceTitleEmpty))
		{
			return false;
		}
		if(IsEmpty(mp_email,''))
		{
			if(!IsEmail(mp_email,MarketPlaceValidEmail))
			{
					return false;
			}
		}
		if(mpcat_id.selectedIndex == 0)
		{
				alert(MarketPlaceSelCategory);
				return false;
		}
		if(mp_state.selectedIndex == 0)
		{
				alert(MarketPlaceSelState);
				return false;
		}
		if(IsEmpty(mp_picture,''))
		{
			if(!checkImageType(mp_picture,MarketValidImage))
			{
					return false;
			}
		}
	}	
	return true;
}
//====================================================================================================
//	Function Name	:	Validate_doLogin
//	Purpose			:	Show user option
//----------------------------------------------------------------------------------------------------
function Validate_doLogin()
{
	with(document.frmLogin)
	{
		if(!IsEmpty(user_email, JM_EnterEmailAddress))
		{
			return false;
		}
		else if (!IsEmail(user_email, JM_EnterValidEmailAddress))
		{
			return false;
		}
	
		if(!IsEmpty(user_password, JM_EnterPassword))
		{
			return false;
		}
	}
	return true;
}
//====================================================================================================
//	Function Name	:	Mail_Click()
//----------------------------------------------------------------------------------------------------

function Mail_Click(PageId,NewsId)
{
	with(document.frmNews)
	{
		popupWindowURL('index.php?Action=newssend&pid='+PageId+'&news_id='+NewsId, '',600, 500, false, false, true);
	}
}

// Validate News mail  form
function Validate_MailNewsForm(frm)
{
	with(frm)
    {
    	if(!IsEmpty(txtFriendName, NewsFriendName))
        {
			return false;
        }
		if(!IsEmail(txtFriendEmail, NewsFriendMailId))
		{
			return false;
		}
    	if(!IsEmpty(txtSender, NewsYourName))
        {
			return false;
        }
		if(!IsEmpty(txtYourMail, NewsSenderMailId))
		{
			return false;
		}
		if(!IsEmail(txtYourMail, NewsMailValidate))
		{
			return false;
		}

return true;
    }
}

function callPrintWin(NewsId)
{
	with(document.frmNews)
	{
		popupWindowURL('index.php?Action=print&news_id='+NewsId, '',550, 400, false, false, true);
	}	
}
function callPrint()
{
	window.print();
}

function ValidateRegister(frm)
{
	with(frm)
    {
    	if(!IsEmpty(admin_firstname, RegisterFirstNameEmpty))
        {
			return false;
        }
    	if(!IsEmpty(admin_lastname, RegisterLastNameEmpty))
        {
			return false;
        }
    	if(!IsEmpty(admin_email, RegisterEmailEmpty))
        {
			return false;
        }
		if(!IsEmail(admin_email, RegisterEmailValid))
		{
			return false;
		}
    	if(!IsEmpty(user_login_id, RegisterUsernameEmpty))
        {
			return false;
        }
		if(!IsLen(user_login_id,5,15, RegisterUserNameValid))
        {
			return false;
        }
		if(!IsEmpty(user_password, RegisterPwdEmpty))
        {
			return false;
        }
		if(!IsLen(user_password,5,15, RegisterPwdValid))
        {
			return false;
        }
		if(!IsPassword(user_password,RegisterIsPwd))
		{
			return false;
		}
    	if(!IsEmpty(user_confirm_password, RegisterVarifyPwd))
        {
			return false;
        }
		if(frm.user_password.value != frm.user_confirm_password.value)
        {
			alert(RegisterPwdNotMatch);
			return false;
        }
		
        return true;
    }
}
