﻿// JScript File


function ShowCareer(Opt)
{
 var ddlDept= document.getElementById("ctl00_MainMaster_ddlDept").value;
 var ddlApp=document.getElementById("ctl00_MainMaster_ddlApp").value;

if (Opt=="7" && (ddlApp==""|| ddlApp=="Select Job"))
{

alert("Please Select Applied For...");
return false;
}

     CloseAllCareer();
     if(document.getElementById("Career"+Opt) != null)
     {
        document.getElementById("Career"+Opt).style.display="inline";
        if (Opt==7)
        {
        document.getElementById("sitemapCareer").innerHTML= document.getElementById("CareerMnu6").innerHTML;
        }
        else
        {
        document.getElementById("sitemapCareer").innerHTML= document.getElementById("CareerMnu"+Opt).innerHTML;
        }
     }
   
     if(document.getElementById("CareerMnu"+Opt) != null)
     {
        document.getElementById("CareerMnu"+Opt).className="LeftMnuTxtSel";
     } 
 
 
}

function CloseAllCareer()
{
 for(var i=1;i<=7;i++)
    {
    
    if(document.getElementById("Career"+i) != null)
    {
    document.getElementById("Career"+i).style.display="none";
   } 
   
     if(document.getElementById("CareerMnu"+i) != null)
    {
   document.getElementById("CareerMnu"+i).className="LeftMnuTxt";
   } 
   
    }

}

function ShowFAQ(Opt)
{
  CloseAllFAQ();
  document.getElementById("FAQ"+Opt).style.display="inline";
  document.getElementById("FAQMnu"+Opt).className="LeftMnuTxtSel";

document.getElementById("FAQSitemap").innerHTML= document.getElementById("FAQMnu"+Opt).innerHTML;



}

function CloseAllFAQ()
{
 for(var i=1;i<=4;i++)
    {
    
    if (document.getElementById("FAQ"+i))
    {
    document.getElementById("FAQ"+i).style.display="none";
    }
    if (document.getElementById("FAQMnu"+i))
    {
    document.getElementById("FAQMnu"+i).className="LeftMnuTxt";
    }
    }

}
var XmlHttpGL;
function CreateXmlHttpGL()
	{
		//Creating object of XMLHTTP in IE
		try
		{
			XmlHttpGL = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				XmlHttpGL = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(oc)
			{
				XmlHttpGL = null;	
			}
		}
		//Creating object of XMLHTTP in Mozilla and Safari 
		if(!XmlHttpGL&& typeof XMLHttpRequest != "undefined") 
		{
			XmlHttpGL = new XMLHttpRequest();
		}
	}
function FillAppl(Dept)
{
  CreateXmlHttpGL();
  document.body.style.cursor = "progress";
  scheme = document.getElementById("ctl00_MainMaster_ddlApp"); 
  
    document.getElementById("ctl00_MainMaster_HidApply").value= Dept;
      
   var requestUrl=HostAddressInJSfileForPages+"/Static/AjaxGetApplyJob.aspx?Dept="+Dept+"&timeStamp="+new Date().getTime();

	if(XmlHttpGL)	
			{
					XmlHttpGL.onreadystatechange = function(){ShowShowGLData(scheme);}; 
					XmlHttpGL.open("GET", requestUrl,  true);
					XmlHttpGL.send(null);
			}
}
function ShowShowGLData(ig_) 
{ 

if(XmlHttpGL.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttpGL.status == 200)
		{			
			
		    var strData = XmlHttpGL.responseText;
		 
			if(strData != "")
			{
				var arrSchm = strData.split("|");
				ig_.length = 0; 	
			
				for(i=0; i<arrSchm.length-1; i++) {	
				
					var strSchm = arrSchm[i];
					ig_.options[i] = new Option();
					ig_.options[i].value = arrSchm[i];
					ig_.options[i].text = arrSchm[i];
				}
			}
				else {
					ig_.length = 0;
					ig_.options[0] = new Option(); 
					ig_.options[0].value = "";
					ig_.options[0].text = "job application is not available";			
			}
			document.body.style.cursor = "auto";	
		
		}
		else
		{
			
			document.body.style.cursor = "auto";
		}
	}

	
}

var XmlHttpCar;
function CreateXmlHttpCar()
	{
		//Creating object of XMLHTTP in IE
		try
		{
			XmlHttpCar = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				XmlHttpCar = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(oc)
			{
				XmlHttpCar = null;	
			}
		}
		//Creating object of XMLHTTP in Mozilla and Safari 
		if(!XmlHttpCar&& typeof XMLHttpRequest != "undefined") 
		{
			XmlHttpCar = new XMLHttpRequest();
		}
	}
	
	
