
function trim(str,charlist){var whitespace,l=0,i=0;str+='';if(!charlist){whitespace=" \n\r\t\f\x0b\xa0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000";}else{charlist+='';whitespace=charlist.replace(/([\[\]\(\)\.\?\/\*\{\}\+\$\^\:])/g,'$1');}
l=str.length;for(i=0;i<l;i++){if(whitespace.indexOf(str.charAt(i))===-1){str=str.substring(i);break;}}
l=str.length;for(i=l-1;i>=0;i--){if(whitespace.indexOf(str.charAt(i))===-1){str=str.substring(0,i+1);break;}}
return whitespace.indexOf(str.charAt(0))===-1?str:'';}
function isValidEmail(str)
{var at="@";var dot=".";var lat=str.indexOf(at);var lstr=str.length;if(str.indexOf(at)==-1){return false;}
if(str.indexOf(at)==-1||str.indexOf(at)==0||str.indexOf(at)==lstr){return false;}
if(str.indexOf(dot)==-1||str.indexOf(dot)==0||str.indexOf(dot)==lstr){return false;}
if(str.indexOf(at,(lat+1))!=-1){return false;}
if(str.substring(lat-1,lat)==dot||str.substring(lat+1,lat+2)==dot){return false;}
if(str.indexOf(dot,(lat+2))==-1){return false;}
if(str.indexOf(" ")!=-1){return false;}
return true;}
function makeRequest(url,script_qry,element,callback)
{var http_request,posn;http_request=false;posn=url.indexOf('#');if(posn!=-1)url=url.substr(0,posn);if(script_qry)url=url+(url.indexOf('?')==-1?'?':'&')+script_qry;if(window.XMLHttpRequest)
{http_request=new XMLHttpRequest();}
else if(window.ActiveXObject)
{try{http_request=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e)
{try{http_request=new ActiveXObject("Microsoft.XMLHTTP");}
catch(e)
{}}}
if(!http_request)
{alert('Unable to make Ajax request. You may have an obsolete web browser.');return false;}
http_request.onreadystatechange=function()
{var el;el=(typeof(element)=='string')?document.getElementById(element):element;if(el&&http_request.readyState==4)
{if(http_request.status==200)
{el.innerHTML=http_request.responseText;if(typeof(callback)=='function')callback();}
else el.innerHTML='Internal error - please try again';}};http_request.open('GET',url,true);http_request.send(null);}
function clearResult(element)
{var el;el=(typeof(element)=='string')?document.getElementById(element):element;el.innerHTML='';}
function rawRequest(url,script_qry,callback)
{var http_request;http_request=false;posn=url.indexOf('#');if(posn!=-1)url=url.substr(0,posn);if(script_qry)url=url+(url.indexOf('?')==-1?'?':'&')+script_qry;if(window.XMLHttpRequest)
{http_request=new XMLHttpRequest();}
else if(window.ActiveXObject)
{try{http_request=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e)
{try{http_request=new ActiveXObject("Microsoft.XMLHTTP");}
catch(e)
{}}}
if(!http_request)
{alert('Unable to make Ajax request. You may have an obsolete web browser.');return false;}
http_request.onreadystatechange=function(){rawResult(http_request,callback);};http_request.open('GET',url,true);http_request.send(null);}
function rawResult(http_request,callback)
{if(http_request.readyState==4)
{if(http_request.status==200)callback(http_request.responseText)
else alert('Internal error - please try again');}}
function closest(el,tag,classname)
{var parentEl;tag=tag.toLowerCase();parentEl=el.parentNode;while(parentEl.tagName.toLowerCase()!=tag||(classname&&parentEl.className!=classname))
{parentEl=parentEl.parentNode;if(!parentEl||!parentEl.tagName)return null;}
return parentEl;}
function getElements(classname,tagname,root){if(!root)root=document;else if(typeof root=="string")root=document.getElementById(root);if(!tagname)tagname="*";var all=root.getElementsByTagName(tagname);if(!classname)return all;var elements=[];for(var i=0;i<all.length;i++){var element=all[i];if(isMember(element,classname))
elements.push(element);}
return elements;function isMember(element,classname){var classes=element.className;if(!classes)return false;if(classes==classname)return true;var whitespace=/\s+/;if(!whitespace.test(classes))return false;var c=classes.split(whitespace);for(var i=0;i<c.length;i++){if(c[i]==classname)return true;}
return false;}}
function radioValue(formEl,name)
{var radioButtons,i;radioButtons=formEl.elements[name];for(i=0;i<radioButtons.length;++i)if(radioButtons[i].checked)return radioButtons[i].value;return null;}
function toggle(el_id)
{var el,oldStyleDisplay;el=document.getElementById(el_id);if(el)
{if(window.getComputedStyle)oldStyleDisplay=window.getComputedStyle(el,null).display;else if(el.currentStyle)oldStyleDisplay=el.currentStyle.display;else if(el.style.display)oldStyleDisplay=el.style.display;else oldStyleDisplay='block';if(oldStyleDisplay=='none')
{if(el.originalDisplay)el.style.display=el.originalDisplay;else el.style.display='block';}
else
{el.originalDisplay=oldStyleDisplay;el.style.display='none';}}}
function scrollbarWidth()
{var overflowStyle,width;overflowStyle=document.body.style.overflow;document.body.style.overflow='hidden';width=document.body.clientWidth;document.body.style.overflow='scroll';width-=document.body.clientWidth;if(overflowStyle)document.body.style.overflow=overflowStyle;else document.body.style.overflow='';return width;}
function ultimateOffsetLeft(el)
{var offset;offset=0;if(el)
{while(el.offsetParent)
{offset+=el.offsetLeft;el=el.offsetParent;}}
return offset;}
function ultimateOffsetTop(el)
{var offset;offset=0;if(el)
{while(el.offsetTop)
{offset+=el.offsetTop;el=el.offsetParent;}}
return offset;}
var Geometry={};function geometry(){if(window.screenLeft){Geometry.getWindowX=function(){return window.screenLeft;};Geometry.getWindowY=function(){return window.screenTop;};}
else if(window.screenX){Geometry.getWindowX=function(){return window.screenX;};Geometry.getWindowY=function(){return window.screenY;};}
if(window.innerWidth){Geometry.getViewportWidth=function(){return window.innerWidth;};Geometry.getViewportHeight=function(){return window.innerHeight;};Geometry.getHorizontalScroll=function(){return window.pageXOffset;};Geometry.getVerticalScroll=function(){return window.pageYOffset;};}
else if(document.documentElement&&document.documentElement.clientWidth){Geometry.getViewportWidth=function(){return document.documentElement.clientWidth;};Geometry.getViewportHeight=function(){return document.documentElement.clientHeight;};Geometry.getHorizontalScroll=function(){return document.documentElement.scrollLeft;};Geometry.getVerticalScroll=function(){return document.documentElement.scrollTop;};}
else if(document.body.clientWidth){Geometry.getViewportWidth=function(){return document.body.clientWidth;};Geometry.getViewportHeight=function(){return document.body.clientHeight;};Geometry.getHorizontalScroll=function(){return document.body.scrollLeft;};Geometry.getVerticalScroll=function(){return document.body.scrollTop;};}
if(document.documentElement&&document.documentElement.scrollWidth){Geometry.getDocumentWidth=function(){return document.documentElement.scrollWidth;};Geometry.getDocumentHeight=function(){return document.documentElement.scrollHeight;};}
else if(document.body.scrollWidth){Geometry.getDocumentWidth=function(){return document.body.scrollWidth;};Geometry.getDocumentHeight=function(){return document.body.scrollHeight;};}}
if(window.addEventListener)
window.addEventListener("load",geometry,0);else if(window.attachEvent)
window.attachEvent("onload",geometry);function computedDimension(element,property){if(window.getComputedStyle)
{return parseInt(document.defaultView.getComputedStyle(element,null).getPropertyValue(property));}
else if(element.currentStyle)
{var IE_cascadedStyle,hyphen,tempDiv,dimension;while((hyphen=property.indexOf('-'))!=-1)
{property=property.substr(0,hyphen).concat(property.charAt(hyphen+1).toUpperCase()).concat(property.substr(hyphen+2));}
IE_cascadedStyle=element.currentStyle[property];if(IE_cascadedStyle.match(/^\d+px$/))
{return parseInt(IE_cascadedStyle);}
else if(IE_cascadedStyle.match(/\d+(%|em|ex|pt|pc|in|mm|cm)$/))
{tempDiv=document.createElement("div");tempDiv.style.width=IE_cascadedStyle;document.body.appendChild(tempDiv);dimension=tempDiv.offsetWidth;document.body.removeChild(tempDiv);return dimension;}
else
return IE_cascadedStyle;}}
function computedStyle(element,property){if(window.getComputedStyle)
return document.defaultView.getComputedStyle(element,null).getPropertyValue(property);else if(element.currentStyle)
return element.currentStyle[property];}
function date(format,timestamp){var that=this;var jsdate=((typeof(timestamp)=='undefined')?new Date():(typeof(timestamp)=='object')?new Date(timestamp):new Date(timestamp*1000));var pad=function(n,c){if((n=n+"").length<c){return new Array(++c-n.length).join("0")+n;}else{return n;}};var _dst=function(t){var dst=0;var jan1=new Date(t.getFullYear(),0,1,0,0,0,0);var june1=new Date(t.getFullYear(),6,1,0,0,0,0);var temp=jan1.toUTCString();var jan2=new Date(temp.slice(0,temp.lastIndexOf(' ')-1));temp=june1.toUTCString();var june2=new Date(temp.slice(0,temp.lastIndexOf(' ')-1));var std_time_offset=(jan1-jan2)/(1000*60*60);var daylight_time_offset=(june1-june2)/(1000*60*60);if(std_time_offset===daylight_time_offset){dst=0;}else{var hemisphere=std_time_offset-daylight_time_offset;if(hemisphere>=0){std_time_offset=daylight_time_offset;}
dst=1;}
return dst;};var ret='';var txt_weekdays=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];var txt_ordin={1:"st",2:"nd",3:"rd",21:"st",22:"nd",23:"rd",31:"st"};var txt_months=["","January","February","March","April","May","June","July","August","September","October","November","December"];var f={d:function(){return pad(f.j(),2);},D:function(){var t=f.l();return t.substr(0,3);},j:function(){return jsdate.getDate();},l:function(){return txt_weekdays[f.w()];},N:function(){return f.w()?f.w():7;},S:function(){return txt_ordin[f.j()]?txt_ordin[f.j()]:'th';},w:function(){return jsdate.getDay();},z:function(){return(jsdate-new Date(jsdate.getFullYear()+"/1/1"))/864e5>>0;},W:function(){var a=f.z(),b=364+f.L()-a;var nd2,nd=(new Date(jsdate.getFullYear()+"/1/1").getDay()||7)-1;if(b<=2&&((jsdate.getDay()||7)-1)<=2-b){return 1;}
if(a<=2&&nd>=4&&a>=(6-nd)){nd2=new Date(jsdate.getFullYear()-1+"/12/31");return that.date("W",Math.round(nd2.getTime()/1000));}
var w=(1+(nd<=3?((a+nd)/7):(a-(7-nd))/7)>>0);return(w?w:53);},F:function(){return txt_months[f.n()];},m:function(){return pad(f.n(),2);},M:function(){var t=f.F();return t.substr(0,3);},n:function(){return jsdate.getMonth()+1;},t:function(){var n;if((n=jsdate.getMonth()+1)==2){return 28+f.L();}
if(n&1&&n<8||!(n&1)&&n>7){return 31;}
return 30;},L:function(){var y=f.Y();return(!(y&3)&&(y%1e2||!(y%4e2)))?1:0;},o:function(){if(f.n()===12&&f.W()===1){return jsdate.getFullYear()+1;}
if(f.n()===1&&f.W()>=52){return jsdate.getFullYear()-1;}
return jsdate.getFullYear();},Y:function(){return jsdate.getFullYear();},y:function(){return(jsdate.getFullYear()+"").slice(2);},a:function(){return jsdate.getHours()>11?"pm":"am";},A:function(){return f.a().toUpperCase();},B:function(){var off=(jsdate.getTimezoneOffset()+60)*60;var theSeconds=(jsdate.getHours()*3600)+
(jsdate.getMinutes()*60)+
jsdate.getSeconds()+off;var beat=Math.floor(theSeconds/86.4);if(beat>1000){beat-=1000;}
if(beat<0){beat+=1000;}
if((String(beat)).length==1){beat="00"+beat;}
if((String(beat)).length==2){beat="0"+beat;}
return beat;},g:function(){return jsdate.getHours()%12||12;},G:function(){return jsdate.getHours();},h:function(){return pad(f.g(),2);},H:function(){return pad(jsdate.getHours(),2);},i:function(){return pad(jsdate.getMinutes(),2);},s:function(){return pad(jsdate.getSeconds(),2);},u:function(){return pad(jsdate.getMilliseconds()*1000,6);},e:function(){return'UTC';},I:function(){return _dst(jsdate);},O:function(){var t=pad(Math.abs(jsdate.getTimezoneOffset()/60*100),4);t=(jsdate.getTimezoneOffset()>0)?"-"+t:"+"+t;return t;},P:function(){var O=f.O();return(O.substr(0,3)+":"+O.substr(3,2));},T:function(){return'UTC';},Z:function(){return-jsdate.getTimezoneOffset()*60;},c:function(){return f.Y()+"-"+f.m()+"-"+f.d()+"T"+f.h()+":"+f.i()+":"+f.s()+f.P();},r:function(){return f.D()+', '+f.d()+' '+f.M()+' '+f.Y()+' '+f.H()+':'+f.i()+':'+f.s()+' '+f.O();},U:function(){return Math.round(jsdate.getTime()/1000);}};return format.replace(/[\\]?([a-zA-Z])/g,function(t,s){if(t!=s){ret=s;}else if(f[s]){ret=f[s]();}else{ret=s;}
return ret;});}
function todaysDate(input_id)
{document.getElementById(input_id).value=date('d/m/Y');}
function getCountryVAT()
{makeRequest("ajax_php/get-vat-reg.php","code="+document.advert_add.invoice_country.value,"vat_num");}
function adjustPrice(discipline)
{if(typeof(disciplineCount)=='undefined')disciplineCount=0;if(discipline.checked==true)disciplineCount++;else disciplineCount--;getPrice();}
function getPrice()
{var x;x=document.getElementById('invoice_price');if(x)
{var prices;if(disciplineCount==0)prices="&euro;0 / $0 / &pound;0";else if(disciplineCount==1)prices="&euro;60 / $80 / &pound;40";else if(disciplineCount>6)prices="&euro;180 / $240 / &pound;120";else prices="&euro;135 / $180 / &pound;90";if(disciplineCount==1)x.innerHTML='<strong>'+disciplineCount+'</strong> disclipline: <strong>'+prices+'</strong>';else x.innerHTML='<strong>'+disciplineCount+'</strong> discliplines: <strong>'+prices+'</strong>';}}
function changeJobCategory(key)
{makeRequest('ajax_php/get-job-type.php','job_category='+key,'job-type-container');if(document.getElementById('job-categories-dynamic'))makeRequest('ajax_php/get-job-subtypes.php','job_category='+key,'job-categories-dynamic');}
function changeJobInfoFormat(key)
{var divs,i,el;divs=document.getElementById('job-info-input').getElementsByTagName('div');for(i=0;i<divs.length;++i)divs[i].style.display='none';document.getElementById('job-info-input-'+key).style.display="block";if(key=='htm')
{el=document.getElementById('job-text-input');el.style.display='block';el.style.height='220px';}
else
{document.getElementById('job-text-input').style.display='none';}}
function selectJobCountry(response)
{if(response.match(/[a-z]{2}/))
{var select,options,i;select=document.getElementById('job_country');options=select.options;for(i=0;i<options.length;++i)
{if(options[i].value==response)options[i].selected=true;else options[i].selected=false;}
select.disabled=false;}}
function highlight3(self)
{var uls,lis,topY,bottomY,viewportBottomY,viewportHeight;uls=self.getElementsByTagName('ul');if(self.parentNode.parentNode.parentNode.tagName.toLowerCase()=='ul'&&uls.length)
{uls[0].style.marginTop='';lis=uls[0].getElementsByTagName('li');lis[0].className=lis[0].className+' hover3';topY=ultimateOffsetTop(uls[0]);bottomY=topY+uls[0].offsetHeight;viewportHeight=Geometry.getViewportHeight();viewportBottomY=Geometry.getVerticalScroll()+viewportHeight;if(bottomY>viewportBottomY)
{if(uls[0].offsetHeight>viewportHeight)
{uls[0].style.marginTop=(Geometry.getVerticalScroll()-topY-uls[0].offsetTop).toString().concat('px');}
else
{uls[0].style.marginTop=(viewportBottomY-bottomY-2).toString().concat('px');}}}
else if(self.parentNode.parentNode.parentNode.parentNode.parentNode.tagName.toLowerCase()=='ul')
{lis=self.parentNode.getElementsByTagName('li');if(lis[0].className=='hover3')lis[0].className='';else lis[0].className=lis[0].className.replace(/ hover3/,'');}}
function unhighlight3(self)
{var lis;if(self.parentNode.parentNode.parentNode.parentNode.parentNode.tagName.toLowerCase()=='ul')
{lis=self.parentNode.getElementsByTagName('li');if(lis[0].className.indexOf('hover3')==-1)lis[0].className=lis[0].className+' hover3';}}
function log_test()
{return(!window.location.href.match(/\-enquiry(\.php)?\?id=\d+/)&&!window.location.href.match(/http\:\/\/(musicalchairs\.)?(dougal|localhost|192\.168\.1\.)/));}
function assign2events()
{var selectCompany,selectCountry;selectCompany=document.getElementById('job_company');selectCountry=document.getElementById('job_country');if(selectCompany&&selectCountry&&selectCompany.tagName.toLowerCase()=='select')selectCompany.onchange=function()
{selectCountry.disabled=true;selectCountry.value='';rawRequest('ajax_php/get-company-countrycode.php','company='+this.value,selectJobCountry);}
var inputJobEnd,inputJobExpiry,expiryEdited,expiryValue;inputJobEnd=document.getElementById('job_closing_date');inputJobExpiry=document.getElementById('job_expiry_date');expiryEdited=false;if(inputJobEnd&&inputJobExpiry)
{inputJobEnd.onblur=function()
{if(!expiryEdited)inputJobExpiry.value=inputJobEnd.value;}
inputJobExpiry.onfocus=function()
{expiryValue=this.value;}
inputJobExpiry.onblur=function()
{if(this.value!=expiryValue)expiryEdited=true;}}}
function links(popupDiv)
{var as,i;function logClick(anchorTag)
{if(log_test())
{var trEl;trEl=closest(anchorTag,'tr');if(trEl)
{trId=trEl.getAttribute('id');if(trId&&trId.match(/impression[a-z]{2}\d+/))makeRequest('ajax_php/log-click.php','type='+trId.substr(10,2)+'&id='+trId.substr(12));}}
return true;}
if(popupDiv)as=popupDiv.getElementsByTagName('a');else as=document.getElementsByTagName('a');for(i=0;i<as.length;++i)
{if((as[i].hostname!=window.location.hostname&&as[i].protocol.toLowerCase().substr(0,4)=="http")||as[i].href.match(/\.(pdf|PDF)$/)||as[i].href.match(/\-pdf(\.php)?\?.+/))
{as[i].onclick=function()
{logClick(this);if(window.open(this.href))return false;else return true;};}
else if(as[i].href.match(/(job\-advert|musician\-cv)(\.php)?(\?.*)?/))
{as[i].onclick=function()
{logClick(this);if(window.open(this.href+(this.href.indexOf('?')==-1?'?':'&')+'nw=1','advert',"status=no,toolbar=no,location=no,menubar=no,directories=no,resizable=yes,scrollbars=yes,width=734"))return false;else return true;};}
else if(as[i].className.match(/delete-link/))
{as[i].onclick=function()
{var listingTr1,listingTr2;listingTr2=closest(this,'tr');listingTr1=listingTr2;do
{listingTr1=listingTr1.previousSibling;if(!listingTr1)return true;}while(listingTr1&&listingTr1.nodeType!=1);listingTr1.className+=(listingTr1.className?" ":"")+"highlighted-row";if(confirm("Are you sure you wish to delete this listing?"))
{rawRequest(this.href,'',function(responseText)
{if(responseText=='1')
{listingTr1.parentNode.removeChild(listingTr1);listingTr2.parentNode.removeChild(listingTr2);}});return false;}
else
{listingTr1.className=listingTr1.className.replace("highlighted-row","").replace("  "," ");return false;}};}
else if(as[i].className.match(/\bprint\b/))
{as[i].onclick=function()
{var drsEl;drsEl=closest(this,'div','drsElement');if(drsEl)window.open(windows[drsEl.winId].href+'&print=now');else window.print();return false;};}
else
{as[i].onclick=function()
{var divs,i,els,j,maxWidth,popupHref;logClick(this);if(popupDiv)
{divs=popupDiv.getElementsByTagName('div');for(i=0;i<divs.length;++i)
{if(divs[i].className=='drsContent')
{makeRequest(popupHref=this.href,'ajax=1',divs[i],function()
{popupDiv.id+='_';refreshFns();windows[popupDiv.winId].resizeToFit(getElements('drsContent','div',popupDiv.id)[0]);windows[popupDiv.winId].href=popupHref;});return false;}}}
if(window.location.href.match(/[?&]nw\=1/))
{window.location.href=this.href+(this.href.indexOf('?')==-1?'?':'&')+'nw=1';return false;}
else
{return true;}};}}}
function errorScroll()
{var ps,i;ps=document.getElementsByTagName('p');for(i=0;i<ps.length;++i)
{if(ps[i].className.match(/\berror\b/))
{ps[i].scrollIntoView();return;}}}
function inputCountDown()
{var textareas,inputs,i,maxlen;inputs=document.getElementsByTagName('input');for(i=0;i<inputs.length;++i)
{if(maxlen=inputs[i].getAttribute('maxlength'))
{inputs[i].onkeyup=function()
{if(counter=document.getElementById(this.getAttribute('id')+'-counter'))counter.innerHTML=this.getAttribute('maxlength')-this.value.length;};}}
textareas=document.getElementsByTagName('textarea');for(i=0;i<textareas.length;++i)
{if(maxlen=textareas[i].maxlength)
{textareas[i].onkeyup=function()
{if(counter=document.getElementById(this.getAttribute('id')+'-counter'))counter.innerHTML=this.maxlength-this.value.length;};}}}
function setFocus()
{var inputs,i;inputs=document.getElementsByTagName('input');for(i=0;i<inputs.length;++i)
{if(inputs[i].getAttribute('type')!='hidden')
{inputs[i].focus();break;}}}
function subtypeSelection()
{var fieldsets,inputs,i,j,label;fieldsets=document.getElementsByTagName('fieldset');for(i=0;i<fieldsets.length;++i)
{if(fieldsets[i].className=='add-sub-categories')
{inputs=fieldsets[i].getElementsByTagName('input');for(j=0;j<inputs.length;++j)
{inputs[j].onclick=function()
{label=this.parentNode;if(this.parentNode.tagName.toLowerCase()=='label')
{if(this.checked)label.style.color='#000000';else if(label.getAttribute('style'))label.removeAttribute('style');}
adjustPrice(this);}}}}}
function layout()
{var main,side;main=document.getElementById('main_container');side=document.getElementById('side_container');if(main&&side&&side.offsetHeight+side.offsetTop>main.offsetHeight)
{if(ieversion==null||ieversion>6)main.style.minHeight=(side.offsetHeight+side.offsetTop).toString().concat('px');else main.style.height=(side.offsetHeight+side.offsetTop).toString().concat('px');}}
function impressionLogger()
{var trs,i,trId,ids_query_string,type;if(log_test())
{ids_query_string='';trs=document.getElementsByTagName('tr');for(i=0;i<trs.length;++i)
{trId=trs[i].getAttribute('id');if(trId&&trId.substr(0,10)=='impression')
{type=trId.substr(10,2)
ids_query_string+='&ids[]='+trId.substr(12);}}
makeRequest('ajax_php/log-impression.php','type='+type+ids_query_string);}}
function showJS()
{var els,i;els=document.getElementsByTagName("*");for(i=0;i<els.length;++i)if(els[i].className.match(/\bJS\b/))els[i].className=trim(els[i].className.replace("JS","").replace("  "," "));}
function dropdownAuto(dropdownName)
{var input,select;input=document.getElementById(dropdownName+'-submit');if(input)
{select=document.getElementById(dropdownName);select.onchange=function()
{var href,separator,qmPos,hrefQueryString,queryStringRegexp;separator='?';href=select.parentNode.parentNode.getAttribute('action');if(href.substr(0,base_href.length)!=base_href)href=base_href+href;qmPos=window.location.href.indexOf('?');if(qmPos!=-1)
{queryStringRegexp=new RegExp("(\\?|\\&)"+dropdownName+"\\=[^&]*","g");hrefQueryString=window.location.href.substr(qmPos).replace(queryStringRegexp,'');if(hrefQueryString.length)
{href+='?'+hrefQueryString.substr(1);separator='&';}}
window.location.href=href+separator+dropdownName+'='+this.value;}
input.style.position='absolute';input.style.left='-5000px';input.style.width='8em';}}
function highlightAnchor()
{if(window.location.hash.length>1)
{var el;el=document.getElementById(window.location.hash.substr(1));el.className+='highlighted-row';el.scrollIntoView();window.scrollBy(0,-10);}}
function printnow()
{if(window.location.href.match(/(\?|\&)print\=now/))window.print();}
var ieversion,base_href;function loadFns()
{if(/MSIE (\d+\.\d+);/.test(navigator.userAgent))
ieversion=new Number(RegExp.$1);else
ieversion=null;base=document.getElementsByTagName('base');if(base&&base[0]&&base[0].href)base_href=base[0].href;else base_href='http://'+document.domain+'/';jNotice=document.getElementById('javascript-notice');if(jNotice)jNotice.parentNode.removeChild(jNotice);assign2events();subtypeSelection();links();inputCountDown();layout();setFocus();errorScroll();dropdownAuto('sort');dropdownAuto('month-year');impressionLogger();showJS();highlightAnchor();printnow();}
function refreshFns()
{assign2events();subtypeSelection();links();inputCountDown();layout();dropdownAuto('sort');dropdownAuto('month-year');showJS();}
if(window.addEventListener)
window.addEventListener("load",loadFns,0);else if(window.attachEvent)
window.attachEvent("onload",loadFns);function checkAddGeneric(section,dateCheck)
{function mandatory_date(n)
{x=n.parentNode.firstChild;while(x.nodeType!=1)x=x.nextSibling;if(x.innerHTML.match(/\(optional\)/))return false;else return true;}
var el,el2;el=document.getElementById(section+'_name');if(el&&trim(el.value)=="")
{alert("Please provide a "+section+" name");el.focus();return false;}
el=document.getElementById(section+'_email');if(el)
{if(trim(el.value)=="")
{alert("Please provide a "+section+" email");el.focus();return false;}
if(!isValidEmail(el.value))
{alert("Your email address is not valid");el.focus();return false;}
el2=document.getElementById(section+'_email_confirm');if(el2)
{if(el.value!=el2.value)
{alert("Email and confirm email do not match");el.focus();return false;}}}
el=document.getElementById(section+'_towncity');if(el&&trim(el.value)=="")
{alert("Please provide a "+section+" town/city");el.focus();return false;}
el=document.getElementById(section+'_country');if(el&&el.value=="")
{alert("Please select a country");el.focus();return false;}
el=document.getElementById(section+'_description');if(el&&trim(el.value)=="")
{alert("Please provide a "+section+" description");el.focus();return false;}
el=document.getElementById(section+'_start');if(el&&trim(el.value)==""&&mandatory_date(el))
{alert("Please provide a "+section+" start date");document.getElementById(section+'_start-picker-button').click();document.getElementById('datepicker').scrollIntoView();return false;}
el=document.getElementById(section+'_end');if(el&&trim(el.value)==""&&mandatory_date(el))
{alert("Please provide a "+section+" end date");document.getElementById(section+'_end-picker-button').click();document.getElementById('datepicker').scrollIntoView();return false;}
return true;}
function checkAddCourse()
{if(!checkAddGeneric('course'))return false;if(disciplineCount<1)
{alert("Please select at least one disipline");document.advert_add.elements[0].focus();return false;}
return true;}
function checkAddCompetition()
{if(!checkAddGeneric('competition'))return false;if(disciplineCount<1)
{alert("Please select at least one disipline");document.advert_add.elements[0].focus();return false;}
return true;}
function checkAddSale()
{var el;if(!checkAddGeneric('sale'))return false;el=document.getElementById('sale_subtype');if(el&&el.value=="")
{alert("Please provide an instrument family");el.focus();return false;}
el=document.getElementById('sale_currency');if(trim(el&&el.value)=="")
{alert("Please select a currency");el.focus();return false;}
el=document.getElementById('sale_value');if(el&&trim(el.value)=="")
{alert("Please provide a price");el.focus();return false;}
return true;}
function checkAddJob()
{var el,inputs,i,flag;if(!checkAddGeneric('job'))return false;el=document.getElementById('job_company');if(el&&trim(el.value)=="")
{alert("Please provide an orchestra/company name");el.focus();return false;}
flag=false;el=null;inputs=document.getElementsByTagName('input');for(i=0;i<inputs.length;++i)
{if(inputs[i].getAttribute('name')=='job_category')
{if(!el)el=inputs[i];if(inputs[i].checked)
{flag=true;break;}}}
if(!flag)
{alert("Please select a job category")
el.focus();return false;}
el=document.getElementById('job_type');if(el&&trim(el.value)=="")
{alert("Please select a job type");el.focus();return false;}
if(document.getElementById('job_info_url').checked)
{el=document.getElementById('job_website');if(el&&trim(el.value)=="")
{alert("Please provide a website link");el.focus();return false;}}
if(document.getElementById('job_info_pdf').checked)
{el=document.getElementById('job_pdf');if(el&&trim(el.value)==""&&!el.className.match(/\buploaded\b/))
{alert("Please upload a PDF file");el.focus();return false;}}
el=document.getElementById('job_subtype');if(el&&trim(el.value)=="")
{alert("Please select a job discipline");el.focus();return false;}
return true;}
function checkManagerLogin()
{var el;if(trim(el=document.getElementById('login_email').value)=="")
{alert("Please provide your email");el.focus();return false;}
el=document.getElementById('login_password');if(el&&trim(el.value)=="")
{alert("Please provide your password");el.focus();return false;}
else return true;}
function checkAddAccount()
{if(document.advert_add.subscription_name&&trim(document.advert_add.subscription_name.value)=="")
{alert("Please enter a login manager name");document.advert_add.subscription_name.focus();return false;}
if(document.advert_add.subscription_email)
{if(trim(document.advert_add.subscription_email.value)=="")
{alert("Please enter a login manager email address");document.advert_add.subscription_email.focus();return false;}
if(!isValidEmail(trim(document.advert_add.subscription_email.value)))
{alert("Please check your email address - it appears to be invalid.");document.advert_add.subscription_email.focus();return false;}
if(document.advert_add.subscription_email.value!=document.advert_add.subscription_email2.value)
{alert("Email and confirm email do not match");document.advert_add.subscription_email.focus();return false;}}
if(document.advert_add.subscription_password)
{var subscriptionPassword=document.advert_add.subscription_password.value;if(subscriptionPassword.length<6||subscriptionPassword.length>15)
{alert("Please enter a password between 6 and 15 characters long");document.advert_add.subscription_password.focus();return false;}}
return true;}
function checkAddMusician()
{var el;el=document.getElementById('musician_firstname');if(el&&trim(el.value)=="")
{alert("Please enter a firstname");el.focus();return false;}
el=document.getElementById('musician_surname');if(el&&trim(el.value)=="")
{alert("Please enter a surname");el.focus();return false;}
el=document.getElementById('musician_email');if(el)
{if(trim(el.value)=="")
{alert("Please enter an email address");el.focus();return false;}
if(el.value!=document.getElementById('musician_email_confirm').value)
{alert("Email and confirm email do not match");el.focus();return false;}}
el=document.getElementById('musician_subtype');if(el&&el.value=="")
{alert("Please select a discipline");el.focus();return false;}
el=document.getElementById('musician_country');if(el&&el.value=="")
{alert("Please select a country");el.focus();return false;}}
function checkAddInvoice()
{var el;if(trim(document.advert_add.invoice_name.value)=="")
{alert("Please provide an invoice name");document.advert_add.invoice_name.focus();return false;}
el=document.advert_add.invoice_position;if(el&&trim(el.value)=="")
{alert("Please provide an invoice position");document.advert_add.invoice_position.focus();return false;}
if(trim(document.advert_add.invoice_phone.value)=="")
{alert("Please provide an invoice phone number");document.advert_add.invoice_phone.focus();return false;}
if(trim(document.advert_add.invoice_email.value)=="")
{alert("Please provide an invoice email");document.advert_add.invoice_email.focus();return false;}
if(document.advert_add.invoice_email.value!=document.advert_add.invoice_email_confirm.value)
{alert("Invoice email and confirm email do not match");document.advert_add.invoice_email.focus();return false;}
if(!isValidEmail(document.advert_add.invoice_email.value))
{alert("Your invoice email address is not valid");document.advert_add.invoice_email.focus();return false;}
if(trim(document.advert_add.invoice_address_1.value)=="")
{alert("Please provide a first line of address");document.advert_add.invoice_address_1.focus();return false;}
if(document.advert_add.invoice_country.value=='gb'&&trim(document.advert_add.invoice_postcode.value)=="")
{alert("Please provide an invoice postcode");document.advert_add.invoice_postcode.focus();return false;}
if(trim(document.advert_add.invoice_country.value)=="")
{alert("Please provide a country");document.advert_add.invoice_country.focus();return false;}
if(trim(document.advert_add.invoice_vatnum.value)!="")
{if(!checkVATNumber(trim(document.advert_add.invoice_vatnum.value)))
{alert("Your VAT number does not appear to be valid");document.advert_add.invoice_vatnum.focus();return false;}}
return true;}