﻿function CallTerm() {


    if (document.getElementById('ShowTermCond').style.display == 'none') {
        document.getElementById('ShowTermCond').style.display = 'block';
    }
    else {
        document.getElementById('ShowTermCond').style.display = 'none';
    }
}

function setOpacity(value) {
    document.getElementById("pccont").style.opacity = value / 10;
    document.getElementById("pccont").style.filter = 'alpha(opacity=' + value * 10 + ')';
}
function fadeOutMyPopup() {
    for (var i = 0; i <= 100; i++) {
        setTimeout('setOpacity(' + (10 - i / 10) + ')', 8 * i);
    }

    //setTimeout('closeMyPopup()', 800 );
}

function fadeInMyPopup() {
    for (var i = 0; i <= 100; i++)
        setTimeout('setOpacity(' + (i / 10) + ')', 8 * i);
}
function show() {
    //document.body.style.backgroundColor = 'alpha(opacity=' + value * 10 + ')';
    setOpacity(0);
    document.getElementById('pccont').style.zindex = '2';
    document.getElementById('pccont').style.visibility = 'visible';
    document.getElementById('pccont').style.display = 'block';
    fadeInMyPopup();
}
function show1() {
    //setOpacity(0);
    document.getElementById('pccont').style.zindex = '2';
    document.getElementById('pccont').style.visibility = 'visible';
    document.getElementById('pccont').style.display = 'block';
    //fadeInMyPopup();
}

function hide() {
    fadeOutMyPopup();
    setTimeout("closeit()", 800);

}
function closeit() {
    //fadeOutMyPopup();
    document.getElementById('pccont').style.zindex = '0';
    document.getElementById('pccont').style.visibility = 'hidden';
    document.getElementById('pccont').style.display = 'none';
}
function displayBorder(elemid) {
    elem = document.getElementById(elemid);
    elem.style.borderWidth = "3px";
    elem.style.borderColor = "#DDE8EE";
}
function hideBorder(elemid) {
    elem = document.getElementById(elemid);
    elem.style.borderWidth = "3px";
    elem.style.borderColor = "#EAEAEA";
}
function ShowHide(elemid) {
    elem = document.getElementById(elemid);

    if (elem != null) {

        if (elem.style.borderColor == "#ffffff")
            elem.style.borderColor = "#000000";
        else
            elem.style.borderColor = "#ffffff";
    }
}

function ValidateAddNewUser()
{  	var emailPat = /^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
     var matchArray = document.getElementById('m_txtEmail').value.match(emailPat);
     //var msg;
     // var date = new Date();
     //msg = document.getElementById('ctl00_TxtName').value + ',' + document.getElementById('ctl00_TxtLocation').value + ',says:' + document.getElementById('ctl00_TxtComment').value + '\n' + date;
     
     //rdlistJobFunctionType.SelectedValue
            
                   
             
//        var chk=document.getElementById('Form1');
//        var checkboxlist = chk.getElementsByTagName('chklistInterests')
//        if(checkboxlist.length > 2)
//        {
//         alert('You have choose more than two values.........');
//        }   
        
        //var radoInterests=document.getElementsByName('chklistInterests0');  
        
//         if(document.getElementsByName('chklistInterests0').checked==false)       
//         {
//          alert('Hello');
//         }
      
      
//        //var radoInterests=document.getElementsByName('chklistInterests').childNodes[0];
//        
//        //alert(radoInterests.childNodes.length);
//              
//        var selectedInterestsCount;
//        selectedInterestsCount=0;
//        
//        alert(radoInterests.length);
//        for(var i=0;i<radoInterests.length;i++)
//         {
//               if(radoInterests[i].type=="checkbox")
//               {
//                  if(radoInterests[i].checked)  
//                  { 
//                    selectedInterestsCount++
//                    //break;
//                    //alert(selectedInterestsCount);
//                    //alert(radoInterests[i].value);
//                  }
//               }            
//         }
//         if(selectedInterestsCount==0)     
//         {
//           alert('You should select a item from Interest list');
//           return false;
//         }
     
        var radoJobFunctionType=document.getElementsByName("rdlistJobFunctionType");
        var selectedJobFunctionTypeCount;
        selectedJobFunctionTypeCount=0;
        for(var i=0;i<radoJobFunctionType.length;i++)
         {
               if(radoJobFunctionType[i].type=="radio")
               {
                  if(radoJobFunctionType[i].checked)  
                  { 
                    selectedJobFunctionTypeCount++                  
                    
                    if(radoJobFunctionType[i].value=="Other")
                    {
                      if (document.getElementById('TxtJobFunction').value == "") 
                      {
                         alert("Please Enter a Job Function");
                         document.getElementById('TxtJobFunction').focus();
                         return false;
                      }                     
                    }
                    //break;
                  }
               }
            
         }
         if(selectedJobFunctionTypeCount==0)     
         {
           alert('You should select a item from Job Function list');
           return false;
         }
         
        var radoIndustryType=document.getElementsByName("rdlistIndustryType");
        var selectedIndustryTypeCount;
        selectedIndustryTypeCount=0;
        for(var i=0;i<radoIndustryType.length;i++)
         {
               if(radoIndustryType[i].type=="radio")
               {
                  if(radoIndustryType[i].checked)  
                  { 
                    selectedIndustryTypeCount++
                    if(radoIndustryType[i].value=="Other")
                    {
                      if (document.getElementById('TxtIndustry').value == "") 
                      {
                         alert("Please Enter a Industry Type");
                         document.getElementById('TxtIndustry').focus();
                         return false;
                      }                     
                    }
                  }
               }
            
         }
         if(selectedIndustryTypeCount==0)     
         {
           alert('You should select a item from Industry Type list');
           return false;
         }
         
       
         
         

     if (document.getElementById('m_txtUserName').value == "") {
         alert("Please Enter a Name gdgdfgdgf");
         document.getElementById('m_txtUserName').focus();
         return false;
     }
     if (document.getElementById('m_txtPassword').value == "") {
         alert("Please Enter a Password");
         document.getElementById('m_txtPassword').focus();
         return false;
     }
     if (document.getElementById('m_txtRePassword').value == "") {
         alert("Please ReEnter a Password");
         document.getElementById('m_txtRePassword').focus();
         return false;
     }
     if (document.getElementById('m_txtPassword').value!=document.getElementById('m_txtRePassword').value)
     {
         alert("Password Mismatch");
         document.getElementById('m_txtRePassword').focus();
         return false;
     }
     if (document.getElementById('m_txtEmail').value=="")
     {
         alert("Please Enter a EmailId");
         document.getElementById('m_txtEmail').focus();
         return false;
     }
     if (matchArray == null) {
         alert('Please enter your valid email address.');
         document.getElementById('m_txtEmail').focus();
         return false;
     }
     if (document.getElementById('ddlQuestion').value=="")
     {
         alert("Please Select a Question");
         document.getElementById('ddlQuestion').focus();
         return false;
     }
     if (document.getElementById('m_txtSecurityAns').value=="")
     {
         alert("Please Enter Your Answer");
         document.getElementById('m_txtSecurityAns').focus();
         return false;
     }
     if (document.getElementById('m_txtFirstName').value=="")
     {
         alert("Please Enter First Name");
         document.getElementById('m_txtFirstName').focus();
         return false;
     }
     if (document.getElementById('m_txtLastName').value=="")
     {
         alert("Please Enter Last Name");
         document.getElementById('m_txtLastName').focus();
         return false;
     }
     
     
     
     
//     if (document.getElementById('ctl00_ContentPlaceHolder1_ddlMarital').value=="")
//     {
//         alert("Please Select a Marital Status");
//         document.getElementById('ctl00_ContentPlaceHolder1_ddlMarital').focus();
//         return false;
//     }
//     if (document.getElementById('ctl00_ContentPlaceHolder1_m_txDateofBirth').value=="")
//     {
//         alert("Please Enter a Date Of Birth");
//         document.getElementById('ctl00_ContentPlaceHolder1_m_txDateofBirth').focus();
//         return false;
//     }
//     
//     if (document.getElementById('ctl00_ContentPlaceHolder1_ddlsex').value=="")
//     {
//         alert("Please Select a Sex");
//         document.getElementById('ctl00_ContentPlaceHolder1_ddlsex').focus();
//         return false;
//     }
//     if (document.getElementById('ctl00_ContentPlaceHolder1_ddlEthnicity').value=="")
//     {
//         alert("Please Select a Ethnicity");
//         document.getElementById('ctl00_ContentPlaceHolder1_ddlEthnicity').focus();
//         return false;
//     }
//     
//     if (document.getElementById('ctl00_ContentPlaceHolder1_ddlOccupation').value=="")
//     {
//         alert("Please Select a Occupation");
//         document.getElementById('ctl00_ContentPlaceHolder1_ddlOccupation').focus();
//         return false;
//     }
    return true; 

}


