
//  ___________
// |           |____________________________________________________
// |                                                                |
// |    core browser sniffer                                        |
// |________________________________________________________________|
//
ns = document.layers;   // 4.0 < ns < 6.0
ie  = document.all;     // for all internet explorers
              // ie4 only
w3 = document.getElementById; // ie5 and ns6 w3 consortium DOM
ie4 = ie&&!w3; 

if (w3 && !ie){
    ns6 = true;  
	moz = true;
}
else{
    ns6 = false;  
	moz = false;
}

mac=(navigator.userAgent.toLowerCase().indexOf('mac'))!=-1;
ie7 = (navigator.userAgent.toLowerCase().indexOf('msie 7'))!=-1;

//  ____________________________
// |                            |________________________________________________________
// |                                                                                     |
// |   color handling functions                                                          |
// |_____________________________________________________________________________________|
//
HEX_TABLE = new Array("00","01","02","03","04","05","06","07","08","09","0A","0B","0C","0D","0E","0F","10","11","12","13","14","15","16","17","18","19","1A","1B","1C","1D","1E","1F","20","21","22","23","24","25","26","27","28","29","2A","2B","2C","2D","2E","2F","30","31","32","33","34","35","36","37","38","39","3A","3B","3C","3D","3E","3F","40","41","42","43","44","45","46","47","48","49","4A","4B","4C","4D","4E","4F","50","51","52","53","54","55","56","57","58","59","5A","5B","5C","5D","5E","5F","60","61","62","63","64","65","66","67","68","69","6A","6B","6C","6D","6E","6F","70","71","72","73","74","75","76","77","78","79","7A","7B","7C","7D","7E","7F","80","81","82","83","84","85","86","87","88","89","8A","8B","8C","8D","8E","8F","90","91","92","93","94","95","96","97","98","99","9A","9B","9C","9D","9E","9F","A0","A1","A2","A3","A4","A5","A6","A7","A8","A9","AA","AB","AC","AD","AE","AF","B0","B1","B2","B3","B4","B5","B6","B7","B8","B9","BA","blog","BC","BD","BE","BF","C0","C1","C2","C3","C4","C5","C6","C7","C8","C9","CA","CB","CC","CD","CE","CF","D0","D1","D2","D3","D4","D5","D6","D7","D8","D9","DA","DB","DC","DD","DE","DF","E0","E1","E2","E3","E4","E5","E6","E7","E8","E9","EA","EB","EC","ED","EE","EF","F0","F1","F2","F3","F4","F5","F6","F7","F8","F9","FA","FB","FC","FD","FE","FF");
DEC_TABLE = new Array();
DEC_TABLE['0'] = 0;DEC_TABLE['1'] = 1;DEC_TABLE['2'] = 2;DEC_TABLE['3'] = 3;DEC_TABLE['4'] = 4;DEC_TABLE['5'] = 5;DEC_TABLE['6'] = 6;DEC_TABLE['7'] = 7;DEC_TABLE['8'] = 8;DEC_TABLE['9'] = 9;DEC_TABLE['A'] = 10;DEC_TABLE['B'] = 11;DEC_TABLE['C'] = 12;DEC_TABLE['D'] = 13;DEC_TABLE['E'] = 14;DEC_TABLE['F'] = 15;

