﻿// JScript File for Admission enquiry form ,from Search page
//Author-Rupesh Prasad 01/10/2009

    function ResetControls()
    {
        MyVariable = document.getElementById("txtName");
        MyVariable.value="Name";
        MySpan=document.getElementById("spnName");
        MySpan.style.display='none';    
        MySpanValidation=document.getElementById("spnNameValidation");
        MySpanValidation.style.display='none';    
        
        MyVariable = document.getElementById("txtEmail");
        MyVariable.value="Email Id";
        MySpan=document.getElementById("spnEmailid");
        MySpan.style.display='none';    
        MySpanValidation=document.getElementById("spnEmailidValidation");
        MySpanValidation.style.display='none';    
        MySpanValidation=document.getElementById("spnValidMail");
        MySpanValidation.style.display='none';    
        
        MyVariable = document.getElementById("txtContactNumber");
        MyVariable.value="Contact Number";
        MySpan=document.getElementById("spnContact");
        MySpan.style.display='none';    
        MySpanValidation=document.getElementById("spnContactValidation");
        MySpanValidation.style.display='none';    
        SContactIsNum =document.getElementById("spnContactIsNum");
        SContactIsNum.style.display='none';    
        
        MyVariable = document.getElementById("txtQualification");
        MyVariable.value="Qualification";
        MySpan=document.getElementById("spnQualification");
        MySpan.style.display='none';    
        MySpanValidation=document.getElementById("spnQualificationValidation");
        MySpanValidation.style.display='none';    
        
        MyVariable = document.getElementById("txtPercentage");
        MyVariable.value="Percentage";
        MySpan=document.getElementById("spnPercentage");
        MySpan.style.display='none';    
        MySpanValidation=document.getElementById("spnPercentageValidation");
        MySpanValidation.style.display='none';    
        
        MyVariable = document.getElementById("txtAdmission");
        MyVariable.value="Admission sought for";
        MySpan=document.getElementById("spnAdmission");
        MySpan.style.display='none';    
        MySpanValidation=document.getElementById("spnAdmissionValidation");
        MySpanValidation.style.display='none';    
        
        MyVariable = document.getElementById("txtOtherCollege");
        MyVariable.value="Any other college that you would be interested in";
        MySpan=document.getElementById("spnOtherCollege");
        MySpan.style.display='none';    
        
        MyVariable = document.getElementById("txtOtherInformation");
        MyVariable.value="Any other information you want to know from the institution";
        MySpan=document.getElementById("spnOtherInformation");
        MySpan.style.display='none';    
    }
    
    function disp_alert(Str)
    {
        var NewStr = Str.replace(/imgBtnPostEnquiry/,"lblCollege")
        var collegeid = document.getElementById(NewStr);
        var Labelcollegeid = document.getElementById("txtCollegeId");
        Labelcollegeid.value = collegeid.title;
    }
    
     function CallFunctionSend()
    {
        var flag = 0;
        TName = document.getElementById("txtName");
        TEmail = document.getElementById("txtEmail");
        TContact = document.getElementById("txtContactNumber");        
        TQualification = document.getElementById("txtQualification");
        TPercentage = document.getElementById("txtPercentage");
        TAdmission = document.getElementById("txtAdmission");
        SName = document.getElementById("spnNameValidation");
        SEmail=document.getElementById("spnEmailidValidation");
        SContact=document.getElementById("spnContactValidation");
        SQualification  =document.getElementById("spnQualificationValidation");
        SPercentage =document.getElementById("spnPercentageValidation");
        SAdmission =document.getElementById("spnAdmissionValidation");
        SContactIsNum =document.getElementById("spnContactIsNum");
        SvalidMail =document.getElementById("spnValidMail");
        SpanEmail = document.getElementById("spnEmailid");
        SpanContact = document.getElementById("spnContact");
        apos=TEmail.value.indexOf("@");
        dotpos=TEmail.value.lastIndexOf(".");
        if(TName.value=="Name")
        {
            SName.style.display='block';
        }
        else
        {
            SName.style.display='none';
            flag = ++flag;
        }
        //alert("Name=" + flag);
        if(TEmail.value=="Email Id")
        {
            SEmail.style.display='block';
        }
        else
        {
            SEmail.style.display='none';
            flag = ++flag;
        }
        if (apos<1||dotpos-apos<2)
        {
            if(SEmail.style.display!='block')
            {
                SvalidMail.style.display='block';
                SpanEmail.style.display='none'; 
            }
        }
        else 
        {   
            SvalidMail.style.display='none';
            flag = ++flag;
        }
        if(TContact.value=="Contact Number")
        {
            SContact.style.display='block';
        }
        else
        {
            SContact.style.display='none';
            flag = ++flag;
        }
        if(isNaN(TContact.value)==true)
        {
            if(SContact.style.display!='block')
            {
                SContactIsNum.style.display='block';
                SpanContact.style.display='none';
            }
        }
        else
        {
            SContactIsNum.style.display='none';
            flag = ++flag;
        }
        //alert("Contact=" + flag);
        if(TQualification.value=="Qualification")
        {
            SQualification.style.display='block';
            
        }
        else
        {
            SQualification.style.display='none';
            flag = ++flag;
        }
        //alert("Qualification=" + flag);
        if(TPercentage.value=="Percentage")
        {
            SPercentage.style.display='block';
            
        }
        else
        {
            SPercentage.style.display='none';
            flag = ++flag;
        }
        //alert("Percentage=" + flag);
        if(TAdmission.value=="Admission sought for")
        {
            SAdmission.style.display='block';
            flag = ++flag;
        }
        else
        {
            SAdmission.style.display='none';
            flag = ++flag;
        }
        //alert("Admission=" + flag);
        if(flag==8)
        {
            btn = document.getElementById("Submit1");
            btn.click();
        }
    }
    
function funShowDropDown()
  {
        if ((document.getElementById('selBCourse') != null) && (document.getElementById('selBLevel') != null) && (document.getElementById('selCity') != null) && (document.getElementById('selState') != null) && (document.getElementById('selType') != null) && (document.getElementById('selMajor') != null) && (document.getElementById( 'selCourse') != null) && (document.getElementById('selLevel') != null))
        {
        onlyShow('selType'); onlyShow('selMajor');onlyShow( 'selCourse');onlyShow('selLevel');
         onlyShow('selCity');onlyShow('selState');
          onlyShow('selBCourse');onlyShow('selBLevel');
         }
  }
  
  function ChangetextForTextBox(CurrnetId,SpnId,Text,Command,SpnValidationId,spnValidation1)
    {
        var CurrentTextBox = document.getElementById(CurrnetId);
        var CurrentSpn = document.getElementById(SpnId);
        var CurrentValidationSpn = document.getElementById(SpnValidationId);
        //alert(spnValidation1);
        if(spnValidation1!="")
        {
            var Additional = document.getElementById(spnValidation1);
            Additional.style.display='none';
        }
        if(CurrentValidationSpn==null)
        {
            CurrentValidationSpn = document.getElementById("Span1");
        }
        if(Command==0)
        {
            if(CurrentTextBox.value==Text)
            {
                CurrentSpn.style.display='block';    
                CurrentTextBox.value="";
                CurrentValidationSpn.style.display='none';    
            }
        }
        if(Command==1)
        {
            if(CurrentTextBox.value!=Text)
            {
                CurrentSpn.style.display='block';    
                CurrentValidationSpn.style.display='none';    
            }
            if(CurrentTextBox.value=="")
            {
                CurrentSpn.style.display='none';
                CurrentTextBox.value=Text;
                CurrentValidationSpn.style.display='none';  
            }
        }
    }
    