function ValidateUpdateUser()
{  	var emailPat = /^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
     var matchArray = document.getElementById('m_txtEmail').value.match(emailPat);
     //var msg;
     // var date = new Date();
     //msg = document.getElementById('ctl00_TxtName').value + ',' + document.getElementById('ctl00_TxtLocation').value + ',says:' + document.getElementById('ctl00_TxtComment').value + '\n' + date;

   
     
     
     if (document.getElementById('m_txtEmail').value=="")
     {
         alert("Please Enter a EmailId");
         document.getElementById('m_txtEmail').focus();
         return false;
     }
     if (matchArray == null) {
         alert('Please enter your valid email address.');
         document.getElementById('m_txtEmail').focus();
         return false;
     }
     if (document.getElementById('ddlQuestion').value=="")
     {
         alert("Please Select a Question");
         document.getElementById('ddlQuestion').focus();
         return false;
     }
     if (document.getElementById('m_txtSecurityAns').value=="")
     {
         alert("Please Enter Your Answer");
         document.getElementById('m_txtSecurityAns').focus();
         return false;
     }
     if (document.getElementById('m_txtFirstName').value=="")
     {
         alert("Please Enter First Name");
         document.getElementById('m_txtFirstName').focus();
         return false;
     }
     if (document.getElementById('m_txtLastName').value=="")
     {
         alert("Please Enter Last Name");
         document.getElementById('m_txtLastName').focus();
         return false;
     }
     
//     if (document.getElementById('ctl00_ContentPlaceHolder1_ddlMarital').value=="")
//     {
//         alert("Please Select a Marital Status");
//         document.getElementById('ctl00_ContentPlaceHolder1_ddlMarital').focus();
//         return false;
//     }
//     if (document.getElementById('ctl00_ContentPlaceHolder1_m_txDateofBirth').value=="")
//     {
//         alert("Please Enter a Date Of Birth");
//         document.getElementById('ctl00_ContentPlaceHolder1_m_txDateofBirth').focus();
//         return false;
//     }
//     
//     if (document.getElementById('ctl00_ContentPlaceHolder1_ddlsex').value=="")
//     {
//         alert("Please Select a Sex");
//         document.getElementById('ctl00_ContentPlaceHolder1_ddlsex').focus();
//         return false;
//     }
//     if (document.getElementById('ctl00_ContentPlaceHolder1_ddlEthnicity').value=="")
//     {
//         alert("Please Select a Ethnicity");
//         document.getElementById('ctl00_ContentPlaceHolder1_ddlEthnicity').focus();
//         return false;
//     }
//     
//     if (document.getElementById('ctl00_ContentPlaceHolder1_ddlOccupation').value=="")
//     {
//         alert("Please Select a Occupation");
//         document.getElementById('ctl00_ContentPlaceHolder1_ddlOccupation').focus();
//         return false;
//     }
    return true; 

}

function ChkUser()
{  	

     if (document.getElementById('ctl00_ContentPlaceHolder1_m_txtUserName').value == "") {
         alert("Please Enter a Name");
         document.getElementById('ctl00_ContentPlaceHolder1_m_txtUserName').focus();
         return false;
     }
    return true; 
}

function CheckUserLogin()
{  	
     if (document.getElementById('m_txtLoginName').value == "") {
         alert("Please Enter a Name");
         document.getElementById('m_txtLoginName').focus();
         return false;
     }
     if (document.getElementById('m_txtLoginPassword').value == "") {
         alert("Please Enter a Password");
         document.getElementById('m_txtLoginPassword').focus();
         return false;
     }
      return true;
 }