function Color(r,g,b)
{
	this.r=r;
	this.g=g;
	this.b=b;
	//this.a=255;
}
function getHexColor(r,g,b)
{
	//alert(r+" "+g+" "+b);
	return '#'+HEX_TABLE[r]+HEX_TABLE[g]+HEX_TABLE[b];
}
function getRGB(hex)
{	
	hex = hex.toUpperCase()
	hex = hex.replace("#","");
	r = DEC_TABLE[hex.substr(0,1)]*16+DEC_TABLE[hex.substr(1,1)];
	g = DEC_TABLE[hex.substr(2,1)]*16+DEC_TABLE[hex.substr(3,1)];
	b = DEC_TABLE[hex.substr(4,1)]*16+DEC_TABLE[hex.substr(5,1)];
	return new Color(r,g,b);
}
function fixPNG(imgObj)
{   

	imgObj.onload=function rien(){};
	if(ie7) return;
	if (ie&&!mac)
	{
		w=imgObj.width;h=imgObj.height;
		imgObj.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ imgObj.src+  "',sizingMethod='scale')";
		imgObj.src="/images/clear.gif";
		imgObj.style.width=w;
		imgObj.style.height=h;
	}
	imgObj.style.visibility="inherit";
	
}
cmo_counter=0;
i_mover = new Array();
i_mout  = new Array();
function createMouseOver(imageObject,moverSrc)
{
		if(imageObject.name)
			imageObject.id = imageObject.name
		else if (imageObject.id){
			imageObject.name = imageObject.id;
		}
		imageObject.index = cmo_counter;
		imageObject.selected = false;
		i_mover[cmo_counter]=new Image();i_mover[cmo_counter].src=moverSrc;
		i_mout[cmo_counter]=new Image();i_mout[cmo_counter].src=imageObject.src;
		imageObject.onmouseover=function cmo_over(){this.src=i_mover[this.index].src}
		imageObject.onmouseout=function cmo_out(){if(!this.selected)this.src=i_mout[this.index].src}
		cmo_counter++;
		//alert(cmo_counter)
		//alert(imageObject.index+" "+i_mover[imageObject.index].src+" "+i_mout[imageObject.index].src+" ");
		imageObject.onload="";
}	
//  ___________
// |           |____________________________________________________
// |                                                                |
// |   core cross-browser interfaces                               |
// |________________________________________________________________|
//
function clipLayer(layerRef,x,y,w,h)
{	if (typeof layerRef=='string')
		layerRef=getStyle(layerRef);
    if(ns)
    {   
        layerRef.clip.top=y;
        layerRef.clip.left=x;
        layerRef.clip.height=h;
        layerRef.clip.width=w;
        
    }else{  
        layerRef.clip = "rect("+y+"px "+(x+w)+"px "+(y+h)+"px "+x+")";      
    }
    
}
function getLayer(id)
{
    if(w3)
        return document.getElementById(id);
    if(ie)  
        return document.all[id];
}
function getHeight(id)
{
	 if (typeof id == 'object')  
		obj = id;
	 else
		obj = getLayer(id);
	 if(w3||ie)
        return obj.offsetHeight;
}
function getWidth(id)
{    
	 if (typeof id == 'object')  
		obj = id;
	 else
		obj = getLayer(id);
	 if(w3||ie)
        return obj.offsetWidth;
}
function getStyle(id)
{  
    if (typeof id == 'object')  
		obj = id;
	else
		obj = getLayer(id);
	
	if(w3||ie)
		return obj.style;
    
}
function setOpacity(styleobj,opacity)
{
	if(ie)
	{
		if(opacity==1)
		styleobj.filter="";
		else
		styleobj.filter="alpha(opacity="+opacity*100+")";
		
	}
	if(w3)
		styleobj.MozOpacity=opacity;

}
function getCssStyle(rule)
	{
		
		for(i=0;i<document.styleSheets.length;i++)
		{
		 	//alert(i)
			jj=(ie)?document.styleSheets[i].rules.length : document.styleSheets[i].cssRules.length
			for(j=0;j<jj;j++)
			{
				//alert(j)
				sel = (ie)?document.styleSheets[i].rules[j].selectorText:
						  document.styleSheets[i].cssRules[j].selectorText
						 // alert(sel)
				if (sel=='.'+rule)
					{
					
					styl = ((ie)?document.styleSheets[i].rules[j].style:
						  document.styleSheets[i].cssRules[j].style)
						  
				    //alert(b+'asdasd');
					
					return styl;
					}
			}
		}
		return false;
	}
