
window.onerror=function(msg,url,line){alert("ERROR: "+msg+"\n"+url+" : "+line);return false;}
$=function(ID){try{return document.getElementById(ID);}catch(ex){return undefined;}}
var Handler={};if(document.addEventListener){Handler.add=function(element,eventType,handler){element.addEventListener(eventType,handler,false);};Handler.remove=function(element,eventType,handler){element.removeEventListener(eventType,handler,false);};}
else if(document.attachEvent){Handler.add=function(element,eventType,handler){if(Handler._find(element,eventType,handler)!=-1)return;var wrappedHandler=function(e){if(!e)e=window.event;var event={_event:e,type:e.type,target:e.srcElement,currentTarget:element,relatedTarget:e.fromElement?e.fromElement:e.toElement,eventPhase:(e.srcElement==element)?2:3,clientX:e.clientX,clientY:e.clientY,screenX:e.screenX,screenY:e.screenY,altKey:e.altKey,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,charCode:e.keyCode,stopPropagation:function(){this._event.cancelBubble=true;},preventDefault:function(){this._event.returnValue=false;}}
if(Function.prototype.call)
handler.call(element,event);else{element._currentHandler=handler;element._currentHandler(event);element._currentHandler=null;}};element.attachEvent("on"+eventType,wrappedHandler);var h={element:element,eventType:eventType,handler:handler,wrappedHandler:wrappedHandler};var d=element.document||element;var w=d.parentWindow;var id=Handler._uid();if(!w._allHandlers)w._allHandlers={};w._allHandlers[id]=h;if(!element._handlers)element._handlers=[];element._handlers.push(id);if(!w._onunloadHandlerRegistered){w._onunloadHandlerRegistered=true;w.attachEvent("onunload",Handler._removeAllHandlers);}};Handler.remove=function(element,eventType,handler){var i=Handler._find(element,eventType,handler);if(i==-1)return;var d=element.document||element;var w=d.parentWindow;var handlerId=element._handlers[i];var h=w._allHandlers[handlerId];element.detachEvent("on"+eventType,h.wrappedHandler);element._handlers.splice(i,1);delete w._allHandlers[handlerId];};Handler._find=function(element,eventType,handler){var handlers=element._handlers;if(!handlers)return-1;var d=element.document||element;var w=d.parentWindow;for(var i=handlers.length-1;i>=0;i--){var handlerId=handlers[i];var h=w._allHandlers[handlerId];if(h.eventType==eventType&&h.handler==handler)
return i;}
return-1;};Handler._removeAllHandlers=function(){var w=this;for(id in w._allHandlers){var h=w._allHandlers[id];h.element.detachEvent("on"+h.eventType,h.wrappedHandler);delete w._allHandlers[id];}}
Handler._counter=0;Handler._uid=function(){return"h"+Handler._counter++;};}
AJAX={};AJAX._factories=[function(){return new XMLHttpRequest();},function(){return new ActiveXObject("Msxml2.XMLHTTP");},function(){return new ActiveXObject("Microsoft.XMLHTTP");}];AJAX._factory=null;AJAX._errorHandler=null;AJAX._request=null;AJAX._requestTimeout=null;AJAX.newRequest=function(){if(AJAX._factory!=null)return AJAX._factory();for(var i=0;i<AJAX._factories.length;i++){try{var factory=AJAX._factories[i];var request=factory();if(request!=null){AJAX._factory=factory;return request;}}catch(e){continue;}}
AJAX._factory=function(){throw new Error("XMLHttpRequest not supported");}
AJAX._factory();};AJAX.post=function(url,values,callback,errorHandler){var request=AJAX.newRequest();AJAX._errorHandler=errorHandler;request.onreadystatechange=function(){if(request.readyState==4){if(request.status==200){clearTimeout(AJAX._requestTimeout);callback(request);}else{if(errorHandler)errorHandler(request.status,request.statusText);else callback(null);}}}
request.open("POST",url);request.setRequestHeader("Content-Type","application/x-www-form-urlencoded");request.send(AJAX.encodeFormData(values));AJAX._requestTimeout=setTimeout("AJAX._timeout('408', 'Timeout')",10000);AJAX._request=request;};AJAX._timeout=function(status,statusText){AJAX._request.abort();AJAX._errorHandler(status,statusText);}
AJAX.encodeFormData=function(data){var pairs=[];var regexp=/%20/g;for(var name in data){var value=data[name].toString();var pair=encodeURIComponent(name).replace(regexp,"+")+'='+encodeURIComponent(value).replace(regexp,"+");pairs.push(pair);}
return pairs.join('&');}
AJAX._getResponse=function(request){if(request.responseText!=""){var decoded=eval("("+request.responseText+")");return decoded;}
return"";}
function BrowserDetect(){var ua=navigator.userAgent.toLowerCase();this.isGecko=(ua.indexOf('gecko')!=-1&&ua.indexOf('safari')==-1);this.isAppleWebKit=(ua.indexOf('applewebkit')!=-1);this.isKonqueror=(ua.indexOf('konqueror')!=-1);this.isSafari=(ua.indexOf('safari')!=-1);this.isOmniweb=(ua.indexOf('omniweb')!=-1);this.isOpera=(ua.indexOf('opera')!=-1);this.isIcab=(ua.indexOf('icab')!=-1);this.isAol=(ua.indexOf('aol')!=-1);this.isIE=(ua.indexOf('msie')!=-1&&!this.isOpera&&(ua.indexOf('webtv')==-1));this.isMozilla=(this.isGecko&&ua.indexOf('gecko/')+14==ua.length);this.isFirefox=(ua.indexOf('firefox/')!=-1||ua.indexOf('firebird/')!=-1);this.isNS=((this.isGecko)?(ua.indexOf('netscape')!=-1):((ua.indexOf('mozilla')!=-1)&&!this.isOpera&&!this.isSafari&&(ua.indexOf('spoofer')==-1)&&(ua.indexOf('compatible')==-1)&&(ua.indexOf('webtv')==-1)&&(ua.indexOf('hotjava')==-1)));this.isIECompatible=((ua.indexOf('msie')!=-1)&&!this.isIE);this.isNSCompatible=((ua.indexOf('mozilla')!=-1)&&!this.isNS&&!this.isMozilla);this.geckoVersion=((this.isGecko)?ua.substring((ua.lastIndexOf('gecko/')+6),(ua.lastIndexOf('gecko/')+14)):-1);this.equivalentMozilla=((this.isGecko)?parseFloat(ua.substring(ua.indexOf('rv:')+3)):-1);this.appleWebKitVersion=((this.isAppleWebKit)?parseFloat(ua.substring(ua.indexOf('applewebkit/')+12)):-1);}
var browser=new BrowserDetect();var ANGLE;if(!ANGLE)ANGLE={};else if(typeof ANGLE!="object")
throw new Error("ANGLE already exists and is not an object!!!");if(!ANGLE.EDITOR)ANGLE.EDITOR={};else if(typeof ANGLE.EDITOR!="object")
throw new Error("ANGLE.EDITOR already exists and is not an object!!!");ANGLE.EDITOR.currentSelectedRegion="";ANGLE.menuHeadingOut=false;ANGLE.menuHeadingIn=false;ANGLE.initFunctions=new Array();ANGLE.init=function(){Handler.add($("ClientLocation"),"click",ANGLE.ShowANGLEMenu);Handler.add($("ClientLocation"),"mouseover",ANGLE.LocationButtonOver);Handler.add($("ClientLocation"),"mouseout",ANGLE.LocationButtonOut);if($("Editable_Title")!=undefined){Handler.add($("Editable_Title"),"mouseover",ANGLE.Editable_Region_Hover);}
if($("Editable_Content")!=undefined){Handler.add($("Editable_Content"),"mouseover",ANGLE.Editable_Region_Hover);}
if($("Editable_SidePanel")!=undefined){Handler.add($("Editable_SidePanel"),"mouseover",ANGLE.Editable_Region_Hover);}
if($("EditButton")!=undefined){Handler.add($("EditButton"),"click",ANGLE.EDITOR.show);}
if($("Editable_Home")!=undefined){Handler.add($("Editable_Home"),"mouseover",ANGLE.Editable_Region_Hover);}
for(var i=0;i<ANGLE.initFunctions.length;i++){ANGLE.initFunctions[i]();}}
ANGLE.LocationButtonOver=function(){var buttonEl=$("ClientLocation");if(buttonEl.src.search(/UK/)!=-1){buttonEl.src="../img/Site_Location_UK_over.png"}else if(buttonEl.src.search(/US/)!=-1){buttonEl.src="../img/Site_Location_US_over.jpg";}else if(buttonEl.src.search(/UAE/)!=-1){buttonEl.src="../img/Site_Location_UAE_over.jpg";}}
ANGLE.LocationButtonOut=function(){var buttonEl=$("ClientLocation");if(buttonEl.src.search(/UK/)!=-1){buttonEl.src="../img/Site_Location_UK.png";}else if(buttonEl.src.search(/US/)!=-1){buttonEl.src="../img/Site_Location_US.jpg";}else if(buttonEl.src.search(/UAE/)!=-1){buttonEl.src="../img/Site_Location_UAE.jpg";}}
ANGLE.ShowANGLEMenu=function(){if(ANGLE.menuHeadingIn){return;}
ANGLE.menuHeadingOut=true;var menuEl=$("Location_Menu");var scrollDistance=161;var moveDistance=21;var currentTop=parseInt(menuEl.style.top);if(isNaN(currentTop)){currentTop=-210;}
menuEl.style.display="block";if(currentTop<-74){currentTop+=moveDistance;setTimeout("ANGLE.ShowANGLEMenu()",50);}else{currentTop=-74;Handler.remove($("ClientLocation"),"click",ANGLE.ShowANGLEMenu);Handler.add($("ClientLocation"),"click",ANGLE.HideANGLEMenu);Handler.add(document.body,"mousemove",ANGLE.HideANGLEMenu);ANGLE.menuHeadingOut=false;}
menuEl.style.top=currentTop+"px";}
ANGLE.HideANGLEMenu=function(e){var menuEl=$("Location_Menu");if((e!=null)&&(e!=undefined)){if(e.pageX||e.pageY){mouseX=e.pageX;mouseY=e.pageY;}else if(e.clientX||e.clientY){mouseX=e.clientX+document.body.scrollLeft
+document.documentElement.scrollLeft;mouseY=e.clientY+document.body.scrollTop
+document.documentElement.scrollTop;}
var menuX=menuEl.offsetLeft+menuEl.scrollLeft;var menuY=menuEl.offsetTop+menuEl.scrollTop;if((mouseX>menuX)&&(mouseX<menuX+menuEl.clientWidth)){if((mouseY>(menuY-7))&&(mouseY<menuY+menuEl.clientWidth)){return;}}}
ANGLE.menuHeadingIn=true;var scrollDistance=161;var moveDistance=21;var currentTop=parseInt(menuEl.style.top);if(currentTop>-210){currentTop-=moveDistance;setTimeout("ANGLE.HideANGLEMenu(null)",50);Handler.remove(document.body,"mousemove",ANGLE.HideANGLEMenu);Handler.remove($("ClientLocation"),"click",ANGLE.HideANGLEMenu);}else{currentTop=-210;Handler.add($("ClientLocation"),"click",ANGLE.ShowANGLEMenu);ANGLE.menuHeadingIn=false;}
menuEl.style.top=currentTop+"px";}
ANGLE.Editable_Region_Hover=function(event){var boxEl=event.currentTarget;if((ANGLE.EDITOR.currentSelectedRegion!=boxEl.id)&&(ANGLE.EDITOR.currentSelectedRegion!="")){ANGLE.Editable_Region_Leave(event);}
ANGLE.EDITOR.currentSelectedRegion=boxEl.id;var editBtn=$("EditButton");var boxX,boxY;boxX=boxY=0;var parentEl=boxEl;do{boxX+=parentEl.offsetLeft;boxY+=parentEl.offsetTop;}while(parentEl=parentEl.offsetParent);editBtn.style.display="block";editBtn.style.left=boxX+boxEl.offsetWidth-editBtn.clientWidth-1+"px";editBtn.style.top=boxY+1+"px";boxEl.style.border="#666666 dashed 1px";Handler.add(document.body,"mousemove",ANGLE.Editable_Region_Leave);}
ANGLE.Editable_Region_Leave=function(e){var boxEl=$(ANGLE.EDITOR.currentSelectedRegion);var boxX,boxY;boxX=boxY=0;var parentEl=boxEl;do{boxX+=parentEl.offsetLeft;boxY+=parentEl.offsetTop;}while(parentEl=parentEl.offsetParent);if(e.pageX||e.pageY){mouseX=e.pageX;mouseY=e.pageY;}else if(e.clientX||e.clientY){mouseX=e.clientX+document.body.scrollLeft
+document.documentElement.scrollLeft;mouseY=e.clientY+document.body.scrollTop
+document.documentElement.scrollTop;}
if((mouseX>boxX)&&(mouseX<boxX+boxEl.offsetWidth)){if((mouseY>(boxY))&&(mouseY<boxY+boxEl.offsetHeight)){return;}}
var editBtn=$("EditButton");editBtn.style.display="none";ANGLE.EDITOR.currentSelectedRegion="";boxEl.style.border="none";Handler.remove(document.body,"mousemove",ANGLE.Editable_Region_Leave);}
ANGLE.EDITOR.show=function(event){if(ANGLE.EDITOR.currentSelectedRegion=="Editable_Content"){EDITOR.preview("EditPage","Editable_Content","editorDiv");}else if(ANGLE.EDITOR.currentSelectedRegion=="Editable_Title"){ANGLE.EDITOR.EditTitle();}else if(ANGLE.EDITOR.currentSelectedRegion=="Editable_SidePanel"){var indexPos=document.location.href.lastIndexOf("/");var pageName=document.location.href.substring(indexPos+1);document.location="../admin/editsidepanel?page="+pageName;}else if(ANGLE.EDITOR.currentSelectedRegion=="Editable_Home"){EDITOR.preview("EditPage","Editable_Home","HomePageEditor");}}
ANGLE.EDITOR.EditTitle=function(){if($("newTitle")!=undefined){return;}
var titleContainer=$("Editable_Title");var currentTitle=titleContainer.innerHTML;var editableHTML='<label>Page Title: </label><input name="newTitle" type="text" id="newTitle" size="70" maxlength="150" value="'+currentTitle+'"/>';editableHTML+='<input id="oldTitle" type="hidden" name="hiddenField" value="'+currentTitle+'"/>';editableHTML+='<input name="Change" type="button" id="ChangeTitle" value="Change" />';editableHTML+='<input name="Cancel" type="button" id="CancelTitle" value="Cancel" />';titleContainer.innerHTML=editableHTML;setTimeout(function(){Handler.add($("ChangeTitle"),"click",ANGLE.EDITOR.SendTitleToServer);Handler.add($("CancelTitle"),"click",ANGLE.EDITOR.EditTitleClose);},100);Handler.remove($("Editable_Title"),"mouseover",ANGLE.Editable_Region_Hover);}
ANGLE.EDITOR.EditTitleClose=function(){var titleContainer=$("Editable_Title");var currentTitle=$("newTitle").value;titleContainer.innerHTML=currentTitle;Handler.add($("Editable_Title"),"mouseover",ANGLE.Editable_Region_Hover);}
ANGLE.EDITOR.SendTitleToServer=function(){var newTitle=$("newTitle");POSTdata=Array();POSTdata["pageTitle"]=newTitle.value;var indexPos=document.location.href.lastIndexOf("/");POSTdata["pageName"]=document.location.href.substring(indexPos+1);var href="/ajax/updatepagetitle";$("ChangeTitle").value="sending...";AJAX.post(href,POSTdata,function(){ANGLE.EDITOR.EditTitleClose();},function(){alert("An error occured whilst trying to update the title of this page!")});}
ANGLE.ShowMessageBox=function(msg,errorBoxID,goodBoxID,timeOut){if(timeOut==undefined)timeOut=4000;var msgBox=(errorBoxID=="")?$(goodBoxID):$(errorBoxID);var currentOpacity=((msgBox.style.opacity!="")&&(msgBox.style.opacity!=undefined))?parseFloat(msgBox.style.opacity):0.00;if(msg!='null'){msgBox.innerHTML=msg;}
if(currentOpacity<=0){msgBox.style.display="block";}
if(currentOpacity<1){currentOpacity+=0.05;setTimeout("ANGLE.ShowMessageBox('"+msg+"', '"+errorBoxID+"', '"+goodBoxID+"', "+timeOut+")",50);ANGLE._ChangeOpacity(msgBox,currentOpacity);}else{if(timeOut!=0){setTimeout("ANGLE.HideMessageBox('"+errorBoxID+"', '"+goodBoxID+"')",timeOut);}}}
ANGLE.HideMessageBox=function(errorBoxID,goodBoxID){var msgBox=(errorBoxID=="")?$(goodBoxID):$(errorBoxID);var currentOpacity=((msgBox.style.opacity!="")&&(msgBox.style.opacity!=undefined))?parseFloat(msgBox.style.opacity):1;if(currentOpacity>0){currentOpacity-=0.05;setTimeout("ANGLE.HideMessageBox('"+errorBoxID+"', '"+goodBoxID+"')",50);ANGLE._ChangeOpacity(msgBox,currentOpacity);}else{msgBox.style.display="none";}}
ANGLE._ChangeOpacity=function(element,newValue){element.style.opacity=String(newValue);element.style.MozOpacity=newValue;element.style.KhtmlOpacity=newValue;element.style.filter="alpha(opacity="+(newValue*100)+")";}
function trim(s){s=s.replace(/(^\s*)|(\s*$)/gi,"");s=s.replace(/[ ]{2,}/gi," ");s=s.replace(/\n /,"\n");return s;}
ANGLE.SendContactForm=function(event){var href="../requests/sendcontactemail";var contactForm=document.contactFrm;$("ANGLE_NameError").innerHTML="";$("ANGLE_EmailError").innerHTML="";$("ANGLE_PhoneError").innerHTML="";$("ANGLE_SubjectError").innerHTML="";$("ANGLE_MessageError").innerHTML="";$("ANGLE_AttachmentError").innerHTML="";if(contactForm.ANGLE_Attachment.value!=""){$("iframewrapper").innerHTML='<iframe id="upload_target" name="upload_target" src="about:blank" onload="ANGLE.SendAttachment()" class="hidden"></iframe>';contactForm.action=href;contactForm.target='upload_target';ANGLE.ShowMessageBox("Sending...","ContactStarted","",0);contactForm.submit();}else{POSTdata=Array();POSTdata["ANGLE_Name"]=contactForm.ANGLE_Name.value;POSTdata["ANGLE_Email"]=contactForm.ANGLE_Email.value;POSTdata["ANGLE_Phone"]=contactForm.ANGLE_Phone.value;POSTdata["ANGLE_Subject"]=contactForm.ANGLE_Subject.value;POSTdata["ANGLE_Message"]=contactForm.ANGLE_Message.value;AJAX.post(href,POSTdata,ANGLE.SendContactForm_Succeed,ANGLE.SendContactForm_Fail);}}
ANGLE.SendAttachment=function(){var i=$("upload_target");if(browser.isIE==false){var d=i.contentDocument;}else{var d=window.frames["upload_target"].document;}
if(d.location.href=="about:blank"){return;}
$("ContactStarted").style.display="none";var returnObj={};returnObj.responseText=d.body.innerHTML;ANGLE.SendContactForm_Succeed(returnObj);};ANGLE.SendContactForm_Succeed=function(returnObj){var contactForm=document.contactFrm;ANGLE._ChangeOpacity($("ContactError"),0);ANGLE._ChangeOpacity($("ContactGood"),0);var result=eval('('+returnObj.responseText+')');if(result.result==true){ANGLE.ShowMessageBox("Your message has been sent, thank you for contacting us.","","ContactGood");contactForm.ANGLE_Name.value="";contactForm.ANGLE_Email.value="";contactForm.ANGLE_Phone.value="";contactForm.ANGLE_Subject.value="";contactForm.ANGLE_Message.value="";contactForm.ANGLE_Attachment.value="";}
else{ANGLE.ShowMessageBox("Your message could not be sent, please refer to the messages below.","ContactError","");$("ANGLE_NameError").innerHTML=(result.ANGLE_Name!=undefined)?result.ANGLE_Name:"";$("ANGLE_EmailError").innerHTML=(result.ANGLE_Email!=undefined)?result.ANGLE_Email:"";$("ANGLE_PhoneError").innerHTML=(result.ANGLE_Phone!=undefined)?result.ANGLE_Phone:"";$("ANGLE_SubjectError").innerHTML=(result.ANGLE_Subject!=undefined)?result.ANGLE_Subject:"";$("ANGLE_MessageError").innerHTML=(result.ANGLE_Message!=undefined)?result.ANGLE_Message:"";$("ANGLE_AttachmentError").innerHTML=(result.ANGLE_Attachment!=undefined)?result.ANGLE_Attachment:"";}}
ANGLE.SendContactForm_Fail=function(){ANGLE.ShowMessageBox("Sorry, your message could be sent an unknown error occured...","ContactError","");}