function MsgDeleteRecord()
{
	if(confirm("Are you sure to delete this record?"))
	{	return true;	}
	return false;  }

function ValidateChangePass()
{
	var err, ErrorDisp;
	err="";
	ErrorDisp = "You are missing following entries.\n";
	ErrorDisp += "----------------------------------------\n";
	if (document.Form1.txtExistingPass.value=="")
	{
		err += " Existing Password required.\n";
	}
	if (document.Form1.txtNewPass.value=="")
	{
		err += " New Password required.\n";
	}
	if (document.Form1.txtNewPass.value!=document.Form1.txtConfirmPass.value)
	{
		err += " Password mismatch.\n";
	}
	if (err=="") 
	{
		return true;
	}
	else
	{	
		alert(ErrorDisp+err);
		return false;
	}
}	 

////   Client Manage
function ValidateClientManage()
{	

	var emailPat =/^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
	var matchArray = Form1.m_txtEmail.value.match(emailPat);
	var err, ErrorDisp, UrlPat;
	err="";
	ErrorDisp = "You are missing following entries.\n";
	ErrorDisp += "----------------------------------------\n";
	if (document.Form1.m_txtFirstName.value == "")
	{
		err += "Enter First Name.\n";
	}
	if(document.Form1.m_txtFirstName.value.charAt(0)==' ')
	{
		err += "No spaces allowed.\n";
	}
	if (document.Form1.m_txtUserName.value == "")
	{
		err += "Enter UserName.\n";  
	}
	if(document.Form1.m_txtUserName.value.charAt(0)==' ')
	{
		err += "No spaces allowed.\n";  
	}
	if (document.Form1.m_txtPassword.value == "")
	{
		err += "Enter Password.\n";  
	}
	if(document.Form1.m_txtPassword.value.charAt(0)==' ')
	{
		err += "No spaces allowed.\n";  
	}
	if (document.Form1.m_txtEmail.value == "")
	{
		err += "Enter Email Id.\n";
	}
	else if (matchArray == null)
	{
		err += "Inavalid Email format.\n";
	}
	
	/*if (document.Form1.m_txtAns.value == "")
	{
		err += "Enter answer.\n" ;
	}
	if(document.Form1.m_txtAns.value.charAt(0)==' ')
	{
		err += "No spaces allowed.\n"; 
	}*/
	if (err=="") 
	{
		return true;
	}
	else
	{	
		alert(ErrorDisp+err);
		return false;
	}
	}
	
	function ChkClientDeleteAll(checkAllBox)                      
	{                                                           
	var frm = document.Form1.elements ;                             
	var ChkState=checkAllBox.checked;                   
	k1=3;
	for(i=0;i<frm.length;i++)                              
	{                                                              
		e=frm.elements[i];                                   
		if(e.name=='m_dtgClient:_ctl'+k1+':m_chkdelete')
		{
			e.checked= ChkState;                        
			k1++;
		}
	}  
}

function ChkClientActiveAll(checkAllBox)                      
{                                                           
	var frm = document.Form1.elements ;                             
	var ChkState=checkAllBox.checked;    
	k=3;
	for(i=0;i<frm.length;i++)                              
	{                                                              
		e=frm.elements[i];                                   
		if(e.name=='m_dtgClient:_ctl'+k+':m_chkactive')
		{
			e.checked= ChkState;    
			k++;                    
		}
		
	}  
}
//for employee
function ChkEmployeeDeleteAll(checkAllBox)                      
	{                                                           
	var frm = document.Form1.elements ;                             
	var ChkState=checkAllBox.checked;                   
	k1=3;
	for(i=0;i<frm.length;i++)                              
	{                                                              
		e=frm.elements[i];                                   
		if(e.name=='DataGrid1:_ctl'+k1+':m_chkdelete')
		{
			e.checked= ChkState;                        
			k1++;
		}
	}  
}

function ChkEmployeeActiveAll(checkAllBox)                      
{                                                           
	var frm = document.Form1.elements ;                             
	var ChkState=checkAllBox.checked;    
	k=3;
	for(i=0;i<frm.length;i++)                              
	{                                                              
		e=frm.elements[i];                                   
		if(e.name=='DataGrid1:_ctl'+k+':m_chkactive')
		{
			e.checked= ChkState;    
			k++;                    
		}
		
	}  
}
function ValidateCreatePage()
 {
  if (document.Form1.m_txtpagename.value == "")
	{
		alert("Enter Page Name");
		document.Form1.m_txtpagename.focus();
		return false;
	} 
	var is_space=document.Form1.m_txtpagename.value.indexOf(" ");
	if (is_space!=-1)
	{ 
		alert("Space is not allowed in Page Name.");
		document.Form1.m_txtpagename.focus();
		return false;
	}
	var pagePat = /^[A-Za-z0-9_]+$/				
	var matchArray = Form1.m_txtpagename.value.match(pagePat);
	if (matchArray == null)
	{
		strd="Page Name contains Only Alphabets.";
		alert (strd);						
		document.Form1.m_txtpagename.focus();
		return false;
	}
	if (document.Form1.m_txtpagetitle.value == "")
	{   
		alert("Enter Your Page Title.");
		document.Form1.m_txtpagetitle.focus();
		return false;
	}
	if(document.Form1.m_txtpagetitle.value.charAt(0)==' ')
	{
		alert("No spaces allowed.");
		document.Form1.m_txtpagetitle.focus();
		return false;
	}
	if (document.Form1.m_txtmkey.value == "")
	{
		alert("Enter Your Meta Keyword.");
		document.Form1.m_txtmkey.focus();
		return false;
	}
	if(document.Form1.m_txtmkey.value.charAt(0)==' ')
	{
		alert("No spaces allowed.");
		document.Form1.m_txtmkey.focus();
		return false;
	}
	if (document.Form1.m_txtmdesc.value == "")
	{
		alert("Enter Your Meta Description.");
		document.Form1.m_txtmdesc.focus();
		return false;
	}
	if(document.Form1.m_txtmdesc.value.charAt(0)==' ')
	{
		alert("No spaces allowed.");
		document.Form1.m_txtmdesc.focus();
		return false;
	}
	return true;			
}
function limit(text,long) 
{
	var maxlength = new Number(long); 
	if (text.value.length > maxlength)
	{
		text.value = text.value.substring(0,maxlength);
		alert(" Only " + long + " chars");
		return false;
	}
	return true;
}