function FillDetails(jobAppl)
{

  CreateXmlHttpCar();
  document.body.style.cursor = "progress";
  var Dept = document.getElementById("ctl00_MainMaster_ddlDept").value;     

  document.getElementById("ctl00_MainMaster_HidDept").value= jobAppl;
  var requestUrl=HostAddressInJSfileForPages+"/Static/AjaxGetApplyJob.aspx?Dept="+Dept+"&jobAppl="+jobAppl+"&timeStamp="+new Date().getTime();

	if(XmlHttpCar)	
			{
					XmlHttpCar.onreadystatechange = function(){ShowCar();}; 
					XmlHttpCar.open("GET", requestUrl,  true);
					XmlHttpCar.send(null);
			}
}

function ShowCar()
{

	if(XmlHttpCar.readyState == 4)
	{
		
		if(XmlHttpCar.status == 200)//
		{
		 var strData =XmlHttpCar.responseText;
		 if(strData != null)
		 {
		  var arrSchm = strData.split("|");
		  document.getElementById("ctl00_MainMaster_TextPos").value = arrSchm[0];
		  document.getElementById("ctl00_MainMaster_TextLoc").value = arrSchm[1];
		  document.getElementById("ctl00_MainMaster_TextQul").value = arrSchm[2];
		  document.getElementById("ctl00_MainMaster_TextExp").value = arrSchm[3];
		  document.getElementById("ctl00_MainMaster_TextJobDesc").value = arrSchm[4];
		  document.getElementById("ctl00_MainMaster_TextJbPost").value = arrSchm[5];
		  document.getElementById("ctl00_MainMaster_TextJbExp").value = arrSchm[6];
		 }
		}
		else
		{
			document.body.style.cursor = "auto";
		}
		
	}
}

function BindJos()
{
 document.getElementById("ctl00_MainMaster_Dept").value = document.getElementById("ctl00_MainMaster_ddlDept").value;
 document.getElementById("ctl00_MainMaster_Applyfor").value = document.getElementById("ctl00_MainMaster_ddlApp").value;
}
function CarValidation()
{
  var Name =  document.getElementById("ctl00_MainMaster_TextName");
  var Address =  document.getElementById("ctl00_MainMaster_TextAdd");
  var mail =  document.getElementById("ctl00_MainMaster_Textmail");
  var ContNo =  document.getElementById("ctl00_MainMaster_TextCont");
  var CurrentOrg =document.getElementById("ctl00_MainMaster_TextCO");
  var CurrentSal =document.getElementById("ctl00_MainMaster_TexTCS");
  var ExpSal =document.getElementById("ctl00_MainMaster_TextES");  
  var Remark =document.getElementById("ctl00_MainMaster_TextRem");  
  var UploadFile =document.getElementById("ctl00_MainMaster_uploadfile");  
  
   
   if(Name.value == "")
   {
     alert("Please enter your name");
     Name.value="";
     Name.focus();
     return false;
   }
   if(Address.value == "")
   {
     alert("Please enter your Address");
     Address.value="";
     Address.focus();
     return false;
   }
   if(mail.value == "")
   {
     alert("Please enter your Email ID");
     mail.value ="";
     mail.focus();
     return false;
   }
    if(ContNo.value == "")
   {
     alert("Please enter your Contact No");
     ContNo.value="";
     ContNo.focus();
     return false;
   }
   
   if(CurrentOrg.value == "")
   {
     alert("Please enter your Current Organization ");
     CurrentOrg.value="";
     CurrentOrg.focus();
     return false;
   }
   if(CurrentSal.value == "")
   {
     alert("Please enter your Current Salary");
     CurrentSal.value="";
     CurrentSal.focus();
     return false;
   }
   if(ExpSal.value == "")
   {
     alert("Please enter your Expected Salary");
     ExpSal.value="";
     ExpSal.focus();
     return false;
   }
   if(Remark.value == "")
   {
     alert("Please enter your Expected Salary");
     Remark.value="";
     Remark.focus();
     return false;
   }
    if(UploadFile.value == "")
   {
     alert("Please enter your Expected Salary");
     UploadFile.value="";
     UploadFile.focus();
     return false;
   }
  
   if (UploadFile.value != "")
	{
	  var file =document.getElementById("ctl00_MainMaster_uploadfile").value ;
		
	    extArray = new Array(".doc");
        allowSubmit = false;
        if (!file) return;
        while (file.indexOf("\\") != -1)
        file = file.slice(file.indexOf("\\") + 1);
        ext = file.slice(file.indexOf(".")).toLowerCase();
        for (var i = 0; i < extArray.length; i++) 
        {
            if (extArray[i] == ext)
            {
                allowSubmit = true; 
                break;
            }
        }
        if (allowSubmit)
        {
             return true;
        }
        else
        {
            alert("Please upload only .doc file");
            return false;
	    }
    }
}
function EmailVali()
	{
	 var Mail = document.getElementById("ctl00_MainMaster_Textmail");
	
		if(Mail.value !="")
		{
			var filter1=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/	
			if (filter1.test(Mail.value)){ return (true)	}
				alert("'" + Mail.value + "' Invalid E-mail Address! Please re-enter.");
				Mail.value="";
				Mail.focus();								
				return false;
		}
			
	}
	
	 function checkDigit()
     {
	    if(window.event.keyCode < 48 || window.event.keyCode > 57)
	    {		
		    if(window.event.keyCode == 43 || window.event.keyCode == 45)
		    {
			    event.returnValue = true;
			}
	      else
	        {
			    event.returnValue = false;
			    alert("Use Numbers only");
		    }
	    }
     }
     
     function BusinessShowTabs(Opt)
  {
  
     document.getElementById("BAMainImg1").style.display="inline";
    document.getElementById("BAMainImg2").style.background="url(../App_Themes/Common/Images/business-partner_04.gif)";
  
    for(var i=1;i<=6;i++)
    {
    document.getElementById("BSTxtTD"+i).style.display="none";
    }
    document.getElementById("BSTxtTD"+Opt).style.display="inline";
    
    if (Opt=="4" || Opt=="5")
    {
    document.getElementById("BAMainImg1").style.display="none";
    document.getElementById("BAMainImg2").style.background="";
    }
    
  }
  
  function BissFAQDataDisp(Opt)
 {
  BissCloseAllFAQDataDisp();
  document.getElementById("BAQuest"+Opt).style.display="inline";
  document.getElementById("BAImg"+Opt).src="../App_Themes/Common/images/MinusHome.gif";
 }


   function BissCloseAllFAQDataDisp()
  {
 for(var i=1;i<=11;i++)
    {
    document.getElementById("BAQuest"+i).style.display="none";
    document.getElementById("BAImg"+i).src="../App_Themes/Common/images/PlusHome.gif";
    }
  }

  
  
  
  
  
  
