﻿
var remember=0;var ajax_flag=0;var cArray=Array('00501','45733','55566','22583','77367','62489','55884','44693','48802','14733','19963','24631','77419','88304','56561','55227','48481','32237','88848','33672');function windowHeight()
{var height=0
if(typeof window.innerHeight!=='undefined')
{height=window.innerHeight}
else if(typeof document.documentElement!=='undefined'&&typeof document.documentElement.clientHeight!=='undefined'&&document.documentElement.clientHeight!==0)
{height=document.documentElement.clientHeight}
else
{height=document.getElementsByTagName('body')[0].clientHeight}
return height}
function scrollPositionCheck()
{var position=0
if(typeof window.pageYoffset!=='undefined')
{position=window.pageYoffset}
else if(typeof document.documentElement.scrollTop!=='undefined'&&document.documentElement.scrollTop>0)
{position=document.documentElement.scrollTop}
else if(typeof document.body.scrollTop!=='undefined')
{position=document.body.scrollTop}
return position}
function heightAdjust()
{var height=windowHeight()
var containerHeight=document.getElementById('container').offsetHeight
var paddingHeight=document.getElementById('padding').offsetHeight
containerHeight-=paddingHeight
var padding=document.getElementById('padding').style
if(height>containerHeight)
{padding.display='block'
padding.height=(height-containerHeight)+'px'}
else
{document.getElementById('padding').style.display='none'}}
function loadPage(http_request,holdingDiv)
{if(http_request.readyState==4&&http_request.status==200)
{if(holdingDiv=='control-panel-edit')
{ajax_flag=0
controlPanel()}
else
{document.getElementById(holdingDiv).innerHTML=http_request.responseText
if(holdingDiv=='logged_in')
{ajax_flag=0
var hash=document.getElementById('logged_in').value
hash=='error'?loginProcess('false',hash):loginProcess('true',hash)}
if(holdingDiv=='newsletter-table-hidden'||holdingDiv=='contact-table-hidden'||holdingDiv=='refer-table-hidden')
{ajax_flag=0}
if(holdingDiv=='control-panel-throbber')
{ajax_flag=0}
if(holdingDiv=='sign-up-check')
{ajax_flag=0
var hash=document.getElementById('sign-up-check').value
if(hash=='error')
{toggle('sign-up-form','sign-up-form-hidden')
alert('Sorry, the account you have requested already exists. Please try a different password')}
else
{loginProcess('true',hash)
document.getElementById('sign-up-form-hidden').innerHTML='<p style="color: #fdbc18; font-size: 22px; line-height: 30px; font-weight: bold; text-align: center; padding: 135px 30px 40px 30px; background: #fff">Your account has been successfully set up<br />Please continue to Step 2</p>'}}
if(holdingDiv=='submit-job')
{ajax_flag=0
var jobID=document.getElementById('submit-job').value
if(jobID=='error')
{document.getElementById('sign-up-form-main-hidden').innerHTML='<p style="color: #fdbc18; font-size: 20px; line-height: 27px; font-weight: bold; text-align: center; padding: 300px 30px 40px 30px; background: #fff"><span style="font-size: 70px; line-height: 90px">Error!</span><br />Your account status does not allow you to post jobs</p>'}
else
{location.href="job-details.php?q="+jobID}}
if(holdingDiv=='submit-band')
{ajax_flag=0
if(document.getElementById('submit-band').value=='error')
{document.getElementById('sign-up-form-main-hidden').innerHTML='<p style="color: #fdbc18; font-size: 16px; line-height: 27px; font-weight: bold; text-align: center; padding: 300px 30px 40px 30px; background: #fff"><span style="font-size: 70px; line-height: 90px">Error!</span><br />Either this account has already been set up or your account status does not allow you to advertise yourself as a band</p>'}
else
{toggle('sign-up-form-main','sign-up-form-main-hidden')
uploadPanel()}}
if(holdingDiv=='submit-jobseeker')
{ajax_flag=0
var jobseekerID=document.getElementById('submit-jobseeker').value
if(jobseekerID=='error')
{document.getElementById('sign-up-form-main-hidden').innerHTML='<p style="color: #fdbc18; font-size: 16px; line-height: 27px; font-weight: bold; text-align: center; padding: 50px 30px 20px 30px; background: #fff"><span style="font-size: 70px; line-height: 90px">Error!</span><br />Either this account has already been set up or your account status does not allow you to advertise yourself as a jobseeker</p>'}
else
{location.href="jobseeker-details.php?q="+jobseekerID}}}}}
function XHR(method)
{http_request=false
if(window.XMLHttpRequest)
{http_request=new XMLHttpRequest()
if(method=='post')
{if(http_request.overrideMimeType)
{http_request.overrideMimeType('text/html')}}}
else if(window.ActiveXObject)
{try
{http_request=new ActiveXObject('Msxml2.XMLHTTP')}
catch(e)
{try
{http_request=new ActiveXObject('Microsoft.XMLHTTP')}
catch(e){}}}
else
{return false}}
function ajaxGet(url,holdingDiv)
{XHR('get')
http_request.onreadystatechange=function(){loadPage(http_request,holdingDiv);}
http_request.open('GET',url,true)
http_request.send(null)}
function lightBox(div)
{var height=document.getElementById('container').offsetHeight
var mask=document.getElementById('mask').style
mask.display='block'
mask.height=height+'px'
document.getElementById('iframe-mask').style.height=height+'px'
if(div!=='null')
{var window_height=windowHeight()
var scroll_position=scrollPositionCheck()
var y=(window_height-390)/2+scroll_position
var lightBoxPanel=document.getElementById('light-box-panel').style
lightBoxPanel.marginTop=y+'px'
lightBoxPanel.display='block'
var panel=document.getElementById(div).style
panel.height=390+'px'
panel.width=390+'px'
panel.display='block'
panel.marginTop=y+'px'
panel.left=248+'px'
panel.zIndex=101}}
function lightBoxClose(div)
{document.getElementById('mask').style.display='none'
document.getElementById(div).style.display='none'
document.getElementById('light-box-panel').style.display='none'}
function showPanel(status)
{var signupTop=document.getElementById('sign-up-top').style
var signupMain=document.getElementById('sign-up-main').style
var signupLinks=document.getElementById('sign-up-links').style
if(status=='over')
{signupTop.display='none'
signupMain.display='block'
signupLinks.display='block'}
else
{signupTop.display='block'
signupMain.display='none'
signupLinks.display='none'}}
function newsLetter()
{lightBox('newsletter-panel')}
function newsLetterClose()
{lightBoxClose('newsletter-panel')}
function newsletterSignup()
{if(ajax_flag===0)
{var newsletter_name=document.getElementById('newsletter-name').value
if(newsletter_name.length<2)
{alert('Please enter you name')
return false}
var newsletter_country=document.getElementById('newsletter-country').value
if(newsletter_country.length<2)
{alert('Please enter you country')
return false}
var newsletter_email=document.getElementById('newsletter-email').value
if(emailCheck(newsletter_email)=='false')
{alert('Please enter a valid email address')
return false}
var newsletter_name_array=newsletter_name.split("|")
if(newsletter_name_array.length!==0)
{newsletter_name=''
for(var i=0;i<newsletter_name_array.length;i++)
{newsletter_name+=newsletter_name_array[i]}}
var newsletter_name_array=newsletter_name.split("***")
if(newsletter_name_array.length!==0)
{newsletter_name=''
for(var i=0;i<newsletter_name_array.length;i++)
{newsletter_name+=newsletter_name_array[i]}}
var q=escape(newsletter_name)+'***'+escape(newsletter_country)+'***'+escape(newsletter_email)
toggle('newsletter-table-hidden','newsletter-table')
ajax_flag=1
ajaxGet('tiger-sense.php?q='+q+'&action=newsletter&rand='+Math.random()*999,'newsletter-table-hidden')}}
function xpressPanel(id)
{lightBox('xpress-panel')
var flashStr='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="322" height="278" id="upload">'
flashStr+='<param name="movie" value="upload.swf" />'
flashStr+='<param name="menu" value="false" />'
flashStr+='<param name="flashvars" value="cv_id='+id+'" />'
flashStr+='<embed src="upload.swf" flashvars="cv_id='+id+'" menu="false" width="322" height="278" name="upload" type="application/x-shockwave-flash" />'
flashStr+='</object>'
document.getElementById('flash-upload').innerHTML=flashStr}
function xpressPanelClose()
{lightBoxClose('xpress-panel')}
function loginStart()
{if(document.getElementById('logged_in').value!='true'&&ajax_flag===0)
{var login_email=document.getElementById('login-email').value
login_email=login_email.toLowerCase()
var login_email_length=login_email.length
login_email_length--
while(login_email_length>0)
{if(name.charAt(login_email_length)==' ')
{login_email=login_email.substring(0,login_email_length)}
login_email_length--}
var login_password=document.getElementById('login-password').value
if(login_email==''||login_password=='')
{alert('Please enter your username and password')
return false}
else
{var hash=escape(login_email)+escape(login_password)
hash=sha1Hash(hash)
loginGet(hash)}}
return false}
function loginGet(hash)
{document.getElementById('login-throbber').style.display='block'
ajax_flag=1
ajaxGet('tiger-sense.php?q='+hash+'&action=login&rand='+Math.random()*999,'logged_in')}
function loginProcess(status,hash)
{document.getElementById('login-throbber').style.display='none'
document.getElementById('login-email').value=''
document.getElementById('login-password').value=''
if(status=='true')
{document.getElementById('logged_in').value='true'
var hash_values=hash.split(",")
hash=hash_values[0]
var cv_id="'"+hash.substr(0,8)+hash_values[1]+"'"
document.getElementById('xpress-icon').innerHTML='<img width="147" height="28" alt="" src="graphics/cv-icon.gif" onclick="xpressPanel('+cv_id+')" />'
document.getElementById('welcome').innerHTML='Welcome back  | <a href="javascript: controlPanel()">my control panel</a>'
if(remember==1)
{setCookie('THS',hash,exp)}}
else
{alert("sorry, your login details are incorrect. If you can't remember your password, please contact us")}}
function rememberButton()
{if(document.getElementById('logged_in').value!='true'&&ajax_flag===0)
{remember===0?remember=1:remember=0
var remember_tick=document.getElementById('remember-active').style
remember===0?remember_tick.visibility='hidden':remember_tick.visibility='visible'}}
function welcome()
{if(document.getElementById('logged_in').value!='true'&&ajax_flag===0)
{var hash=readCookie('THS')
if(hash!==null)
{loginGet(hash)}}}
function readCookie(name)
{var nameEQ=name+"="
var ca=document.cookie.split(';')
for(var i=0;i<ca.length;i++)
{var c=ca[i]
while(c.charAt(0)==' ')
{c=c.substring(1,c.length)}
if(c.indexOf(nameEQ)===0)
{return c.substring(nameEQ.length,c.length)}}
return null}
var exp=new Date()
exp.setTime(exp.getTime()+(1000*60*60*24*365))
function setCookie(name,value,expires)
{document.cookie=name+"="+escape(value)+"; path=/"+((expires===null)?"":"; expires="+expires.toGMTString())}
function sha1Hash(msg)
{var K=[0x5a827999,0x6ed9eba1,0x8f1bbcdc,0xca62c1d6]
msg+=String.fromCharCode(0x80)
var l=Math.ceil(msg.length/4)+2
var N=Math.ceil(l/16)
var M=new Array(N)
for(var i=0;i<N;i++)
{M[i]=new Array(16)
for(var j=0;j<16;j++)
{M[i][j]=(msg.charCodeAt(i*64+j*4)<<24)|(msg.charCodeAt(i*64+j*4+1)<<16)|(msg.charCodeAt(i*64+j*4+2)<<8)|(msg.charCodeAt(i*64+j*4+3))}}
M[N-1][14]=((msg.length-1)*8)/Math.pow(2,32);M[N-1][14]=Math.floor(M[N-1][14])
M[N-1][15]=((msg.length-1)*8)&0xffffffff
var H0=0x67452301
var H1=0xefcdab89
var H2=0x98badcfe
var H3=0x10325476
var H4=0xc3d2e1f0
var W=new Array(80);var a,b,c,d,e
for(var i=0;i<N;i++)
{for(var t=0;t<16;t++)W[t]=M[i][t]
for(var t=16;t<80;t++)W[t]=ROTL(W[t-3]^W[t-8]^W[t-14]^W[t-16],1)
a=H0;b=H1;c=H2;d=H3;e=H4
for(var t=0;t<80;t++)
{var s=Math.floor(t/20)
var T=(ROTL(a,5)+f(s,b,c,d)+e+K[s]+W[t])&0xffffffff
e=d
d=c
c=ROTL(b,30)
b=a
a=T}
H0=(H0+a)&0xffffffff
H1=(H1+b)&0xffffffff
H2=(H2+c)&0xffffffff
H3=(H3+d)&0xffffffff
H4=(H4+e)&0xffffffff}
return H0.toHexStr()+H1.toHexStr()+H2.toHexStr()+H3.toHexStr()+H4.toHexStr()}
function f(s,x,y,z)
{switch(s)
{case 0:return(x&y)^(~x&z)
case 1:return x^y^z
case 2:return(x&y)^(x&z)^(y&z)
case 3:return x^y^z}}
function ROTL(x,n)
{return(x<<n)|(x>>>(32-n))}
Number.prototype.toHexStr=function()
{var s="",v
for(var i=7;i>=0;i--)
{v=(this>>>(i*4))&0xf;s+=v.toString(16)}
return s}
function controlPanel()
{if(ajax_flag===0)
{lightBox('null')
document.getElementById('control-panel-close').style.display='block'
document.getElementById('control-panel').style.display='block'
document.getElementById('control-panel-throbber').innerHTML=''
ajax_flag=1
ajaxGet('tiger-sense.php?action=control-panel&rand='+Math.random()*999,'control-panel-throbber')}}
function controlPanelEdit()
{if(ajax_flag===0)
{var cp_tel=document.getElementById('cp-tel').value
var cp_mobile=document.getElementById('cp-mobile').value
document.getElementById('control-panel-throbber').innerHTML=''
var URL='tiger-sense.php?tel='+escape(cp_tel)
URL+='&mobile='+escape(cp_mobile)
URL+='&action=control-panel-edit'
URL+='&rand='+Math.random()*999
ajax_flag=1
ajaxGet(URL,'control-panel-edit')}}
function controlPanelClose()
{control_panel_flag=0;document.getElementById('control-panel-close').style.display='none'
document.getElementById('control-panel-throbber').innerHTML=''
lightBoxClose('control-panel')}
function toggle(divOn,divOff)
{document.getElementById(divOn).style.display='block'
document.getElementById(divOff).style.display='none'}
function emailCheck(email)
{var success='true'
var email=email.toLowerCase()
var emailLength=email.length
var validationStr="0123456789abcdefghijklmnopqrstuvwxyz-_@."
var validationStrLength=validationStr.length
var validCharacterCheck=0
for(var i=0;i<emailLength;i++)
{for(var j=0;j<validationStrLength;j++)
{if(email.charAt(i)==validationStr.charAt(j))
{validCharacterCheck++}}}
if(validCharacterCheck!=emailLength)
{success='false'}
var email_check=email.indexOf('@')
var at_check=email.lastIndexOf('@')
if(email_check==-1||email_check!=at_check)
{success='false'}
else
{email_check=email.split("@")
if(email_check[1].length<5)
{success='false'}
if(email_check[0].length<2)
{success='false'}}
if(email.indexOf('.')==-1)
{success='false'}
return success}