function ValidateMyProfile()
{
	var emailPat =/^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
	var err, ErrorDisp;
	
	err="";
    ErrorDisp = "You are missing following entries.\n";
	ErrorDisp += "----------------------------------------\n";
	
	if (document.Form1.txtDisplayName.value=="")
	{
		err += "Display name required.\n";
	}
	if(document.Form1.txtDisplayName.value.charAt(0)==' ')
	{
		err += "No spaces allowed.\n";
	}
	if (document.Form1.txtFirstName.value=="")
	{
		err += "First name required.\n";
	}
	if(document.Form1.txtFirstName.value.charAt(0)==' ')
	{
		err += "No spaces allowed.\n";
	}
	if (document.Form1.txtEmail.value=="")
	{
		err += "Email required.\n";
	}
	//var matchArray = Form1.txtEmail.value.match(emailPat);
	else if (Form1.txtEmail.value.match(emailPat) == null)
	{
		err += "Inavalid Email format.\n";
	}
	

	if (err=="") 
	{
		return true;
	}
	else
	{	
		alert(ErrorDisp+err);
		return false;
	}
}		
	 

function popup(url)
{
	width = 400;
	height = 345;
	xx = window.screen.width;
	yy = window.screen.height;
	xx = (xx/2) - (width/2);
	yy = (yy/2) - (height);
	style = 'left = ' +  xx + ',top = ' + yy + ',width='+ width +',height=' + height + ',directories=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,resizable=no';
	newwindow=window.open(url,'name',style);
	if (window.focus) {newwindow.focus()}
}


function staffImagepopup(url)
{
	width = 500;
	height = 500;
	xx = window.screen.width;
	yy = window.screen.height;
	xx = (xx/2) - (width/2);
	yy = (yy/2) - (height);
	style = 'left = ' +  xx + ',top = ' + yy + ',width='+ width +',height=' + height + ',directories=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,resizable=no';
	newwindow=window.open(url,'name',style);
	if (window.focus) {newwindow.focus()}
}

function ValidateStaffEditGen()
{
	
	var emailPat =/^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
	var matchArray = Form1.txtEmail.value.match(emailPat);
	var err, ErrorDisp, UrlPat;
	err="";
	
	ErrorDisp = "You are missing following entries.\n";
	ErrorDisp += "----------------------------------------\n";
	
	if(document.Form1.ddlDepartment.selectedIndex=="0")
	{	
		err += "Department required.\n";
		
	}
	
	if (document.Form1.txtStaffNo.value=="")
	{
		err += "Staff no required.\n";
	}
	if(document.Form1.txtStaffNo.value.charAt(0)==' ')
	{
		err += "No spaces allowed.\n";
	}
	if (document.Form1.txtFName.value=="")
	{
		err += "First name required.\n";
	}
	if(document.Form1.txtFName.value.charAt(0)==' ')
	{
		err += "No spaces allowed.\n";
	}
	if (document.Form1.txtLName.value=="")
	{
		err += "Last name required.\n";
	}
	if(document.Form1.txtLName.value.charAt(0)==' ')
	{
		err += "No spaces allowed.\n";
	}
	if (document.Form1.txtEmail.value=="")
	{
		err += "Email required.\n";
	}
	else if (matchArray == null)
	{
		err += "Inavalid Email format.\n";
	}
	if (document.Form1.ddlGender.selectedIndex=="0")
	{
		err += "Select gender.\n";
	}
	if (document.Form1.txtDesignation.value=="")
	{
		err += "Designation required.\n";
	}
	if(document.Form1.txtDesignation.value.charAt(0)==' ')
	{
		err += "No spaces allowed.\n";
	}
	if (document.Form1.txtDOB.value=="")
	{
		err += "Date of birth required.\n";
	}
	
	if (err=="") 
	{
		return true;
	}
	else
	{	
		alert(ErrorDisp+err);
		return false;
	}
}

function ValidateStaffEditDep()
{
	var err, ErrorDisp;
	err="";
	
	ErrorDisp = "You are missing following entries.\n";
	ErrorDisp += "----------------------------------------\n";
	if (document.Form1.ddlBloodGroup.selectedIndex=="0")
	{
		err += "Select blood group.\n";
	}
	if (document.Form1.ddlCountry.selectedIndex=="0")
	{
		err += "Select country.\n";
	}
	if (err=="") 
	{
		return true;
	}
	else
	{	
		alert(ErrorDisp+err);
		return false;
	}
}

function ProcatManagevalidation()
{	
	var strd;
	if (document.Form1.m_txtCatName.value == "")
	{
		strd=document.Form1.MRF1.value;
		alert(strd);
		document.Form1.m_txtCatName.focus();
		return false;
	}
	if(document.Form1.m_txtCatName.value.charAt(0)==' ')
	{
		alert("Nospaces allowed.");
		document.Form1.m_txtCatName.focus();
		return false;
	}
	var anum=/(^\d+$)|(^\d+\.\d+$)/
	if (!anum.test(document.Form1.m_txtSortOrder.value))
	{
		strd=document.Form1.MRF2.value;
		alert(strd);
		document.Form1.m_txtSortOrder.value="";
		document.Form1.m_txtSortOrder.focus();
		return false;
	}
	return true;
}
// color validation for site settings

