
/* Copyright 2001-2004 Lampyrine Studions, NilsOlof Önning */

document.outhtml = '';
// [minx,miny,maxx,maxy],
// [id,[X(left,center,width,right),overflow(scroll,hidden,visible),xval(fromxpos,deltafromcenter,fromxpos,fromrightpos),xval(width,width,fromrightpos,width)],
// [Y(top,middle,height,bottom),overflow(scroll,hidden,visible),yval(fromtoppos,deltafrommiddle,fromtoppos,frombottompos),yval(height,height,frombottompos,height)]]
document.setSize = function(oneposarr)
{
	this.update = function(width,height)
	{
		if ((this.obj.tagName=='IFRAME'))
		{
			width += 15;
			height += 15;
		}
		if (parseInt(this.parentid)) 
		{
			this.parentpos = document.setSizes.ids[this.parentid].posandsize();
			width = parseInt(this.parentpos[2]);
			height = parseInt(this.parentpos[3]);
		} 
		else 
			this.parentpos = [0,0];
	  this.obj.style.left = (eval(this.left.replace('width',width))+parseInt(this.parentpos[0]))+'px'; 
		this.obj.style.top = (eval(this.top.replace('height',height))+parseInt(this.parentpos[1]))+'px'; 
		this.obj.style.width = eval(this.width.replace('width',width))+'px'; 
		this.obj.style.height = eval(this.height.replace('height',height))+'px'; 
	}
	this.posandsize = function()
	{
		if (!this.obj.style.left)
			this.update(document.setSizes.cswidth,document.setSizes.csheight);
		return [this.obj.style.left,this.obj.style.top,this.obj.style.width,this.obj.style.height]; 		
	}
	this.change = function(oneposarr)
	{
		this.vars = oneposarr.split('¤');
		this.parentid = parseInt(this.vars[5]);
		this.set();
		this.update(document.setSizes.cswidth,document.setSizes.csheight);
	}
	this.set = function()
	{
		this.obj.style.position = 'absolute';
		this.obj.style.zIndex = this.vars[4];
		if (this.vars[2])
			this.x = this.vars[2].split(',')
		else
			this.x = [0,0,0,0];
		if (this.vars[3])
			this.y = this.vars[3].split(',')
		else
			this.y = [0,0,0,0];
		this.overflow = ['scroll','hidden','visible','auto'];
		this.obj.style.overflow = this.overflow[this.x[0]];
		switch (parseInt(this.x[1])) 
		{ 
		   	case 0: 
				this.left = ''+this.x[2];
				this.width = ''+this.x[3];
			break; 
		   	case 1: 
				this.left = 'parseInt(width/2)-parseInt('+this.x[3]+'/2)+('+this.x[2]+')';
				this.width = ''+this.x[3];
		      	break; 
		   	case 2: 
				this.left = ''+this.x[2];
				this.width = 'width-('+(parseInt(this.x[3])+parseInt(this.x[2]))+')';
		      	break; 
		   	case 3: 
				this.left = 'width-('+(parseInt(this.x[3])+parseInt(this.x[2]))+')';
				this.width = ''+this.x[3];
		      break; 
		}
		switch (parseInt(this.y[1])) 
		{ 
		   	case 0: 
				this.top = ''+this.y[2];
				this.height = ''+this.y[3];
			break; 
		   	case 1: 
				this.top = 'parseInt(height/2)-parseInt('+this.y[3]+'/2)+('+this.y[2]+')';
				this.height = ''+this.y[3];
		      	break; 
		   	case 2: 
				this.top = ''+this.y[2];
				this.height = 'height-('+(parseInt(this.y[3])+parseInt(this.y[2]))+')';
		      	break; 
		   	case 3: 
				this.top = 'height-('+(parseInt(this.y[3])+parseInt(this.y[2]))+')';
				this.height = ''+this.y[3];
		      	break; 
		}
	}
	this.vars = oneposarr.split('¤');
	this.obj = document.getElementById('container_'+this.vars[1]);
	this.parentid = parseInt(this.vars[5]);
	this.set();		
}
document.setSizes = new function()
{
	this.ind = [];
	this.ids = [];
	this.update = function()
	{
		if (this.timer)
			clearTimeout(this.timer);
		this.timer = setTimeout('document.setSizes.updatedo()',50);
	}
	this.checksize = function()
	{
		if (document.documentElement)
		{
			document.documentElement.scrollTop = 10000;
			extraY = (document.documentElement.scrollTop!=10000)?document.documentElement.scrollTop:0;
			document.documentElement.scrollTop = 0;
			document.documentElement.scrollLeft = 10000;
			extraX = (document.documentElement.scrollLeft!=10000)?document.documentElement.scrollLeft:0;
			document.documentElement.scrollLeft = 0;
		}
		else
		{
			document.body.scrollTop = 10000;
			extraY = document.body.scrollTop;
			document.body.scrollTop = 0;
			document.body.scrollLeft = 10000;
			extraX = document.body.scrollLeft;
			document.body.scrollLeft = 0;
		}
		this.cswidth += extraX;
		this.csheight += extraY;
		if (this.cswidth<parseInt(this.maxmin[0][0]))
			this.cswidth = parseInt(this.maxmin[0][0]);
		if (this.csheight<parseInt(this.maxmin[1][0]))
			this.csheight = parseInt(this.maxmin[1][0]);
		for(this.i=1;this.i<this.pos;this.i++)
			this.ind[this.i].update(this.cswidth,this.csheight);
	}
	this.updatedo = function()
	{
		this.cswidth = document.body.clientWidth?parseInt(document.body.clientWidth):self.innerWidth;
		if (!document.all)
			this.cswidth -= 1;
		if (this.cswidth>parseInt(this.maxmin[0][1]))
			this.cswidth = parseInt(this.maxmin[0][1]);
		this.csheight = document.body.clientHeight?parseInt(document.body.clientHeight):self.innerHeight;
		if (!this.csheight)
			this.csheight = document.documentElement.offsetHeight;
		if (!this.cswidth)
			this.cswidth = document.documentElement.offsetWidth;
		if (!document.all)
			this.csheight -= 1;
		if (this.csheight>parseInt(this.maxmin[1][1]))
			this.csheight = parseInt(this.maxmin[1][1]);
		for(this.i=1;this.i<this.pos;this.i++)
			this.ind[this.i].update(this.cswidth,this.csheight);
		this.timer = setTimeout('document.setSizes.checksize()',100);
	}
	this.init = function()
	{
		if ((document.posarray)&&(document.posarray[1]))
		{
			this.pos = document.posarray[1].length;
			this.maxmin = document.posarray[1][0].split('¤');
			this.maxmin = [this.maxmin[2].split(','),this.maxmin[3].split(',')];
			for(this.i=1;this.i<this.pos;this.i++)
			{
				this.ind[this.i] = new document.setSize(document.posarray[1][this.i]);
				this.ids[document.posarray[1][this.i].split('¤')[0]] = this.ind[this.i];
			}
			this.updatedo();
		}
	}
	this.add = function(posarr)
	{
		this.ind[this.pos] = new document.setSize(posarr);
		this.ind[this.pos++].update(this.cswidth,this.csheight);
	}
}
/*
document.init = new function()
{
	this.update = function()
	{
		document.setSizes.update();
		for(this.i=0;this.i<this.pos;this.i++)
			eval(this.ind[this.i]);
	}
	this.add = function(addfunction)
	{
		this.ind[this.pos++] = addfunction;
	}
	this.ind = [];
	this.pos = 0;
}
document.page = new function()
{
	this.pageid = '';
	this.funclist = [];
	this.load = function(pageid)
	{
		if ((pageid == 3)&&(document.user.loggedin))
			this.pageid = 8
		else
			this.pageid = pageid;
		document.dhtmlLoadScript.load(this.pageid,'document.page.continueload()');
	}
	this.continueload = function()
	{
		document.openDIVs.hide();
		document.htmlpage = replacefunc(document.htmlpage,'BR','\n');
		if (this.pageid == 4)
			document.htmlpage = insertTextElement(document.htmlpage,'item',replacelist(getTextElement(document.htmlpage,'item'),document.shopitems,2));
		setinnerHTML(document.htmlpage,'main');
		if (this.pageid == 8)
			document.user.fillform(document.regform);
		if ((this.pageid == 7)&&(document.user.loggedin))
			document.user.fillform(document.contact);	
		if (typeof(this.funclist[this.pageid])=='undefined')
			document.imgnavsel.desel()
		else
			eval(this.funclist[this.pageid]);
	}
	this.addfunc = function(func,pagenr)
	{
		this.funclist[pagenr] = func;
	}
}
*/

