
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->



<!-- Begin-->
function ValidTextCheck(StrText) 
{
    if(StrText.length == 0 )
    { 
        return true;
    }
   
/* The following string represents the pattern for matching all special
   characters.  We don't want to allow special characters in the address. 
   These characters include ( ) < > @ , ; : \ " . [ ]    */
var specialChars="\\<>\\\\\\\"\\\\"
/* The following string represents the range of characters allowed in a 
   username or domainname.  It really states which chars aren't allowed. */
var validChars="\[^\\" + specialChars + "\]"
/* The following pattern applies if the "user" is a quoted string (in
   which case, there are no rules about which characters are allowed
   and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
   is a legal e-mail address. */
var quotedUser="(\"[^\"]*\")"
/* The following pattern applies for domains that are IP addresses,
   rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
   e-mail address. NOTE: The square brackets are required. */
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
/* The following string represents an atom (basically a series of
   non-special characters.) */
var atom=validChars + '+'
/* The following string represents one word in the typical username.
   For example, in john.doe@somewhere.com, john and doe are words.
   Basically, a word is either an atom or quoted string. */
var word="(" + atom + "|" + quotedUser + ")"
// The following pattern describes the structure of the user
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")

    var user=StrText

    // See if "user" is valid 
    if (user.match(userPat)==null) 
    {
        // user is not valid
        alert(gstrMsgExceptionInvalidText)
        return false
    }
    return true
}

/////////validate check
function emailCheck (emailStr) 
{
      

/* The following pattern is used to check if the entered e-mail address
   fits the user@domain format.  It also is used to separate the username
   from the domain. */
var emailPat=/^(.+)@(.+)$/
/* The following string represents the pattern for matching all special
   characters.  We don't want to allow special characters in the address. 
   These characters include ( ) < > @ , ; : \ " . [ ]    */
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
/* The following string represents the range of characters allowed in a 
   username or domainname.  It really states which chars aren't allowed. */
var validChars="\[^\\s" + specialChars + "\]"
/* The following pattern applies if the "user" is a quoted string (in
   which case, there are no rules about which characters are allowed
   and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
   is a legal e-mail address. */
var quotedUser="(\"[^\"]*\")"
/* The following pattern applies for domains that are IP addresses,
   rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
   e-mail address. NOTE: The square brackets are required. */
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
/* The following string represents an atom (basically a series of
   non-special characters.) */
var atom=validChars + '+'
/* The following string represents one word in the typical username.
   For example, in john.doe@somewhere.com, john and doe are words.
   Basically, a word is either an atom or quoted string. */
var word="(" + atom + "|" + quotedUser + ")"
// The following pattern describes the structure of the user
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
/* The following pattern describes the structure of a normal symbolic
   domain, as opposed to ipDomainPat, shown above. */
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")

/* Finally, let's start trying to figure out if the supplied address is
   valid. */
/* Begin with the coarse pattern to simply break up user@domain into
   different pieces that are easy to analyze. */

var matchArray=emailStr.match(emailPat)
if (matchArray==null) 
{
  /* Too many/few @'s or something; basically, this address doesn't
     even fit the general mould of a valid e-mail address. */
	alert(gstrMsgExceptionInvalidEmail)
	return false
}


var user=matchArray[1]

var domain=matchArray[2]

// See if "user" is valid 
if (user.match(userPat)==null) {
    // user is not valid
    alert(gstrMsgExceptionInvalidEmail)
    return false
}

/* if the e-mail address is at an IP address (as opposed to a symbolic
   host name) make sure the IP address is valid. */
var IPArray=domain.match(ipDomainPat)
if (IPArray!=null) {
    // this is an IP address
	  for (var i=1;i<=4;i++) {
	    if (IPArray[i]>255) {
	        alert(gstrMsgExceptionInvalidEmail)
		return false
	    }
    }
    return true
}

// Domain is symbolic name
var domainArray=domain.match(domainPat)
if (domainArray==null) {
	alert(gstrMsgExceptionInvalidEmail)
    return false;
}

/* domain name seems valid, but now make sure that it ends in a
   three-letter word (like com, edu, gov) or a two-letter word,
   representing country (uk, nl), and that there's a hostname preceding 
   the domain or country. */

/* Now we need to break up the domain to get a count of how many atoms
   it consists of. */
var atomPat=new RegExp(atom,"g")
var domArr=domain.match(atomPat)
var len=domArr.length
if (domArr[domArr.length-1].length<2 || 
    domArr[domArr.length-1].length>3) {
   // the address must end in a two letter or three letter word.
   alert(gstrMsgExceptionInvalidEmail)
   return false
}

// Make sure there's a host name preceding the domain.
if (len<2) {
   alert(gstrMsgExceptionInvalidEmail)
   return false
}

// If we've gotten this far, everything's valid!
return true;
}
//  End emailCheck()-->