function getCssProperty(clss,property)
{
	//alert(clss,property);
	var sty = getCssStyle(clss);
	//alert(clss+'is '+sty);
	return eval("sty."+property);
}
function delegateEvent(object,event,targetInstance,targetMethod)
{
	obj = targetInstance ? targetInstance.id+".":"";
	delegate = new Function(obj+targetMethod+"();"); 
	if(ie)
	{
		
		eval(object.id+"."+"on"+event+" = delegate");
	}
	if(moz)
	{
		object.addEventListener(event,delegate,false);
	}

}
function makeChild(ParentNode,type,id,html,cssClass,width,height,x,y)
	{ 
     if(w3)
	    {   
		//alert(id);
	        el = document.createElement(type);
	        el.id =id;
			el.className = cssClass;
			if (width && width!="auto")
	        	el.style.width = width+"px";
	        else if (width=="auto")
	        	el.style.width = getCssProperty(cssClass,'width');
			if (height && height!="auto"){
				el.style.height = height+"px";
				
				}
			else if (height=="auto")
				el.style.height = getCssProperty(cssClass,'height');
			if(y || y === 0)
				el.style.top = y+"px";
			if(x || x === 0)
				el.style.left = x+"px";
			//adjustBoxModel(el)
	        el.style.position ="absolute";
	        el.style.visibility = "inherit";
	        if(html)
	        el.innerHTML = html;
			if (!ParentNode)
				ParentNode = document.body;
	        ParentNode.appendChild(el);
			
			//alert(ParentNode.id);
	        return el;
	    }
	
	}
function makeButton(ParentNode,id,css,x,y)
{
	el = document.createElement("img");
	el.id=id;
	el.className = css;
	src = getCssProperty(css,"backgroundImage");
	//alert(css+" "+src);
	src = src.replace(/url[(]/,"");
	src = src.replace(/[)]/,"");
	el.src = src;
	el.style.backgroundImage="";
	el.style.position ="absolute";
	el.style.visibility = "inherit";
	if(y)
		el.style.top = y+"px";
	if(x)
		el.style.left = x+"px";
	if (!ParentNode)
		ParentNode = document.body;
	ParentNode.appendChild(el);
	return el;
	
}
function getInnerWidth(obj)
{
	//alert(obj.id)
	cn = obj.className
	bw = parseInt(getCssProperty(cn,"borderWidth"));
	blw = parseInt(getCssProperty(cn,"borderLeftWidth"));
	brw = parseInt(getCssProperty(cn,"borderRightWidth"));
	if (isNaN(bw))bw=0;
	if(isNaN(blw))blw=0;
	if(isNaN(brw))brw=0;
	if(blw+brw>bw*2)
		bw = blw+brw;
	//alert(obj.id+" "+obj.className+" bw:"+bw+" bl"+blw+" br:"+brw);
	return obj.offsetWidth- bw;
}
function getInnerHeight(obj)
{
	cn = obj.className
	bw = parseInt(getCssProperty(cn,"borderWidth"));
	blw = parseInt(getCssProperty(cn,"borderTopWidth"));
	brw = parseInt(getCssProperty(cn,"borderBottomWidth"));
	if (isNaN(bw))bw=0;
	if(isNaN(blw))blw=0;
	if(isNaN(brw))brw=0;
	if(blw+brw>bw*2)
		bw = blw+brw;
	//alert(obj.id+" "+obj.className+" bw:"+bw+" bl"+blw+" br:"+brw);
	return obj.offsetHeight - bw;
}
function adjustBoxModel(obj)
{
	var w,h,cl,st,btw,blogw,blw,brw,bw,hw,vw;
	cl = obj.className;
	st = getCssStyle(cl);
	w = obj.style.width? parseInt(obj.style.width) : parseInt(st.width);
	h = obj.style.height? parseInt(obj.style.height) : parseInt(st.height);
	btw = parseInt(st.borderTopWidth);
	blogw = parseInt(st.borderBottomWidth);
	blw = parseInt(st.borderLeftWidth);
	brw = parseInt(st.borderRightWidth);
	bw = parseInt(st.borderWidth);
	pw = parseInt(st.padding);
	tpw = parseInt(st.paddingTop);
	
	nw = w;
	nh = h;
	
	if(moz)
	{
		
			nw -= 2*bw;
			nh -= 2*bw;
			
			nh += (bw-btw) + (bw-blogw);
			nw += (bw-blw) + (bw-brw);
			
		obj.style.width =nw+"px";
		obj.style.height =nh+"px"
	}
	
}
function getPageTop(obj)
{
	t =obj.offsetTop;
	while(obj.offsetParent)
	{
		obj = obj.offsetParent;
		t+= obj.offsetTop;
		//alert(obj.nodeName+" "+t);
	}
	
	return t;
	
	
}
function getPageLeft(obj)
{
	L =obj.offsetLeft;
	while(obj.offsetParent)
	{
		obj = obj.offsetParent;
		L+= obj.offsetLeft;
	}
	//alert(L);
	return L;
}
//  ___________
// |           |____________________________________________________
// |                                                                |
// |   screen dimension object                                      |
// |________________________________________________________________|
//
function ScreenMetrics(minx,miny)
    {
	   
         if (ns||ns6){
          this.w=(self.innerWidth>minx) ? self.innerWidth : minx;
          this.h=(self.innerHeight>miny) ? self.innerHeight : miny;      
       }
       if (ie){
           this.w=(document.body.clientWidth>minx) ? document.body.clientWidth : minx;
           this.h=(document.body.clientHeight>miny) ? document.body.clientHeight : miny;          
       }
       this.mx = this.w/2 ;
       this.my = this.h/2 ;
    }
	

 // ____________________________