document.show = function(id)
{
       	document.getElementById(id).style.display = "block";
       	/* document.getElementById(id).style.visibility = "visible";*/
}
document.hide = function(id)
{
	document.getElementById(id).style.display = "none";
	/*document.getElementById(id).style.visibility = "hidden";*/
}

function setinnerHTML(text,id)
{
	if (document.getElementById)
	{
		x = document.getElementById(id);
		x.innerHTML = '';
		x.innerHTML = text;
	}
	else if (document.all)
	{
		x = document.all[id];
		x.innerHTML = text;
	}
	else if (document.layers)
	{
		/*document.nn4var = text;
		document.layers[id].visibility = "hide";
		document.layers[id].load('loadpage.php?nn4=true',200);alert(document.layers[id].pageX);
		document.layers[id].visibility = "show";*/
		document.layers[id].document.open();
		document.layers[id].document.write(text);
		document.layers[id].document.close();
		
	}
}
function getinnerHTML(id)
{
	if (document.getElementById)
        {
        	x = document.getElementById(id);
                return x.innerHTML;
        }
        else if (document.all)
        {
                x = document.all[id];
                return x.innerHTML;
        }
        else if (document.layers)
       	{
                /*x = document.layers[id];
                //x.document.open();*/
                text = 'fgfg';//x.document.read();
                /*x.document.close();*/
                return text;
        }
}