function mandatorycheck(textvalue)
{
    if (isWhitespace(textvalue))
    {
     alert(gstrMsgExceptionMandatoryField);
     return false
    }
return true 
}


function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

// Check whether string s is empty.

function isEmpty(s)
{   return ((s == null) || (s.length == 0))
}
// Returns true if string s is empty or 
// whitespace characters only.

function isWhitespace (s)

{   var i;
    var whitespace = " \t\n\r";
    // Is s empty?
    if (isEmpty(s)) return true;

    // Search through string's characters one by one
    // until we find a non-whitespace character.
    // When we do, return false; if we don't, return true.

    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);

        if (whitespace.indexOf(c) == -1) return false;
    }

    // All characters are whitespace.
    return true;
}


function HilightRedcolor(txtbox,lblred)
{
    lblred.style.color='red';
	txtbox.focus();
}

function Normalcolor(lblred)
{
    lblred.style.color='black';
}


function MandatoryComboboxField(lstbox,lbl)
{
   if(lstbox.selectedIndex == 0) 
     {
        
        HilightRedcolor(lstbox,lbl);
        alert(gstrMsgExceptionMandatoryField);
        return false;     
     }
     
     else
     {
        Normalcolor(lbl);
        return true;
     }

}

function MandatoryCheckField(txtbox,lbl)
{
if (!mandatorycheck(txtbox.value))
     {
        HilightRedcolor(txtbox,lbl);
        return false;     
     }
     
     else
     {
        Normalcolor(lbl);
        return true;
     }
}

function ValidCheckField(txtbox,lbl)
{
if(!ValidTextCheck(txtbox.value))
	{
		HilightRedcolor(txtbox,lbl);
		return false;
	}
    else
    {
        Normalcolor(lbl);
        return true;
    }
}


function NumericCheckField(txtbox,lbl)
{
    if (!isInteger(txtbox.value))
    {
    	HilightRedcolor(txtbox,lbl);
		alert(gstrMsgExceptionInvalidNumeric);
		return false;
    }
    else
    {
        Normalcolor(lbl);
        return true;
    }
}


function PositiveNumericCheckField(txtbox,lbl)
{
    if (!isInteger(txtbox.value))
    {
    	HilightRedcolor(txtbox,lbl);
		alert(gstrMsgExceptionPositiveInteger);
		return false;
    }
    else
    {
        Normalcolor(lbl);
        return true;
    }
}

function MandatoryCheckBoxField(txtbox,lbl,ctrlid,ctrlname)
{
        
        var counter =0;
        for(var i=0;i<txtbox.value;i=i+1)
			{
				if (counter < 10)
				{
				var namegen = ctrlid+'0'+counter+'_'+ctrlname;
				}
				else
				{
				var namegen = ctrlid+counter+'_'+ctrlname;
				}
				
				//ctl00_ContentPlaceHolder1_ModifyJournalist1_datalistFunction_ctl05_chkFunction
				var chkDetail=document.getElementById(namegen);
				counter=counter+1
				if (chkDetail.checked == true)
				{
					 Normalcolor(lbl);
					 return true;
				}
			}	
			lbl.style.color='red';
			alert(gstrMsgExceptionMandatoryField);
			return false;	
}


//Page wise validation test