// |                            |________________________________________________________
// |                                                                                     |
// |    base Object -- put in totally common things here                                 |
// |_____________________________________________________________________________________|
//
	function BaseObject(id)
	{
		
		//this.canvas=null;
	
	}
//  ___________
// |           |____________________________________________________
// |                                                                |
// |     Sprite object                                              |
// |________________________________________________________________|
//
// 

Algorithms = new Object();
Algorithms.linear = function _linear(distance,duration,startTime,now){
	if(!now) now = new Date().getTime();
	return distance * (now-startTime)/duration;
}
Algorithms.startSlowEndSlow = function _sses(distance,duration,startTime,now)
{	
	if(!now) now = new Date().getTime();
	ratio =(now-startTime)/duration;
	//alert(ratio);
	//return distance * Math.log(ratio*(Math.E-1)+1);
	if(ratio <=0.5)
	return distance/2 - distance/2 * Math.cos(Math.PI/2*(ratio/0.5));
	else
	{
	ratio-=0.5;
	return distance/2  + distance/2 * Math.sin(Math.PI/2*(ratio/0.5));
	}
			

}
//  ___________
// |           |____________________________________________________
// |                                                                |
// |     Sprite object                                              |
// |________________________________________________________________|
//
// 

function Sprite(name,id)
{
	//this.id = id;
	this.clss ="BaseObject";			
	this.busy = false;			// something like a mutex
	this.timeInterval = null;		// each object's timeout handle
	this.doInit = true;			// set to false when overriding a constructor's
	this.toString = function bs_tStr(){return this.clss+"=>id:"+this.id}				
	this.x=0;					
	this.y=0;
	this.xOffset=0;
	this.yOffset=0;
    this.id=name;
	this.children = new Array();
	this.content = id;
	this.isMoving= false;
	if (id == null){
		
		this.node = makeChild(document.body,"div",name+"canvas","","",0,0,0,0)
		//alert(this.node.style.position)
		this.node.style.visibility="hidden";
		//alert(this.node.id);
		//alert(this.node.style.position);
		this.h=0;
		this.w=0;
	}
	else{
		this.node = document.getElementById(id);
		this.h = getHeight(id);
		this.w = getWidth(id);
	}
    this.canvas=this.node.style;

    this.Move = SpriteMove;
    this.iMove = recurSpriteMove;
    this.hide = base_hide;
    this.show = base_show;
    this.setXY = base_setXY;
	this.setSize = base_setSize;
    this.stack =0;
	this.update = baseUpdate;
	this.algorithm = Algorithms.startSlowEndSlow;
	ImplementFade(this);
	ImplementXmlLoad(this);
	ImplementScale(this);

}
function baseUpdate(html)
{
	this.node.innerHTML=html;
	if(this.doLayout)
		this.doLayout();
}  
function SpriteMove(xdis,ydis,ms)
 { 
 
 	  this.canvas.position="absolute";
	  if (this.isMoving==true)
	  	return;
	  this.isMoving=true;
	  this.iMove(this.x,this.y,xdis,ydis,ms,(new Date()).getTime())//calls recursive function
 }   
