var fadeObject=new fadeClass();function fader(obj,o) {if (obj.style) {if (o==100) {if (obj.style.MozOpacity!=null){obj.style.MozOpacity = "";}else if (obj.style.opacity!=null){obj.style.opacity = "";}else if (obj.style.filter!=null){obj.style.filter = "";}}else{if (obj.style.MozOpacity!=null){obj.style.MozOpacity = (o/100) - .001;}else if (obj.style.opacity!=null){obj.style.opacity = (o/100) - .001;}else if (obj.style.filter!=null){obj.style.filter = "alpha(opacity="+o+")";}}}}function fadeClass() {this.timer=null;this.fade=fade;this.process=process;this.o=[];function fade(obj,f,t,s,h) {var i=-1;if (this.o.length>0) {for(var oi=this.o.length-1;oi>=0;oi--) {if (this.o[oi]==obj) i=oi;}}if ((s<0 && f<t) || (s>=0 && f>t)) s=-s;if (i>=0) {this.o[i][4]=s;this.o[i][2]=f;this.o[i][3]=h;}else{this.o.push([obj,f,t,h,s]);}if (this.timer===null) this.timer=setTimeout("fadeObject.process()",2);}function process() {if (this.o.length>0) {for(var oi=this.o.length-1;oi>=0;oi--) {if (this.o[oi][0].style.display=="none") this.o[oi][0].style.display="block";this.o[oi][1]+=this.o[oi][4];var c=false;if (this.o[oi][4]<0) {if (this.o[oi][1]<this.o[oi][2]) c=true;}else{if (this.o[oi][1]>this.o[oi][2]) c=true;}if (c) this.o[oi][1]=this.o[oi][2];fader(this.o[oi][0],this.o[oi][1]);if (c) {if(this.o[oi][3]!==null) {if (typeof(this.o[oi][3])=="string") {eval(this.o[oi][3]+";");}else{this.o[oi][3]();}}this.o.splice(oi,1);}}}if (this.o.length>0) {this.timer=setTimeout("fadeObject.process()",2);}else{clearTimeout(this.timer);this.timer=null;}}}

var sR=new spr_class();function spr_class() {this.post=post;this.get=get;this.send=send;this.received=received;this.r=[];this.h=[];function post(u,p,h) {this.send('POST',u,p,h);}function get(u,p,h) {this.send('GET',u,p,h);}function send(t,u,p,h) {u+="?rand="+new Date().valueOf()+((t=='GET')?"&"+p:'');var thisRequest=null;if (window.XMLHttpRequest){thisRequest=new XMLHttpRequest();thisRequest.onreadystatechange=sRreceived;}else if (window.ActiveXObject){thisRequest=new ActiveXObject("Microsoft.XMLHTTP");if (thisRequest) thisRequest.onreadystatechange=sRreceived;}if (thisRequest) {this.h.push(h);this.r.push(thisRequest);thisRequest.open(t,u,true);thisRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");if (t=="POST") {thisRequest.send(p);}else{thisRequest.send();}}}function received() {var r="";for (var i=this.r.length-1;i>=0;i--) {if (this.r[i].readyState==4) {r=this.r[i].responseText;this.r[i].getAllResponseHeaders();if (this.r[i].status==200) {r=this.r[i].responseText;}this.r[i]=null;this.r.splice(i,1);var th=this.h[i];this.h.splice(i,1);th(r);}}}}function sRreceived() {sR.received();}function rSC(reply) {var sendingForm=false;if (reply!="ok" && reply!="") {var sect=reply.split("<sections>");for(si=0;si<sect.length;si++) {if (/^<scripting>/.test(sect[si])) {eval(sect[si].replace('<scripting>',''));}else{if (/<inside>/.test(sect[si])) {ip=sect[si].split("<inside>");ob(ip[0]).innerHTML=ip[1];}else{if (/<insert>/.test(sect[si])) {ip=sect[si].split("<insert>");cont=null;if (/^<appendtostart>/.test(ip[0])) {ip[0]=ip[0].replace('<appendtostart>','');if (cont=ob(ip[0])) ip[1]+=cont.innerHTML;}cont=null;if (/^<appendtoend>/.test(ip[0])) {ip[0]=ip[0].replace('<appendtoend>','');if (cont=ob(ip[0])) ip[1]=cont.innerHTML+ip[1];}if (cont==null) cont=ob(ip[0]);if (cont!=null) {if (ip[0]=="dialogContent") {sIHCentered(ip[0],ip[1],"dialog");}else{sIH(cont,ip[1]);}}}else{if (/<replace>/.test(sect[si])) {ip=sect[si].split("<replace>");if (src=ob("block"+ip[0])) {pRH("<div id=\"tempcontainer\" style=\"display:none\">"+ip[1]+"</div>",document.body);newsrc=ob("tempcontainer").childNodes[0];src.parentNode.insertBefore(newsrc,src);removeTheNode(src);removeTheNode("tempcontainer");}}else{alert('Unexpected response from the server');}}}}}}}