function ValidateLogin()
{	
	
var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_Login1_txtNewEmail");
var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_Login1_lczlblMyEmailAddress");

	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	
	if (!ValidCheckField(txtbox,lbl))
    {
	    return false;
	}
	
	if(!emailCheck(txtbox.value))
	{
		HilightRedcolor(txtbox,lbl)
		return false;
	}
	else
	{
	    Normalcolor(lbl)
	}
	
var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_Login1_txtPassword");
var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_Login1_lczlblPassword");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!ValidCheckField(txtbox,lbl))
    {
	return false;
	}
    if(txtbox.value.length < 6)
	{
	    HilightRedcolor(txtbox,lbl)
	    alert(gstrMsgExceptionInvalidPassword);
	    return false;
	}
	
	else
	{
	 Normalcolor(lbl)
	}
	
var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_Login1_txtConformPassword");
var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_Login1_lczlblConfirmPassword");

	 
	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}
		
	if(txtbox.value.length < 6)
        {
            HilightRedcolor(txtbox,lbl)
            alert(gstrMsgExceptionInvalidPassword);
            return false;
        }
     else
        {
        Normalcolor(lbl)
        }
		
	if (document.getElementById("ctl00_ContentPlaceHolder1_Login1_txtPassword").value !=
	    document.getElementById("ctl00_ContentPlaceHolder1_Login1_txtConformPassword").value)
        {
           alert(gstrMsgExceptionConformPasswordWrongEntry);
	       HilightRedcolor(txtbox,lbl)
           return false
        }	
    	    
	 else
         {
            Normalcolor(lbl)
         }
	    
	return true;	
}	
//login page validate()

// Start of Admin Search Page Validation
function AdminSearch()
{

}


// Start of Public Contacts Page Validation

function PublicvalidateContact()
{


	var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_ModifyPublic1_txtEmail");
    var lbl = document.getElementById("ctl00_ContentPlaceHolder1_ModifyPublic1_glczlblEmail");
	
	if (txtbox.value.length == 0)
	{
	
	return true;
	}
	if(!emailCheck(txtbox.value))
	{
		HilightRedcolor(txtbox,lbl)
		return false;
	}
	else
	{
	    Normalcolor(lbl)
	}

    var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_ModifyPublic1_txtLastName");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_ModifyPublic1_glczlblLastName");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}
	
	var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_ModifyPublic1_txtFirstName");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_ModifyPublic1_glczlblFirstName");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	    return false;
	}
	if (!ValidCheckField(txtbox,lbl))
	{
	    return false;
	}
	
	var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_ModifyPublic1_txtOrganisation");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_ModifyPublic1_glczlblOrganisation");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	    return false;
	}
	if (!ValidCheckField(txtbox,lbl))
	{
	    return false;
	}
	
		
	var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_ModifyPublic1_txtStreet");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_ModifyPublic1_glczlblStreet");
	
	
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}
	
	var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_ModifyPublic1_txtCity");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_ModifyPublic1_glczlblCity");
	
	
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}
	
	
	
	var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_ModifyPublic1_txtState");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_ModifyPublic1_glczlblState");
	
	
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}
	
		
	var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_ModifyPublic1_txtZip");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_ModifyPublic1_glczlblZip");
	
	
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}
	
	var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_ModifyPublic1_txtTelephone");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_ModifyPublic1_glczlblTelephone");
	
	
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!NumericCheckField(txtbox,lbl))
	{
	return false;
	}
	
	
	var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_ModifyPublic1_txtFax");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_ModifyPublic1_glczlblFax");
	
	
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}
	
	if (!NumericCheckField(txtbox,lbl))
	{
	return false;
	}
	
	var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_ModifyPublic1_txtMobile");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_ModifyPublic1_glczlblMobile");
	
	
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}
	
	if(!NumericCheckField(txtbox,lbl))
	{
	return false;
	}
	         
}

//End Public contact page validation


