function $(_1){
return document.getElementById(_1);
}
gUtils={};
gUtils.popupWindow=function(_2,_3,_4,_5){
var w=_4?180:600;
var h=_4?130:600;
if(_5){
h=_5;
}
var l=(screen.width-w)/2;
var t=(screen.height-100-h)/2;
var _a=window.open(_2,_3,"width="+w+",height="+h+",top="+t+",left="+l+",resizable=0,location=0,scrollbars=0,toolbar=0,status=0");
_a.focus();
return false;
};
gUtils.mouseOver=function(_b){
var _c=$(_b+"_img");
if(_c){
_c.src=_c.src.replace(/\.gif$/,"Over.gif");
}
};
gUtils.mouseOut=function(_d){
var _e=$(_d+"_img");
if(_e){
_e.src=_e.src.replace(/Over\.gif$/,".gif");
}
};
gUtils.setImageSrc=function(_f,_10){
$(_f).src=$(_f).src.replace(/[^\\^\/]*\.gif$/,_10);
};
gUtils.formatDate=function(_11){
var _12=_11.split(" ");
var _13=_12[2]%10;
var _14=Math.floor(_12[2]/10);
var _15="th";
if(_14!=1){
switch(_13){
case 1:
_15="st";
break;
case 2:
_15="nd";
break;
case 3:
_15="rd";
break;
default:
}
}
var _16=_12[4].split(":");
var _17=parseInt(_16[0])>12?"pm":"am";
return _12[0]+" "+_12[2]+_15+" "+_12[1]+" "+_16[0]+":"+_16[1]+_17;
};
gUtils.submitForm=function(_18){
var _19;
if(navigator.userAgent.toLowerCase().match(/safari/)){
var _1a=document.getElementsByTagName("form");
for(var i=0;i<_1a.length;i++){
if(_1a[i].getAttribute("name")==_18){
_19=_1a[i];
break;
}
}
}else{
_19=document.forms[_18];
}
_19.submit();
};
gUtils.hidePostcodeIfRegionEIRE=function(_1c){
var _1d,_1e;
var _1f=$("region_id");
var _20=_1f.options[_1f.selectedIndex].innerHTML.toUpperCase()=="EIRE";
$("postcode_control").style.display=(!_20?"block":"none");
if(_1c){
_1d=$("user_postcode");
if(!_1d){
_1d=$("postcode");
}
if(_1d){
if(_20){
_1d.setAttribute("value_x",_1d.value);
_1d.value="na";
}else{
_1e=_1d.getAttribute("value_x");
if(_1e){
_1d.value=_1e;
}
if(_1d.value=="na"){
_1d.value="";
}
_1d.removeAttribute("value_x");
}
}
}
};
gUtils.arrayFind=function(_21,_22){
var _23=gConst.kNotDefined;
for(var i=0;i<_21.length&&_23==gConst.kNotDefined;i++){
if(_21[i]==_22){
_23=i;
}
}
return _23;
};
gUtils.poundFormat=function(_25){
var _26=Math.floor(_25/100);
var _27=_25%100;
_27=(_27<10?"0"+_27:_27);
return "\xa3"+_26+"."+_27;
};
gUtils.sendPrefToServer=function(_28,_29){
var _2a=HTTP.newRequest();
_2a.open("GET","data/setPref.php?pref="+_28+"&value="+_29);
_2a.send(null);
};
gUtils.setDivText=function(_2b,_2c){
var _2d=_2b.firstChild;
var _2e=document.createTextNode(_2c);
if(_2d){
_2b.replaceChild(_2e,_2d);
}else{
_2b.appendChild(_2e);
}
};
gUtils.clearDivText=function(_2f){
var _30=_2f.firstChild;
if(_30){
_2f.removeChild(_30);
}
};
gUtils.getAbsoluteUrl=function(_31){
var _32=window.location.pathname.replace(/[^\/]*$/,"");
return window.location.protocol+"//"+window.location.host+_32+_31;
};
gUtils.gotoLocalPage=function(_33){
window.location=gUtils.getAbsoluteUrl(_33);
};
gUtils.createDisplayNameAnchor=function(_34,_35){
var _36=document.createElement("a");
gUtils.addDisplayTextToParent(_36,_34,_35);
return _36;
};
gUtils.addDisplayTextToParent=function(_37,_38,_39){
if(_38.length>_39){
var _3a=_38.match(/[A-Z0-9]/g);
if(_3a){
var _3b=_3a.length/_38.length;
if(_3b>0.1){
_39=Math.ceil(_39*(1-_3b)*0.5)*2;
}
}
var _3c=parseInt(_39/2);
var _3d=new RegExp("^(.{"+_3c+"})(.*)(.{"+_3c+"})$");
var _3a=_38.match(_3d);
_37.appendChild(document.createTextNode(_3a[1]));
var _3e=document.createElement("span");
_3e.style.display="none";
_3e.appendChild(document.createTextNode(_3a[2]));
_37.appendChild(_3e);
var _3f=document.createElement("span");
_3f.appendChild(document.createTextNode(".."));
_37.appendChild(_3f);
_37.appendChild(document.createTextNode(_3a[3]));
}else{
_37.appendChild(document.createTextNode(_38));
}
};
gUtils.getElementTlPos=function(_40,_41){
var _42={x:0,y:0};
var _43=false;
while(_40!==null&&!_43){
_42.x+=_40.offsetLeft;
_42.y+=_40.offsetTop;
_40=_40.offsetParent;
_43=(_41!=undefined&&_40&&_40.id!=undefined&&_41==_40.id);
}
return _42;
};
gUtils.getElementBrPos=function(_44,_45){
var _46=gUtils.getElementTlPos(_44,_45);
_46.x+=_44.offsetWidth;
_46.y+=_44.offsetHeight;
return _46;
};
gUtils.centreImageInSquare=function(_47,_48,aW,aH){
var _4b=0;
if(aW>aH){
_4b=Math.round((_48-aH)/2);
}
$(_47).style.marginTop=_4b+"px";
};
gUtils.addXmlListToArray=function(_4c,_4d){
var _4e,i,_50,_51,_52=$(_4d);
if(_52!==null){
_4e=_52.firstChild.childNodes;
for(i=0;i<_4e.length;i++){
_50=_4e.item(i);
if(_50.nodeType==1){
_51=_50.getAttribute("value");
if(_51.match(/^\d+$/)){
_51=parseInt(_51);
}else{
if(_51.match(/^\d*\.\d*$/)){
_51=parseFloat(_51);
}else{
if(_51.match(/^\{.*\}$/)){
_51=_51.match(/[^{^}^,]+/g);
}
}
}
_4c[_50.getAttribute("name")]=_51;
}
}
}
};
if(document.documentElement&&document.documentElement.scrollWidth!==undefined){
gUtils.getDocumentSize=function(){
return {w:document.documentElement.scrollWidth,h:document.documentElement.scrollHeight};
};
}else{
if(document.body&&document.body.scrollWidth){
gUtils.getDocumentSize=function(){
return {w:document.body.scrollWidth,h:document.body.scrollHeight};
};
}else{
gUtils.getDocumentSize=function(){
return {w:2000,h:2000};
};
}
}
if(window.innerWidth){
gUtils.getScrollPos=function(){
return {x:window.pageXOffset,y:window.pageYOffset};
};
gUtils.getViewportSize=function(){
return {w:window.innerWidth,h:window.innerHeight};
};
}else{
if(document.documentElement&&document.documentElement.clientWidth){
gUtils.getScrollPos=function(){
return {x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop};
};
gUtils.getViewportSize=function(){
return {w:document.documentElement.clientWidth,h:document.documentElement.clientHeight};
};
}else{
if(document.body.clientWidth){
gUtils.getScrollPos=function(){
return {x:document.body.scrollLeft,y:document.body.scrollTop};
};
gUtils.getViewportSize=function(){
return {w:document.body.clientWidth,h:document.body.clientHeight};
};
}else{
gUtils.getScrollPos=function(){
return {x:0,y:0};
};
gUtils.getViewportSize=function(){
return {w:1024,h:768};
};
}
}
}
if(window.screenLeft){
gUtils.setScrollPos=function(aX,aY){
window.screenLeft=aX;
window.screenTop=aY;
};
}else{
if(window.screenX){
gUtils.setScrollPos=function(aX,aY){
window.screenX=aX;
window.screenY=aY;
};
}
}
gUtils.scrollToBottom=function(){
var _57=gUtils.getDocumentSize().h-gUtils.getViewportSize().h;
if(_57>0){
window.scrollTo(0,_57);
}
};
String.prototype.trim=function(){
return this.replace(/^\s+|\s+$/g,"");
};
String.prototype.padLeft=function(_58,_59){
var ret="";
for(var i=0;i<_58-this.length;i++){
ret+=_59;
}
return (ret+this);
};
String.prototype.htmlEntityDecode=function(){
var ret=this.replace(/&amp;/g,"&");
ret=ret.replace(/&pound;/g,"\xa3");
ret=ret.replace(/&gt;/g,">");
ret=ret.replace(/&lt;/g,"<");
ret=ret.replace(/&quot;/g,"\"");
return unescape(ret);
};
debugMsg=function(_5d,_5e){
if(_5e){
var now=new Date();
_5d=(now.getTime()%100000)+" : "+_5d;
}
$("debug").innerHTML+=_5d+"<br />";
};
debugMsgHtml=function(_60){
$("debug").innerHTML+="<pre>"+_60.replace(/</g,"!").replace(/>/g,"|")+"</pre><br />";
};

