function chn(x)
{
	x.style.background="";
}

function ch_pink(rd)
{
	rd.style.background="#990000"
}

function ch_green(rd)
{
	rd.style.background="#336600"
}
function ch_blue(rd)
{
	rd.style.background="#330099"
}
function ch_orange(rd)
{
	rd.style.background="#FF6600"
}

function chkMBN()
{
	
	if (document.frmActivate.MBN.value != document.frmActivate.MBN2.value)
	{
		alert("Confirmation Mobile Number is incorrect");
		return (false);
	}
	else if (document.frmActivate.MBN.value.length < 10)
	{
		alert("INVALID MOBILE NUMBER");
		return (false);	
	}
	else if (parseInt(document.frmActivate.MBN.value) == 0)
	{
		alert("INVALID MOBILE NUMBER");
		return (false);	
	}
	else
		return (true);
}

function openwindow(x,w,h)
    {
    
    childwin = window.open(x,"SMS","toolbar=no,scrollbars=no,location=no,directories=no,status=no,menubar=no, width="+w+", height="+h+",fixed=yes")
    childwin.focus();  
    }

function calcCharLeft() {
	clipped = false
	lenUSig = 0
	maxLength = 160
        if (document.frmsms.STR_MESSAGETEXT.value.length > maxLength) 
		{ 
	        document.frmsms.STR_MESSAGETEXT.value = document.frmsms.STR_MESSAGETEXT.value.substring(0,maxLength)
			charleft = 0
			clipped = true
        } 
		else 
		{
			charleft = maxLength - document.frmsms.STR_MESSAGETEXT.value.length
		}
        document.frmsms.msgCL.value = charleft
        return clipped
}

function textKey() {
	supportsKeys = true
	calcCharLeft()
}

function AddTemp()
{
	
	if (document.frmsms.Title.value.length < 1)
	{	alert("Title Cannot Be Blank"); document.frmsms.Title.focus(); return (false) ; }
	else if (document.frmsms.STR_MESSAGETEXT.value.length < 1)
	{	alert("Message Cannot Be Blank"); document.frmsms.STR_MESSAGETEXT.focus() ;return (false) ; }
	else
		return (true);
}

function chkNumber()
{
	if (document.frmAddNumber.MobileNo.value.length < 10 )
	{ alert("Mobile Number Cannot Be Less Than 10 Digits"); document.frmAddNumber.MobileNo.focus(); return (false); }
	else if (document.frmAddNumber.Name.value.length < 3)
	{ alert("Name Cannot Be Less Than 3 Characters"); document.frmAddNumber.Name.focus(); return (false); }
	else
		return (true);

}


function chkPassword()
{
	if (document.frmUpdatePassword.OldPassword.value.length < 5 )
	{ alert("Password Cannot Be Less Than 5 Characters"); document.frmUpdatePassword.OldPassword.focus(); return (false); }
	else if (document.frmUpdatePassword.NewPassword.value.length < 5)
	{ alert("New Password Cannot Be Less Than 5 Characters"); document.frmUpdatePassword.NewPassword.focus(); return (false); }
	else if (document.frmUpdatePassword.ConPassword.value.length < 5)
	{ alert("Confirmation Password Cannot Be Less Than 5 Characters"); document.frmUpdatePassword.ConPassword.focus(); return (false); }
	else if (document.frmUpdatePassword.NewPassword.value != document.frmUpdatePassword.ConPassword.value)
	{ alert("New Password and Confirmation Password are not similer"); document.frmUpdatePassword.ConPassword.focus(); return (false); }
	else
		return (true);

}