function recurSpriteMove(ox,oy,xdis,ydis,ms,FatherTime)
{ 
   now = (new Date()).getTime(); 
   ratio = (now - FatherTime)/ms
   if (ratio >= 1)
   {
	   this.setXY(ox+xdis,oy+ydis)
	   this.x=ox+xdis;this.y=oy+ydis;
	   this.isMoving=false;
	   return
   }
   else{  
    this.setXY(ox+this.algorithm(xdis,ms,FatherTime,now),oy+this.algorithm(ydis,ms,FatherTime,now));
    wastedTime = (new Date()).getTime() - now;
	wastedTime = wastedTime < 30 ? 30:wastedTime;
    this.stack=setTimeout(this.id+'.iMove('+ox+','+oy+','+xdis+','+ydis+','+ms+','+FatherTime+')',wastedTime);
   }
}
function base_hide(){
  	this.canvas.visibility="hidden";
	this.visible= false;
}
function base_show(){
  	this.canvas.visibility="visible";
	this.visible = true;
}  
function base_setXY(x,y,v)
{
		if(typeof(x)=="number")this.x  =x;
		if(typeof(y)=="number")this.y =y;
		this.canvas.top = this.y+this.yOffset+"px";
		this.canvas.left = this.x+this.xOffset+"px";
		if(v)
			this.show();
		//if (dbg&&this.layer.length) dbg.printLn(this.id+'layer[0].top='+this.layer[0].top);
		
}
function base_setSize(w,h,boolSuspendLayout)
{	this.w=w;this.h=h;
	this.canvas.width = w+ (isNaN(w)?'':"px");
	this.canvas.height = h + (isNaN(h)?'':"px");
	if(this.doLayout&&!boolSuspendLayout)
		this.doLayout();

}