function JournalistvalidateContact()
{

	var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_ModifyJournalist1_txtEmail");
    var lbl = document.getElementById("ctl00_ContentPlaceHolder1_ModifyJournalist1_glczlblEmail");
	
	if (txtbox.value.length == 0)
	{
	
	return true;
	}
	if(!emailCheck(txtbox.value))
	{
		HilightRedcolor(txtbox,lbl)
		return false;
	}
	else
	{
	    Normalcolor(lbl)
	}

    var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_ModifyJournalist1_txtLastName");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_ModifyJournalist1_glczlblLastName");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}
	
	var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_ModifyJournalist1_txtFirstName");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_ModifyJournalist1_glczlblFirstName");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}
	
	
	var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_ModifyJournalist1_txtTitle");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_ModifyJournalist1_glczlblTitle");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}
	
	
	var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_ModifyJournalist1_HiddenField1");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_ModifyJournalist1_lczlblFunction");
	
	if(!MandatoryCheckBoxField(txtbox,lbl,'ctl00_ContentPlaceHolder1_ModifyJournalist1_datalistFunction_ctl','chkFunction'))
	{
	    return false;
	}
	
	
	
	var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_ModifyJournalist1_txtOrganisation");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_ModifyJournalist1_glczlblOrganisation");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}
	
	var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_ModifyJournalist1_txtPublication");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_ModifyJournalist1_glczlblPublication");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}
	
	
	var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_ModifyJournalist1_txtStreet");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_ModifyJournalist1_glczlblStreet");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}
	
	var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_ModifyJournalist1_txtCity");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_ModifyJournalist1_glczlblCity");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}
	
	
	
	
	var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_ModifyJournalist1_txtState");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_ModifyJournalist1_glczlblState");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}
	
	
	
	var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_ModifyJournalist1_txtZip");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_ModifyJournalist1_glczlblZip");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}
	
	/*
	commented by pratap 
	as per bug details
	Modify Journalist page (http://ada-vmmssql-dev:81/admin/modifyjournalist.aspx)
    When changing the approval status for somebody that is registering as a 
    journalist the system is asking me to enter the country even though this field is already filled in – 
    I did not notice this error occurring before
	
	var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_ModifyJournalist1_cmbCountry");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_ModifyJournalist1_glczlblCountry");
	
	if (!MandatoryComboboxField(txtbox,lbl))
	{
	return false;
	}
	*/
	
	var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_ModifyJournalist1_txtTelephone");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_ModifyJournalist1_glczlblTelephone");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}
	if(!NumericCheckField(txtbox,lbl))
	{
	return false;
	}
	
	
	var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_ModifyJournalist1_txtFax");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_ModifyJournalist1_glczlblFax");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!NumericCheckField(txtbox,lbl))
	{
	return false;
	}
	
	var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_ModifyJournalist1_txtMobile");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_ModifyJournalist1_glczlblMobile");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!NumericCheckField(txtbox,lbl))
	{
	return false;
	}
	
	
	var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_ModifyJournalist1_txtPresscardNo");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_ModifyJournalist1_glczlblPresscardNo");
	
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}
	
	var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_ModifyJournalist1_txtSupName");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_ModifyJournalist1_lczlblName");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}
	
	var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_ModifyJournalist1_txtSupTitle");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_ModifyJournalist1_lczlblTitle");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}
	var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_ModifyJournalist1_txtSupTelephone");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_ModifyJournalist1_lczlblSupTelephone");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!NumericCheckField(txtbox,lbl))
	{
	return false;
	}
	
	var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_ModifyJournalist1_txtSupEmail");
    var lbl = document.getElementById("ctl00_ContentPlaceHolder1_ModifyJournalist1_lczlblEmail");
	if(txtbox.value != '')
	{
	    if(!emailCheck(txtbox.value))
	    {
		    HilightRedcolor(txtbox,lbl)
		    return false;
	    }
	    else
	    {
	        Normalcolor(lbl)
	    }
    }
         
	var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_ModifyJournalist1_txtRemarks");
    var lbl = document.getElementById("ctl00_ContentPlaceHolder1_ModifyJournalist1_lczlblRemarks");

	if (txtbox.value.length == 0)
	{
	return true;
	}
   	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}


}
//Journalist contact page validation

//Existing user LoginPage
function ExistLoginValidation()
{
    var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_MemberLogin1_txtEmail");
    var lbl = document.getElementById("ctl00_ContentPlaceHolder1_MemberLogin1_lczlblEmail");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	
	if (!ValidCheckField(txtbox,lbl))
    {
	    return false;
	}
	
	if(!emailCheck(txtbox.value))
	{
		HilightRedcolor(txtbox,lbl)
		return false;
	}
	else
	{
	    Normalcolor(lbl)
	}
	
	
	var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_MemberLogin1_txtPassword");
    var lbl = document.getElementById("ctl00_ContentPlaceHolder1_MemberLogin1_lczlblPassword");
    
    if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
    if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}
	
}

function ForgotLoginValidation()
{
    var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_ForgetPassword1_txtEmail");
    var lbl = document.getElementById("ctl00_ContentPlaceHolder1_ForgetPassword1_lczlblEmail");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	
	if (!ValidCheckField(txtbox,lbl))
    {
	    return false;
	}
	if(!emailCheck(txtbox.value))
	{
		HilightRedcolor(txtbox,lbl)
		return false;
	}
	else
	{
	    Normalcolor(lbl)
	}
	
		
}