var validators={"dorequire":{regex:'^.+$',errmsg:'we do require something here'},"email":{regex:'^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$',errmsg:'not a valid email'},"telephone":{regex:'^[0-9 ]{0,20}$',errmsg:'please use numbers only please'}};
function getInternetExplorerVersion()
// Returns the version of Internet Explorer or a -1
// (indicating the use of another browser).
{
  var rv = -1; // Return value assumes failure.
  if (navigator.appName == 'Microsoft Internet Explorer')
  {
    var ua = navigator.userAgent;
    var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(ua) != null)
      rv = parseFloat( RegExp.$1 );
  }
  return rv;
}
function checkVersion()
{
  var msg = "You're not using Internet Explorer.";
  var ver = getInternetExplorerVersion();

  if ( ver > -1 )
  {
    if ( ver >= 8.0 ) 
      msg = "You're using a recent copy of Internet Explorer."
    else
      msg = "You should upgrade your copy of Internet Explorer.";
  }
  alert( msg );
}


function sIH(obj,content) {
	thisresize=((typeof(obj)=="string")?ob(obj):obj);
    if (thisresize.tagName=="DIV" || thisresize.tagName=="TD") {
		if (obj.style) {
			if (obj.style.display=="none") {
				obj.style.display="block";
				oh=1;
			}else{
				oh=thisresize.clientHeight*1;
			}
		}else{
			oh=thisresize.clientHeight*1;
		}
        thisresize.innerHTML="<div id='parsesIH' style='width:"+obj.clientWidth+"px;position:absolute;visibility:hidden'>"+content+"</div>";
		dh=ob("parsesIH").clientHeight;
        thisresize.style.overflow="hidden";
        thisresize.style.display="block";
		thisresize.innerHTML=content;
		resizer.resize([thisresize],0,1,null,oh,null,dh,null,20,2,false,null,true);
    }else{
        thisresize.innerHTML=content;
    }
}
function sIHCentered(obj,content,container) {
	thisresize=((typeof(obj)=="string")?ob(obj):obj);
    if (thisresize.tagName=="DIV" || thisresize.tagName=="TD") {
		oh=thisresize.clientHeight*1;
		ow=thisresize.clientWidth*1;
        thisresize.innerHTML="<div id='parsesIHC' style='position:absolute;visibility:hidden'>"+content+"</div>";
		dh=ob("parsesIHC").clientHeight;
		dw=ob("parsesIHC").clientWidth;
        thisresize.style.overflow="hidden";
        thisresize.style.display="block";
        thisresize.innerHTML=content;
		resizer.resize([thisresize],1,1,ow,oh,dw,dh,ob(container),20,3,false,null,true);
    }else{
        thisresize.innerHTML=content;
    }
}

var resizer=new resize_class();

