// JavaScript Document

//side menu to show above other hyperlinks
function hidelink()
{
	var links = document.getElementsByTagName("A"); 
	for (i=0; i<links.length; i++) 
	{  
		 if(links[i].className == "contentsmallheadingfontsp" || links[i].className == "bluetablink")
		 {
			 if (typeof document.body.style.maxHeight != "undefined") 
			 {
			 } 
			 else 
			 {
				links[i].style.position = "fixed"; 
			 }
		 }
	} 
}
function showlink()
{
	var links = document.getElementsByTagName("A"); 
	for (i=0; i<links.length; i++) 
	{  
		 if(links[i].className == "contentsmallheadingfontsp" || links[i].className == "bluetablink")
		 {
			 if (typeof document.body.style.maxHeight != "undefined") 
			 {
			 } 
			 else 
			 {
				links[i].style.position = "relative"; 
			 }
		 }
	} 
}


function checkForInt(evt) {
//notice that the check is != null now, as the tab key has a value of 0
var charCode = ( evt.which != null ) ? evt.which : event.keyCode
//charCodes < 32 include tab, delete, arrow keys, etc
return (charCode < 32 || (charCode >= 48 && charCode <= 57))
}



function textboxMultilineMaxNumber(txt,maxLen){   
	try{  
                if(txt.value.length > (maxLen-1))
                return false;  
               }catch(e){  
               }  
}   


<!--//--><![CDATA[//><!--

sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	var sfEls2 = document.getElementById("navH").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
	for (var i=0; i<sfEls2.length; i++) {
		sfEls2[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls2[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

//--><!]]>

function uncheckanyjobtype()
{
	document.getElementById("chkSearchJobAllField").checked = false;
	document.getElementById("chkSearchJobEitherField").checked = true;
}

function checkanyjobtype()
{
	document.getElementById("chkSearchJobEitherField").checked = false;
	document.getElementById("chkSearchJobAllField").checked = true;
	document.getElementById("chkSearchJobTemp").checked = false;
	document.getElementById("chkSearchJobContract").checked = false;
	document.getElementById("chkSearchJobParttime").checked = false;
	document.getElementById("chkSearchJobPermanent").checked = false;
}

function uncheckanyjoblevel()
{
	document.getElementById("chkSearchJobAllLevel").checked = false;
	document.getElementById("chkSearchJobEitherLevel").checked = true;
}

function checkanyjoblevel()
{
	document.getElementById("chkSearchJobEitherLevel").checked = false;
	document.getElementById("chkSearchJobAllLevel").checked = true;
	document.getElementById("chkSearchNonExecutive").checked = false;
	document.getElementById("chkSearchExecutive").checked = false;
	document.getElementById("chkSearchSeniorExecutive").checked = false;
	document.getElementById("chkSearchManager").checked = false;
	document.getElementById("chkSearchEntryLevel").checked = false;
}

function changepoint(point)
{
	//Company Registration
	if(point=="1a")
	{
		document.getElementById('point1').className='point1';
		document.getElementById('point2').className='point2-out';
	}
	
	if(point=="2a")
	{
		document.getElementById('point2').className='point2';
		document.getElementById('point1').className='point1-out';
	}
	
	//Job Seeker Registration
	if(point=="1")
	{
		document.getElementById('point1').className='point1';
		document.getElementById('point2').className='point2-out';
		document.getElementById('point3').className='point3-out';
		document.getElementById('point4').className='point4-out';
	}
	
	if(point=="2")
	{
		document.getElementById('point2').className='point2';
		document.getElementById('point1').className='point1-out';
		document.getElementById('point3').className='point3-out';
		document.getElementById('point4').className='point4-out';
	}
	
	if(point=="3")
	{
		document.getElementById('point3').className='point3';
		document.getElementById('point1').className='point1-out';
		document.getElementById('point2').className='point2-out';
		document.getElementById('point4').className='point4-out';
	}
	
	if(point=="4")
	{
		document.getElementById('point4').className='point4';
		document.getElementById('point2').className='point2-out';
		document.getElementById('point3').className='point3-out';
		document.getElementById('point1').className='point1-out';
	}
}

function bdaydefault(type)
{
	if(type=="on")
	{
		if(document.getElementById('TxtRegBDay').value == 'Day')
		{
			document.getElementById('TxtRegBDay').value = '';
		}
		document.getElementById('point2').className='point2';
		document.getElementById('point1').className='point1-out';
		document.getElementById('point3').className='point3-out';
		document.getElementById('point4').className='point4-out';
	}
	
	if(type=="out")
	{
		if(document.getElementById('TxtRegBDay').value == '')
		{
			document.getElementById('TxtRegBDay').value = 'Day';
		}
	}
	
	if(type=="on2")
	{
		if(document.getElementById('TxtCoyPostJobDateDay').value == 'Day')
		{
			document.getElementById('TxtCoyPostJobDateDay').value = '';
		}
		document.getElementById('point2').className='point1';
		document.getElementById('point1').className='point2-out';
	}
	
	if(type=="out2")
	{
		if(document.getElementById('TxtCoyPostJobDateDay').value == '')
		{
			document.getElementById('TxtCoyPostJobDateDay').value = 'Day';
		}
	}
}

function byeardefault(type)
{
	if(type=="on")
	{
		if(document.getElementById('TxtRegBYear').value == 'Year')
		{
			document.getElementById('TxtRegBYear').value = '';
		}
		document.getElementById('point2').className='point2';
		document.getElementById('point1').className='point1-out';
		document.getElementById('point3').className='point3-out';
		document.getElementById('point4').className='point4-out';
	}
	
	if(type=="out")
	{
		if(document.getElementById('TxtRegBYear').value == '')
		{
			document.getElementById('TxtRegBYear').value = 'Year';
		}
	}
	
	if(type=="on2")
	{
		if(document.getElementById('TxtCoyPostJobDateYear').value == 'Year')
		{
			document.getElementById('TxtCoyPostJobDateYear').value = '';
		}
		document.getElementById('point2').className='point1';
		document.getElementById('point1').className='point2-out';
	}
	
	if(type=="out2")
	{
		if(document.getElementById('TxtCoyPostJobDateYear').value == '')
		{
			document.getElementById('TxtCoyPostJobDateYear').value = 'Year';
		}
	}
}

// Ajax Intialization Here
function createRequestObject() {
    var tmpXmlHttpObject;
    
    //depending on what the browser supports, use the right way to create the XMLHttpRequest object
    if (window.XMLHttpRequest) { 
        // Mozilla, Safari would use this method ...
        tmpXmlHttpObject = new XMLHttpRequest();
	
    } else if (window.ActiveXObject) { 
        // IE would use this method ...
        tmpXmlHttpObject = new ActiveXObject("Microsoft.XMLHTTP");
    }
    
    return tmpXmlHttpObject;
}

//call the above function to create the XMLHttpRequest object
var http = createRequestObject();

function calendar(dte,mth,yr,type)
{
	var urlheader = "getCalendar.aspx?q=" + dte + "&" + "v=" + mth + "&" + "x=" + yr + "&" + "type=" + type;
	setTimeout("getCalendar('"+urlheader+"')", 500);
	clearTimeout();
}

function getCalendar(wordId)
{
	//make a connection to the server ... specifying that you intend to make a GET request 
    //to the server. Specifiy the page name and the URL parameters to send
    http.open('get', wordId);
	
    //assign a handler for the response
    http.onreadystatechange = processCalendar;
	
    //actually send the request to the server
    http.send(null);	
}

function processCalendar() {
    //check if the response has been received from the server
    if(http.readyState == 4){
	
        //read and assign the response from the server
        var response = http.responseText;
        //do additional parsing of the response, if needed
		
        //in this case simply assign the response to the contents of the <div> on the page. 
        document.getElementById('contentind').innerHTML = response;
		
		
        //If the server returned an error message like a 404 error, that message would be shown within the div tag!!. 
        //So it may be worth doing some basic error before setting the contents of the <div>
    }
}

//This would usally go in the section of your code
function CheckSearchSubmit(e)
{
e=e?e:window.event;
if(e.keyCode==13)
searchjobsimple(document.getElementById('TxtSearchJobTitle').value,document.getElementById('chkSearchJobTemp').checked,document.getElementById('chkSearchJobContract').checked,document.getElementById('chkSearchJobPermanent').checked,document.getElementById('chkSearchJobParttime').checked,document.getElementById('chkSearchNonExecutive').checked,document.getElementById('chkSearchExecutive').checked,document.getElementById('chkSearchSeniorExecutive').checked,document.getElementById('chkSearchManager').checked,document.getElementById('chkSearchEntryLevel').checked);
}

function searchjobsimple(title,jobtemp, jobcontract, jobperm, jobnonexec, jobexec, jobseniorexec, jobmanager, jobentrylevel)
{
	var type = "simple";
	var urlheader = "getSearchJob.aspx?type=" + type + "&" + "title=" + title + "&" + "jt=" + jobtemp + "&" + "jc=" + jobcontract + "&" + "jp=" + jobperm + "&" + "jne=" + jobnonexec + "&" + "je=" + jobexec + "&" + "jse=" + jobseniorexec + "&" + "jm=" + jobmanager + "&" + "jel=" + jobentrylevel;
	
	document.getElementById('searchword').innerHTML = title;
	document.getElementById('searchresultbox').style.display = "block";
	document.getElementById('searchupdatecontent').innerHTML = document.getElementById('searchloadinggif').innerHTML
	setTimeout("getSearchJob('"+urlheader+"')", 500);
	clearTimeout();
}

function getSearchJob(wordId)
{
	//make a connection to the server ... specifying that you intend to make a GET request 
    //to the server. Specifiy the page name and the URL parameters to send
    http.open('get', wordId);
	
    //assign a handler for the response
    http.onreadystatechange = processSearchJob;
	
    //actually send the request to the server
    http.send(null);	
}

function processSearchJob() {
    //check if the response has been received from the server
    if(http.readyState == 4){
	
        //read and assign the response from the server
        var response = http.responseText;
        //do additional parsing of the response, if needed
		
        //in this case simply assign the response to the contents of the <div> on the page. 
        document.getElementById('searchupdatecontent').innerHTML = response;
        //If the server returned an error message like a 404 error, that message would be shown within the div tag!!. 
        //So it may be worth doing some basic error before setting the contents of the <div>
    }
}

function applyjob(username,jobid)
{
	if(username=="")
	{
		alert("You need to login");
	}
	else
	{
		var urlheader = "getApplyJob.aspx?us=" + username + "&" + "jb=" + jobid;
		setTimeout("getApplyJob('"+urlheader+"')", 500);
		clearTimeout();	
	}
}

function getApplyJob(wordId)
{
	//make a connection to the server ... specifying that you intend to make a GET request 
    //to the server. Specifiy the page name and the URL parameters to send
    http.open('get', wordId);
	
    //assign a handler for the response
    http.onreadystatechange = processApplyJob;
	
    //actually send the request to the server
    http.send(null);	
}

function processApplyJob() {
   //check if the response has been received from the server
    if(http.readyState == 4){
	
        //read and assign the response from the server
        var response = http.responseText;
        //do additional parsing of the response, if needed
		
        //in this case simply assign the response to the contents of the <div> on the page. 
        //document.getElementById('searchupdatecontent').innerHTML = response;
		
        //If the server returned an error message like a 404 error, that message would be shown within the div tag!!. 
        //So it may be worth doing some basic error before setting the contents of the <div>
    }
}