function ChangeLoginValidation()
{
    var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_ChangeEmail1_txtNewEmailAddress");
    var lbl = document.getElementById("ctl00_ContentPlaceHolder1_ChangeEmail1_lczlblNewEmailAddress");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	
	if (!ValidCheckField(txtbox,lbl))
    {
	    return false;
	}
	if(!emailCheck(txtbox.value))
	{
		HilightRedcolor(txtbox,lbl)
		return false;
	}
	else
	{
	    Normalcolor(lbl)
	}
	return true;
}


function ChangePasswordValidation()
{
    var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_ChangePassword1_txtOldPassword");
    var lbl = document.getElementById("ctl00_ContentPlaceHolder1_ChangePassword1_lczlblOldPassword");
    
    if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!ValidCheckField(txtbox,lbl))
    {
	return false;
	}
	
	var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_ChangePassword1_txtNewPassword");
    var lbl = document.getElementById("ctl00_ContentPlaceHolder1_ChangePassword1_lczlblNewPassword");
    
    if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!ValidCheckField(txtbox,lbl))
    {
	return false;
	}
	
    if(txtbox.value.length < 6)
	{
	    HilightRedcolor(txtbox,lbl)
	    alert(gstrMsgExceptionInvalidPassword);
	    return false;
	}
	
	else
	{
	 Normalcolor(lbl)
	}
	
	var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_ChangePassword1_txtConfirmPassword");
    var lbl = document.getElementById("ctl00_ContentPlaceHolder1_ChangePassword1_lczlblConfirmPassword");
    
    if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!ValidCheckField(txtbox,lbl))
    {
	return false;
	}
	if(txtbox.value.length < 6)
	{
	    HilightRedcolor(txtbox,lbl)
	    alert(gstrMsgExceptionInvalidPassword);
	    return false;
	}
	
   if (document.getElementById("ctl00_ContentPlaceHolder1_ChangePassword1_txtNewPassword").value !=
	    document.getElementById("ctl00_ContentPlaceHolder1_ChangePassword1_txtConfirmPassword").value)
        {
           alert(gstrMsgExceptionConformPasswordWrongEntry);
	       HilightRedcolor(txtbox,lbl)
           return false
        }	
    	    
	 else
         {
            Normalcolor(lbl)
         }
	     
    
}

function ChangeSubjectValidation()
{  
  
    var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_ChangeSubject1_HiddenField1");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_ChangeSubject1_glczlblSubjects");
	if(!MandatoryCheckBoxField(txtbox,lbl,'ctl00_ContentPlaceHolder1_ChangeSubject1_dlSubject_ctl','chkSubject'))
	{
	    return false;
	}
}

//Checkbox action

function UnSelect_TopAll(e)
{
    if (!e.checked)
    {
        var topchk = document.getElementById("ctl00_ContentPlaceHolder1_Emaildomain1_gvEmailDomain_ctl01_chkHeaderSelectAll");
        topchk.checked = false;
    }
}

function UnSelectBounced_TopAll(e)
{
    if (!e.checked)
    {
        var topchk = document.getElementById("ctl00_ContentPlaceHolder1_Bademail1_gvBadEmail_ctl01_chkHeaderSelectAll");
        topchk.checked = false;
    }
}


    function DomainSelectAll()
	{
			
			var namegen 
			var counter = 2
			var ChkCounter 
			var totRecords = document.getElementById("ctl00_ContentPlaceHolder1_Emaildomain1_lblcount").innerHTML;
			
			for(var i=0;i<totRecords;i=i+1)
			{
				if (counter < 10)
				{
				ChkCounter ='0'+ counter
				}
				else
				{
				ChkCounter = counter
				}
				//'BibleView2_dgBible__ctl'+counter+'_chkdelete'
				var chkDetail=document.getElementById("ctl00_ContentPlaceHolder1_Emaildomain1_gvEmailDomain_ctl"+ChkCounter+"_chkSelectAll");
				var chkheaderselect =document.getElementById("ctl00_ContentPlaceHolder1_Emaildomain1_gvEmailDomain_ctl01_chkHeaderSelectAll");
				
				if (chkheaderselect.checked == true)				
				{
				    chkDetail.checked = true
				}
				else
				{
				    chkDetail.checked = false
				}
				
				counter=counter+1
								
			}			
	 }


    function BouncedMailSelectAll()
	{
			
			var namegen 
			var counter = 2
			var ChkCounter 
			var totRecords = document.getElementById("ctl00_ContentPlaceHolder1_Bademail1_lblCount").innerHTML;
			
			for(var i=0;i<totRecords;i=i+1)
			{
				if (counter < 10)
				{
				ChkCounter ='0'+ counter
				}
				else
				{
				ChkCounter = counter
				}
				//'BibleView2_dgBible__ctl'+counter+'_chkdelete'
				var chkDetail=document.getElementById("ctl00_ContentPlaceHolder1_Bademail1_gvBadEmail_ctl"+ChkCounter+"_chkSelectAll");
				var chkheaderselect =document.getElementById("ctl00_ContentPlaceHolder1_Bademail1_gvBadEmail_ctl01_chkHeaderSelectAll");
				
				if (chkheaderselect.checked == true)				
				{
				    chkDetail.checked = true
				}
				else
				{
				    chkDetail.checked = false
				}
				
				counter=counter+1
								
			}			
	 }