function resize_class() {
	this.o=[];
	this.resize=resize;
	this.t=null;
	this.oi=oi;
	this.p=p;
	this.r=r;
	function resize(obj,sX,sY,fX,fY,tX,tY,c,mS,d,ifN,h,rD) {
		var i=this.oi(obj[0]);
		//document.body.innerHTML+="<div>"+mS+"</div>";
		var ok=true;
		var dim=[];
		if (ifN) ok=(obj[0].style.display=="none");
		
		if (ok){
			if (tX===null && tY===null) {
				dim=objFreeSize(obj[0],sX,sY);
				if (sX) tX=dim[0];
				if (sY) tY=dim[1];
				
			}
			if (fX===null && fY===null) {
				if (obj[0].style.display=="none") {
					dim=[0,0];
				}else{
					dim=objFreeSize(obj[0],sX,sY);
				}
				if (sX) fX=dim[0];
				if (sY) fY=dim[1];
			}
			if (i>=0) {
			//alert(this.o[i]["cY"]);
//alert(this.o[i]["tX"]+"!="+tX+" && "+this.o[i]["tY"]+"!="+tY);
				if (this.o[i]["tX"]!=tX || this.o[i]["tY"]!=tY) {
					this.o[i]["tX"]=tX;
					this.o[i]["tY"]=tY;
					//this.o[i]["eX"]=sX;
					//this.o[i]["eY"]=sY;
			//alert(this.o[i]["cY"]+" to "+this.o[i]["tY"]);
				}
			}
			if (i<0) {
				if (tY!=fY || tX!=fX) {
					//document.body.innerHTML+="<div>added "+obj.id+" at "+i+"</div>";
					for(var objt=0;objt<obj.length;objt++) {
						this.o.push({"sO":obj[objt],"eX":sX,"eY":sY,"tX":tX,"tY":tY,"cX":fX,"cY":fY,"mS":mS,"d":d,"cC":c,"h":h,"rD":rD});
						var os=obj[objt].style;
						if (sX) os.width=fX+"px";
						if (sY) os.height=fY+"px";
						os.overflow="hidden";
						os.display="block";
					}
				}
			}
			if (this.t===null) this.t=setTimeout("resizer.p()",2);
		}
	}
	function r(obj) {
		if (this.oi(obj)>=0) this.o.splice(i,1);
	}
	function oi(obj) {
		var j=-1;
		for(var ii=0;ii<this.o.length;ii++) {
			if (this.o[ii]["sO"].id==obj.id) {
				j=ii;
			//document.body.innerHTML+="<div>"+j+","+this.o[ii]["sO"].id+" = "+obj.id+"</div>";
			}
		}
		//document.body.innerHTML+="<div>"+j+"</div>";
		return j;
	}
	function p() {
		if (this.o.length>0) {
			var row='';
			for(var i=this.o.length-1;i>=0;i--) {
				var o=this.o[i];
				row+=o["sO"].id+" ";
			//document.body.innerHTML+="<div>"+o["sO"].id+" - "+this.o.length+"</div>";
				var fin=false;
				var dif=0;
				if (o["eX"]) {
					cx=(o["tX"]-o["cX"])/o["d"];
					dif=Math.sqrt(Math.pow(o["tX"]-o["cX"],2));
					if (cx<-o["mS"]) cx=-o["mS"];
					if (cx>o["mS"]) cx=o["mS"];
					this.o[i]["cX"]+=cx;
					o["sO"].style.width=Math.round(this.o[i]["cX"])+"px";
				}
				if (o["eY"]) {
					if (Math.sqrt(Math.pow(o["tY"]-o["cY"],2))>dif) dif=Math.sqrt(Math.pow(o["tY"]-o["cY"],2));
					cy=(o["tY"]-o["cY"])/o["d"];
					if (cy<-o["mS"]) cy=-o["mS"];
					if (cy>o["mS"]) cy=o["mS"];
					this.o[i]["cY"]+=cy;
					o["sO"].style.height=Math.round(this.o[i]["cY"])+"px";
				}
				//alert(this.o[i]["cX"]+","+this.o[i]["cY"]);
				if (dif<1) {
					fin=true;
					if (o["eX"]) {
						this.o[i]["cX"]=o["tX"];
						o["sO"].style.width=this.o[i]["cX"]+"px";
					}
					if (o["eY"]) {
						this.o[i]["cY"]=o["tY"];
						o["sO"].style.height=this.o[i]["cY"]+"px";
					}
					//if (fin) {
					if (o["rD"]) o["sO"].style.width=o["sO"].style.height='';
					o["sO"].style.overflow="";
					if (o["tX"]==0 || o["tY"]==0) o["sO"].style.display="none";
					if (o["h"]) eval(o["h"]);
					
					this.o.splice(i,1);
				}
				//ob('op').value+=o["mS"]+", ";
				if (o["cC"]) {
					cO(o["cC"]);
				}

			}
			row="<div>"+row+"</div>";
			if (this.o.length>0) {
				this.t=setTimeout("resizer.p()",10);
			}else{
				clearTimeout(this.t);
				this.t=null;
			}
		}else{
			clearTimeout(this.t);
			this.t=null;
		}
	}
}
function objFreeSize(obj,sX,sY) {
	//if (obj.style.display=="none") {
		if (sY) fh=obj.style.height;
		if (sX) fw=obj.style.width;
		var pos=obj.style.position;
		var vis=obj.style.visibility;
		var dis=obj.style.display;
		obj.style.position="absolute";
		obj.style.visibility="hidden";
		obj.style.display="block";
		if (sY) obj.style.height="";
		if (sX) obj.style.width="";
	//alert(obj.offsetHeight);
		var w=obj.offsetWidth;
		var h=obj.offsetHeight;
		if (sY) obj.style.height=fh;
		if (sX) obj.style.width=fw;
		obj.style.display=dis;
		obj.style.visibility=vis;
		obj.style.position=pos;
	/*}else{
		var w=obj.offsetWidth;
		var h=obj.offsetHeight;
	}*/
	return [w,h];
}
//function showSlide(srcObj,expW,expH) {
//    var dims=objFreeSize(srcObj,expW,expH);
//    var st=maxExpandStep(0,(expW?dims[0]:0),0,(expH?dims[1]:null),true);
//    resizer.resize(srcObj,expW,expH,0,0,(expW?dims[0]:null),(expH?dims[1]:null),null,st,4,false,null,true);
//}
//function hideSlide(srcObj,expW,expH) {
//    var dims=objFreeSize(srcObj,expW,expH);
//    var st=maxExpandStep(srcObj.offsetWidth,0,srcObj.offsetHeight,0,true);
//st=2;
//    resizer.resize(srcObj,expW,expH,srcObj.offsetWidth,srcObj.offsetHeight,(expW?0:null),(expH?0:null),null,st,4,false,null,false);
//}
function tE(srcObj, expW, expH, collapseOthers,centeredObject) {
	if (typeof(srcObj)=="string") srcObj=ob(srcObj);
	if (srcObj.style.display=="none") {
		var dims=objFreeSize(srcObj,expW,expH);
		st=maxExpandStep(0,(expW?dims[0]:0),0,(expH?dims[1]:null),false);
		st=5;
		resizer.resize([srcObj],expW,expH,0,0,(expW?dims[0]:null),(expH?dims[1]:null),null,st,4,false,null,true);
		if (collapseOthers) {
			if (collapseOthers.match(/\:/)) {
				o=collapseOthers.split(":");
				for(i=0;i<o.length;i++) {
					if (o[i]!='') {
						ot=ob(o[i]);
						st=maxExpandStep(ot.offsetWidth,0,ot.offsetHeight,0,false);
						if (ot.style.display=="block") resizer.resize([ot],expW,expH,ot.offsetWidth,ot.offsetHeight,(expW?0:null),(expH?0:null),null,st,2,false,null,false);
					}
				}
			}else{
				ot=ob(collapseOthers);
				st=maxExpandStep(ot.offsetWidth,0,ot.offsetHeight,0,false);
				if (ot.style.display=="block") resizer.resize([ot],expW,expH,ot.offsetWidth,ot.offsetHeight,(expW?0:null),(expH?0:null),centeredObject,st,2,false,null,false);
			}
		}
	}else{
		st=maxExpandStep(srcObj.offsetWidth,0,srcObj.offsetHeight,0,false);
		resizer.resize([srcObj],expW,expH,srcObj.offsetWidth,srcObj.offsetHeight,(expW?0:null),(expH?0:null),centeredObject,st,4,false,null,false);
	}
}
function maxExpandStep(fromx,tox,fromy,toy,quick) {
	dx=fromx-tox;
	dx=Math.sqrt(Math.pow(dx,2));
	dx/=(quick?2:100);
	dy=fromy-toy;
	dy=Math.sqrt(Math.pow(dy,2));
	dy/=(quick?2:100);
	if (dy>0 && dy<dx) dx=dy;
	if (dy<2) dy=2;
	return dy;
}
function ob(i) {return document.getElementById(i);}
function showOverlay(srcO,show) {
    //if (theSrcElement(e)==srcObj) {
   // if (srcO.id!==null) {
		if (srcO.id=="scrollerControl") {
			if (cobj=currentScrollElement(ob("scrollthrough"))) srcO=cobj;
		}
		if (srcO.id!==null) {
			var tar=null;
			tar=ob(srcO.id.replace("block","overlay"));
			if (show) {
				revealObject(tar);
			}else{
				hideObjectDelay(tar);
			}
		}
	//}
}
var revealObjects=new Array();
var revealTimer=null;
var hideTimer={};
function revealObject(tar) {
    var id=tar.id.replace("overlay","");
    if (tar.getAttribute("showing")!="1") {
		tar.setAttribute("showing","1");
		var dims=objFreeSize(tar,false,true);
		var st=maxExpandStep(0,0,0,dims[1],true);
		resizer.resize([tar],false,true,0,0,null,dims[1],null,st,20,false,null,true);

	   // resizer.resize(tar,false,true,0,0,null,null,null,10,4,true,null,true);
		if (hideTimer[id]) clearTimeout(hideTimer[id]);
	   // alert("Reveal");
   }
}
function hideObjectDelay(tar) {
	var id=tar.id.replace("overlay","");
	if (hideTimer[id]) clearTimeout(hideTimer[id]);
	hideTimer[id]=setTimeout("hideObject('"+tar.id+"')",500);
}
function hideObject(tar) {
	if (typeof(tar)=="string") tar=ob(tar);
	var dims=objFreeSize(tar);
	var st=maxExpandStep(0,0,0,dims[1],false);
		tar.setAttribute("showing","0");
	resizer.resize([tar],false,true,null,null,null,0,null,st,20,false,null,true);
}
function theSrcElement(e) {
    if (!e) var e = window.event;
    if (e.target) target = e.target
    else if (e.srcElement) target = e.srcElement
    return target;
}
function requireScrollers(container) {
	var theslide=container;
	if (!container.id.match(/slide$/)) {
		theslide=ob(container.id+"slide");
	}
    var nodes=theslide.childNodes;
    var kids=[];
    for(var n=0;n<nodes.length;n++) {
    	if (nodes[n].tagName=="DIV") kids.push(nodes[n]);
    }
    var kidwidth=kids[0].offsetWidth;
    var ds=container.offsetWidth;
    var shows=Math.round(ds/kidwidth);
    var isscroll=(shows<kids.length);
    ob(container.id+"left").style.display=isscroll?"block":"none";
    ob(container.id+"right").style.display=isscroll?"block":"none";
}
function currentScrollElement(container) {
    var l=container.scrollLeft;
    var theslide=ob(container.id+"slide");
    var nodes=theslide.childNodes;
    var kids=[];
    for(var n=0;n<nodes.length;n++) {
    	if (nodes[n].tagName=="DIV") kids.push(nodes[n]);
    }
    if(kids.length>0) {
		//var kidwidth=kids[0].offsetWidth;
		var ds=container.offsetWidth;
		var kidwidth=totalWidth(kids[0]);
		//kidwidth=kids[0].offsetWidth;
		var shows=Math.round(ds/kidwidth);
		var cindex=Math.round(l/kidwidth);
		//alert(l+"/"+kidwidth);
		return kids[cindex];
	}
}
function totalWidth(obj) {
//alert(obj.className);
	var ml=getStyle(obj,"margin-left").replace("px","");
	var mr=getStyle(obj,"margin-right").replace("px","");
	if(ml=="auto") ml=0;
	if(mr=="auto") mr=0;
	var margin=obj.offsetWidth+(1*ml)+(1*mr);
	//alert(obj.innerHTML);
	//alert(getStyle(obj,"margin-left"));
	return margin;
}
function scrollToElement(container,dindex,index) {
	//alert(container.id);
	if (container.id!="dvdslider") showOverlay(ob("scrollerControl"),false);
    var l=container.scrollLeft;
    var theslide=ob(container.id+"slide");
    var nodes=theslide.childNodes;
    var kids=[];
    for(var n=0;n<nodes.length;n++) {
    	if (nodes[n].tagName=="DIV") kids.push(nodes[n]);
    }
    var kidwidth=totalWidth(kids[0]);
    var ds=container.offsetWidth;
    var shows=Math.round(ds/kidwidth);
    if (index===null) {
	    var cindex=Math.round(l/kidwidth);
	    cindex+=dindex;
	    if (cindex>=kids.length-shows) cindex=kids.length-shows;
	    if (cindex<0) cindex=0;
    }else{
    	    cindex=index;
    }
    var newl=cindex*kidwidth;
    scrollObjectTo(container,newl);
    var dots=null;
    if (dots=ob(container.id+"dots")) {
		var dts=dots.getElementsByTagName("LI");
		for(var k=0;k<dts.length;k++) {
			dts[k].className=((dts.length-k-1)==cindex)?"":"selectable";
		}
    }
}
function gotoSlideLink() {
	var container=ob("scrollthrough");
    var l=container.scrollLeft;
    var theslide=ob(container.id+"slide");
    var nodes=theslide.childNodes;
    var kids=[];
    for(var n=0;n<nodes.length;n++) {
    	if (nodes[n].tagName=="DIV") kids.push(nodes[n]);
    }
    if(kids.length>0) {
		var ds=container.offsetWidth;
		var kidwidth=totalWidth(kids[0]);
		var shows=Math.round(ds/kidwidth);
		var cindex=Math.round(l/kidwidth);
		window.location=sliderLinks[cindex];
	}

}
var scrollingObjects=[]; // obj, current scrollleft, desired scrollleft
var scrollingTimer=null;
var scrollingTimerOn=false;
function scrollObjectTo(obj,scrleft) {
    var idx=-1;
    for(var i=scrollingObjects.length-1;i>=0;i--) {
        if (scrollingObjects[i]["obj"]==obj) idx=i;
    }
    if (idx<0) {
        scrollingObjects.push({"obj":obj,"current":obj.scrollLeft,"desired":scrleft});
        if (!scrollingTimerOn) {
        	scrollingTimerOn=true;
        	scrollingTimer=setTimeout("scrollObjects()",2);
        }
    }
}
function scrollObjects() {
    for(var i=scrollingObjects.length-1;i>=0;i--) {
        var ns=(scrollingObjects[i]["desired"]-scrollingObjects[i]["current"])/4;
        if (ns>10) ns=10;
        if (ns<-10) ns=-10;
        if (ns>-1 && ns<1) {
            ns=scrollingObjects[i]["desired"];
            scrollingObjects[i]["obj"].scrollLeft=ns;
            scrollingObjects.splice(i,1);
        }else{
            scrollingObjects[i]["current"]+=ns;
            scrollingObjects[i]["obj"].scrollLeft=Math.round(scrollingObjects[i]["current"]);
        }
        
    }
    if (scrollingObjects.length>0) {
        scrollingTimer=setTimeout("scrollObjects()",2);
    }else{
        clearTimeout(scrollingTimer);
        scrollingTimer=null;
        scrollingTimerOn=false;
    }
}
function buttondown(srcObj) {
	if (iev>0) {
		
		var h=srcObj.clientHeight;
		var pos='';
		if (pos=getStyle(srcObj,"background-position-x")) {
			pos+=" "+(-(h*2))+"px";
			srcObj.style.backgroundPosition=pos;
		}
	}else{
		var h=srcObj.clientHeight;
		var pos='';
		if (pos=getStyle(srcObj,"background-position")) {
			var pos=pos.split(" ");
			pos[1]=(-(h*2))+"px";
			srcObj.style.backgroundPosition=pos.join(" ");
		}
	}
}
function buttonup(srcObj) {
	srcObj.style.backgroundPosition="";
}
function getStyle(oElm, strCssRule){
	var strValue = "";
	if(document.defaultView && document.defaultView.getComputedStyle){
		strValue = document.defaultView.getComputedStyle(oElm, "").getPropertyValue(strCssRule);
	}else if(oElm.currentStyle){
		strCssRule = strCssRule.replace(/\-(\w)/g, function (strMatch, p1){
			return p1.toUpperCase();
		});
		strValue = oElm.currentStyle[strCssRule];
	}
	if (strValue=="") strValue=oElm.style[strCssRule];
	return strValue;
}
var topAtrObj=-1;
var topBuildTimer=null;
var topauto=true;
function topBuild(idx) {
	if (topAtrObj<0) ob("promochange").innerHTML="";
	/*if (idx===null) {
		topAtrObj++;
	}else{
		topAtrObj=idx;
	}
	alert(topAtrObj);*/
	var ins='';
	for(var pd=0;pd<promo_data.length;pd++) {
		ins+="<li id='promo_thumb_"+pd+"' onclick='topBuild("+pd+")' style='background:url("+promo_data[pd]["background"]+");'><div></div></li>";
	}
	ob("thumbs").innerHTML=ins;
	buildTop(idx);
}
function stopPromoTimer() {
		clearTimeout(topBuildTimer);
		topauto=false;
		topBuildTimer=null;
}
function buildTop(idx) {
	if (topAtrObj>=0) {
		ob('promo_thumb_'+topAtrObj).className='';
	}
	if (idx===null) {
		topAtrObj++;
		if (topAtrObj>=promo_data.length) topAtrObj=0;
	}else{
		stopPromoTimer();
		topAtrObj=idx;
	}
	ob('promo_thumb_'+topAtrObj).className='selected';
	var atrObj=promo_data[topAtrObj];
	var ins="<div class='promoContainer'><img src='/"+atrObj['back']+"' onload='topLoaded(this)'/>";
	ins+="<div id='reviews'>"+atrObj['review'].replace(/&lt;/g,"<").replace(/&gt;/g,">")+"</div>";
	ins+="<div id='pricing' style='color:#"+atrObj['colour']+"'>"+atrObj['pricing'].replace(/&lt;/g,"<").replace(/&gt;/g,">")+"</div>";
	ins+="<a class='bigbuynow' onmousedown='buttondown(this)' onmouseup='buttonup(this)' href='/online-shop.php' >BUY NOW</a>";
	ins+="<div id='videoselector' style='top:252px;left:78px'>";
	for(var j=0;j<atrObj.covers.length;j++) {
		ins+='<li onclick="stopPromoTimer();displayMovie(this,this.parentNode);" id="clip'+atrObj['covers'][j][4]+'"><div class="cover" style="background:url('+atrObj['covers'][j][0]+')"><div class="play"></div></div>'+atrObj['covers'][j][1]+"</li>";
		images["clip"+atrObj['covers'][j][4]]={"name":atrObj['covers'][j][1],"source":atrObj['covers'][j][2],"description":atrObj['covers'][j][3]};
	}
	ins+="</div></div>";
	ob("loadArea").innerHTML=ins;
}
function topLoaded(srcImg) {
	srcImg.setAttribute("onload","");
	srcImg.onload='';
	topAlpha=100;
	swapTop();
}
var topAlpha=100;
var topTimer=null;
function swapTop() {
	var la=ob("loadArea");
	topAlpha-=2;
	if (topAlpha<0) topAlpha=0;
	fader(la,100-topAlpha);
	if (la.style.display!="block")	la.style.display="block";
	if (topAlpha==0) {
		promoOut();
	}else{
		topTimer=setTimeout("swapTop()",2);
	}
}
function promoOut() {
	clearTimeout(topTimer);
	topTimer=null;
	ob('promochange').innerHTML=ob("loadArea").innerHTML;
	fader(ob('promochange'),100);
	fader(ob('loadArea'),0);
	ob("loadArea").style.display="none";
	if (topauto) topBuildTimer=setTimeout("buildTop(null)",5000);
}
function fadeBackground(alpha) {
	if (backdrop=ob("backgroundfade")) {
	}else{
		ins="<div id='backgroundfade'></div>";
		if (!(dest=ob("overlays"))) dest=document.body;
		pRH(ins,dest);
		backdrop=ob("backgroundfade");
	}
	fadeObject.fade(backdrop,0,alpha,5,null);
}
function loseBackground(alpha) {
	if (backdrop=ob("backgroundfade")) fadeObject.fade(backdrop,alpha,0,10,'lostBackground()');
}
function lostBackground() {
	removeTheNode("backgroundfade");
}
function pRH(theHTML,destinationObj) {
    var hiddenArea=null;
    if (ob("ParseArea")==null) {
        hiddenArea=document.createElement("div");
        hiddenArea.style.display="none";
        hiddenArea.ID="ParseArea";
    } else {
        hiddenArea = ob("ParseArea");
    }
    hiddenArea.innerHTML=theHTML;
    for (c=0;c<hiddenArea.childNodes.length;c++) destinationObj.appendChild(hiddenArea.childNodes[c]);
    hiddenArea.innerHTML="";
}
function cO(obj) {
    scr=getScrollXY();
	if (getStyle(obj,'position')=="fixed") scr=[0,0];
    wh = getWindowHeight();
    t=(obj.clientHeight>wh)?scr[1]:((wh-obj.clientHeight)/2)+scr[1];
    if (t<10) t=10;
    l=((document.body.offsetWidth-obj.clientWidth)/2);
    if (l<0) l=0;
	l+=scr[0];
    obj.style.left=l+"px";
    obj.style.top=t+"px";
}
function getWindowHeight() {
    dims=windowDims();
	return dims[1];
} 
function getWindowWidth() {
    dims=windowDims();
	return dims[0];
} 
function windowDims() {
    var myWidth=myHeight=0;
    if(typeof(window.innerWidth)=='number'){myWidth=window.innerWidth;myHeight=window.innerHeight;}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){myWidth=document.documentElement.clientWidth;myHeight=document.documentElement.clientHeight;}else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){myWidth=document.body.clientWidth;myHeight=document.body.clientHeight;}
    return [myWidth,myHeight];
}
function removeTheNode(idname) {
	if (typeof(idname)=="string") {
		if (ob(idname)!=null) {
			thisNode=ob(idname);
			thisNode.parentNode.removeChild(thisNode);
		}
	}else{
		idname.parentNode.removeChild(idname);
	}
}