var XmlHttpCar;
function CreateXmlHttpAnnounce()
	{
		//Creating object of XMLHTTP in IE
		try
		{
			XmlHttpAnnounce = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				XmlHttpAnnounce = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(oc)
			{
				XmlHttpAnnounce = null;	
			}
		}
		//Creating object of XMLHTTP in Mozilla and Safari 
		if(!XmlHttpAnnounce&& typeof XMLHttpRequest != "undefined") 
		{
			XmlHttpAnnounce = new XMLHttpRequest();
		}
	}

function UnSelectAllAnnouncement()
{
 for(var i=1;i<=10;i++)
    {
       if(document.getElementById("Ann"+i) != null)
        {
       document.getElementById("Ann"+i).className="StaticTabUnSel";
        }
    }
}
	
	
function GetAnnouncementData(TabId,AnnType)
{

   UnSelectAllAnnouncement()
   document.getElementById("Ann"+TabId).className="StaticTabSel";





  CreateXmlHttpAnnounce();
  document.body.style.cursor = "progress";
 
  var requestUrl="GetAjaxannouncements.aspx?TabId="+TabId+"&AnnType="+AnnType+"&timeStamp="+new Date().getTime();

	if(XmlHttpAnnounce)	
			{
					XmlHttpAnnounce.onreadystatechange = function(){ShowAnndata();}; 
					XmlHttpAnnounce.open("GET", requestUrl,  true);
					XmlHttpAnnounce.send(null);
			}
}

function ShowAnndata()
{
	if(XmlHttpAnnounce.readyState == 4)
	{
		if(XmlHttpAnnounce.status == 200)//
		{
		 var strData =XmlHttpAnnounce.responseText;
		 var Anndata = document.getElementById("AnndataTD");
		 if(strData != null)
		 {
		        Anndata.innerHTML = strData;				
				document.body.style.cursor = "auto";
		 }
		}
		else
		{
			document.getElementById("AnndataTD").innerHTML =  "There was a problem retrieving data from the server.";
			document.body.style.cursor = "auto";
		}
	}
}
  
  