function Title()
{
 document.title=document.getElementById("ctl00_lczlblMainPara").innerHTML
}
// Title display for all the pages


function MemberSearchValidate()
{
    var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_managemember1_txtSearchFor");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_managemember1_lczlblSearchFor");

    if (!ValidCheckField(txtbox,lbl))
    {
	return false;
	}
}

function AdvancedSearchValidate()
{
    var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_advsearch1_txtFirstName");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_advsearch1_lczlblFirstName");

    if (!ValidCheckField(txtbox,lbl))
    {
	return false;
	}

    var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_advsearch1_txtLastName");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_advsearch1_lczlblLastName");

    if (!ValidCheckField(txtbox,lbl))
    {
	return false;
	}

    var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_advsearch1_txtEmail");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_advsearch1_lczlblEmail");


            if (!ValidCheckField(txtbox,lbl))
            {
	        return false;
	        }
       if (!(txtbox.value == null) &&  txtbox.value != '')
        {
	        if(!emailCheck(txtbox.value))
	        {
		        HilightRedcolor(txtbox,lbl)
		        return false;
	        }
	        else
	        {
	            Normalcolor(lbl)
	        }
        }

    var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_advsearch1_txtCompany");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_advsearch1_lczlblCompany");

    if (!ValidCheckField(txtbox,lbl))
    {
	return false;
	}

}


function ManageEditValidate()
{
 
    var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_managedataaddedit1_txtenglishvalue");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_managedataaddedit1_glczlblenglish");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}
   
    var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_managedataaddedit1_txtfrenchvalue");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_managedataaddedit1_glczlblfrench");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}

    var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_managedataaddedit1_txtspanishvalue");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_managedataaddedit1_glczlblspanish");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}

}

function AppConfigValidate()
{
    var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_appconfig1_txtMailServerIp");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_appconfig1_lczlblMailServerIp");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}


    var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_appconfig1_txtForgetPasswordFromMailId");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_appconfig1_lczlblForgetPasswordFromMailId");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}
    if(!emailCheck(txtbox.value))
    {
        HilightRedcolor(txtbox,lbl)
        return false;
    }
    else
    {
        Normalcolor(lbl)
    }

    var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_appconfig1_txtRegistrationAdminMailId");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_appconfig1_lczlblRegistrationAdminMailId");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}
    if(!emailCheck(txtbox.value))
    {
        HilightRedcolor(txtbox,lbl)
        return false;
    }
    else
    {
        Normalcolor(lbl)
    }

    var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_appconfig1_txtUrlChangePassword");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_appconfig1_lczlblUrlChangePassword");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}


    var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_appconfig1_txtUrlActivation");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_appconfig1_lczlblUrlActivation");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}
	
	var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_appconfig1_txtnewsubject");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_appconfig1_lczlblnewsubject");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}

    var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_appconfig1_txtdisclaimerEn");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_appconfig1_lczlblDisclaimerEn");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}
	
	var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_appconfig1_txtdisclaimerFr");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_appconfig1_lczlblDisclaimerFr");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}
	
	var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_appconfig1_txtdisclaimerSp");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_appconfig1_lczlblDisclaimerSp");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}
	
	var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_appconfig1_txtheaderEn");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_appconfig1_lczlblHeaderEn");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}
	
	var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_appconfig1_txtheaderFr");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_appconfig1_lczlblHeaderFr");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}
	
	var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_appconfig1_txtheaderSp");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_appconfig1_lczlblHeaderSp");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}

    var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_appconfig1_txtActivationFromMailId");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_appconfig1_lczlblActivationFromMailId");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}
    if(!emailCheck(txtbox.value))
    {
        HilightRedcolor(txtbox,lbl)
        return false;
    }
    else
    {
        Normalcolor(lbl)
    }

    var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_appconfig1_txtgridpagesize");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_appconfig1_lczlblGridpagesize");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}
 	if (!NumericCheckField(txtbox,lbl))
	{
	return false;
	}

    var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_appconfig1_txtUnconfirmedRegistrationPublic");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_appconfig1_lczlblUnconfirmedRegistrationPublic");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!PositiveNumericCheckField(txtbox,lbl))
	{
	return false;
	}

    var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_appconfig1_txtUnconfirmedRegistrationJournalist");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_appconfig1_lczlblUnconfirmedRegistrationJournalist");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!PositiveNumericCheckField(txtbox,lbl))
	{
	return false;
	}
 
}

