var iS=0
var iSl=0
var sB=""
var sQ=location.search.substring(1,location.search.length)
if(sQ.indexOf("store")!=-1)iS=sQ.split("=")[1]
function aT(t){
 var start,end
 var a=document.getElementById("text")
 if(typeof a.selectionStart!="undefined"){
  start=a.selectionStart
  end=a.selectionEnd
  a.value=a.value.substr(0,start)+t+a.value.substr(end)
  a.focus()
  a.selectionStart=start-end==0?start+t.length:start
  a.selectionEnd=start+t.length
 }else{
  if(a.createTextRange&&a.caretPos){
   var pos=a.caretPos
   pos.text=pos.text.charAt(pos.text.length-1)==" "?t+" ":t
  }else a.value+=t
  a.focus(pos)
 }
}
function cC(e){
 var sCat=e.options[e.selectedIndex].value
 var oTab=document.getElementById("list")
 if(sCat){
  var xReq=false
  if(window.XMLHttpRequest){
   xReq=new XMLHttpRequest()
   if(xReq.overrideMimeType)xReq.overrideMimeType("text/xml")
  }else if(window.ActiveXObject){
   try{
    xReq=new ActiveXObject("Msxml2.XMLHTTP")
   }catch(e){
    try{
     xReq=new ActiveXObject("Microsoft.XMLHTTP")
    }catch(e){}
   }
  }
  if(!xReq){
   alert("ERROR\nCould not create XMLHTTP object.")
   return false
  }
  var sHed="<table border=\"0\" cellspacing=\"1\" cellpadding=\"5\" summary=\"List of stores in Johnston Court\"><tr><th>Name</th><th>Floor</th><th>Unit</th><th>Phone</th><th>Link</th></tr>"
  xReq.onreadystatechange=function(){
   if(xReq.readyState==4){
    if(xReq.status==200)oTab.innerHTML=sHed+unescape(xReq.responseXML.getElementsByTagName("root").item(0).firstChild.data)+"</table>"
    else alert("ERROR\nServer responded with "+xReq.status+" error")
    return false
   }
  }
  oTab.innerHTML=sHed+"<tr><td class=\"c first\" colspan=\"5\"><img src=\"i/l.gif\" width=\"220\" height=\"19\" alt=\"Loading ...\" /></td></tr></table>"
  xReq.open("POST","filter.asp",true)
  xReq.setRequestHeader("Content-Type","application/x-www-form-urlencoded")
  xReq.send("c="+escape(sCat)+"&s="+escape(iS))
  iSl=0
  sB=""
  return false
 }else{
  oT.options.length=0
  oT[0]=new Option("Any","")
  oT.selectedIndex=0
 }
}
function cI(o,c,r){
 if(o.value==c)o.value=r
}
function cP(o){
 if(o.options[o.selectedIndex].value!="")document.getElementById("photo").src="i/u/"+o.options[o.selectedIndex].value
 else document.getElementById("photo").src="i/x.png"
}
function dR(t){
 return confirm("Are you sure you wish to permanently delete this "+t+"?")
}
function eC(i,n){
 document.getElementById("i").value=i
 document.getElementById("name").value=n
}
function gT(){
 var a=document.getElementById("text")
 if(a.createTextRange&&a.caretPos)return a.caretPos.text
 else if(typeof a.selectionStart!="undefined")return a.value.substr(a.selectionStart,a.selectionEnd-a.selectionStart)
 return ""
}
function iT(){
 var aO=["bold","centre","colour=000000","font=arial","heading","italic","link=","page=","size=","subheading","underline"]
 var aC=[aO[0],aO[1],"colour","font",aO[4],aO[5],"link","page","size",aO[9],aO[10]]
 var n=document.getElementById("tag").options[document.getElementById("tag").selectedIndex].value
 var t=gT()
 aT("["+aO[n]+"]"+t+"[/"+aC[n]+"]")
 document.getElementById("tag").options[0].selected=true
}
function lW(){
 var iH=Math.max(document.getElementById("ads").offsetHeight,document.getElementById("content").offsetHeight,document.getElementById("news").offsetHeight)-5
 document.getElementById("ads").style.height=iH+"px"
 document.getElementById("content").style.height=iH+"px"
 document.getElementById("news").style.height=(iH)+"px"
}
window.onload=lW
function sC(v){
 if(v.createTextRange)v.caretPos=document.selection.createRange().duplicate()
}
function sS(s){
 document.getElementById("s"+iS).style.display="none"
 if(iSl!=0)document.getElementById("sl"+iSl).className=sB
 document.getElementById("s"+s).style.display="block"
 if(s!=0){
  sB=document.getElementById("sl"+s).className
  document.getElementById("sl"+s).className="third"
 }
 iSl=iS=s
 return false
}
function tL(u,w){
 w=window.open(u,w)
 w.focus()
 return false
}
function mA(f,t){
 sA(f)
 if(arguments.length==2)mS(f,t)
 else if(arguments.length==3)mS(f,t,arguments[2])
 else if(arguments.length==4)mS(f,t,arguments[2],arguments[3])
 return false
}
function mS(f,t){
 if(arguments.length>3){
  var r=arguments[3]
  if(r!="")uM(f,r)
 }
 for(x=0;x<f.options.length;x++){
  var o=f.options[x]
  if(o.selected)t.options[t.options.length]=new Option(o.text,o.value,false,false)
 }
 for(x=(f.options.length-1);x>=0;x--){
  var p=f.options[x]
  if(p.selected)f.options[x]=null
 }
 if((arguments.length<3)||(arguments[2]==true)){
  sL(f)
  sL(t)
 }
 f.selectedIndex=-1
 t.selectedIndex=-1
 return false
}
function sA(o){
 var iMax=500
 var iMaxCounter=o.options.length
 if(iMaxCounter>iMax)iMaxCounter=iMax
 for(x=0;x<iMaxCounter;x++)o.options[x].selected=true
}
function sL(o){
 var a=new Array()
 for(x=0;x<o.options.length;x++)a[a.length]=new Option(o.options[x].text,o.options[x].value,o.options[x].defaultSelected,o.options[x].selected)
 a=a.sort( 
  function(i,j){
   if((i.text+"").toLowerCase()<(j.text+"").toLowerCase())return -1
   if((i.text+"").toLowerCase()>(j.text+"").toLowerCase())return 1
   return 0
  }
 )
 for(x=0;x<a.length;x++)o.options[x]=new Option(a[x].text,a[x].value,a[x].defaultSelected,a[x].selected)
}
function sM(i,r,w,o){
 if(window.RegExp){
  var selected1,selected2
  if(w=="select"){
   selected1=true
   selected2=false
  }else if(w=="unselect"){
   selected1=false
   selected2=true
  }else return
  var re=new RegExp(regex)
  for(x=0;x<i.options.length;x++){
   if(re.test(i.options[x].text))i.options[x].selected=selected1
   else{
    if(o)i.options[x].selected=selected2
   }
  }
 }
}
function uM(o,r){
 sM(o,r,"unselect",false)
}