function ValidateSiteSettings()
{
	var validChar='0123456789ABCDEF';
	var entry1=document.Form1.txtMenuActBgColor.value.toUpperCase();
	var entry2=document.Form1.txtMenuInactBgColor.value.toUpperCase();
	var entry3=document.Form1.txtMenuActFontColor.value.toUpperCase();
	var entry4=document.Form1.txtMenuInactFontColor.value.toUpperCase();
	var entry5=document.Form1.txtMenuBorderColor.value.toUpperCase();
	var UrlPat = /^[A-Za-z0-9_\-]+[.]+([A-Za-z0-9_\-]+)*[.]+([A-Za-z0-9_\-]+)$/
	var matchArray = Form1.txtGCopyRitURL.value.match(UrlPat);
	var emailPat =/^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
	var matchEmail = Form1.txtGEmail.value.match(emailPat);
	var strlen1=entry1.length;
	if(strlen1!=7)
	{
		alert("MenuActBgColor Entry must be EXACTLY 7 characters long");
		return false;
	}
	for (i=1;i<7;i++ )
	{
		if(validChar.indexOf(entry1.charAt(i))<0)
		{
			alert("MenuActBgColor Entry must be in RRGGBB hexcode format!");
			return false;
		}
	}
	
	if(entry1.charAt(0) != "#" )
	{
		alert("MenuActBgColor First Character should be # Sign"); 
		return false;
	}
	
	var strlen2=entry2.length;
	if(strlen2!=7)
	{
		alert("MenuInactBgColor Entry must be EXACTLY 7 characters long");
		return false;
	}
	
	for (i=1;i<7;i++ )
	{
		if(validChar.indexOf(entry2.charAt(i))<0)
		{
			alert("MenuInactBgColor Entry must be in RRGGBB hexcode format!");
			return false;
		}
	}
	
	if(entry2.charAt(0) != "#" )
	{
		alert("MenuInactBgColor First Character should be # Sign"); 
		return false;
	}
	
	var strlen3=entry3.length;
	if(strlen3!=7)
	{
		alert("MenuActFontColor Entry must be EXACTLY 7 characters long");
		return false;
	}
	for (i=1;i<7;i++ )
	{
		if(validChar.indexOf(entry3.charAt(i))<0)
		{
			alert("MenuActFontColor Entry must be in RRGGBB hexcode format!");
			return false;
		}
	}
	if(entry3.charAt(0) != "#" )
	{
		alert("MenuActFontColor First Character should be # Sign"); 
		return false;
	}	
	var strlen4=entry4.length;
	if(strlen4!=7)
	{
		alert("MenuInactFontColor Entry must be EXACTLY 7 characters long");
		return false;
	}
	for (i=1;i<7;i++ )
	{
		if(validChar.indexOf(entry4.charAt(i))<0)
		{
			alert("MenuInactFontColor Entry must be in RRGGBB hexcode format!");
			return false;
		}
	}
	if(entry4.charAt(0) != "#" )
	{
		alert("MenuInactFontColor First Character should be # Sign"); 
		return false;
	}	
	var strlen5=entry5.length;
	if(strlen5!=7)
	{
		alert("MenuBorderColor Entry must be EXACTLY 7 characters long");
		return false;
	}
	for (i=1;i<7;i++ )
	{
		if(validChar.indexOf(entry5.charAt(i))<0)
		{
			alert("MenuBorderColor Entry must be in RRGGBB hexcode format!");
			return false;
		}
	}
	if(entry5.charAt(0) != "#" )
	{
		alert("MenuBorderColor First Character should be # Sign"); 
		return false;
	}	
		if (document.Form1.txtGEmail.value=="")
	{
		alert("Admin Email can not be left empty.");
		return false;
	}
	else if(matchEmail== null)
	{
		alert("Invalid Email format.");
		return false;
	}
	
	if (document.Form1.txtGCopyRightText.value=="")
	{
		alert("Copyright field can not be left empty.");
		document.Form1.txtGCopyRightText.focus();
		return false;
	}
	if(document.Form1.txtGCopyRightText.value.charAt(0)==' ')
	{
		alert("No spaces allowed.");
		return false;
	}
	if (document.Form1.txtGCycImgTrans.value=="")
	{
		alert("Cyclic image transition field can not be left empty.");
		document.Form1.txtGCycImgTrans.focus();
		return false;
	}
	//else
	
		//if (isNaN(document.Form1.txtGCycImgTrans.value)) 
		//{
	//		ErrMsg+ = "Cyclic image transition field accept Numeric Digits Only.\N";
	//	}
	
	
	if (document.Form1.txtGCopyRitURL.value=="")
	{
		alert("Copyright URL field can not be left empty.");
		document.Form1.txtGCopyRitURL.focus();
		return false;
	}
	 else if (matchArray == null)
	{
		alert("Invalid URL.");
		return false;
	}	
	if (document.Form1.m_txtAutoSubject.value=="")
	{
		alert("Subject required.");
		document.Form1.m_txtAutoSubject.focus();
		return false;
	}
	if(document.Form1.m_txtAutoSubject.value.charAt(0)==' ')
	{
		alert("No spaces allowed.");
		return false;
	}
	if (document.Form1.m_txtAutoResBody.value=="")
	{
		alert("Body required.");
		document.Form1.m_txtAutoResBody.focus();
		return false;
	}
	if(document.Form1.m_txtAutoResBody.value.charAt(0)==' ')
	{	alert("No spaces allowed.");
		return false;
	}
	
		return true;
	}

function faqCatManageValidate() 
{ 
	if (document.Form1.txtCatName.value == "")
	{ 
		alert("Enter Category Name");
		document.Form1.txtCatName.focus();
		return false; 
	} 
	if(document.Form1.txtCatName.value.charAt(0)==' ')
	{	alert("No spaces allowed.");
		document.Form1.txtCatName.focus();
		return false; }
	if (document.Form1.txtSortOrder.value == "")
	{
		alert("Enter Sort Order"); 
		document.Form1.txtSortOrder.focus();
		return false;
	}
	var anum=/(^\d+$)|(^\d+\.\d+$)/
	if (!anum.test(document.Form1.txtSortOrder.value))
	{
		alert("Enter numeric Sort Order");
		document.Form1.txtSortOrder.value="";
		document.Form1.txtSortOrder.focus();
		return false;
	}
	return true;
}