function EmailDomainValidate()
{
    var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_emaildomain1_txtsearchfordomain");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_emaildomain1_lczlblsearchfordomain");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}
    
}
function EmailDomainValidate1()
{
    var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_emailchanconf1_txtreplacewithdomain");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_emailchanconf1_lczlblreplacewithdomain");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}
    
}
/* Added by Anitha Reddy on 9th Jan 2007*/ 
/* For getting and setting the number of selected records in the list box*/

function DisplaySelectedRecord(listBoxID,textID,labelID)
{

      var count = 0;
      var itemSelected = 0;

      docLength=listBoxID.options.length-1;

      for(incrementCount=0;incrementCount <= docLength ;incrementCount++)
      {
           if(listBoxID.options[incrementCount].selected)
            {
                    itemSelected = 1;
                   count ++
            }
      }
       document.getElementById(textID).innerHTML = count

      if(count < 9 )
        {
            document.getElementById(textID).style.width = "6px"
        }
      if(count > 9 && count < 100)
        {
            document.getElementById(textID).style.width = "12px"
        }
        if(count >100 && count < 999)
        {
            document.getElementById(textID).style.width = "19px"
        }

       if (itemSelected == 1)
        {
            document.getElementById(labelID).innerHTML = listBoxID.options[listBoxID.selectedIndex].text;
        }


    return true
}

function Display(listBoxID,textID,labelID)
{
  
      var count = 0;
      var itemSelected = 0;

      docLength=listBoxID.options.length-1;

      for(incrementCount=0;incrementCount <= docLength ;incrementCount++)
      {
           if(listBoxID.options[incrementCount].selected)
            {
                    itemSelected = 1;
                   count ++
            }
      }
       document.getElementById(textID).innerHTML = count

      if(count < 9 )
        {
            document.getElementById(textID).style.width = "6px"
        }
      if(count > 9 && count < 100)
        {
            document.getElementById(textID).style.width = "12px"
        }
        if(count >100 && count < 999)
        {
            document.getElementById(textID).style.width = "19px"
        }

       if (itemSelected == 1)
        {
            document.getElementById(labelID).innerHTML = arrListDetails[listBoxID.selectedIndex];
        }


    return true
}




function MailDispatchValidate()
{
    var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_Mdhstp2_1_txtFromAddress");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_Mdhstp2_1_glczlblFromAddress");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}
    if(!emailCheck(txtbox.value))
    {
        HilightRedcolor(txtbox,lbl)
        return false;
    }
    
    var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_Mdhstp2_1_txtSubject");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_Mdhstp2_1_glczlblSubject");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}
	
	var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_Mdhstp2_1_txtHeader");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_Mdhstp2_1_lczlblHeader");
	
	if (!MandatoryCheckField(txtbox,lbl))
	{
	return false;
	}
	if (!ValidCheckField(txtbox,lbl))
	{
	return false;
	}
	
/*	
    var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_Mdhstp2_1_lstDistributionList");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_Mdhstp2_1_glczlblDistributionList");
	
	if (!MandatoryComboboxField(txtbox,lbl))
	{
	return false;
	}
	
	var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_Mdhstp2_1_lstCountryList");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_Mdhstp2_1_glczlblCountry");
	
	if (!MandatoryComboboxField(txtbox,lbl))
	{
	return false;
	}
	
	var txtbox = document.getElementById("ctl00_ContentPlaceHolder1_Mdhstp2_1_lstOccupationList");
    var lbl =	 document.getElementById("ctl00_ContentPlaceHolder1_Mdhstp2_1_glczlblOccupation");
	
	if (!MandatoryComboboxField(txtbox,lbl))
	{
	return false;
	}
	*/
}