function ImplementFade(SpriteObject)
	{
		SpriteObject.fadeTimeout = null;
		SpriteObject.opacity=0;
		SpriteObject.fadeTo = IF_fadeTo;
		SpriteObject._fade = IF_fade;
		SpriteObject.setOpacity=IF_setOpacity;
	
		function IF_fadeTo(percent,duration)
		{
			if(this.opacity==0 || this.visible ==false)
			{
				//alert(
				this.setOpacity(0);
				this.show();
			}
			if(this.fadeTimeout)
				clearTimeout(this.fadeTimeout);
			this._fade(this.opacity,percent,new Date().getTime(),duration)
		}
		
		function IF_fade(startPercent, endPercent, startTime, duration )
		{
			now= new Date().getTime();
			ratio = (now-startTime)/duration;
			//alert(ratio)
			if(ratio>=1)
			{
				this.setOpacity(endPercent)
				//if(ie) this.filter="alpha(opacity:100)";
				//if(moz) this.MozOpacity=1;
				return;
			}
			else
			{
				op = startPercent + this.algorithm(endPercent-startPercent,duration,startTime,now);
				this.setOpacity(op);
				rnow=new Date().getTime();
				this.fadeTimeout = setTimeout(this.id+"._fade("+startPercent+","+endPercent+","+startTime+","+duration+")", rnow-now + 30);
			
			}
		}
		function IF_setOpacity(opacity)
		{
			//alert(opacity);
			this.opacity=opacity;
			if(ie)
				this.canvas.filter="alpha(opacity="+(opacity*100)+")";
			if(moz)
				this.canvas.MozOpacity = opacity;
		
		}
	}
	function ImplementScale(SpriteObject)
	{
		
		SpriteObject.original = SpriteObject.node.cloneNode(true);
		SpriteObject.imageElements = Array();
		SpriteObject.imageElements = SpriteObject.node.getElementsByTagName("img");
		SpriteObject.all = SpriteObject.node.getElementsByTagName("*");
		SpriteObject.originalAll = new Array();
		//SpriteObject.iMove=recurSpriteMoveCos;
		for(i=0;i<SpriteObject.all.length;i++)
		{
			SpriteObject.originalAll[i] = SpriteObject.all[i].cloneNode(true);
		
		}
		SpriteObject.imageWidths = new Array();
		SpriteObject.imageHeights = new Array();
		for(i=0;i<SpriteObject.imageElements.length;i++)
		{
			SpriteObject.imageWidths[i]=SpriteObject.imageElements[i].width;
			SpriteObject.imageHeights[i]=SpriteObject.imageElements[i].height;
			
		}
		SpriteObject.scaleFactor=1;
		SpriteObject.originalw =SpriteObject.w;
		SpriteObject.originalh=SpriteObject.h;
		SpriteObject.scale = IS_scale;
		SpriteObject.grow = IS_grow;
		SpriteObject._grow = IS_rGrow;
		//SpriteObject._growTo = so_rGrowTo;
	
	}
	function IS_grow(anchorpoint,endFactor,duration)
	{
		if(this.scaleTimeout)
			clearTimeout(this.scaleTimeout);
		this._grow(anchorpoint,this.scaleFactor,endFactor,new Date().getTime(),duration)
		
	}
	function IS_rGrow(anchorpoint,startFactor,endFactor,startTime,duration)
	{
		
		now=new Date().getTime();
		ratio = (now - startTime)/duration;
		if(ratio>=1)
		{
			this.scale(endFactor,anchorpoint);
			this.scaleTimeout=null;
			return;
		}
		newfactor =  startFactor + this.algorithm(endFactor-startFactor,duration,startTime,now);
		this.scale(newfactor,anchorpoint);
		this.scaleTimeout = setTimeout;
		elapsed = new Date().getTime() - now;
		this.scaleTimeout = setTimeout(this.id+"._grow('"+anchorpoint+"',"+startFactor+","+endFactor+","+startTime+","+duration+")",elapsed+20);
		

	
	}
	function IS_scale(factor,anchorpoint)
	{
		
		nw = Math.round(this.originalw * factor);
		nh = Math.round(this.originalh *factor);
		dw = nw-this.w;
		dh = nh-this.h;
		s=anchorpoint.toLowerCase();
		//alert(s);
		switch(s)
		{
			
			case "center" :
				ny=this.y-dh/2;
				nx=this.x=dw/2;
				break;
			case "tr" :
				ny=this.y;
				nx=this.x-dw;
				break;
			case "bl" :
				ny = this.y-dh;
				nx = this.x;
				break;
			case "br" :
				nx = this.x-dw;
				ny = this.y-dh;
				break;
			case "tl" :
			default :
				nx= this.x;
				ny= this.y;
		
		
		
		}

		//alert(nh);
		this.canvas.width=nw+"px";
		this.canvas.height=nh+"px";
		this.canvas.top = ny+"px";
		this.canvas.left = nx+"px";
		this.scaleFactor = factor;
		fs = Math.round(12*(factor));
		if (fs<4) fs=4;
		this.canvas.fontSize = fs+"px";
		this.canvas.lineHeight = Math.round(12*factor*6/5)+"px";
		for(i=0;i<this.imageElements.length;i++)
		{
			this.imageElements[i].width = Math.round(this.imageWidths[i]*factor);
			this.imageElements[i].height = Math.round(this.imageHeights[i]*factor);
		}
		for(i=0;i<this.originalAll.length;i++)
		{
			//alert(parseInt(this.originalAll[i].style.margin)*factor);
			if(!isNaN(parseInt(this.originalAll[i].style.padding)))
			this.all[i].style.padding = Math.round(parseInt(this.originalAll[i].style.padding)*factor)+"px";
			if(!isNaN(parseInt(this.originalAll[i].style.margin)))
			this.all[i].style.margin = Math.round(parseInt(this.originalAll[i].style.margin)*factor)+"px";
		}
	}
    function LoadXml(url,query) {

        if (window.XMLHttpRequest) { // Mozilla, Safari,...
            this.HttpRequest = new XMLHttpRequest();
            if (this.HttpRequest.overrideMimeType) {
                this.HttpRequest.overrideMimeType('text/xml');
                // See note below about this line
            }
        } else if (window.ActiveXObject) { // IE
            try {
                this.HttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    this.HttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }

        if (!this.HttpRequest) {
            alert('Giving up :( Cannot create an XMLHTTP instance');
            return false;
        }
        this.HttpRequest.onreadystatechange = new Function ( this.id+".XmlResponse();");
        this.HttpRequest.open('POST', url, true);
        this.HttpRequest.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		this.HttpRequest.setRequestHeader('Accept-Encoding','multi-part/form-data');
        this.HttpRequest.send(query);

    }

    function LoadXmlResponse() {

        if (this.HttpRequest.readyState == 4) {
            if (this.HttpRequest.status == 200) {
				//alert(this.HttpRequest.responseText);
                this.XmlDoc = this.HttpRequest.responseXML;
				this.onXmlLoad();
			//	alert(this.HttpRequest.responseText);
				if(this.parent)
				{
					try{
						this.parent.onChildLoad(this);
					}catch(e){alert(e)}
				}
            } else {
               
            }
        }

    }
	function ImplementXmlLoad(obj)
	{
		obj.HttpRequest=null;
		obj.XmlDoc =null;
		obj.loadXml = LoadXml;
		obj.XmlResponse = LoadXmlResponse;
		obj.onXmlLoad = function default_onXmlLoad()
			{
			
				if(this.update)
				this.update(this.HttpRequest.responseText);
				else if(this.innerHTML)
							this.innerHTML = this.HttpRequest.responseText
					
			}
		return obj;
	}
	
function Box(id,content,css,w,h)
{
 this.inherit = Sprite;
 this.inherit(id,content); 
 this.busy = false;
 this.w=w;this.w=h;
 this.node.className=css;
 this.grow=grow;
 this.regrow=regrow;
 this.setSize(w,h);    
}


function grow(width,height,time,xoff,yoff)
{
     ft= (new Date()).getTime();
	 this.busy=true;
	 this.regrow(ft,time,width,height,xoff,yoff)
    
}
function regrow(fatherTime,ms,width,height,xoff,yoff)
{

   now = (new Date()).getTime(); // get now to calculate
   ratio = (now - fatherTime)/ ms;  
   if (ratio >= 1) 
   { 
    this.canvas.width = width+"px"; 
    this.canvas.height = height+"px"; 
	this.w = width;
	this.h = height;
	this.x = this.x + xoff;
	this.y = this.y + yoff;
	this.xOffset=0;
	this.yOffset=0;
	this.setXY();
	this.busy=false;
    return;
   } 
    adjr = this.algorithm(1,ms,fatherTime,now);
    this.canvas.width = parseInt(this.w+(width-this.w)*adjr)+"px";
    this.canvas.height = parseInt(this.h+(height-this.h)*adjr)+"px";
	this.yOffset = parseInt(yoff*adjr);
	this.xOffset = parseInt(xoff*adjr);
	this.setXY();
    wastedTime = (new Date()).getTime()-now;
   	setTimeout(this.id+".regrow("+fatherTime+","+ms+","+width+","+height+","+xoff+","+yoff+")",25+wastedTime);
   
}

////////////////////////////////////////////////////////////////////
/// DOM_BASED ANIMATION FUNCTIONS
////////////////////////////////////////////////////////////////////

// these functions, unlike the GUI system are meant to create effects using
// animations, much like the sprite, but for simple HTML elements, not
// for complex objects
function highlight(divid,startColor,endColor,duration)
		{
			//alert(divid);
		//	document.getElementById("star").style.visibility="hidden";
			if(typeof divid=='object')
				node=divid;
			else
				node = getLayer(divid);
			node.divID = divid;
			if(!node.hightlight)
			{
				node.highlight = _highlight;
			}
			//alert(startColor);
			node.startColor = getRGB(startColor);
			//alert(node.startColor.r+" "+node.startColor.g+" "+node.startColor.b);
			//alert(node.endColor);
			//alert(endColor)
			node.endColor = getRGB(endColor);
			//alert(node.endColor.r+" "+node.endColor.g+" "+node.endColor.b);
			node.highlight(duration,(new Date()).getTime());
		}
		function _highlight(duration,fatherTime)
		{
			//alert(this.divID)
			now = new Date().getTime();
			if(now>=fatherTime+duration)
			{
				this.style.backgroundColor=getHexColor(this.endColor.r,this.endColor.g,this.endColor.b);
			}
			else{
				ratio= (now-fatherTime)/(duration);
				nr = parseInt(this.startColor.r + (this.endColor.r-this.startColor.r)*ratio);
				ng = parseInt(this.startColor.g + (this.endColor.g-this.startColor.g)*ratio);
				nb = parseInt(this.startColor.b + (this.endColor.b-this.startColor.b)*ratio);
				this.style.backgroundColor=getHexColor(nr,ng,nb);
				//alert(getHexColor(nr,ng,nb)+" "+ratio)
				now2 = new Date().getTime();
				delay = now2-now >20 ? now2-now:20;
				setTimeout("getLayer('"+this.divID+"').highlight("+duration+","+fatherTime+")",delay);
			}
		}