function validateEditDynamicpage()
{
	if (document.Form1.m_txtpagetitle.value == "")
	{   
		alert("Enter Your Page Title.");
		document.Form1.m_txtpagetitle.focus();
		return false;
	}
	if(document.Form1.m_txtpagetitle.value.charAt(0)==' ')
	{
		alert("No spaces allowed.");
		document.Form1.m_txtpagetitle.focus();
		return false;	
	}
	if (document.Form1.m_txtmkey.value == "")
	{
		alert("Enter Your Meta Keyword.");
		document.Form1.m_txtmkey.focus();
		return false;
	}
	if(document.Form1.m_txtmkey.value.charAt(0)==' ')
	{
		alert("No spaces allowed.");
		document.Form1.m_txtmkey.focus();
		return false;
	}
	if (document.Form1.m_txtmdesc.value == "")
	{
		alert("Enter Your Meta Description.");
		document.Form1.m_txtmdesc.focus();
		return false;
	}
	if(document.Form1.m_txtmdesc.value.charAt(0)==' ')
	{
		alert("No spaces all.");
		document.Form1.m_txtmdesc.focus();
		return false;
	}
	return true;			
}

function ValidateMenuAdd()
 {
	if (document.Form1.m_txtSubMenu.value == "")
	{
		alert("Enter SubMenu Name");
		document.Form1.m_txtSubMenu.focus();
		return false;
	}
	if(document.Form1.m_txtSubMenu.value.charAt(0)==' ')
	{
		alert("No spaces allowed.");
		document.Form1.m_txtSubMenu.focus();
		return false;
	}
	if (document.Form1.m_txtsort.value =="")
	{
		alert("Enter SortOrder");
		document.Form1.m_txtsort.focus();
		return false;
	}
	var anum=/(^\d+$)|(^\d+\.\d+$)/
	if (!anum.test(document.Form1.m_txtsort.value))
	{
		alert("Invalid SortOrder");
		document.Form1.m_txtsort.value="";
		document.Form1.m_txtsort.focus();
		return false;
	}
	if (document.Form1.m_dropdwnlink.value == "::Select::" && document.Form1.txtCustomLink.value == "")
	{
		alert("Select Link");
		document.Form1.m_dropdwnlink.focus();
		return false;
	}
	return true;			
}

function publicationManagevalidation()
{
	var strd;
	if (document.Form1.m_txtPubName.value == "")
	{
		strd="Publication Name Required.";
		alert(strd);
		document.Form1.m_txtPubName.focus();
		return false;
	}
	if(document.Form1.m_txtPubName.value.charAt(0)==' ')
	{
		alert("No spaces allowed.");
		document.Form1.m_txtPubName.focus();
		return false;
	}
	var anum=/(^\d+$)|(^\d+\.\d+$)/
	if (!anum.test(document.Form1.m_txtSortOrder.value))
	{
		alert('Enter numeric sort order.');
		document.Form1.m_txtSortOrder.value="";
		document.Form1.m_txtSortOrder.focus();
		return false;
	}
	return true;
}


function validatePageManage()
{
	if (document.Form1.m_txtPageTitle.value == "")
	{   
		alert("Enter Your Page Title.");
		document.Form1.m_txtPageTitle.focus();
		return false;
	}
	if(document.Form1.m_txtPageTitle.value.charAt(0)==' ')
	{
		alert("No spaces allowed.");
		document.Form1.m_txtPageTitle.focus();
		return false;
	}
	if (document.Form1.m_txtMetaKeyword.value == "")
	{
		alert("Enter Your Meta Keyword.");
		document.Form1.m_txtMetaKeyword.focus();
		return false;
	}
	if(document.Form1.m_txtMetaKeyword.value.charAt(0)==' ')
	{
		alert("No spaces allowed.");
		document.Form1.m_txtMetaKeyword.focus();
		return false;	
	}
	if (document.Form1.m_txtMetaDescription.value == "")
	{
		alert("Enter Your Meta Description.");
		document.Form1.m_txtMetaDescription.focus();
		return false;
	}
	if(document.Form1.m_txtMetaDescription.value.charAt(0)==' ')
	{
		alert("No spaces allowed.");
		document.Form1.m_txtMetaDescription.focus();
		return false;
	}
	return true;
}

function validateServiceManage()
{	
	if (document.Form1.m_txtServiceName.value == "")
	{
		alert("Please Enter Service Name");
		document.Form1.m_txtServiceName.focus();
		return false;
	}
	if(document.Form1.m_txtServiceName.value.charAt(0)==' ')
	{
		alert("No spaces allowed.");
		document.Form1.m_txtServiceName.focus();
		return false;
	}
	if (document.Form1.m_txtSortOrder.value=="")
	{
		alert("Please Enter SortOrder");					
		document.Form1.m_txtSortOrder.focus();
		return false;
	}
	var anum=/(^\d+$)|(^\d+\.\d+$)/
	if (!anum.test(document.Form1.m_txtSortOrder.value))
	{
		alert("Please Enter Valid SortOrder");
		document.Form1.m_txtSortOrder.value="";
		document.Form1.m_txtSortOrder.focus();
		return false;
	}
	if (document.Form1.m_txtshortDesc.value =="")
	{
		alert("Please Enter Short Description.");
		document.Form1.m_txtshortDesc.focus();
		return false;
	}
	if(document.Form1.m_txtshortDesc.value.charAt(0)==' ')
	{
		alert("No spaces allowed.");
		document.Form1.m_txtshortDesc.focus();
		return false;
	}
	return true;
}

function validateLibCatManage()
{	
	if (document.Form1.m_txtCatName.value == "")
	{
		alert("Please Enter Category Name");
		document.Form1.m_txtCatName.focus();
		return false;
	}
	if(document.Form1.m_txtCatName.value.charAt(0)==' ')
	{
		alert("No spaces allowed.");
		document.Form1.m_txtCatName.focus();
		return false;
	}
	if (document.Form1.m_txtSortOrder.value=="")
	{
		alert("Please Enter Sort Order");
		document.Form1.m_txtSortOrder.focus();
		return false;
	}
	var anum=/(^\d+$)|(^\d+\.\d+$)/
	if (!anum.test(document.Form1.m_txtSortOrder.value))
	{
		alert("Please Enter Valid Sort Order");
		document.Form1.m_txtSortOrder.focus();
		return false;
	}
	return true;
}
 function ValidateAddDepartment()
 {
	if(document.Form1.txtDeptName.value=="")
	{
		alert("enter department name");
		document.Form1.txtDeptName.focus();
		return false;
	}
	if(document.Form1.txtDeptName.value.charAt(0)==' ')
	{
		alert("No spaces allowed.");
		document.Form1.txtDeptName.focus();
		return false;
	}
	if (document.Form1.txtSortOrder.value=="")
	{
		alert("Please Enter Sort Order");
		document.Form1.txtSortOrder.focus();
		return false;
	}
	var anum=/(^\d+$)|(^\d+\.\d+$)/
	if (!anum.test(document.Form1.txtSortOrder.value))
	{   
		alert("Please Enter Valid Sort Order");
		document.Form1.txtSortOrder.value="";
		document.Form1.txtSortOrder.focus();
		
		return false;
	}
	return true;
 }