function validateInput(srcObj,type) {
	op=true;
	if (regex=validators[type]["regex"]) {
		rg=new RegExp(regex);
		if(rg.test(srcObj.value)) {
			srcObj.className="ok";
		}else{
			srcObj.className="fail";
			op=false;
		}
	}else{
		srcObj.className="ok";
	}
	var errmsg='';
	if (!op) {
		errmsg=validators[type]["errmsg"];
	}
	if (err=ob(srcObj.id+"alert")) {
		err.innerHTML=errmsg;
		err.style.display=(errmsg=="")?"none":"block";
	}
	return op;
}
function confirmInput(srcObj,ip) {
	var op=validateInput(ob(ip),"password");
	if (op && srcObj.value!=ob(ip).value) {
		srcObj.className="fail";
		op=false;
	}else{
		srcObj.className='';
	}
	var errmsg='';
	if (!op) errmsg="Does not match";
	if (err=ob(srcObj.id+"alert")) {
		if (errmsg=="") {
			err.style.display="none";
		}else{
			err.style.display="block";
			err.innerHTML=errmsg;
		}
	}
	return op;
}
function pressingEnterOrEscape(srcObj,e,enterhandler,escapehandler) {
    if (window.event) {
        e=window.event;
        keycode=window.event.keyCode;
    }else{
        keycode=e.which;
    }
	reply=true;
	if (keycode==13 && enterhandler) {
		eval(enterhandler+"(srcObj)");
		reply=false;
	}
	if (keycode==27 && escapehandler) eval(escapehandler+"()");
	return reply;
}
function gotoStrippedURL() {
	var url=window.location.href.replace(/\?.*$/,'');
	window.location=url;
}
function requestNewsLetter() {
	if (validateInput(ob("Newsletter_name"),"dorequire") && validateInput(ob("Newsletter_email"),"email")) {
		var vars="cmd=newsletter&email="+ob("Newsletter_email").value+"&name="+ob("Newsletter_name").value;
		sR.post("/",vars,requestedNewsLetter);
	}
}
function requestedNewsLetter(reply) {
	var com='';
	switch(reply) {
		case "exists":
			com=ob("Newsletter_email").value+" is already registered";
			break;
		case "signedup":
			com=ob("Newsletter_email").value+" is now registered for our mailing list";
			ob("Newsletter_name").value='Name';
			ob("Newsletter_email").value='Email address';
			break;
		case "error":
			com="There has been an error on the system";
			break;
		default:
			com="There has been an error on the system";
			break;
	}
	ob("newslettercomment").innerHTML=com;
	if (ob('newsletterreply').style.display=="none") {
			fadeObject.fade(ob('newsletterreply'),0,70,5,null);
	}
}
function hideNLComment() {
	ob('newsletterreply').style.display="none";
}
function submitContact() {
	if (ob("contactsubmitbutton").className=="bigbuynow") {
		if (validateInput(ob("contactwhere"),"dorequire") && validateInput(ob("contactfirstname"),"dorequire") && validateInput(ob("contactlastname"),"dorequire") && validateInput(ob("contactemail"),"email")) {
			var vars="cmd=contactus&email="+encodeUpload(ob("contactemail").value)+"&name="+encodeUpload(ob("contactfirstname").value)+" "+encodeUpload(ob("contactlastname").value)+"&salutation="+ob("contactsalutation").value+"&address="+encodeUpload(ob("contactaddress").value)+"&telephone="+encodeUpload(ob("contacttelephone").value)+"&school="+encodeUpload(ob("contactorganisation").value)+"&enquiry="+encodeUpload(ob("contactenquiry").value)+"&where="+encodeUpload(ob("contactwhere").value);
			ob("contactsubmitbutton").innerHTML="sending...";
			ob("contactsubmitbutton").className="bigwait";
			//contactedus("");
			sR.post("/",vars,contactedus);
		}
	}
}
function contactedus(reply) {
	dropThisMessage("Your message has been sent to Stage on Screen");
	ob("contactsubmitbutton").innerHTML="Submit";
	ob("contactsubmitbutton").className="bigbuynow";
	ob("contactemail").value='';
	ob("contactfirstname").value='';
	ob("contactlastname").value='';
	ob("contactaddress").value='';
	ob("contacttelephone").value='';
	ob("contactorganisation").value='';
	ob("contactenquiry").value='';
}
function encodeUpload(ip) {
	return ip.replace(/&/g,"(amp)").replace(/=/g,"(eq)").replace(/%/g,"(per)").replace(/\+/g,"(plus)").replace(/ /g,"+");
}
function displayMovie(srcObj,container) {
	var obj=images[srcObj.id];
	if(flashobj=swfobject.getObjectById('video_player')) {
		playMovie(obj["source"]);
	}else{
		lightbox.show(srcObj,container);
	}
}
function playMovie(src) {
	var flashobj=swfobject.getObjectById('video_player');
	//if (flashobj===null) alert("No movie player");
	if (flashobj===null) flashobj=swfobject.getObjectById('lb_player');
	flashobj.playMovie(src);
}

function showdialog(title,ins,cmd,width) {
	fadeBackground(50);
	var con="";
	if (title=="") title="Dialog box";
	if (ins===null) ins="<div class='loading' style='width:"+width+"px;height:"+width+"px'></div>";
	con="<div id='dialog' style='width:"+width+"px'><div><div class='content'><div class='dialogtitle'><div class='close' onclick='closeDialog()'></div><span onmousedown='dragObject(event,ob(\"dialog\"),null);return false;' id='dialogtitle'>"+title+"</span></div><div id='dialogContent'>"+ins+"</div></div></div></div>";
	if (!(dest=ob("overlays"))) dest=document.body;
	pRH(con,dest);
	cO(ob("dialog"));
	if (cmd!==null) sR.post('/index.php',cmd,rSC);
}
function closeDialog() {
	fadeObject.fade(ob("dialog"),100,0,5,lostDialog);
	loseBackground(50);
}
function lostDialog() {
	removeTheNode("dialog");
}
function selectedValue(selector) {
	return selector.options[selector.selectedIndex].text;
}
function isIE() {
      return /msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent);
}

