// JavaScript Document
function funcOpenInNewWindow1(url,company)
{
	var newWindowPage = "AdWindow.aspx?url="+url+"&company="+company
	window.open(newWindowPage,'mywindow');
}
function funcOpenInNewWindow(url,company)
{
	var newWindowPage = "AdWindow.aspx?url="+url+"&company="+company
	//window.open(newWindowPage,'mywindow','width=600,height=470,toolbar=yes,location=no,directories=no,status=yes,menubar=no,scrollbars=no,copyhistory=yes,resizable=no')
	window.open(newWindowPage,'mywindow');
}
function funcOpenEmailAFriend(jobid)
{
	//Added by JC 06/09/07: This function is called from the JobDetails user control, to open the emailafriend.aspx popup page.
	//It requires the JobID that is to be emailed to the friend to be passed into the popup page.
	
	var newWindowPage = "emailafriend.aspx?jobid="+ jobid
	window.open(newWindowPage,"myWindowEmailAFriend","width=368,height=530,toolbars=0,status=0,scrollbars=1,resizable=0");
}
function funcClose()
{
	//Added by JC 11/09/07: This is called by the EmailAFriendConfirmation.aspx control to close the popup window.
	window.close();
}
function func_submit()
{
	 var iSector = document.forms[0]._ctl0_cboSector.value;
	 var iSalary = document.forms[0]._ctl0_cboSalary.value;
	 var iLocation = document.forms[0]._ctl0_cboLocation.value;
	 if(iSector == "" && iSalary == "" && iLocation == "")
	 {
		alert("Please select Sector, Salary or Location to search");
	 }
	 else
	 {
		window.location = "Home.aspx?p=SearchResult&sec="+iSector+"&sal="+iSalary+"&loc="+iLocation;
	}
}
function funcSearch()
{
	var iIndustry = document.forms[0]._ctl0_cboIndustry.value;
	 if(iIndustry == "")
	 {
		alert("Please select Industry");
	 }
	 else
	 {
		window.location = "Home.aspx?p=SearchResult&sec="+iIndustry;
	}
}		

//Function added by JC 24/10/07: This is called to allow the correct button click event to be fired when 
//the return key is pressed after a textbox has had data added.
//It gets call in the SearchControl UC to allow the keywords textbox to work, and it is called in the
//JobDetails UC to allow the Transport Direct textbox to work.
function clickCorrectButton(e, buttonid){ 

      var evt = e ? e : window.event;

      var bt = document.getElementById(buttonid);

      if (bt){ 
		  //If the return key has been clicked.
          if (evt.keyCode == 13){ 
                bt.click(); 
                return false; 
          } 
      } 
}