function validateLibraryManage()
{	
	var UrlPat = /^[http:/]+([A-Za-z0-9_\-]+)[.]+([A-Za-z0-9_\-]+)*[.]+([A-Za-z0-9_\-]+)$/
	//var matchArray = Form1.m_txtUrl.value.match(UrlPat);
	if (document.Form1.m_cmbCategory.value == "")
	{
		alert("Please Select Category Name");
		document.Form1.m_cmbCategory.focus();
		return false;
	}
	if(document.Form1.m_cmbCategory.value.charAt(0)==' ')
	{
		alert("No spaces allowed.");
		document.Form1.m_cmbCategory.focus();
		return false;
	}
	if (document.Form1.m_txtLibrary.value == "")
	{
		alert("Please Enter Links Name");
		document.Form1.m_txtLibrary.focus();
		return false;
	}
	if(document.Form1.m_txtLibrary.value.charAt(0)==' ')
	{
		alert("No spaces allowed.");
		document.Form1.m_txtLibrary.focus();
		return false;
	}
	if (document.Form1.m_txtUrl.value == "")
	{
		alert("Please Enter Url");
		document.Form1.m_txtUrl.focus();
		return false;
	}
	//else if(matchArray == null)
	//{
	//	alert(" Invalid Url  try http:// at begninig");
	//	return false;
	//}
	if (document.Form1.m_txtSortOrder.value=="")
	{
		alert("Please Enter Sort Order");
		document.Form1.m_txtSortOrder.focus();
		return false;
	}
	var anum=/(^\d+$)|(^\d+\.\d+$)/
	if (!anum.test(document.Form1.m_txtSortOrder.value))
	{
		alert("Please Enter Valid Sort Order");
		document.Form1.m_txtSortOrder.focus();
		return false;
	}
	return true;
}

function faqlistMsgDeleteRecord()
{
	var strd=document.Form1.DMCN.value;
	if (confirm(strd))
	{
		return true;
	}
	return false;
}

function doFullScreen()
{		
}
function doNormalScreen()
{
}

function ProductManagevalidation()
			{	
				var strd;
				if (document.Form1.m_txtRefNo.value == "")
				{
					strd=document.Form1.MRF1.value;
					alert(strd);
					document.Form1.m_txtRefNo.focus();
					return false;
				}
				if(document.Form1.m_txtRefNo.value.charAt(0)==' ')
				{
					alert("No spaces allowed.");
					document.Form1.m_txtRefNo.focus();
					return false;
				}
				if (document.Form1.m_txtProductName.value == "")
				{
					strd=document.Form1.MRF2.value;
					alert(strd);
					document.Form1.m_txtProductName.focus();
					return false;
				}
				if(document.Form1.m_txtProductName.value.charAt(0)==' ')
				{
					alert("No spaces allowed.");
					document.Form1.m_txtProductName.focus();
					return false;
				}
			
				if (document.Form1.m_txtShortDesc.value == "")
				{
					strd=document.Form1.MRF3.value;
					alert(strd);
					document.Form1.m_txtShortDesc.focus();
					return false;
				}
				
				
				var anum=/(^\d+$)|(^\d+\.\d+$)/ 
				if (!anum.test(document.Form1.m_txtSortOrder.value))
				{
					strd="Please Enter Numeric Sort Order.";
					alert(strd);
					document.Form1.m_txtSortOrder.value="";
					document.Form1.m_txtSortOrder.focus();
					return false;
				}
				
				return true;
			}
			
	function datevalidtion(todate,fromdate)
		{
	if ((document.Form1.todate.value!="") && (document.Form1.fromdate.value!=""))
	{
		if ((document.Form1.todate.value) > (document.Form1.fromdate.value))
		{
			alert("To Date Must be less than From Date");
			document.Form1.todate.focus();
		}	
	}  
}  
function CheckAll(checkAllBox)                      
{                                                           
	var frm = document.Form1.elements ;                             
	var ChkState=checkAllBox.checked;                   
	for(i=0;i<frm.length;i++)                              
	{                                                              
		e=frm.elements[i];                                   
		if(e.type=='checkbox')
		e.checked= ChkState ;                        
	}  
}

function ChkServiceActiveAll(checkAllBox)                      
{                                                           
	var frm = document.Form1.elements ;                             
	var ChkState=checkAllBox.checked;    
	k=3;
	for(i=0;i<frm.length;i++)                              
	{                                                              
		e=frm.elements[i];                                   
		if(e.name=='m_dtgService:_ctl'+k+':m_chkactive')
		{
			e.checked= ChkState;    
			k++;                    
		}
	}  
}
function ChkServiceDeleteAll(checkAllBox)                      
{                                                           
	var frm = document.Form1.elements ;                             
	var ChkState=checkAllBox.checked;                   
	k1=3;
	for(i=0;i<frm.length;i++)                              
	{                                                            
		e=frm.elements[i];                                   
		if(e.name=='m_dtgService:_ctl'+k1+':m_chkdelete')
		{
			e.checked= ChkState;                        
			k1++;
		}
	}  
}



