    // declare global variables
    var checkSelectedTab;
	// for intelliType
	var xmlQuickSearch;
	var currentPosition = "";
	var itRowCount = 0;
	
	var JobTitleForEmail;
	
	//for querystring checking
	var page = new PageQuery(window.location.search);
    var jobAdId = page.getValue("JobAdvertisementID");
    var keywordString = unescape(page.getValue("keyword"));
    var selectedTab = page.getValue("searchFlag")
    var nextRequest = "";
	
    var virtualDir = document.location.href.substring(0,document.location.href.lastIndexOf("/"));
	
	function initPage()
    {
		//disable unused dropdowns
		//document.getElementById("selCountries").style.display = "none";
		//document.getElementById("selCities").disabled = true;
		document.getElementById("selJobCategories").disabled = true;
		document.getElementById("selCities").length = 1;
		document.getElementById("selJobCategories").length = 1;
		//populate dropdowns
		
		// flood countries is disabled due to display of cities first
		
		//floodCountries();
		floodCities();
		
		// Removed by: Gerald Ortiz 08/07/06
		
		//if (selectedTab != true){
		//	clickedTab();
		//}		
		//else {
		//	clickedWorkingTab();
		//}
	}
	   
    function floodCountries()
    {
        CallerID = "GetCountries";
		xmlUrl = wsUrlCountry;
		xsltUrl = "";
		processXslt = false;
		arrParams = new Array();
		
		loadXMLRequest(xmlUrl, CallerID);
    }
    
    function floodCities()
    {
		//var countryId = document.getElementById("selCountries").options[document.getElementById("selCountries").selectedIndex].value;
		var countryId = 1;
		
		document.getElementById("selCities").length = 1;
		document.getElementById('selJobCategories').length = 1;
		if(countryId == "0")
		{
			if(!document.getElementById("selCities").disabled)
			{
				document.getElementById("selCities").disabled = true;
			}
			
			if(!document.getElementById('selJobCategories').disabled)
			{
				document.getElementById('selJobCategories').disabled = true;
			}			
		}
		else
		{
			document.getElementById("selCities").disabled = false;
			
			CallerID = "GetCitiesByCountryID";
			xmlUrl = wsUrlCity;
			xsltUrl = "";
			processXslt = false;
			arrParams = new Array(["countryID"], [countryId]);
			
			loadXMLRequest(xmlUrl, CallerID);
		}
    }
    
    function floodJobCategories()
	{
		var cityId = document.getElementById("selCities").options[document.getElementById('selCities').selectedIndex].value;
		
		if(cityId == 0)
		{
			document.getElementById('selJobCategories').length =1;
			if(!document.getElementById('selJobCategories').disabled)
			{
				document.getElementById('selJobCategories').disabled = true;
			}
		}
		else
		{
			document.getElementById('selJobCategories').length =1;
			document.getElementById('selJobCategories').disabled = false;
			
			CallerID = "GetJobCategoriesByCityID";
			xmlUrl = wsUrlJobAdvertisement;
			xsltUrl = "";
			processXslt = false;
			arrParams = new Array(["cityID"], [cityId]);
			
			loadXMLRequest(xmlUrl, CallerID);
		}
	}
	
	function floodEducationalLevels()
	{
		if(document.getElementById("selEducationalBackground").length == 1)
		{
			CallerID = "GetEducationalLevels";
			xmlUrl = wsUrlApplicant;
			xsltUrl = "Xsl/sortEducationalLevelAsc.aspx";
			processXslt = true;
			arrParams = new Array();
			loadXMLRequest(xmlUrl, CallerID);
		}
	}

	function floodSources()
	{
		CallerID = "GetListOfSources";
		xmlUrl = wsUrlUser;
		xsltUrl = "Xsl/sortSourcesByNameAsc.aspx";
		processXslt = true;
		arrParams = new Array();
		loadXMLRequest(xmlUrl, CallerID);
	}

	function floodDegrees()
	{
		/*
		CallerID = "GetListOfDegrees";
		xmlUrl = wsUrlUser;
		xsltUrl = "Xsl/sortDegreesByNameAsc.aspx";
		processXslt = true;
		arrParams = new Array();
		loadXMLRequest(xmlUrl, CallerID);
		*/
		CallerID = "GetListOfDegrees";
		xmlUrl = "GetDegrees.aspx";
		xsltUrl = "Xsl/sortDegreesByNameAsc.aspx";
		processXslt = true;
		arrParams = new Array();
		loadXMLRequest(xmlUrl, CallerID);
	}

	function floodBestContactTime()
	{
		if(document.getElementById("selBestTimeToContact").length == 1)
		{
			CallerID = "GetContactTimes";
			xmlUrl = wsUrlApplicant;
			xsltUrl = "Xsl/sortContactTimesAsc.aspx";
			processXslt = true;
			arrParams = new Array();
			loadXMLRequest(xmlUrl, CallerID);
		}
	}
	
	function search()
	{
		//clear results if any
		document.getElementById("divJobList").innerHTML = "";
		document.getElementById("divJobDetails").innerHTML = "";
				
		//retrieve combobox values
		var countryId = document.getElementById("selCountries").options[document.getElementById("selCountries").selectedIndex].value;
		var cityId = document.getElementById("selCities").options[document.getElementById("selCities").selectedIndex].value;
		var jobCategoryId = document.getElementById("selJobCategories").options[document.getElementById("selJobCategories").selectedIndex].value;
		var requestType = "";
		var jobListSource;
		
		//determine jobListSource
		if(jobCategoryId == 0)
		{
			//no jobCategory was chosen
			if(cityId == 0)
			{
				//no city was chosen
				//search jobs given Country
				/*
				CallerID = "GetJobListByCountryID";
				arrParams = new Array(["countryID"], [countryId]);
				*/
				CallerID = "GetJobListByCountryID";
				arrParams = new Array();
				requestType = "Country";
			}
			else
			{
				//city was chosen
				//search jobs given City and Country
				CallerID = "GetJobListByCityID";
				arrParams = new Array(["cityID"], [cityId]);
				requestType = "City";
			}
			
		}
		else
		{
			//jobCategories was chosen
			//search jobs given JobCategory, City and Country
			CallerID = "GetJobListByCityIDAndJobCategoryID";
			arrParams = new Array(["cityID", "categoryID"], [cityId, jobCategoryId]);
			requestType = "Both";
		}
		//xmlUrl = wsUrlJobAdvertisement;
		xmlUrl = "GetJobList.aspx?RequestType=" + requestType + "&CountryID=" + countryId + "&CityID=" + cityId + "&JobCategoryID=" + jobCategoryId;
		xsltUrl = "Xsl/createTableJobsByDatePostedDesc.aspx";
		processXslt = true;
		
		loadXMLRequest(xmlUrl, CallerID);
		displayDivJobList();
	}
	
	function DoQuickSearch(keyword)
	{
		
		//clear results if any
		document.getElementById("divJobList").innerHTML = "";
		document.getElementById("divJobDetails").innerHTML = "";		
		
		CallerID = "GetJobListByKeyword";
		xmlUrl = wsUrlJobAdvertisement;
		xsltUrl = "Xsl/createTableJobsByDatePostedDesc.aspx";
		processXslt = true;
		arrParams = new Array(["keyword"], [keyword]);
		loadXMLRequest(xmlUrl, CallerID);
	}
	
	function searchJobByAdvertisementID(jobAdId)		
	{
		//clear results if any
		document.getElementById("divJobList").innerHTML = "";
		document.getElementById("divJobDetails").innerHTML = "";
		
		CallerID = "GetJobsByJobAdvertisementID";
		xmlUrl = wsUrlJobAdvertisement;
		xsltUrl = "Xsl/createTableJobsByDatePostedDesc.aspx";
		processXslt = true;
		arrParams = new Array(["JobAdvertisementID"], [jobAdId]);
		loadXMLRequest(xmlUrl, CallerID);
	}
	
	function GetJobListByJobAdvertisementID(jobAdId)
	{
		CallerID = "GetJobListByJobAdvertisementID";
		xmlUrl = wsUrlJobAdvertisement;
		xsltUrl = "Xsl/createTableJobsByDatePostedDesc.aspx";
		processXslt = true;
		arrParams = new Array(["jobAdvertisementID"], [jobAdId]);
		loadXMLRequest(xmlUrl, CallerID);
	}
	
	function ShowJobDetails(jobAdvertisementID)
	{
		// pass the value of Job Advertisement ID to the selected Job Ad ID
		selectedAdID = jobAdvertisementID;

		CallerID = "GetJobDetailsByJobAdvertisementID";
		xmlUrl = wsUrlJobAdvertisement;
		xsltUrl = "Xsl/createDivJobDetails.aspx";
		processXslt = true;
		arrParams = new Array(["jobAdvertisementID"], [jobAdvertisementID]);
		loadXMLRequest(xmlUrl, CallerID);
	
		doFade(); // perform this action to animate in IE
	}
		
	function OnClickApply(ResumeRequired, JobTitle, CityID, JobCatId)
	{   
		//determine whether to show form or show email client
		switch(ResumeRequired)
		{
			case false:
				// check job category if OPERATIONS else do not show Degree
				//JobCatId == "2" ? document.getElementById("divDegree").style.display = "block" : document.getElementById("divDegree").style.display = "none";
				document.getElementById("divDegree").style.display = "none";
				doAlphaDiv();
				showApplicationForm();
				document.getElementById("divJobApplicationForm").style.display = "block";
				document.getElementById("jobApplySuccess").style.display = "none";
				hidemenu();
				floodEducationalLevels(); 
				document.getElementById("txtFirstName").focus();
				document.getElementById("showJobTitle").innerHTML = " Job Title: " + JobTitle;
				break;
			
			case true:
				JobTitleForEmail = JobTitle;
				
				CallerID = "GetEmailByCityID";
				xmlUrl = wsUrlCity;
				xsltUrl = "";
				processXslt = false;
				arrParams = new Array(["cityID"], [CityID]);
				loadXMLRequest(xmlUrl, CallerID);
				break;
		}
	}
	
	function SaveJobApplication()
	{
		CallerID = "SaveJobApplication";
		xmlUrl = wsUrlApplicant;
		xsltUrl = "";
		processXslt = false;
		arrParams = new Array(["xmlParam"], [escape(xmlJobApplicant)]);
		loadXMLRequest(xmlUrl, CallerID);
	}
    
    function XmlResult(xmlData, xslData, xmlDataRaw)
	{
		switch (CallerID)
		{
			case "GetCountries":
				BindXmlToComboBox("CountryID", "CountryName", document.getElementById("selCountries"), xmlData);
				document.getElementById("selCountries").style.display = "block";
				
				if ( jobAdId != "" && jobAdId != false )
				{
					GetJobListByJobAdvertisementID(jobAdId);
					return true;
				}
				
				if ( Trim(keywordString) != "" && keywordString != false )
				{
					DoQuickSearch(keywordString);
					return true;
				}
				break;
			
			case "GetCitiesByCountryID":
				BindXmlToComboBox("CityID", "CityName", document.getElementById("selCities"), xmlData);
				
				if ( jobAdId != "" && jobAdId != false )
				{
					GetJobListByJobAdvertisementID(jobAdId);
					return true;
				}
				
				if ( Trim(keywordString) != "" && keywordString != "false" )
				{
					DoQuickSearch(keywordString);
					return true;
				}
				break;
				
			case "GetJobCategoriesByCityID":
				BindXmlToComboBox("JobCategoryID", "JobCategoryName", document.getElementById("selJobCategories"), xmlData);
				break;
				
			case "GetJobListByJobAdvertisementID":
				displayDivJobList();
				DisplayJobResultsList(xmlDataRaw, xslData);
				ShowJobDetails(jobAdId);
				
				document.getElementById("jobIntruction").style.display = "none";
				break;
				
			case "GetJobListByCountryID":
			case "GetJobListByCityID":
			case "GetJobListByCityIDAndJobCategoryID":
				DisplayJobResultsList(xmlDataRaw, xslData);
				break;
				
			case "GetJobDetailsByJobAdvertisementID":
				document.getElementById("divJobDetails").innerHTML = unescape(xmlData.xml);
				break;
				
			case "GetJobListByIntelliType":
				itRowCount = xmlData.documentElement.childNodes.length;
				ShowIntelliType(xmlData);
				break;
				
			case "GetJobListByKeyword":
			
				if ( Trim(keywordString) != "" && keywordString != "false")
				{
					if ( Trim(document.getElementById("txtQuick").value) == "Quick Job Search" )
					{
						document.getElementById("txtQuick").value = keywordString;
					}
					else if ( Trim(document.getElementById("txtQuick").value) != "" )
					{
					}
					displayDivJobList();
					DisplayJobResultsList(xmlDataRaw, xslData);
					keywordString = false;
				}
				else
				{
					DisplayJobResultsList(xmlDataRaw, xslData);
				}
				break;
				
			case "GetEducationalLevels":
				BindXmlToComboBox("EducationalLevelId", "EducationalLevelDesc", document.getElementById("selEducationalBackground"), xmlData);
				floodBestContactTime();
				break;
				
			case "GetListOfSources":
				BindXmlToComboBox("SourceID", "SourceName", document.getElementById("selSource"), xmlData);
				floodDegrees();
				break;
				
			case "GetListOfDegrees":
				BindXmlToComboBox("DegreeID", "DegreeName", document.getElementById("selDegree"), xmlData);
				break;
				
			case "GetContactTimes":
				BindXmlToComboBox("ContactTimeID", "ContactTimeDesc", document.getElementById("selBestTimeToContact"), xmlData);
				floodSources();
				break;
				
			case "GetEmailByCityID":
				SendResume(JobTitleForEmail, xmlData);
				break;
				
			case "SaveJobApplication":
				alert("Job Application Saved");
				document.getElementById("jobApplySuccess").style.display = "block";
				document.getElementById("divJobApplicationForm").style.display = "none";
				break;
				
			default:
				break;
		}
	}
	
	function DisplayJobResultsList(xmlDataRaw, xslData)
	{
		document.getElementById("divPager").style.display = "none";
		if(xmlDataRaw.getElementsByTagName("JobAdvertisementID")[0].firstChild.nodeValue != "0")
		{
			objXmlPaging = xmlDataRaw;
			objXslPaging = xslData;
			fnPopulateCurrentPage(1);
			document.getElementById("jobIntruction").style.display ="block";
		}
		else
		{
			document.getElementById('divJobList').innerHTML = "<div class=\"errorJobSearch\"><img src=\"Images/error-msg.gif\" align=\"absmiddle\" /> No job found.</div>";
			document.getElementById('divJobList').style.display = "block";
			document.getElementById("jobIntruction").style.display ="block";
		}
	}
	
	function triggerIntelliType(evt)
	{
		var length = document.getElementById('txtQuick').value.length;
		
		if(length>2)
		{
			intelliType(evt)
		}
		else if(document.getElementById('divQuickResults').style.display == "block")
		{
			document.getElementById('divQuickResults').style.display = "none";
		}
	}
	
	function intelliType(evt)
	{
				
		evt = (evt) ? evt : (window.event) ? event : null;
		var charCode = (evt.charCode) ? evt.charCode :
						((evt.keyCode) ? evt.keyCode :
						((evt.which) ? evt.which : 0));
		//40 = keyDown
		//39 = keyRight
		//38 = keyUp
		//37 = keyLeft
		
		if(charCode == 40)
		{	
			if(document.getElementById("divQuickResults").innerHTML != "")
			{
				if(currentPosition == "")
				{
					currentPosition = 1;
					highlight(currentPosition);
				}
				else if(currentPosition != "")
				{
					if(currentPosition < itRowCount)
					{
						currentPosition = currentPosition + 1;
						unhighlight(currentPosition - 1);
						highlight(currentPosition);
					}
					else if(currentPosition > itRowCount)
					{
						//does nothing, cursor is not yet in intelliType div
						//because keypress is trying to move to nonexistent row
					}
				}
			}
		}
		else if(charCode == 38)
		{
			if(currentPosition == "")
			{
				//does nothing, cursor is not yet in intelliType div
			}
			else if(currentPosition != "")
			{
				if(currentPosition > 1)
				{
					currentPosition = currentPosition - 1 
					unhighlight(currentPosition + 1);
					highlight(currentPosition);
				}			
			}
		
		}
		else if((charCode == 13) || (charCode == 39))
		{
			if(currentPosition > 0)
			{
				var rowIndex = "row" + currentPosition;
				document.getElementById("txtQuick").value = document.getElementById(rowIndex).getElementsByTagName('span')[2].firstChild.nodeValue;
				document.getElementById("divQuickResults").style.display = "none";
				
				dosearchResult("quickSearch");
			}
			else
			{
				document.getElementById("divQuickResults").style.display = "none";
				dosearchResult("quickSearch");
			}
		}
		
		else if(charCode != 15 && charCode != 45)
		{						
			//reset current position
			currentPosition = 0;
			
			var keyword = RemoveSpecialCharacters( document.getElementById("txtQuick").value );
			keyword = TrimLength(Trim(keyword));
			
			if(keyword.length > 0)
			{
				CallerID = "GetJobListByIntelliType";
				xmlUrl = wsUrlJobAdvertisement;
				xsltUrl = "Xsl/createIntelliTypeList.aspx";
				processXslt = true;
				arrParams = new Array(["keyword"], [Trim(keyword)]);
				loadXMLRequest(xmlUrl, CallerID);
			}
			else if(keyword.length <= 0)
			{
				var blankString = "";
				xmlQuickSearch.loadXML(blankString);
				
			}
		}
	}
	function ShowIntelliType(xmlDoc)
	{
		document.getElementById("divQuickResults").innerHTML = xmlDoc.xml;
		document.getElementById('divQuickResults').style.display = "block";			
		if(navigator.appName == 'Netscape')
		{
			if(xmlDoc.xml == '<div id="divResultsList"/>')
			{					
			document.getElementById('divQuickResults').style.display = "none";		
			}
		}
		else if(document.getElementById('divQuickResults').innerText == "")
		{
			document.getElementById('divQuickResults').style.display = "none";
		}
	}
	
	function highlight(id)
	{
		var spanRow = "row" + id;
		var spanTitle = "title" + id;
		var spanLocation = "location" + id
		
		document.getElementById(spanRow).style.backgroundColor = "#7D2E41";
		document.getElementById(spanTitle).style.color = "Maroon";
		document.getElementById(spanTitle).style.fontWeight = "bold";
		document.getElementById(spanLocation).style.color = "Maroon";
	}
	
	function unhighlight(id)
	{
		var spanRow = "row" + id;
		var spanTitle = "title" + id;
		var spanLocation = "location" + id
		
		document.getElementById(spanRow).style.backgroundColor = "#7D2E41";
		document.getElementById(spanTitle).style.color = "Black";
		document.getElementById(spanTitle).style.fontWeight = "normal";
		document.getElementById(spanLocation).style.color = "Black";
	}
	
	function validateSearchRequest()
	{
		var countryId = document.getElementById("selCountries").options[document.getElementById("selCountries").selectedIndex].value;
		
		if(countryId == 0)
		{
			
			document.getElementById('divJobList').innerHTML = "<div class=\"errorJobSearch\"><img src=\"Images/error-msg.gif\" align=\"absmiddle\" /> No job found.</div>";
			alert("You must specify a search criteria");
			return false;
		}
		else
		{
			return true;
		}
	}
	
	function validateQuickSearchRequest()
	{
		var keyword = RemoveSpecialCharacters( document.getElementById("txtQuick").value );
		keyword = TrimLength(keyword);
		
		if(keyword.length > 0)
		{
			DoQuickSearch(keyword);	
			displayDivJobList();	
		}
	}
	
	function resetSearchFilters()
	{
		if(confirm("Are you sure you want to reset the search filters?"))
		{
			//reset dropdown boxes
			//document.getElementById("selCountries").length = 1;
			document.getElementById("selCities").options[0].selected = true;
			document.getElementById("selCities").length = 1;
			document.getElementById("selJobCategories").options[0].selected = true;
			document.getElementById("selJobCategories").length = 1;
		
			//disable unused dropdowns
			//document.getElementById("selCities").disabled = true;
			document.getElementById("selJobCategories").disabled = true;
			
			//initialize dropdown boxes
			//floodCountries();
			floodCities();
		}
	}
	
	function sendToFriend(JobAdvertisementID, JobTitle)
	{
		//set vars
		var subject = "?subject=Career Opportunities at Sykes Asia (Position: " + JobTitle + ")";
		var link = virtualDir + "/Careers.aspx?JobAdvertisementID=" + JobAdvertisementID;
		var body = "&body="+link;
		var mailString = "mailto:"+ subject + body; 
		
		location.href = mailString;
	}
	
	function SendResume(JobTitle, xmlData)
	{
		var xmlDocRaw;
		if (isIE)
		{
			xmlDocRaw = new ActiveXObject("Microsoft.XMLDOM");
		}
		else if (!isIE)
		{
			xmlDocRaw = document.implementation.createDocument("", "", null);
		}
		xmlDocRaw.async = false;
		xmlDocRaw.loadXML(xmlData.xml);
		
		var recipient = xmlDocRaw.getElementsByTagName("Email")[0].firstChild.nodeValue;
		
		var to = recipient;
		var subject = "&subject=Application for position:" + JobTitle;
		var body = "&body=Please attach Resume to send";
		var mailString = "mailto:" + to + subject + body;
		
		location.href = mailString;
	}
	
	function showApplicationForm()
	{
		document.getElementById("divApplicationForm").style.display="block";
	}
	
	function selectJobItem(jobTitle)
	{
		document.getElementById("txtQuick").value = jobTitle;
		document.getElementById("divQuickResults").style.display = "none";
		
	}	
	
	// Div control behavior
	
	var filterIsOpen = true;
	function viewDetailClick(jobId) {

		document.getElementById("jobIntruction").style.display ="none";
		ShowJobDetails(jobId);						
	}
	function filterButtonClick(){
		if(filterIsOpen){
			hidemenu();
			//document.getElementById('aboutsykes').style.display = "none";
		}
		else {
			document.getElementById("menuContent").style.display = "block";
			document.getElementById("menuContent").style.height = "150px";
			document.getElementById("filterTabTitle").style.marginLeft = "10px";
			document.getElementById("filterSearchButtonHide").style.display = "none";
			document.getElementById("filterSearchButtonShow").style.display = "block";
			//document.getElementById('aboutsykes').style.display = "block";		
			filterIsOpen = true;
		}
	}
	function hidemenu() {
			document.getElementById("menuContent").style.display = "none";
			document.getElementById("contentBoxTable").style.backgroundImage = "url('images/spacer.gif')"; 
			document.getElementById("contentBoxTable").style.backgroundColor = "#E0DFDF"; 
			document.getElementById("menuContent").style.height = "30px";
			document.getElementById("welcome").style.marginLeft = "0px";
			document.getElementById("filterTabTitle").style.marginLeft = "10px";
			document.getElementById("filterSearchButtonHide").style.display = "block";
			document.getElementById("filterSearchButtonShow").style.display = "none";		
			filterIsOpen = false;
	} 
	function dosearchResult(typeSearch)
	{
			document.getElementById("contentBoxTable").style.height = "370px";
			
		switch (typeSearch) 
		{
			case "quickSearch":
				if(currentPosition > 0)
				{
					var rowIndex = "row" + currentPosition;
					document.getElementById("txtQuick").value = document.getElementById(rowIndex).getElementsByTagName('span')[2].firstChild.nodeValue;				
				}
				if(document.getElementById("divQuickResults").style.display == "block")
				{							
					document.getElementById("divQuickResults").style.display = "none";
				}
				validateQuickSearchRequest();
				
				//clickedTab();
				break;
				
			case "filterSearch":
				
				if (validateSearchRequest())
				{
					search();
				}
				break;
				
			case "queryStringSearch":
				searchJobByAdvertisementID(jobAdId);
				displayDivJobList();					
				break;
			
		}
	}
	function displayDivJobList()
	{
		hidemenu();
		document.getElementById("welcome").style.display = "none";
		document.getElementById("jobcontainer").style.display = "block";
		document.getElementById("contentBoxTable").style.height = "370px";	
	}
	function doAlphaDiv(){
			
			document.getElementById("divAlpha").style.display = "block";
		
	}
	function undoAlphaDiv(){
			
			document.getElementById("divAlpha").style.display = "none";
		
	}			
	
	// Table event script
	
	var selectedAdID;
	var xmlJobApplicant;
	
	function closeApplicationForm()
	{
		clearbuttonclick();
		undoAlphaDiv();
		document.getElementById("divApplicationForm").style.display="none";
	}
	
	function clearinputtxt(txtName)
	{
		var value =document.getElementById(txtName).value;
		if(value !="")
		{
			document.getElementById(txtName).value = "";
		}
	}
	
	function cleardatetxt(txtName)
	{
		var value =document.getElementById(txtName).value;
		if(value !="MM/DD/YYYY")
		{
			document.getElementById(txtName).value = "MM/DD/YYYY";
		}	
	}
	
	function clearallinputtxt()
	{
		clearinputtxt('txtFirstName');
		clearinputtxt('txtLastName');
		clearinputtxt('txtMiddleInitial');
		clearinputtxt('txtLandLine');
		clearinputtxt('txtMobileNumber');
		clearinputtxt('txtEmailAddress');
		cleardatetxt('txtBirthDate');
		clearinputtxt('txtAddress');
	}
	
	function clearSelection(selName)
	{
		var value =document.getElementById(selName).value;
		if(value > 0)
		{
			document.getElementById(selName).value = 0;
		}	
	}
	
	function clearAllSelection()
	{
		clearSelection('selBestTimeToContact');
		clearSelection('selEducationalBackground');
		clearSelection('selSource');
		clearSelection('selDegree');
	}
	function clearbuttonclick()
	{
		clearallinputtxt();
		clearallspan();
		clearAllSelection();
	} 

	function validateonsubmit()
	{
		validaterequiredselection('selBestTimeToContact','span10');
		validaterequiredselection('selEducationalBackground','span9');
		validaterequiredfield('txtFirstName','span1');
		validaterequiredfield('txtLastName','span2');
		validaterequiredfield('txtMiddleInitial','span3');
		validateLandLine('txtLandLine' ,'span4' , 'span5');
		validateMobileNumber('txtMobileNumber','span6','span5');
		eitherrequiredfield('txtLandLine','txtMobileNumber','span5');
		validateEmail('txtEmailAddress' , 'span8' , 'span7');
		validaterequiredfield('txtBirthDate','span11');
		validaterequiredfield('txtAddress','span12');
		Validate('txtBirthDate','span11','span13');
		
		var spanname; 
		var count = 0;
		for(var i=1 ; i<14;i++)
		{
			spanname = "span"+i;
			if(document.getElementById(spanname).style.display == "inline")
			{
			count = count+1;
			}
		}
		if(count==0)
		{
			createJobApplicationXML();
		}
	
	}

	function createJobApplicationXML()
	{
		var tmpxml="<JobApplicants><JobApplicant>"; 
		tmpxml= tmpxml + "<FirstName>"+ document.getElementById("txtFirstName").value +"</FirstName>";
		tmpxml= tmpxml + "<LastName>"+ document.getElementById("txtLastName").value +"</LastName>";
		tmpxml= tmpxml + "<MiddleInitial>"+ document.getElementById("txtMiddleInitial").value +"</MiddleInitial>";
		tmpxml= tmpxml + "<Address>"+ document.getElementById("txtAddress").value +"</Address>";
		if(document.getElementById("txtLandLine").value != "")
		{
		tmpxml= tmpxml + "<ContactNumber>"+ document.getElementById("txtLandLine").value +"</ContactNumber>";
		}
		if(document.getElementById("txtMobileNumber").value != "")
		{
		tmpxml= tmpxml + "<MobileNumber>"+ document.getElementById("txtMobileNumber").value +"</MobileNumber>";
		}
		tmpxml= tmpxml + "<EmailAddress>"+ document.getElementById("txtEmailAddress").value +"</EmailAddress>";
		tmpxml= tmpxml + "<BirthDate>"+ document.getElementById("txtBirthDate").value +"</BirthDate>";
		tmpxml= tmpxml + "<BestTimetoContact>"+ document.getElementById("selBestTimeToContact").value +"</BestTimetoContact>";
		tmpxml= tmpxml + "<EducationalLevelID>"+ document.getElementById("selEducationalBackground").value +"</EducationalLevelID>";
		tmpxml= tmpxml + "<JobAdvertisementID>"+ selectedAdID +"</JobAdvertisementID>";
		tmpxml= tmpxml + "<SourceID>"+document.getElementById("selSource").value+"</SourceID>";
		if(document.getElementById("selDegree").value != "0")
		{
		tmpxml= tmpxml + "<DegreesID>"+document.getElementById("selDegree").value+"</DegreesID>";			
		} 
		tmpxml= tmpxml + "</JobApplicant></JobApplicants>";
		xmlJobApplicant = tmpxml;
		SaveJobApplication();
	}
