//Manage links between Jobsearch and Jobs Apps
String.prototype.trim = function(){return this.replace(/^\s+|\s+$/, ''); };
String.prototype.endsWith = function(match){return ((this.substring(this.length - match.length) == match) ? true : false);}
String.prototype.startsWith = function(match){return ((this.substring(0, match.length) == match) ? true : false);}
var jobsURL = readCookie('jobs_url');
var jobsearchURL = readCookie('jobsearch_url');
var xmlHttpReq = false;
var response = '';
var self = this;
var initPathName = document.location.pathname;
var pathName = '';
if (initPathName == '/') {
if (document.location.hostname.indexOf('jobsearch.statesman') > -1)
pathName = '/hp/statesman/jobsearchtc/';
else if (document.location.hostname.indexOf('jobsearch.coxohio') > -1)
pathName = '/hp/jobmarket/jobsearchtc/';
else
pathName = '/hp/ajc/jobsearchtc/';
} else {
var paths = initPathName.split('/');
for (var i=0; i < paths.length - 1; i++) {
pathName = pathName + paths[i] + '/';
}
}
//alert('URL Path:' + pathName);
if (pathName.indexOf('/jobsearchtc/') > -1) {
var strURL = 'http://' + document.location.host + pathName + 'forward.do?fpage=dhelper';
// Mozilla/Safari
if (window.XMLHttpRequest) {
self.xmlHttpReq = new XMLHttpRequest();
//alert('Mozilla');
}
// IE
else if (window.ActiveXObject) {
self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
//alert('IE');
}
self.xmlHttpReq.open('POST', strURL, false);
self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
self.xmlHttpReq.send(getquerystring());
if (self.xmlHttpReq.status == 200) {
response = self.xmlHttpReq.responseText;
jobsURL = response.split(",")[0];
jobsearchURL = response.split(",")[1];
createCookie('jobsearch_url',jobsearchURL.trim(),0);
createCookie('jobs_url',jobsURL.trim(),0);
//alert('cookie set');
}
}
function getquerystring() {}
//provides link back to results page
if (document.location.href.indexOf('results.do')>-1)
createCookie('curr_jobsearch_request',document.location.href,0);
//provides link back to details page
if (document.location.href.indexOf('detail.do')>-1)
createCookie('curr_jobsearch_record',document.location.href,0);
//returns to the latest results page
function goToCurrJobsearchRequest() {
var searchURL = readCookie('curr_jobsearch_request');
if (searchURL != null)
document.location = searchURL;
}
//returns the app domain used for cookies
function getAppDomain() {
var sDomain = document.domain;
var sParts = sDomain.split('.');
if (sParts.length > 2) {
sDomain = sParts[sParts.length -2] + '.' + sParts[sParts.length-1];
}
//alert('domain = ' + sDomain);
return sDomain;
}
//returns the base URL to the Jobs App
function getJobsURL() {
return jobsURL;
}
//returns the base URL to the Jobsearch App
function getJobsearchURL() {
return jobsearchURL;
}
//returns the full URL to the Jobsearch App
function getJobsearchPath(siteName) {
var strURL = getJobsearchURL() + 'hp/' + siteName + '/jobsearchtc/';
return strURL;
}
//goto the Jobsearch App
function gotoJobsearchSite(siteName) {
var siteFilter = 'Nr=P_SiteId:';
if (siteName == 'ajc')
siteFilter = siteFilter + 'AJC';
else if (siteName == 'statesman')
siteFilter = siteFilter + 'AUSTIN';
else if (siteName == 'jobmarket')
siteFilter = siteFilter + 'DAYTON';
document.location = getJobsearchURL() + 'hp/' + siteName + '/jobsearchtc/home.do?' + siteFilter;
}
//displays the EU Nav box
function getEUNavBox() {
var bLoggedIn = getLoggedIn('EU');
if (bLoggedIn == 'NO') {
document.write('Sign up|');
document.write('Login|');
document.write('Post Jobs|');
document.write('Search Resumes');
}
else {
document.write('Logout|');
document.write('Post Jobs|');
document.write('Search Resumes');
}
}
//Displays the JS remember area
function getRememberMe() {
var username = getJSUserName();
var display = "";
if (username!= -1 )
display = '
Welcome ' + username + '!
';
else
display = 'Welcome
';
document.write(display);
var bLoggedIn = getLoggedIn('JS');
if (bLoggedIn == 'YES')
document.write('My Profile | Logout
');
else
document.write('Login | Register
');
}
//Displays JS Nav Box
function getJSNavBox() {
var bLoggedIn = getLoggedIn('JS');
if (bLoggedIn == 'YES')
document.write('My ajcjobs');
else
document.write('My ajcjobs');
}
//Jobs App user navigation links
function fnHome(siteURL)
{
eraseCookie('coxnetJOBSE','',-1);
document.location = siteURL + 'home.do';
}
function fnJSSignUp()
{
document.location = getJobsURL() + '/JOBSWeb/jobseeker/profile.do?actionFlag=-1';
}
function fnJSLogin()
{
document.location = getJobsURL() + 'JOBSWeb/jobseeker/login.do';
}
function fnMyAjcJobs()
{
document.location = getJobsURL() + '/JOBSWeb/jobseeker/login.do?actionFlag=home'
}
function fnLogOut()
{
document.location = getJobsURL() + '/JOBSWeb/common/index.do?actionFlag=logout';
}
function fnJobSearch()
{
document.location = getJobsURL() + '/JOBSWeb/jobseeker/jobSearch.do?actionFlag=newSearchFromJobSeekerHome';
}
function fnSearchNow()
{
document.location = getJobsURL() + '/JOBSWeb/jobseeker/jobSearchResultFromHome.do?actionFlag=searchJObsFromHome';
}
function fnEmployerLogin()
{
document.location = getJobsURL() + 'JOBSWeb/employer/employerLogin.do';
}
function fnSpecialEmployerLogin()
{
document.location = getJobsURL() + 'JOBSWeb/employer/employerLogin.do?actionFlag=SpecialEmployerName';
}
function fnPostAJob()
{
if (getLoggedIn('EU') == 'YES')
formSubmit('/employer/createOnlineJob','createOnlineJob');
else
formSubmit('/employer/Registration','createOnlineJob');
}
function fnPostCombo() {
if (getLoggedIn('EU') == 'YES')
formSubmit('/employer/printPackage','createCombo');
else
formSubmit('/employer/Registration','createCombo');
}
function fnPostPrint() {
if (getLoggedIn('EU') == 'YES')
formSubmit('/employer/printPackage','createPrintOnly');
else
formSubmit('/employer/Registration','createPrintOnly');
}
function fnPostAJobRegister(){
document.location = getJobsURL() + 'JOBSWeb/employer/Registration.do';
}
function fnPurchasePajPack()
{
document.location = getJobsURL() + 'JOBSWeb/employer/PurchasePajPackAction.do';
}
function resumeSearch() {
document.location = getJobsURL() + 'JOBSWeb/employer/editSearchAgent.do?navScreenResumeSearch=showResumeSearch';
}
function openEmployerWebsite(sURL) {
if (!sURL.startsWith('http')) {
sURL = 'http://' + sURL;
}
window.open(sURL,'euweb','height=500,width=780,top=50,left=7,screenX=7,screenY=50,resizable,scrollbars,menubar');
}
//Support for quick search boxes
function checkKey(event)
{
if(document.layers)
{
if(event.which==13)
{
fnSearchNow()
}
}
else if(parseInt(navigator.appVersion)>=5)
{
if(event.keyCode==13)
{
fnSearchNow()
}
}
else
{
if(event.keyCode==13)
{
fnSearchNow()
}
}
}
function searchJobs(siteName, keyword) {
if (keyword == '') {
alert('Please enter a search keyword');
} else {
strURL = getJobsearchPath(siteName) + 'results.do?keyword=' + keyword;
document.location = strURL;
}
}
//Support links for For Employer boxes
function fnForEmployer()
{
if (getLoggedIn('EU') == 'YES')
document.location = getJobsURL() + 'JOBSWeb/employer/ForEmployersAction.do';
else
document.location = getJobsURL() + 'JOBSWeb/employer/employerLogin.do?actionFlag=login';
}
//Support links for Employer users
function fnEmployerLogOff()
{
document.location = getJobsURL() + '/JOBSWeb/common/index.do?actionFlag=logout';
}
function fnJSSpecialEmpHome(employer)
{
if(employer=='CEFGA')
document.location = getJobsURL() + 'JOBSWeb/jobseeker/specialemphome.do?actionFlag=index';
}
//Production Navigation
function fnPurchasePajPack()
{
document.location =getJobsURL() + 'JOBSWeb/employer/PurchasePajPackAction.do';
}
function fnPurchasePajPackAndResumeDB()
{
document.location = getJobsURL() + 'JOBSWeb/employer/PurchasePajPackAndResumeDBComboAction.do';
}
function fnPurchaseResumeDB()
{
document.location = getJobsURL() + 'JOBSWeb/employer/PurchaseResumeDBAction.do';
}
function searchAgentList(){
document.location = getJobsURL() + 'JOBSWeb/employer/searchAgent.do?actionFlag=showList';
}
function showProfiles(){
document.location = getJobsURL() + 'JOBSWeb/employer/EmployerProfileAction.do';
}
function showJobListings(){
document.location = getJobsURL() + 'JOBSWeb/employer/JobListingManagement.do?actionFlag=activeOnlineJobs';
}
function reports(){
document.location = getJobsURL() + 'JOBSWeb/employer/ReportsAction.do';
}
function formSubmit(actionToInvoke,actionFlag)
{
document.location = getJobsURL() + 'JOBSWeb' + actionToInvoke + '.do?actionFlag=' + actionFlag;
}
//Supports Jobs App reporting on Jobsearch App
function updateJobReports(sSite, sType, IDs) {
var strURL = getJobsURL() + 'JOBSWeb/jobseeker/EndecaAction.do?sAction=REPTG&sJobId=' + IDs + '&sSiteId=' + sSite + '&sType=' + sType;
document.write ('');
}
//Cookie Helpers
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
//alert('document.domain = ' + document.domain);
if (document.domain.split('.').length > 1) {
document.cookie = name+"="+value+expires+"; path=/; domain="+getAppDomain();
//alert('set cookie domain = ' + getAppDomain());
} else {
document.cookie = name+"="+value+expires+"; path=/";
//alert('no cookie domain set');
}
}
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
//alert('c = ' + c);
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
function eraseCookie(name) {
createCookie(name,"",-1);
}
function gotoFEIndex(siteName) {
strURL = getJobsearchPath(siteName) + 'feIndex.do';
document.location = strURL;
}
//Supports displaying images in FE Box
function getFEIconImage(siteName,imageName) {
//document.write('http://jobnews.ajcjobs.com/custom/nospider/impl/images/jobs/ads/fe_cocaCola.gif');
}
//Returns a parameter in a request query str
function getParameter(parmName) {
var queryStr = document.location.search.substring(1,document.location.search.length);
var parms = queryStr.split('&');
var parmValue = '';
for (var i=0; i < parms.length; i++) {
if (parms[i].indexOf(parmName) > -1) {
parmValue = parms[i].split('=');
return parmValue[1];
}
}
return parmValue;
}