function ChkLibraryCatActiveAll(checkAllBox)                      
{                                                           
	var frm = document.Form1.elements;                             
	var ChkState=checkAllBox.checked;    
	k=3;
	for(i=0;i<frm.length;i++)                              
	{                                                              
		e=frm.elements[i];                                   
		if(e.name=='m_dtgLibCat:_ctl'+k+':m_chkactive')
		{
			e.checked= ChkState;    
			k++;                    
		}
		
	}  
}
function ChkLibraryCatDeleteAll(checkAllBox)                      
{                                                           
	var frm = document.Form1.elements ;                             
	var ChkState=checkAllBox.checked;                   
	k1=3;
	for(i=0;i<frm.length;i++)                              
	{                                                              
		e=frm.elements[i];                                   
		if(e.name=='m_dtgLibCat:_ctl'+k1+':m_chkdelete')
		{
			e.checked= ChkState;                        
			k1++;
		}
	}  
}
function ChkLibraryActiveAll(checkAllBox)                      
{                                                           
	var frm = document.Form1.elements ;                             
	var ChkState=checkAllBox.checked;    
	k=3;
	for(i=0;i<frm.length;i++)                              
	{                                                              
		e=frm.elements[i];                                   
		if(e.name=='m_dtgLibrary:_ctl'+k+':m_chkactive')
		{
			e.checked= ChkState;    
			k++;                    
		}
		
	}  
}
function ChkLibraryDeleteAll(checkAllBox)                      
{                                                           
	var frm = document.Form1.elements ;                             
	var ChkState=checkAllBox.checked;                   
	k1=3;
	for(i=0;i<frm.length;i++)                              
	{                                                              
		e=frm.elements[i];                                   
		if(e.name=='m_dtgLibrary:_ctl'+k1+':m_chkdelete')
		{
			e.checked= ChkState;                        
			k1++;
		}
	}  
	                                                            
}
function ValidateCyclicImageEdit()
{
	var err, ErrorDisp, UrlPat;
	err="";
	UrlPat = /^[http:/]+([A-Za-z0-9_\-]+)[.]+([A-Za-z0-9_\-]+)*[.]+([A-Za-z0-9_\-]+)$/
	var matchArray = Form1.txtHyperLinkUrl.value.match(UrlPat);
	
	ErrorDisp = "You are missing following entries.\n";
	ErrorDisp += "----------------------------------------\n";
	if (document.Form1.txtHyperLinkUrl.value=="")
	{
		err += "Hyperlink Url required.\n";
	}
	 else if (matchArray == null)
	{
		err += "http:// should prefix before URL.\n";
	}	
	
	/*if (document.Form1.txtSortOrder.value=="")
	{
		err += "Sort order required.\n";
	}
	
	if (isNaN(document.Form1.txtSortOrder.value)==true)
	{
		err += "Sort order value should be numeric.\n";
	}
	*/
	if (err=="")
	{
		
		return true;
	}
	else
	{	
		alert(ErrorDisp+err);
		return false;
	}
}
function validateNews()
{
	var err, ErrorDisp, UrlPat;
	err="";
	
	ErrorDisp = "You are missing following entries.\n";
	ErrorDisp += "----------------------------------------\n";
	if (document.Form1.txtNewsTitle.value=="")
	{
		err += "Enter News title .\n";
	}
	
	if(document.Form1.txtNewsTitle.value.charAt(0)==' ')
	{
		err += "No spaces allowed.\n";
	}
	if (document.Form1.txtDateNews.value=="")
	{
		err += "Enter news date.\n";
	}
	if (document.Form1.txtNewsDate.value=="")
	{
		err += "Enter expiry date.\n";
	}
	 	
	if (document.Form1.txtSortOrder.value=="")
	{
		err += "Sort order required.\n";
	}
	
	if(isNaN(document.Form1.txtSortOrder.value)==true)
	{
		err += "Sort order value should be numeric.\n";
	}
	
	if (err=="")
	{
		
		return true;
	}
	else
	{	
		alert(ErrorDisp+err);
		return false;
	}
}

function ValidateCyclicImageManage()
{	
  
	var err, ErrorDisp, UrlPat;
	err="";
	UrlPat = /^[http:/]+([A-Za-z0-9_\-]+)[.]+([A-Za-z0-9_\-]+)*[.]+([A-Za-z0-9_\-]+)$/
	var matchArray = Form1.txtUrl.value.match(UrlPat);
	
	ErrorDisp = "You are missing following entries.\n";
	ErrorDisp += "----------------------------------------\n";
	if (document.Form1.txtImageFile.value=="")
	{
		err += "Select image.\n";
	}
	if (document.Form1.txtUrl.value=="")
	{
		err += "Hyperlink Url required.\n";
	}
	 else if (matchArray == null)
	{
		err += "Invalid URL \n";
	}	
	
/*	if (document.Form1.txtSort.value=="")
	{
		err += "Sort order required.\n";
	}
	
	if (isNaN(document.Form1.txtSort.value)==true)
	{
		err += "Sort order value should be numeric.\n";
	} 
	*/
	
	if (err=="")
	{
		
		return true;
	}
	else
	{	
		alert(ErrorDisp+err);
		return false;
	}
}
function faqManagevalidation()
{	
	var strd;
	if (document.Form1.cmbCategory.value == "")
	{
		strd=document.Form1.MRF1.value;
		alert(strd);
		document.Form1.txtQuestion.focus();
		return false;
	}
	if(document.Form1.cmbCategory.value.charAt(0)==' ')
	{
		alert("No spaces allowed");
		document.Form1.txtQuestion.focus();
		return false;
	}
	if (document.Form1.txtQuestion.value == "")
	{
		strd=document.Form1.MRF2.value;
		alert(strd);
		document.Form1.txtQuestion.focus();
		return false;
	}
	if(document.Form1.txtQuestion.value.charAt(0)==' ')
	{
		alert("No spaces allowed.");
		document.Form1.txtQuestion.focus();
		return false;
	}
	if (document.Form1.txtSortOrder.value=="")
	{
		strd=document.Form1.MRF4.value;
		alert(strd);
		document.Form1.txtSortOrder.focus();
		return false;
	}
	var anum=/(^\d+$)|(^\d+\.\d+$)/
	if (!anum.test(document.Form1.txtSortOrder.value))
	{
		strd=document.Form1.MRF5.value;
		alert(strd);
		document.Form1.txtSortOrder.focus();
		return false;
	}
	return true;
}

		