document.htmlelement = function(htmlid)
{
	this.getvar = function(name,add)
	{
		if (!add) add='';
		regexpen = new RegExp('<[!]--'+name+add+'-->((.|\\\s)*?)<[!]--\\\/'+name+'-->','i')
		avar = this.loop.match(regexpen);
		this.loop = this.loop.replace(regexpen,'');
		if (avar)
			return avar[0].replace(new RegExp('[\\\n]*<[!]--[\\\/]?'+name+'('+add+')?-->[\\\n]*','gi'),'')
		else
			return '';
	}
	
	this.gethtmlsnaps = function(html)
	{
		loopvar = html.match(/<[!]--loop-->((.|\s)*?)<!--\/loop-->/i);
		if(loopvar)
		{
			this.loophtmlnames = ['base','default','condition','first','odd','even','last','else','base2','else'];
			this.out = [];
			this.loopbool = true;
			this.loop = loopvar[0];
			this.condition = this.loop.match(/<[!]--condition\(([0-9a-z]|[|]|[=]|[\.])*\)-->/i);
			if (this.condition)
				this.condition = this.condition[0].replace(/(<[!]--condition\()|(\)-->)/gi,'');
			this.out[2] = this.getvar('condition','\\\(([0-9a-z]|[|]|[=]|[\\\.])*\\\)');
			for (i=3;i<8;i++)
				this.out[i] = this.getvar(this.loophtmlnames[i]);
			this.out[1] = this.loop.replace(/[\n]*<[!]--[\/]?loop-->[\n]*/ig,'');
			html = html.replace(/[\n]*<[!]--loop-->((.|\s)*?)<!--\/loop-->[\s]*/i,'¤¤¤¤').split('¤¤¤¤');
			this.loop = html[1];
			if (html[1])
				this.out[9] = this.getvar('else')
			else
				this.out[9] = '';
			this.out[0] = html[0];
			this.out[8] = this.loop;
		}
		else
		{
			this.loopbool = false;
			this.loop = html;
			this.elsevar = this.getvar('else');
			this.out = [this.loop,'','','','','','',this.elsevar];
		}
		return this.out;
	}	
	
	this.insertvars = function(htmlsnip,elementarray,pos)
	{
		if(!(elementarray)) 
		{
			this.out.push(htmlsnip);
			return htmlsnip;
		}
		names = elementarray[0].split('¤');
		len = names.length;
		if (typeof(elementarray[1])=='object')
			oneelement = elementarray[1][pos].split('¤')
		else
			oneelement = elementarray[1].split('¤');
		for(i=0;i < len;i++)
		{
			if ((names[i]=='html')||(/\x07|\x08|<\/textarea>/i.test(oneelement[i])))
				oneelement[i] = oneelement[i].replace(/\x07/g,'\r\n').replace(/\x08/g,'\'').replace(/<\/textarea>/g,'<\\\/textarea>').replace(/\t/g,'    ');
			htmlsnip = htmlsnip.replace(new RegExp('>[|][|]'+names[i]+'[|][|]</textarea>','gi'),' id="'+this.id+'_input_'+pos+'_'+names[i]+'">'+oneelement[i]+'</textarea>').replace(new RegExp('value=[\'"]?[|][|]'+names[i]+'[|][|][\'"]?','gi'),'id="'+this.id+'_input_'+pos+'_'+names[i]+'" value="'+oneelement[i]+'"').replace(new RegExp("['][|][|]"+names[i]+"[|][|][']",'gi'),oneelement[i]).replace(new RegExp('[|][|]'+names[i]+'[|][|]','gi'),oneelement[i]);
		}		
		htmlsnip = htmlsnip.replace(/[|][|]i\.pos[|][|]/gi,pos);
		this.out.push(htmlsnip);
		return htmlsnip;
	}
	
	this.update = function(invar)
	{
		this.out = [];
		if (this.loopbool)
		{
			if ((this.looparray)&&(this.looparray[1].length>0))
			{
				for(j=0;j < this.looparray[1].length;j++)
				if (this.looparray[1][j])
				{
					varcondition = false;
					if (this.htmlcode[2])
					{
						names = this.looparray[0].split('¤');
						oneelement = this.looparray[1][j].split('¤');
						len = names.length;
						onecondition = this.condition
						for(i=0;i < len;i++)
							onecondition = onecondition.replace(new RegExp('[|][|]'+names[i]+'[|][|]','gi'),oneelement[i]);
						onecondition = onecondition.replace(/[|][|]i\.in[|][|]/gi,invar);
						onecondition = onecondition.replace(/[|][|]i\.pos[|][|]/gi,j);
						onecondition = onecondition.replace(/=/gi,'==');
						varcondition = eval(onecondition);
					}
					if (varcondition)
						this.html = this.htmlcode[2] 
					else if ((j==0)&&(this.htmlcode[3]))
						this.html = this.htmlcode[3]
					else if ((j==this.looparray[1].length-1)&&(this.htmlcode[6]))
						this.html = this.htmlcode[6]
					else if ((j%2==1)&&((this.htmlcode[4])||(this.htmlcode[5])))
						this.html = this.htmlcode[4]
					else if ((j%2==0)&&((this.htmlcode[4])||(this.htmlcode[5])))
						this.html = this.htmlcode[5]
					else 
						this.html = this.htmlcode[1];
					this.insertvars(this.html,this.looparray,j);
				}
			}
			else if (this.htmlcode[7])
				this.out.push(this.htmlcode[7]);
			else
			{
				this.x1.obj.innerHTML = this.htmlcode[9];
				return;
			}
			this.x1.obj.innerHTML = this.insertvars(this.htmlcode[0]+this.out.join('')+this.htmlcode[8],this.basearray,0);
		}
		else
			this.x1.obj.innerHTML = this.insertvars(this.htmlcode[0],this.basearray,0);//alert(this.x1.obj.innerHTML);
	}	
	this.setelement = function(basearray,looparray,pos)
	{
		this.basearray = basearray;
		this.looparray = looparray;
		if (pos!=null) this.update(pos);
	}
	this.show = function()
	{
		this.x1.style.display = 'block';
	}
	this.hide = function()
	{
		this.x1.style.display = 'none';
	}
	this.getformvars = function(formvars,pos)
	{
		out = [];
		for (i=0;i<formvars.length;i++)
		{
			obj = document.getElementById(this.id+'_input_'+pos+'_'+formvars[i]);
			if (obj)
				out.push(obj.value);
		}
		return out.join('¤');
	}
	this.getform = function()
	{
		this.basehtmlcode = [this.htmlcode[0],this.htmlcode[8],this.htmlcode[9]];
		this.loophtmlcode = this.htmlcode.slice(1,8);
		temp = this.basehtmlcode.join('').match(/(value=['"]?[|][|][a-z0-9_]+[|][|]['"]?)|(>[|][|][a-z0-9_]+[|][|]<\/textarea>)/gi);
		if (temp)
		{
			this.baseformvar = temp.join('-').match(/[|][a-z0-9_]+[|]/g).join('¤').replace(/[|]/g,'').split('¤')
			base = [this.baseformvar.join('¤'),this.getformvars(this.baseformvar,0)];
		}
		else
			base = '';
		temp = this.loophtmlcode.join('').match(/(value=['"]?[|][|][a-z0-9_]+[|][|]['"]?)|(>[|][|][a-z0-9_]+[|][|]<\/textarea>)/gi);
		if (temp)
		{
			this.loopformvar = temp.join('-').match(/[|][a-z0-9_]+[|]/g).join('¤').replace(/[|]/g,'').split('¤');
			loop = [this.loopformvar.join('¤'),this.getformvars(this.loopformvar,0)];
		}
		else
			loop = '';
		return [base,loop];
	}
	this.insertvar = function(inarray,newarray,pos,set)
	{
		namesin = inarray[0].split('¤');
		namesnew = newarray[0].split('¤');
		if (pos==null)
			varsin = inarray[1].split('¤')
		else
			varsin = inarray[1][pos].split('¤');
		varsnew = newarray[1].split('¤');
		for (i=0;i<namesin.length;i++)
			for (j=0;j<namesnew.length;j++)
				if (namesin[i]==namesnew[j])
					varsin[i] = varsnew[j];
		if (set!=null)
			inarray[1][pos] = varsin.join('¤');
		return [inarray[0],varsin.join('¤')];
	}
	this.set = function(name,html)
	{
		if (!this.inserted) 
			this.inserted = this.x1.obj.innerHTML;
		this.x1.obj.innerHTML = this.inserted.replace(new RegExp("[|][|]"+name+"[|][|]",'gi'),html);
	}
	this.x1 = new getObj(htmlid);
	this.id = htmlid;
	this.htmlcode = this.gethtmlsnaps(this.x1.obj.innerHTML.replace(/[%]7C/g,'|'));
}

function getWidth(obj)
{
	return obj.offsetWidth;
}
function getHeight(obj)
{
	return obj.offsetHeight;
}
/*
HTMLArea._addEvent = function(el, evname, func) {
	if (HTMLArea.is_ie) {
		el.attachEvent("on" + evname, func);
	} else {
		el.addEventListener(evname, func, true);
	}
};

HTMLArea._addEvents = function(el, evs, func) {
	for (var i in evs) {
		HTMLArea._addEvent(el, evs[i], func);
	}
};

HTMLArea._removeEvent = function(el, evname, func) {
	if (HTMLArea.is_ie) {
		el.detachEvent("on" + evname, func);
	} else {
		el.removeEventListener(evname, func, true);
	}
};

HTMLArea._removeEvents = function(el, evs, func) {
	for (var i in evs) {
		HTMLArea._removeEvent(el, evs[i], func);
	}
};
		// intercept some events; for updating the toolbar & keyboard handlers
		HTMLArea._addEvents
			(doc, ["keydown", "keypress", "mousedown", "mouseup", "drag"],
			 function (event) {
				 return editor._editorEvent(HTMLArea.is_ie ? editor._iframe.contentWindow.event : event);
			 });

document._addEvent = function(el, evname, func) {
	if (HTMLArea.is_ie) {
		el.attachEvent("on" + evname, func);
	} else {
		el.addEventListener(evname, func, true);
	}
};

document._addEvents = function(el, evs, func) {
	for (var i in evs) {
		document._addEvent(el, evs[i], func);
	}
};
document._addEvents(document, ["keydown", "keypress"],
			 function (event) {
				 alert(event);//return editor._editorEvent(HTMLArea.is_ie ? editor._iframe.contentWindow.event : event);
			 });

*/
//document.addEventListener("keydown", function (event) { alert(event); },true);
if (document.layers) { document.captureEvents(Event.KEYPRESS); }
document.onkeydown = keyhandlerdown;
document.onkeyup = keyhandlerup;
function keyhandlerdown(ev) 
{
	if (!ev) 
	{
		if (window.event)
 			ev = window.event
 		else
 			ev = document.keyeventhandler.frameobj.contentWindow.event;
 	}
	//alert(ev['keyCode']);
	return document.keyeventhandler.down(ev);
}
function keyhandlerup(ev) 
{
	if (!ev) 
	{
		if (window.event)
 			ev = window.event
 		else
 			ev = document.keyeventhandler.frameobj.contentWindow.event;
 	}
	document.keyeventhandler.up(ev);
}
document.addframetokeyevent = function(frameobj)
{
	frameobj.contentWindow.document.onkeydown = keyhandlerdown;
	frameobj.contentWindow.document.onkeyup = keyhandlerup;	
	document.keyeventhandler.frameobj = frameobj;
}

document.keyevent = function(keyCode,onkeydownfunc,onkeyupfunc)
{
	this.keyCode = keyCode;
	this.onkeydownfunc = onkeydownfunc;
	this.onkeyupfunc = onkeyupfunc;
	document.keyeventhandler.add(this);
}
document.keyeventhandler = new function()
{
	this.shiftKey = false;
	this.altKey = false;
	this.ctrlKey = false;
	this.key = '';
	this.on = false;
	this.keyArray = [];
	this.frameArray = [document];
	this.Size = 0;
	this.add = function(obj)
	{
		this.keyArray[obj.keyCode] = obj;
	}
	this.addframe = function(obj)
	{
		this.frameArray[this.frameArray.length] = obj;
	}
	this.down = function(ev)
	{
		keyCode = ev['keyCode'];
		this.key = keyCode;
		this.shiftKey = ev['shiftKey'];
		this.ctrlKey = ev['ctrlKey'];
		this.altKey = ev['altKey'];
		if (this.keyArray[keyCode])
		{
			if (!this.on)
			{
				eval(this.keyArray[keyCode].onkeydownfunc);
				this.on = true;
			}
			else clearTimeout(this.timer);
		}
		if (keyCode==9) return false; 
	}
	this.up = function(ev)
	{
		keyCode = ev['keyCode'];
		this.shiftKey = ev['shiftKey'];
		this.ctrlKey = ev['ctrlKey'];
		this.altKey = ev['altKey'];
		if (this.keyArray[keyCode])
			this.timer = setTimeout('document.keyeventhandler.uptimer('+keyCode+')',490);
	}
	this.uptimer = function(keyCode)
	{
		eval(this.keyArray[keyCode].onkeyupfunc);
		this.on = false;
	}
}

document.MouseMove = new function()
{
	this.moving = false;
	this.zpluspos = 100;
	this.set = function(e)
	{
 		if (!e) e = window.event;
	   	if (document.getElementById) 
    	{
        	this.xPos = e.clientX;
        	this.yPos = e.clientY;
    	}
    	else if (document.all) 
    	{
        	this.xPos = window.event.x+document.body.scrollLeft;
        	this.yPos = window.event.y+document.body.scrollTop;
    	} 
    	if (this.moving)
    	{
			this.mousecoverid.style.left = (this.xPos - 100)+'px';
			this.mousecoverid.style.top = (this.yPos - 100)+'px';
		}
	}
	this.stopMove = function()
	{
      	this.mousecoverid.style.display = 'none';
      	if (this.zplus)
			this.obj.style.zIndex = this.zpluspos++
		else
			this.obj.style.zIndex = '';
	 	this.obj.style.visibility = 'hidden';
 		if (this.resize)
 		{
	 		this.obj.style.width = this.xStartPosObj + this.xPos - this.xStartPos;
			this.obj.style.height = this.yStartPosObj + this.yPos - this.yStartPos;
		}
 		else
 		{
 	 		this.obj.style.left = this.xStartPosObj + this.xPos - this.xStartPos;
			this.obj.style.top = this.yStartPosObj + this.yPos - this.yStartPos;
		}
  		this.obj.style.visibility = 'visible';
		this.moving = false;
		if (document.toolboxfunc)
			document.toolboxfunc.set(this.obj);
	}
	this.setZ = function(obj)
	{
			obj.style.zIndex = this.zpluspos++;
	}
	this.start = function(obj,zplus,resize,xOutObj,yOutObj)
	{
		this.xStartPos = this.xPos;
		this.yStartPos = this.yPos;
		this.xOutObj = xOutObj;
		this.yOutObj = yOutObj;
		this.mousecoverid = document.getElementById('MouseMoveCover');
		this.mousecoverid.style.left = (this.xPos - 100)+'px';
		this.mousecoverid.style.top = (this.yPos - 100)+'px';
     	this.mousecoverid.style.display = 'block';
		this.moving = true;
		this.resize = resize;
 		if (this.resize)
 		{
    		this.xStartPosObj = obj.offsetWidth;
     		this.yStartPosObj = obj.offsetHeight;
	    }
		else
 		{
			obj.style.zIndex = '900';
			this.zplus = zplus;
			obj.style.position = 'absolute';
    		this.xStartPosObj = findPosX(obj);
     		this.yStartPosObj = findPosY(obj);
	    }
    	this.obj = obj;
    	this.lastx = this.xPos;
    	this.lasty = this.yPos;
		this.timer = setTimeout('document.MouseMove.move()',100);
 	}		
	this.move = function()
	{
		if (this.moving)
		{
	 		if (this.resize)
	 		{
		 		this.obj.style.width = this.xStartPosObj + this.xPos - this.xStartPos;
				this.obj.style.height = this.yStartPosObj + this.yPos - this.yStartPos;
				window.status = this.xStartPosObj + this.xPos - this.xStartPos;
  			}
 			else
	 		{
		 		this.obj.style.visibility = 'hidden';
 		 		this.obj.style.left = this.xStartPosObj + this.xPos - this.xStartPos;
				this.obj.style.top = this.yStartPosObj + this.yPos - this.yStartPos;
	 	 		this.obj.style.visibility = 'visible';
			}
			this.timer = setTimeout('document.MouseMove.move()',100);
			if (this.xOutObj)
			{
				this.xOutObj(this.xPos - this.lastx);
				this.lastx = this.xPos;
			}
			if (this.yOutObj) 
			{
				this.yOutObj(this.yPos - this.lasty);
				this.lasty = this.yPos;
			}
		}
	}
	document.outhtml += '<div id="MouseMoveCover" onmouseup="document.MouseMove.stopMove()" style="position:absolute;cursor:move;top:0px;left:0px;display:none;z-index:10000"><table width="200" height="200"><tr><td>&nbsp;</td></tr></table></div>';	
}
if (document.layers) { 
    document.captureEvents(Event.MOUSEMOVE);
    document.onmousemove = captureMousePosition;
} else if (document.all) { 
    document.onmousemove = captureMousePosition;
} else if (document.getElementById) { 
    document.onmousemove = captureMousePosition;
}
function captureMousePosition(e) 
{
	document.MouseMove.set(e);
}

function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft;
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop - obj.scrollTop;
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;	
	return curtop; 
}

function getObj(name)
{		
 	if (document.getElementById)
 	{
 		if (document.getElementById(name))
 		{
			this.obj = document.getElementById(name);
	   		this.style = document.getElementById(name).style;
	   	}
		else
			alert('Error: '+name);
		
 	}
 	else if (document.all)
 	{
	   	this.obj = document.all[name];
	   	this.style = document.all[name].style;
 	}
 	else if (document.layers)
 	{
	   	if (document.layers[name])
	   	{
	   		this.obj = document.layers[name];
	   		this.style = document.layers[name];
	   	}
	   	else
	   	{
	    		this.obj = document.layers.testP.layers[name];
	    		this.style = document.layers.testP.layers[name];
	   	}
 	}
}

document.gettag = function(contents,tagname)
{
	if (contents)
	{
		this.start = contents.indexOf('<'+tagname+'>')+tagname.length+2;
		this.end = contents.indexOf('</'+tagname+'>');
		if ((this.start!= -1)&&(this.end!=-1))
			return contents.substring(this.start,this.end);
	}
	return '';
}

