// PATH TO THE TRANSPARENT 1*1 PX IMAGE (required by NS 4 as spacer)
var spacer = 'transparentpixel.gif';
var sow_opacity = 0.5;
var sow_openedLayers = 0;

//window.onerror = new Function('return true;');


// Optional commands passed to SET_DHTML() on the html-page (g: may be applied globally, i: individually)
var CLONE			= 'C10nE';   // i  img	  clone image
var COPY			 = 'C0pY';	// i  img	  create copies
var DETACH_CHILDREN  = 'd37aCH';  // i  lyr	  detach images
var HORIZONTAL	   = 'H0r1Z';   // i  img,lyr  horizontally draggable only
var MAXHEIGHT		= 'm7x8I';   // i  img,lyr  maximum height limit, "
var MAXOFFBOTTOM	 = 'm7xd0wN'; // i  img,lyr  downward offset limit
var MAXOFFLEFT	   = 'm7x23Ft'; // i  img,lyr  leftward offset limit
var MAXOFFRIGHT	  = 'm7x0Ff8'; // i  img,lyr  rightward offset limit
var MAXOFFTOP		= 'm7xu9';   // i  img,lyr  upward offset limit
var MAXWIDTH		 = 'm7xW1';   // i  img,lyr  maximum width limit, use with resizable or scalable
var MINWIDTH		 = 'm1nw1';   // i  img,lyr  minimum width limit, "
var MINHEIGHT		= 'm1n8I';   // i  img,lyr  minimum height limit, "
var NO_ALT		   = 'no81T';   // gi img	  disable alt and title attributes
var NO_DRAG		  = 'N0d4Ag';  // i  img,lyr  disable draggability
var RESET_Z		  = 'r35E7z';  // gi img,lyr  reset z-index when dropped
var RESIZABLE		= 'r5IZbl';  // gi img,lyr  resizable if <ctrl> or <shift> pressed
var SCALABLE		 = 'SCLbl';   // gi img,lyr  scalable		   "
var SCROLL		   = 'sC8lL';   // gi img,lyr  enable auto scroll functionality
var TRANSPARENT	  = 'dIApHAn'; // gi img,lyr  translucent while dragged
var VERTICAL		 = 'V3Rt1C';  // i  img,lyr  vertically draggable only
var sw_layer_cursors = new Array(
	'c:default',
	'c:crosshair',
	'c:e-resize',
	'c:hand',
	'c:help',
	'c:move',
	'c:n-resize',
	'c:ne-resize',
	'c:nw-resize',
	'c:s-resize',
	'c:se-resize',
	'c:sw-resize',
	'c:text',
	'c:w-resize',
	'c:wait'
);
var sw_layer_i = sw_layer_cursors.length; while(sw_layer_i--)
	eval('var CURSOR_' + (sw_layer_cursors[sw_layer_i].substring(2).toUpperCase().replace('-', '_')) + ' = "' + sw_layer_cursors[sw_layer_i] + '";');
var sw_layer_u = "undefined";
function WZDD()
{
	this.elements = new Array(0);
	this.obj = null;
	this.n = navigator.userAgent.toLowerCase();
	this.db = (document.compatMode && document.compatMode.toLowerCase() != "backcompat")?
		document.documentElement
		: (document.body || null);
	this.op = !!(window.opera && document.getElementById);
	if(this.op) document.onmousedown = new Function('e',
		'if(((e = e || window.event).target || e.srcElement).tagName == "IMAGE") return false;');
	this.ie = !!(this.n.indexOf("msie") >= 0 && document.all && this.db && !this.op);
	this.iemac = !!(this.ie && this.n.indexOf("mac") >= 0);
	this.ie4 = !!(this.ie && !document.getElementById);
	this.n4 = !!(document.layers && typeof document.classes != sw_layer_u);
	this.n6 = !!(typeof window.getComputedStyle != sw_layer_u && typeof document.createRange != sw_layer_u);
	this.w3c = !!(!this.op && !this.ie && !this.n6 && document.getElementById);
	this.ce = !!(document.captureEvents && document.releaseEvents);
	this.px = this.n4? '' : 'px';
	this.tiv = this.w3c? 40 : 10;
}
var sw_layer = new WZDD();

sw_layer.Int = function(d_x, d_y)
{
	return isNaN(d_y = parseInt(d_x))? 0 : d_y;
};
sw_layer.getWndW = function()
{
	return sw_layer.Int(
		(sw_layer.db && !sw_layer.op && !sw_layer.w3c && sw_layer.db.clientWidth)? sw_layer.db.clientWidth
		: (window.innerWidth || 0)
	);
};
sw_layer.getWndH = function()
{
	return sw_layer.Int(
		(sw_layer.db && !sw_layer.op && !sw_layer.w3c && sw_layer.db.clientHeight)? sw_layer.db.clientHeight
		: (window.innerHeight || 0)
	);
};
sw_layer.getScrollX = function()
{
	return sw_layer.Int(window.pageXOffset || (sw_layer.db? sw_layer.db.scrollLeft : 0));
};
sw_layer.getScrollY = function()
{
	return sw_layer.Int(window.pageYOffset || (sw_layer.db? sw_layer.db.scrollTop : 0));
};
sw_layer.getPageXY = function(d_o)
{
	if(sw_layer.n4 && d_o)
	{
		sw_layer.x = d_o.pageX || 0;
		sw_layer.y = d_o.pageY || 0;
	}
	else
	{
		sw_layer.x = sw_layer.y = 0; //global helper vars
		while(d_o)
		{
			sw_layer.x += sw_layer.Int(d_o.offsetLeft);
			sw_layer.y += sw_layer.Int(d_o.offsetTop);
			d_o = d_o.offsetParent || null;
		}
	}
};
sw_layer.getCssXY = function(d_o)
{
	if(d_o.div)
	{
		if(sw_layer.n4)
		{
			d_o.cssx = d_o.div.x;
			d_o.cssy = d_o.div.y;
		}
		else if(sw_layer.ie4)
		{
			d_o.cssx = d_o.css.pixelLeft;
			d_o.cssy = d_o.css.pixelTop;
		}
		else
		{
			d_o.css.left = d_o.css.top = 0 + sw_layer.px;
			sw_layer.getPageXY(d_o.div);
			d_o.cssx = d_o.x - sw_layer.x;
			d_o.cssy = d_o.y - sw_layer.y;
			d_o.css.left = d_o.cssx + sw_layer.px;
			d_o.css.top = d_o.cssy + sw_layer.px;
		}
	}
	else
	{
		d_o.cssx = 0;
		d_o.cssy = 0;
	}
};
sw_layer.getImgW = function(d_o)
{
	return d_o? sw_layer.Int(d_o.width) : 0;
};
sw_layer.getImgH = function(d_o)
{
	return d_o? sw_layer.Int(d_o.height) : 0;
};
sw_layer.getDivW = function(d_o)
{
	return sw_layer.Int(
		sw_layer.n4? (d_o.div? d_o.div.clip.width : 0)
		: d_o.div? (d_o.div.offsetWidth || d_o.css.pixelWidth || d_o.css.width || 0)
		: 0
	);
};
sw_layer.getDivH = function(d_o)
{
	return sw_layer.Int(
		sw_layer.n4? (d_o.div? d_o.div.clip.height : 0)
		: d_o.div? (d_o.div.offsetHeight || d_o.css.pixelHeight || d_o.css.height || 0)
		: 0
	);
};
sw_layer.getWH = function(d_o)
{
	d_o.w = sw_layer.getDivW(d_o);
	d_o.h = sw_layer.getDivH(d_o);
	if(d_o.css)
	{
		d_o.css.width = d_o.w + sw_layer.px;
		d_o.css.height = d_o.h + sw_layer.px;
		d_o.dw = sw_layer.getDivW(d_o)-d_o.w;
		d_o.dh = sw_layer.getDivH(d_o)-d_o.h;
		d_o.css.width = (d_o.w-d_o.dw) + sw_layer.px;
		d_o.css.height = (d_o.h-d_o.dh) + sw_layer.px;
	}
	else d_o.dw = d_o.dh = 0;
};
sw_layer.getCssProp = function(d_o, d_pn6, d_pstyle, d_pn4)
{
	if(d_o && sw_layer.n6) return ''+window.getComputedStyle(d_o, null).getPropertyValue(d_pn6);
	if(d_o && d_o.currentStyle) return ''+eval('d_o.currentStyle.'+d_pstyle);
	if(d_o && d_o.style) return ''+eval('d_o.style.'+d_pstyle);
	if(d_o && sw_layer.n4) return ''+eval('d_o.'+d_pn4);
	return '';
};
sw_layer.getDiv = function(d_x, d_d)
{
	d_d = d_d || document;
	if(sw_layer.n4)
	{
		if(d_d.layers[d_x]) return d_d.layers[d_x];
		for(var d_i = d_d.layers.length; d_i--;)
		{
			var d_y = sw_layer.getDiv(d_x, d_d.layers[d_i].document);
			if(d_y) return d_y;
		}
	}
	if(sw_layer.ie) return d_d.all[d_x] || null;
	if(d_d.getElementById) return d_d.getElementById(d_x) || null;
	return null;
};
sw_layer.getImg = function(d_o, d_nm, d_xy, d_w)
{
	d_w = d_w || window;
	var d_img;
	if(document.images && (d_img = d_w.document.images[d_nm]))
	{
		if(d_xy)
		{
			if(sw_layer.n4)
			{
				sw_layer.getPageXY(d_w);
				d_o.defx = d_img.x + sw_layer.x;
				d_o.defy = d_img.y + sw_layer.y;
			}
			else
			{
				sw_layer.getPageXY(d_img);
				d_o.defx = sw_layer.x;
				d_o.defy = sw_layer.y;
			}
		}
		return d_img;
	}
	if(sw_layer.n4) for(var d_i = d_w.document.layers.length; d_i--;)
	{
		var d_y = sw_layer.getImg(d_o, d_nm, d_xy, d_w.document.layers[d_i]);
		if(d_y) return d_y;
	}
	return null;
};
sw_layer.getParent = function(d_o, d_p)
{
	if(sw_layer.n4)
	{
		for(d_p, d_i = sw_layer.elements.length; d_i--;)
		{
			if(!((d_p = sw_layer.elements[d_i]).is_image) && d_p.div && (d_p.div.document.layers[d_o.name] || d_o.oimg && d_p.div.document.images[d_o.oimg.name]))
				d_p.addChild(d_o, d_p.detach, 1);
		}
	}
	else
	{
		d_p = d_o.is_image? sw_layer.getImg(d_o, d_o.oimg.name) : (d_o.div || null);
		while(d_p && !!(d_p = d_p.offsetParent || d_p.parentNode || null))
		{
			if(d_p.sw_layerObj)
			{
				d_p.sw_layerObj.addChild(d_o, d_p.sw_layerObj.detach, 1);
				break;
			}
		}
	}
};
sw_layer.getCmd = function(d_o, d_cmd, d_cmdStr)
{
	var d_i = d_o.id.indexOf(d_cmd), d_j,
	d_y = (d_i >= 0)*1;
	if(d_y)
	{
		d_j = d_i+d_cmd.length;
		if(d_cmdStr) d_o.cmd += d_o.id.substring(d_i, d_j);
		d_o.id = d_o.id.substring(0, d_i) + d_o.id.substring(d_j);
	}
	return d_y;
};
sw_layer.getCmdVal = function(d_o, d_cmd, d_cmdStr, int0)
{
	var d_i = d_o.id.indexOf(d_cmd), d_j,
	d_y = (d_o.id.indexOf(d_cmd) >= 0)? sw_layer.Int(d_o.id.substring(d_o.id.indexOf(d_cmd)+d_cmd.length)) : int0? -1 : 0;
	if(!int0 && d_y || int0 && d_y >= 0)
	{
		d_j = d_i+d_cmd.length+(""+d_y).length;
		if(d_cmdStr) d_o.cmd += d_o.id.substring(d_i, d_j);
		d_o.id = d_o.id.substring(0, d_i) + d_o.id.substring(d_j);
	}
	return d_y;
};
sw_layer.addElt = function(d_o, d_p)
{
	sw_layer.elements[d_o.name] = sw_layer.elements[d_o.index = sw_layer.elements.length] = d_o;
	if(d_p) d_p.copies[d_o.name] = d_p.copies[d_p.copies.length] = d_o;
};
sw_layer.mkWzDom = function()
{
	var d_o, d_i = sw_layer.elements.length; while(d_i--) sw_layer.getParent(sw_layer.elements[d_i]);
	d_i = sw_layer.elements.length; while(d_i--)
	{
		d_o = sw_layer.elements[d_i];
		if(d_o.children && !d_o.parent)
		{
			var d_j = d_o.children.length; while(d_j--)
				d_o.children[d_j].setZ(d_o.z+d_o.children[d_j].z, 1);
		}
	}
};
sw_layer.addProps = function(d_o)
{
	var d_i, d_c;
	if(d_o.is_image)
	{
		d_o.div = sw_layer.getDiv(d_o.id);
		d_o.css = (d_o.div && typeof d_o.div.style != sw_layer_u)? d_o.div.style : null;
		d_o.nimg = (sw_layer.n4 && d_o.div)? d_o.div.document.images[0] : (document.images[d_o.id+"NI1m6G"] || null);
		if(!d_o.noalt && !sw_layer.noalt && d_o.nimg && d_o.oimg)
		{
			d_o.nimg.alt = d_o.oimg.alt || '';
			if(d_o.oimg.title) d_o.nimg.title = d_o.oimg.title;
		}
		d_o.bgColor = '';
	}
	else
	{
		d_o.bgColor = sw_layer.getCssProp(d_o.div, 'background-color','backgroundColor','bgColor').toLowerCase();
		if(sw_layer.n6 && d_o.div)
		{
			if((d_c = d_o.bgColor).indexOf('rgb') >= 0)
			{
				d_c = d_c.substring(4, d_c.length-1).split(',');
				d_o.bgColor = '#';
				for(d_i = 0; d_i < d_c.length; d_i++) d_o.bgColor += parseInt(d_c[d_i]).toString(0x10);
			}
			else d_o.bgColor = d_c;
		}
	}
	if(sw_layer.scalable) d_o.scalable = d_o.resizable^1;
	else if(sw_layer.resizable) d_o.resizable = d_o.scalable^1;
	d_o.setZ(d_o.defz);
	d_o.cursor = d_o.cursor || sw_layer.cursor || 'auto';
	d_o._setCrs(d_o.nodrag? 'auto' : d_o.cursor);
	d_o.diaphan = d_o.diaphan || sw_layer.diaphan || 0;
	d_o.opacity = 1.0;
	d_o.visible = true;
};
sw_layer.initz = function()
{
	if(!(sw_layer && (sw_layer.n4 || sw_layer.n6 || sw_layer.ie || sw_layer.op || sw_layer.w3c))) return;
	else if(sw_layer.n6 || sw_layer.ie || sw_layer.op || sw_layer.w3c) sw_layer.recalc(1);
	var d_drag = (document.onmousemove == DRAG),
	d_resize = (document.onmousemove == RESIZE);
	if(sw_layer.loadFunc) sw_layer.loadFunc();
	if(d_drag) sw_layer.setMovHdl(DRAG);
	else if(d_resize) sw_layer.setMovHdl(RESIZE);
	if(d_drag || d_resize) sw_layer.setUpHdl(DROP);
	sw_layer.setDwnHdl(PICK);
};
sw_layer.finlz = function()
{
	if(sw_layer.ie && sw_layer.elements)
	{
		var d_i = sw_layer.elements.length; while(d_i--)
			sw_layer.elements[d_i].del();
	}
	if(sw_layer.uloadFunc) sw_layer.uloadFunc();
};
sw_layer.setCe = function(d_e, d_fnc)
{
	d_fnc? document.captureEvents(d_e) : document.releaseEvents(d_e);
};
sw_layer.setDwnHdl = function(d_x)
{
	if(document.onmousedown != d_x)
	{
		sw_layer.downFunc = document.onmousedown;
		document.onmousedown = d_x;
		if(sw_layer.ce) sw_layer.setCe(Event.MOUSEDOWN, d_x);
	}
};
sw_layer.setMovHdl = function(d_x)
{
	if(document.onmousemove != d_x)
	{
		sw_layer.moveFunc = document.onmousemove;
		document.onmousemove = d_x;
		if(sw_layer.ce) sw_layer.setCe(Event.MOUSEMOVE, d_x);
	}
};
sw_layer.setUpHdl = function(d_x)
{
	if(document.onmouseup != d_x)
	{
		sw_layer.upFunc = document.onmouseup;
		document.onmouseup = d_x;
		if(sw_layer.ce) sw_layer.setCe(Event.MOUSEUP, d_x);
	}
};
sw_layer.evt = function(d_e)
{
	this.but = (this.e = d_e || window.event).which || this.e.button || 0;
	this.button = (this.e.type == 'mousedown')? this.but
		: (sw_layer.e && sw_layer.e.button)? sw_layer.e.button
		: 0;
	this.src = this.e.target || this.e.srcElement || null;
	this.src.tag = ("" + (this.src.tagName || this.src)).toLowerCase();
	this.x = sw_layer.Int(this.e.pageX || this.e.clientX || 0);
	this.y = sw_layer.Int(this.e.pageY || this.e.clientY || 0);
	if(sw_layer.ie)
	{
		this.x += sw_layer.getScrollX() - (sw_layer.ie && !sw_layer.iemac)*1;
		this.y += sw_layer.getScrollY() - (sw_layer.ie && !sw_layer.iemac)*1;
	}
	this.modifKey = this.e.modifiers? this.e.modifiers&Event.SHIFT_MASK : (this.e.shiftKey || false);
};
sw_layer.getEventTarget = function(d_e, d_s, d_n)
{
	d_e = d_e || window.event;
	if(d_e && (d_s = d_e.target || d_e.srcElement || null) != null)
	{
		if(null != (d_n = d_s.id || d_s.name || null))
		{
			if(d_n.indexOf("dIi15vNI1m6G") == d_n.length-12)
				return sw_layer.elements[d_n.substring(0, d_n.length-12)] || null;
			if(d_n.indexOf("dIi15v") == d_n.length-6)
				return sw_layer.elements[d_n.substring(0, d_n.length-6)] || null;
			return sw_layer.elements[d_n] || null;
		}
	}
	return null;
};
sw_layer.recalc = function(d_x)
{
	var d_o, d_i = sw_layer.elements.length; while(d_i--)
	{
		if(!(d_o = sw_layer.elements[d_i]).is_image && d_o.div)
		{
			sw_layer.getWH(d_o);
			if(d_o.div.pos_rel)
			{
				sw_layer.getPageXY(d_o.div);
				var d_dx = sw_layer.x - d_o.x, d_dy = sw_layer.y - d_o.y;
				d_o.defx += d_dx;
				d_o.x += d_dx;
				d_o.defy += d_dy;
				d_o.y += d_dy;
				var d_p, d_j = d_o.children.length; while(d_j--)
				{
					if(!(d_p = d_o.children[d_j]).detached && (d_o != d_p.defparent || !(d_p.is_image && sw_layer.getImg(d_p, d_p.oimg.name, 1))))
					{
						d_p.defx += d_dx;
						d_p.defy += d_dy;
						d_p.moveBy(d_dx, d_dy);
					}
				}
			}
		}
		else if(d_o.is_image && !sw_layer.n4)
		{
			if(sw_layer.n6 && d_x && !d_o.defw) d_o.resizeTo(d_o.defw = sw_layer.getImgW(d_o.oimg), d_o.defh = sw_layer.getImgH(d_o.oimg));
			var d_defx = d_o.defx, d_defy = d_o.defy;
			if(!(d_o.parent && d_o.parent != d_o.defparent) && (d_x || !d_o.detached || d_o.horizontal || d_o.vertical) && sw_layer.getImg(d_o, d_o.oimg.name, 1))
				d_o.moveBy(d_o.defx-d_defx, d_o.defy-d_defy);
		}
	}
};
function WINSZ(d_x)
{
	if(d_x)
	{
		if(sw_layer.n4)
		{
			sw_layer.iW = innerWidth;
			sw_layer.iH = innerHeight;
		}
		window.onresize = new Function('WINSZ();');
	}
	else if(sw_layer.n4 && (innerWidth != sw_layer.iW || innerHeight != sw_layer.iH)) location.reload();
	else if(!sw_layer.n4) setTimeout('sw_layer.recalc()', 0xa);
}
WINSZ(1);

function DDObj(d_o, d_i)
{
	this.id = d_o;
	this.cmd = '';
	this.cpy_n = sw_layer.getCmdVal(this, COPY);
	this.maxoffb = sw_layer.getCmdVal(this, MAXOFFBOTTOM, 0, 1);
	this.maxoffl = sw_layer.getCmdVal(this, MAXOFFLEFT, 0, 1);
	this.maxoffr = sw_layer.getCmdVal(this, MAXOFFRIGHT, 0, 1);
	this.maxofft = sw_layer.getCmdVal(this, MAXOFFTOP, 0, 1);
	var d_j = sw_layer_cursors.length; while(d_j--)
		if(sw_layer.getCmd(this, sw_layer_cursors[d_j], 1)) this.cursor = sw_layer_cursors[d_j].substring(2);
	this.clone = sw_layer.getCmd(this, CLONE, 1);
	this.detach = sw_layer.getCmd(this, DETACH_CHILDREN);
	this.scalable = sw_layer.getCmd(this, SCALABLE, 1);
	this.horizontal = sw_layer.getCmd(this, HORIZONTAL);
	this.noalt = sw_layer.getCmd(this, NO_ALT, 1);
	this.nodrag = sw_layer.getCmd(this, NO_DRAG);
	this.scroll = sw_layer.getCmd(this, SCROLL, 1);
	this.resizable = sw_layer.getCmd(this, RESIZABLE, 1);
	this.re_z = sw_layer.getCmd(this, RESET_Z, 1);
	this.diaphan = sw_layer.getCmd(this, TRANSPARENT, 1);
	this.vertical = sw_layer.getCmd(this, VERTICAL);
	this.maxw = sw_layer.getCmdVal(this, MAXWIDTH, 1, 1);
	this.minw = Math.abs(sw_layer.getCmdVal(this, MINWIDTH, 1, 1));
	this.maxh = sw_layer.getCmdVal(this, MAXHEIGHT, 1, 1);
	this.minh = Math.abs(sw_layer.getCmdVal(this, MINHEIGHT, 1, 1));
	this.pickFunc = this.dragFunc = this.resizeFunc = this.dropFunc = null;

	this.name = this.id + (d_i || '');
	this.oimg = sw_layer.getImg(this, this.id, 1);
	this.is_image = !!this.oimg;
	this.copies = new Array();
	this.children = new Array();
	this.parent = this.original = null;
	if(this.oimg)
	{
		this.id = this.name + "dIi15v";
		this.w = sw_layer.getImgW(this.oimg);
		this.h = sw_layer.getImgH(this.oimg);
		this.dw = this.dh = 0;
		this.defz = sw_layer.Int(sw_layer.getCssProp(this.oimg, 'z-index','zIndex','zIndex')) || 1;
		this.defsrc = this.src = this.oimg.src;
		this.htm = '<img name="' + this.id + 'NI1m6G"'+
			' src="' + this.oimg.src + '" '+
			'width="' + this.w + '" height="' + this.h + '">';
		this.t_htm = '<div id="' + this.id +
			'" style="position:absolute;'+
			'left:' + (this.cssx = this.x = this.defx) + 'px;'+
			'top:' + (this.cssy = this.y = this.defy) + 'px;'+
			'width:' + this.w + 'px;'+
			'height:' + this.h + 'px;">'+
			this.htm + '</div>';
	}
	else
	{
		if(!!(this.div = sw_layer.getDiv(this.id)) && typeof this.div.style != sw_layer_u) this.css = this.div.style;
		sw_layer.getWH(this);
		if(this.div)
		{
			this.div.sw_layerObj = this;
			this.div.pos_rel = ("" + (this.div.parentNode? this.div.parentNode.tagName : this.div.parentElement? this.div.parentElement.tagName : '').toLowerCase().indexOf('body') < 0);
		}
		sw_layer.getPageXY(this.div);
		this.defx = this.x = sw_layer.x;
		this.defy = this.y = sw_layer.y;
		sw_layer.getCssXY(this);
		this.defz = sw_layer.Int(sw_layer.getCssProp(this.div, 'z-index','zIndex','zIndex'));
	}
	this.defw = this.w || 0;
	this.defh = this.h || 0;
}
DDObj.prototype.setPickFunc = function(d_x)
{
	this.pickFunc = d_x;
};
DDObj.prototype.setDragFunc = function(d_x)
{
	this.dragFunc = d_x;
};
DDObj.prototype.setResizeFunc = function(d_x)
{
	this.resizeFunc = d_x;
};
DDObj.prototype.setDropFunc = function(d_x)
{
	this.dropFunc = d_x;
};
DDObj.prototype.moveBy = function(d_x, d_y, d_kds, d_o)
{
	if(!this.div) return;
	this.x += (d_x = sw_layer.Int(d_x));
	this.y += (d_y = sw_layer.Int(d_y));
	if(!d_kds || this.is_image || this.parent != this.defparent)
	{
		(d_o = this.css || this.div).left = (this.cssx += d_x) + sw_layer.px;
		d_o.top = (this.cssy += d_y) + sw_layer.px;
	}
	var d_i = this.children.length; while(d_i--)
	{
		if(!(d_o = this.children[d_i]).detached) d_o.moveBy(d_x, d_y, 1);
		d_o.defx += d_x;
		d_o.defy += d_y;
	}
};

DDObj.prototype.moveTo = function(d_x, d_y)
{
	this.moveBy(sw_layer.Int(d_x)-this.x, sw_layer.Int(d_y)-this.y);
};
DDObj.prototype.hide = function(d_m, d_o, d_p)
{
	if(this.div && this.visible)
	{
		d_p = this.css || this.div;
		if(d_m && !sw_layer.n4)
		{
			this.display = sw_layer.getCssProp(this.div, "display", "display", "display");
			if(this.oimg)
			{
				this.oimg.display = sw_layer.getCssProp(this.oimg, "display", "display", "display");
				this.oimg.style.display = "none";
			}
			d_p.display = "none";
			sw_layer.recalc();
		}
		else d_p.visibility = "hidden";
	}
	this.visible = false;
	var d_i = this.children.length; while(d_i--)
		if(!(d_o = this.children[d_i]).detached) d_o.hide(d_m);
};
DDObj.prototype.show = function(d_o, d_p)
{
	if(this.div)
	{
		d_p = this.css || this.div;
		if(d_p.display && d_p.display == "none")
		{
			d_p.display = this.display || "block";
			if(this.oimg) this.oimg.style.display = this.oimg.display || "inline";
			sw_layer.recalc();
		}
		else d_p.visibility = "visible";
	}
	this.visible = true;
	var d_i = this.children.length; while(d_i--)
		if(!(d_o = this.children[d_i]).detached) d_o.show();
};
DDObj.prototype.resizeTo = function(d_w, d_h, d_o)
{
	if(!this.div) return;
	d_w = (this.w = sw_layer.Int(d_w))-this.dw;
	d_h = (this.h = sw_layer.Int(d_h))-this.dh;
	if(sw_layer.n4)
	{
		this.div.resizeTo(d_w, d_h);
		if(this.is_image)
		{
			this.write('<img src="' + this.src + '" width="' + d_w + '" height="' + d_h + '">');
			(this.nimg = this.div.document.images[0]).src = this.src;
		}
	}
	else if(typeof this.css.pixelWidth != sw_layer_u)
	{
		this.css.pixelWidth = d_w;
		this.css.pixelHeight = d_h;
		if(this.is_image)
		{
			(d_o = this.nimg.style).pixelWidth = d_w;
			d_o.pixelHeight = d_h;
		}
	}
	else
	{
		this.css.width = d_w + sw_layer.px;
		this.css.height = d_h + sw_layer.px;
		if(this.is_image)
		{
			(d_o = this.nimg).width = d_w;
			d_o.height = d_h;
			if(!d_o.complete) d_o.src = this.src;
		}
	}
};
DDObj.prototype.resizeBy = function(d_dw, d_dh)
{
	this.resizeTo(this.w+sw_layer.Int(d_dw), this.h+sw_layer.Int(d_dh));
};
DDObj.prototype.swapImage = function(d_x, d_cp)
{
	if(!this.nimg) return;
	this.nimg.src = d_x;
	this.src = this.nimg.src;
	if(d_cp)
	{
		var d_i = this.copies.length; while(d_i--)
			this.copies[d_i].src = this.copies[d_i].nimg.src = this.nimg.src;
	}
};
DDObj.prototype.setBgColor = function(d_x)
{
	if(sw_layer.n4 && this.div) this.div.bgColor = d_x;
	else if(this.css) this.css.background = d_x;
	this.bgColor = d_x;
};
DDObj.prototype.write = function(d_x, d_o)
{
	this.text = d_x;
	if(!this.div) return;
	if(sw_layer.n4)
	{
		(d_o = this.div.document).open();
		d_o.write(d_x);
		d_o.close();
		sw_layer.getWH(this);
	}
	else
	{
		this.css.height = 'auto';
		this.div.innerHTML = d_x;
		if(!sw_layer.ie4) sw_layer.recalc();
		if(sw_layer.ie4 || sw_layer.n6) setTimeout('sw_layer.recalc();', 0); // n6.0: recalc twice
	}
};
DDObj.prototype.copy = function(d_n, d_p, d_b)
{
	if(!this.oimg) return;
	d_b = (sw_layer.ie && document.all.tags('body'))? document.all.tags('body')[0] : document.getElementsByTagName? (document.getElementsByTagName('body')[0] || sw_layer.db) : sw_layer.db;
	d_n = d_n || 1;
	while(d_n--)
	{
		var d_l = this.copies.length,
		d_o = new DDObj(this.name+this.cmd, d_l+1);
		if(sw_layer.n4)
		{
			d_o.id = (d_p = new Layer(d_o.w)).name;
			d_p.clip.height = d_o.h;
			d_p.visibility = 'show';
			(d_p = d_p.document).open();
			d_p.write(d_o.htm);
			d_p.close();
		}
		else if(d_b && d_b.insertAdjacentHTML) d_b.insertAdjacentHTML("AfterBegin", d_o.t_htm);
		else if(document.createElement && d_b && d_b.appendChild)
		{
			d_b.appendChild(d_p = document.createElement("dIi15v"));
			d_p.innerHTML = d_o.htm;
			d_p.id = d_o.id;
			d_p.style.position = 'absolute';
			d_p.style.width = d_o.w + 'px';
			d_p.style.height = d_o.h + 'px';
		}
		else if(d_b && d_b.innerHTML) d_b.innerHTML += d_o.t_htm;
		d_o.defz = this.defz+1+d_l;
		sw_layer.addProps(d_o);
		d_o.original = this;
		sw_layer.addElt(d_o, this);
		if(this.parent)
		{
			this.parent.addChild(d_o, this.detached);
			d_o.defparent = this.defparent;
		}
		d_o.moveTo(d_o.defx = this.defx, d_o.defy = this.defy);
		if(sw_layer.n4) d_o.defsrc = d_o.src = this.defsrc;
		d_o.swapImage(this.src);
	}
};
DDObj.prototype.addChild = function(d_kd, detach, defp)
{
	if(typeof d_kd != "object") d_kd = sw_layer.elements[d_kd];
	if(d_kd.parent && d_kd.parent == this || d_kd == this || !d_kd.is_image && d_kd.defparent && !defp) return;

	this.children[this.children.length] = this.children[d_kd.name] = d_kd;
	d_kd.detached = detach || 0;
	if(defp) d_kd.defparent = this;
	else if(this == d_kd.defparent && d_kd.is_image) sw_layer.getImg(this, d_kd.oimg.name, 1);
	if(!d_kd.defparent || this != d_kd.defparent)
	{
		d_kd.defx = d_kd.x;
		d_kd.defy = d_kd.y;
	}
	if(!detach)
	{
		d_kd.defz = d_kd.defz+this.defz-(d_kd.parent? d_kd.parent.defz : 0)+(!d_kd.is_image*1);
		d_kd.setZ(d_kd.z+this.z-(d_kd.parent? d_kd.parent.z : 0)+(!d_kd.is_image*1), 1);
	}
	if(d_kd.parent) d_kd.parent._removeChild(d_kd, 1);
	d_kd.parent = this;
};
DDObj.prototype._removeChild = function(d_kd, d_newp)
{
	if(typeof d_kd != "object") d_kd = this.children[d_kd];
	var d_oc = this.children, d_nc = new Array();
	for(var d_i = 0; d_i < d_oc.length; d_i++)
		if(d_oc[d_i] != d_kd) d_nc[d_nc.length] = d_oc[d_i];
	this.children = d_nc;
	d_kd.parent = null;
	if(!d_newp)
	{
		d_kd.detached = d_kd.defp = 0;
		if(d_kd.is_image) sw_layer.getImg(d_kd, d_kd.oimg.name, 1);
	}
};
DDObj.prototype.attachChild = function(d_kd)
{
	(d_kd = (typeof d_kd != "object")? this.children[d_kd]: d_kd).detached = 0;
	d_kd.setZ(d_kd.defz + this.z-this.defz, 1);
};
DDObj.prototype.detachChild = function(d_kd)
{
	(d_kd = (typeof d_kd != "object")? this.children[d_kd]: d_kd).detached = 1;
};
DDObj.prototype.setZ = function(d_x, d_kds, d_o)
{
	if(d_kds)
	{
		var d_dz = d_x-this.z,
		d_i = this.children.length; while(d_i--)
			if(!(d_o = this.children[d_i]).detached) d_o.setZ(d_o.z+d_dz, 1);
	}
	sw_layer.z = Math.max(sw_layer.z, this.z = this.div? ((this.css || this.div).zIndex = d_x) : 0);
};
DDObj.prototype.maximizeZ = function()
{
	this.setZ(sw_layer.z+1, 1);
};
DDObj.prototype._resetZ = function(d_o)
{
	if(this.re_z || sw_layer.re_z)
	{
		this.setZ(this.defz);
		var d_i = this.children.length; while(d_i--)
			if(!(d_o = this.children[d_i]).detached) d_o.setZ(d_o.defz);
	}
};
DDObj.prototype.setOpacity = function(d_x)
{
	this.opacity = d_x;
	this._setOpaRel(1.0, 1);
};
DDObj.prototype.setOpacityAndChilds = function(d_x)
{
	this.opacity = d_x;
	this._setOpaRel(1.0, 1);
	
	var d_i = this.children.length; while(d_i--)
		if(!(d_o = this.children[d_i]).detached) d_o.setOpacityAndChilds(d_x);
};
DDObj.prototype._setOpaRel = function(d_x, d_kd, d_y, d_o)
{
	if(this.css && (this.diaphan || d_kd))
	{
		d_y = this.opacity*d_x;
		if(typeof this.css.MozOpacity != sw_layer_u) this.css.MozOpacity = d_y;
		else if(typeof this.css.filter != sw_layer_u)
			this.css.filter = "Alpha(opacity="+parseInt(100*d_y)+")";
		else this.css.opacity = d_y;
		var d_i = this.children.length; while(d_i--)
			if(!(d_o = this.children[d_i]).detached) d_o._setOpaRel(d_x, 1);
	}
};
DDObj.prototype.setCursor = function(d_x)
{
	this._setCrs(this.cursor = (d_x.indexOf('c:')+1)? d_x.substring(2) : d_x);
};
DDObj.prototype._setCrs = function(d_x)
{
	if(this.css) this.css.cursor = ((!sw_layer.ie || sw_layer.iemac) && d_x == 'hand')? 'pointer' : d_x;
};
DDObj.prototype.setDraggable = function(d_x)
{
	this.nodrag = !d_x*1;
	this._setCrs(d_x? this.cursor : 'auto');
};
DDObj.prototype.setResizable = function(d_x)
{
	this.resizable = d_x*1;
	if(d_x) this.scalable = 0;
};
DDObj.prototype.setScalable = function(d_x)
{
	this.scalable = d_x*1;
	if(d_x) this.resizable = 0;
};
DDObj.prototype.getEltBelow = function(d_ret, d_x, d_y)
{
	var d_o, d_cmp = -1, d_i = sw_layer.elements.length; while(d_i--)
	{
		d_o = sw_layer.elements[d_i];
		d_x = d_o.x-this.w/2;
		d_y = d_o.y-this.h/2;
		if(d_o.visible && d_o.z < this.z && this.x >= d_x && this.x <= d_x+d_o.w && this.y >= d_y && this.y <= d_y+d_o.h)
		{
			if(d_o.z > d_cmp)
			{
				d_cmp = d_o.z;
				d_ret = d_o;
			}
		}
	}
	return d_ret;
};
DDObj.prototype.del = function(d_os, d_o)
{
	var d_i;
	if(this.parent && this.parent._removeChild) this.parent._removeChild(this);
	if(this.original)
	{
		this.hide();
		if(this.original.copies)
		{
			d_os = new Array();
			for(d_i = 0; d_i < this.original.copies.length; d_i++)
				if((d_o = this.original.copies[d_i]) != this) d_os[d_o.name] = d_os[d_os.length] = d_o;
			this.original.copies = d_os;
		}
	}
	else if(this.is_image)
	{
		this.hide();
		if(this.oimg)
		{
		  if(sw_layer.n4) this.oimg.src = this.defsrc;
		  else this.oimg.style.visibility = 'visible';
		}
	}
	else if(this.moveTo)
	{
		if(this.css) this.css.cursor = 'default';
		this.moveTo(this.defx, this.defy);
		this.resizeTo(this.defw, this.defh);
	}
	d_os = new Array();
	for(d_i = 0; d_i < sw_layer.elements.length; d_i++)
	{
		if((d_o = sw_layer.elements[d_i]) != this) d_os[d_o.name] = d_os[d_o.index = d_os.length] = d_o;
		else d_o._free();
	}
	sw_layer.elements = d_os;
	if(!sw_layer.n4) sw_layer.recalc();
};
DDObj.prototype._free = function()
{
	for(var d_i in this)
		this[d_i] = null;
	sw_layer.elements[this.name] = null;
};
sw_layer.n4RectVis = function(vis)
{
	for(var d_i = 4; d_i--;)
	{
		sw_layer.rectI[d_i].visibility = sw_layer.rectA[d_i].visibility = vis? 'show' : 'hide';
		if(vis) sw_layer.rectI[d_i].zIndex = sw_layer.rectA[d_i].zIndex = sw_layer.z+2;
	}
};
sw_layer.n4RectPos = function(d_o, d_x, d_y, d_w, d_h)
{
	d_o.x = d_x;
	d_o.y = d_y;
	d_o.clip.width = d_w;
	d_o.clip.height = d_h;
};
// NN4: Draw img sizing rect
sw_layer.n4Rect = function(d_w, d_h)
{
	var d_i;
	if(!sw_layer.rectI)
	{
		sw_layer.rectI = new Array();
		sw_layer.rectA = new Array();
	}
	if(!sw_layer.rectI[0])
	{
		for(d_i = 4; d_i--;)
		{
			(sw_layer.rectI[d_i] = new Layer(1)).bgColor = '#000000';
			(sw_layer.rectA[d_i] = new Layer(1)).bgColor = '#ffffff';
		}
	}
	if(!sw_layer.rectI[0].visibility || sw_layer.rectI[0].visibility == 'hide') sw_layer.n4RectVis(1);
	sw_layer.obj.w = d_w;
	sw_layer.obj.h = d_h;
	for(d_i = 4; d_i--;)
	{
		sw_layer.n4RectPos(sw_layer.rectI[d_i], sw_layer.obj.x + (!(d_i-1)? (sw_layer.obj.w-1) : 0), sw_layer.obj.y + (!(d_i-2)? (sw_layer.obj.h-1) : 0), d_i&1 || sw_layer.obj.w, !(d_i&1) || sw_layer.obj.h);
		sw_layer.n4RectPos(sw_layer.rectA[d_i], !(d_i-1)? sw_layer.rectI[1].x+1 : (sw_layer.obj.x-1), !(d_i-2)? sw_layer.rectI[2].y+1 : (sw_layer.obj.y-1), d_i&1 || sw_layer.obj.w+2, !(d_i&1) || sw_layer.obj.h+2);
	}
};
sw_layer.reszTo = function(d_w, d_h)
{
	if(sw_layer.n4 && sw_layer.obj.is_image) sw_layer.n4Rect(d_w, d_h);
	else sw_layer.obj.resizeTo(d_w, d_h);
};
sw_layer.embedVis = function(d_vis)
{
	var d_o = new Array('iframe', 'applet', 'embed', 'object');
	var d_i = d_o.length; while(d_i--)
	{
		var d_p = sw_layer.ie? document.all.tags(d_o[d_i]) : document.getElementsByTagName? document.getElementsByTagName(d_o[d_i]) : null;
		if(d_p)
		{
			var d_j = d_p.length; while(d_j--)
			{
				var d_q = d_p[d_j];
				while(d_q.offsetParent || d_q.parentNode)
				{
					if((d_q = d_q.parentNode || d_q.offsetParent || null) == sw_layer.obj.div)
					{
						d_p[d_j].style.visibility = d_vis;
						break;
					}
				}
			}
		}
	}
};

sw_layer.maxOffX = function(d_x, d_y)
{
	return(
		(sw_layer.obj.maxoffl+1 && (d_y = sw_layer.obj.defx-sw_layer.obj.maxoffl)-d_x > 0
		|| sw_layer.obj.maxoffr+1 && (d_y = sw_layer.obj.defx+sw_layer.obj.maxoffr)-d_x < 0)? d_y
		: d_x
	);
};
sw_layer.maxOffY = function(d_x, d_y)
{
	return(
		(sw_layer.obj.maxofft+1 && (d_y = sw_layer.obj.defy-sw_layer.obj.maxofft)-d_x > 0
		|| sw_layer.obj.maxoffb+1 && (d_y = sw_layer.obj.defy+sw_layer.obj.maxoffb)-d_x < 0)? d_y
		: d_x
	);
};
sw_layer.inWndW = function(d_x, d_y)
{
	var d_wx = sw_layer.getScrollX(),
	d_ww = sw_layer.getWndW();
	return(
		((d_y = d_wx+2)-d_x > 0) || ((d_y = d_wx+d_ww+sw_layer.obj.w-2)-d_x < 0)? d_y
		: d_x
	);
};
sw_layer.inWndH = function(d_x, d_y)
{
	var d_wy = sw_layer.getScrollY(),
	d_wh = sw_layer.getWndH();
	return(
		((d_y = d_wy+2)-d_x > 0) || ((d_y = d_wy+d_wh+sw_layer.obj.h-2)-d_x < 0)? d_y
		: d_x
	);
};
// These two funcs limit the size of element when mouseresized.
// Implemented 22.5.2003 by Gregor Ltolf, modified by Walter Zorn
sw_layer.limW = function(d_w)
{
	return(
		(sw_layer.obj.minw-d_w > 0)? sw_layer.obj.minw
		: (sw_layer.obj.maxw > 0 && sw_layer.obj.maxw-d_w < 0)? sw_layer.obj.maxw
		: d_w
	);
};
sw_layer.limH = function(d_h)
{
	return(
		(sw_layer.obj.minh-d_h > 0)? sw_layer.obj.minh
		: (sw_layer.obj.maxh > 0 && sw_layer.obj.maxh-d_h < 0)? sw_layer.obj.maxh
		: d_h
	);
};
// Optional autoscroll-page functionality. Courtesy Cedric Savarese.
// Modified by Walter Zorn.
function DDScroll()
{
	if(!sw_layer.obj || !sw_layer.obj.scroll && !sw_layer.scroll || sw_layer.ie4 || sw_layer.whratio)
	{
		sw_layer.scrx = sw_layer.scry = 0;
		return;
	}
	var d_bnd = 0x1c,
	d_wx = sw_layer.getScrollX(), d_wy = sw_layer.getScrollY();
	if(sw_layer.msmoved)
	{
		var d_ww = sw_layer.getWndW(), d_wh = sw_layer.getWndH(), d_y;
		sw_layer.scrx = ((d_y = sw_layer.e.x-d_ww-d_wx+d_bnd) > 0)? (d_y>>=2)*d_y
			: ((d_y = d_wx+d_bnd-sw_layer.e.x) > 0)? -(d_y>>=2)*d_y
			: 0;
		sw_layer.scry = ((d_y = sw_layer.e.y-d_wh-d_wy+d_bnd) > 0)? (d_y>>=2)*d_y
			: ((d_y = d_wy+d_bnd-sw_layer.e.y) > 0)? -(d_y>>=2)*d_y
			: 0;
	}
	if(sw_layer.scrx || sw_layer.scry)
	{
		window.scrollTo(
			d_wx + (sw_layer.scrx = sw_layer.obj.is_resized? sw_layer.limW(sw_layer.obj.w+sw_layer.scrx)-sw_layer.obj.w : sw_layer.obj.vertical? 0 : (sw_layer.maxOffX(sw_layer.obj.x+sw_layer.scrx)-sw_layer.obj.x)),
			d_wy + (sw_layer.scry = sw_layer.obj.is_resized? sw_layer.limH(sw_layer.obj.h+sw_layer.scry)-sw_layer.obj.h : sw_layer.obj.horizontal? 0 : (sw_layer.maxOffY(sw_layer.obj.y+sw_layer.scry)-sw_layer.obj.y))
		);
		sw_layer.obj.is_dragged? sw_layer.obj.moveTo(sw_layer.obj.x+sw_layer.getScrollX()-d_wx, sw_layer.obj.y+sw_layer.getScrollY()-d_wy)
			: sw_layer.reszTo(sw_layer.obj.w+sw_layer.getScrollX()-d_wx, sw_layer.obj.h+sw_layer.getScrollY()-d_wy);
	}
	sw_layer.msmoved = 0;
	window.setTimeout('DDScroll()', 0x33);
}
function PICK(d_ev)
{
	sw_layer.e = new sw_layer.evt(d_ev);
	if(sw_layer.e.x >= sw_layer.getWndW()+sw_layer.getScrollX() || sw_layer.e.y >= sw_layer.getWndH()+sw_layer.getScrollY()) return true; // on scrollbar
	var d_o, d_t, d_cmp = -1, d_i = sw_layer.elements.length; while(d_i--)
	{
		d_o = sw_layer.elements[d_i];
		if(sw_layer.n4 && sw_layer.e.but > 1 && sw_layer.e.src == d_o.oimg && !d_o.clone) return false;
		if(d_o.visible && sw_layer.e.but <= 1 && sw_layer.e.x >= d_o.x && sw_layer.e.x <= d_o.x+d_o.w && sw_layer.e.y >= d_o.y && sw_layer.e.y <= d_o.y+d_o.h)
		{
			if(d_o.z > d_cmp && (d_t = sw_layer.e.src.tag).indexOf('inpu') < 0 && d_t.indexOf('texta') < 0 && d_t.indexOf('sele') < 0 && d_t.indexOf('opti') < 0 && d_t.indexOf('scrol') < 0)
			{
				d_cmp = d_o.z;
				sw_layer.obj = d_o;
			}
		}
	}
	if(sw_layer.obj)
	{
		if(sw_layer.obj.nodrag) sw_layer.obj = null;
		else
		{
			sw_layer.e.e.cancelBubble = true;
			var d_rsz = sw_layer.e.modifKey && (sw_layer.obj.resizable || sw_layer.obj.scalable);
			if(sw_layer.op)
			{
				(d_o = document.getElementById('OpBlUr')).style.pixelLeft = sw_layer.e.x;
				d_o.style.pixelTop = sw_layer.e.y;
				(d_o = d_o.children[0].children[0]).focus();
				d_o.blur();
			}
			else if(sw_layer.ie && !sw_layer.ie4)
			{
				if(document.selection && document.selection.empty) document.selection.empty();
				sw_layer.db.onselectstart = function()
				{
					event.returnValue = false;
				};
			}
			if(d_rsz)
			{
				sw_layer.obj._setCrs('se-resize');
				sw_layer.obj.is_resized = 1;
				sw_layer.whratio = sw_layer.obj.scalable? sw_layer.obj.defw/sw_layer.obj.defh : 0;
				if(sw_layer.ie)
				{
					if(sw_layer.ie4)
					{
						window.sw_layer_x = sw_layer.getScrollX();
						window.sw_layer_y = sw_layer.getScrollY();
					}
					setTimeout(
						'if(sw_layer.obj && document.selection && document.selection.empty)'+
						'{'+
							'document.selection.empty();'+
							'if(sw_layer.ie4) window.scrollTo(window.sw_layer_x, window.sw_layer_y);'+
						'}'
					,0);
				}
				sw_layer.setMovHdl(RESIZE);
				sw_layer.reszTo(sw_layer.obj.w, sw_layer.obj.h);
			}
			else
			{
				sw_layer.obj.is_dragged = 1;
				sw_layer.setMovHdl(DRAG);
			}
			sw_layer.setUpHdl(DROP);
			sw_layer.embedVis('hidden');
			sw_layer.obj._setOpaRel(sow_opacity);
			sw_layer.obj.maximizeZ();
			sw_layer.ofx = sw_layer.obj.x+sw_layer.obj.w-sw_layer.e.x;
			sw_layer.ofy = sw_layer.obj.y+sw_layer.obj.h-sw_layer.e.y;
			if(window.my_PickFunc) my_PickFunc();
			if(sw_layer.obj.pickFunc) sw_layer.obj.pickFunc();
			DDScroll();
			return !(
				sw_layer.obj.is_resized
				|| sw_layer.n4 && sw_layer.obj.is_image
				|| sw_layer.n6 || sw_layer.w3c
			);
		}
	}
	if(sw_layer.downFunc) return sw_layer.downFunc(d_ev);
	return true;
}
function DRAG(d_ev)
{
	if(!sw_layer.obj || !sw_layer.obj.visible) return true;
	if(sw_layer.ie4 || sw_layer.w3c || sw_layer.n6 || sw_layer.obj.children.length > 0xf)
	{
		if(sw_layer.wait) return false;
		sw_layer.wait = 1;
		setTimeout('sw_layer.wait = 0;', sw_layer.tiv);
	}
	sw_layer.e = new sw_layer.evt(d_ev);
	if(sw_layer.ie && !sw_layer.e.but)
	{
		DROP(d_ev);
		return true;
	}
	sw_layer.msmoved = 1;
	sw_layer.obj.moveTo(
		sw_layer.obj.vertical? sw_layer.obj.x : sw_layer.maxOffX(sw_layer.inWndW(sw_layer.ofx+sw_layer.e.x)-sw_layer.obj.w),
		sw_layer.obj.horizontal? sw_layer.obj.y : sw_layer.maxOffY(sw_layer.inWndH(sw_layer.ofy+sw_layer.e.y)-sw_layer.obj.h)
	);

	if(window.my_DragFunc) my_DragFunc();
	if(sw_layer.obj.dragFunc) sw_layer.obj.dragFunc();
	if(sw_layer.moveFunc) return sw_layer.moveFunc(d_ev);
	return false;
}
function RESIZE(d_ev)
{
	if(!sw_layer.obj || !sw_layer.obj.visible) return true;
	if(sw_layer.wait) return false;
	sw_layer.wait = 1;
	setTimeout('sw_layer.wait = 0;', sw_layer.tiv);
	sw_layer.e = new sw_layer.evt(d_ev);
	if(sw_layer.ie && !sw_layer.e.but)
	{
		DROP(d_ev);
		return true;
	}
	sw_layer.msmoved = 1;
	var d_w = sw_layer.limW(sw_layer.inWndW(sw_layer.ofx+sw_layer.e.x)-sw_layer.obj.x), d_h;
	if(!sw_layer.whratio) d_h = sw_layer.limH(sw_layer.inWndH(sw_layer.ofy+sw_layer.e.y)-sw_layer.obj.y);
	else
	{
		d_h = sw_layer.limH(sw_layer.inWndH(Math.round(d_w/sw_layer.whratio)+sw_layer.obj.y)-sw_layer.obj.y);
		d_w = Math.round(d_h*sw_layer.whratio);
	}
	sw_layer.reszTo(d_w, d_h);
	if(window.my_ResizeFunc) my_ResizeFunc();
	if(sw_layer.obj.resizeFunc) sw_layer.obj.resizeFunc();
	if(sw_layer.moveFunc) return sw_layer.moveFunc(d_ev);
	return false;
}
function DROP(d_ev)
{
	if(sw_layer.obj)
	{
		if(sw_layer.obj.is_dragged)
		{
			if(!sw_layer.obj.is_image) sw_layer.getWH(sw_layer.obj);
		}
		else if(sw_layer.n4)
		{
			if(sw_layer.obj.is_image)
			{
				sw_layer.n4RectVis(0);
				sw_layer.obj.resizeTo(sw_layer.obj.w, sw_layer.obj.h);
			}
		}
		if(!sw_layer.n4 || !sw_layer.obj.is_image) sw_layer.recalc();
		sw_layer.setMovHdl(sw_layer.moveFunc);
		sw_layer.setUpHdl(sw_layer.upFunc);
		if(sw_layer.db) sw_layer.db.onselectstart = null;
		sw_layer.obj._setOpaRel(1.0);
		sw_layer.obj._setCrs(sw_layer.obj.cursor);
		sw_layer.embedVis('visible');
		sw_layer.obj._resetZ();
		sw_layer.e = new sw_layer.evt(d_ev);
		if(window.my_DropFunc) my_DropFunc();
		if(sw_layer.obj.dropFunc) sw_layer.obj.dropFunc();
		sw_layer.msmoved = sw_layer.obj.is_dragged = sw_layer.obj.is_resized = sw_layer.whratio = 0;
		sw_layer.obj = null;
	}
	sw_layer.setDwnHdl(PICK);
}
function SET_DHTML()
{
	var d_a = arguments, d_ai, d_htm = '', d_o, d_i = d_a.length; while(d_i--)
	{
		if(!(d_ai = d_a[d_i]).indexOf('c:')) sw_layer.cursor = d_ai.substring(2);
		else if(d_ai == NO_ALT) sw_layer.noalt = 1;
		else if(d_ai == SCROLL) sw_layer.scroll = 1;
		else if(d_ai == RESET_Z) sw_layer.re_z = 1;
		else if(d_ai == RESIZABLE) sw_layer.resizable = 1;
		else if(d_ai == SCALABLE) sw_layer.scalable = 1;
		else if(d_ai == TRANSPARENT) sw_layer.diaphan = 1;
		else
		{
			d_o = new DDObj(d_ai);
			sw_layer.addElt(d_o);
			d_htm += d_o.t_htm || '';
			if(d_o.oimg && d_o.cpy_n)
			{
				var d_j = 0; while(d_j < d_o.cpy_n)
				{
					var d_p = new DDObj(d_o.name+d_o.cmd, ++d_j);
					sw_layer.addElt(d_p, d_o);
					d_p.defz = d_o.defz+d_j;
					d_p.original = d_o;
					d_htm += d_p.t_htm;
				}
			}
		}
	}
	if (sw_layer.n4 || sw_layer.n6 || sw_layer.ie || sw_layer.op || sw_layer.w3c) document.write(
		(sw_layer.n4? '<div style="position:absolute;"><\/div>\n'
		: (sw_layer.op && !sw_layer.op6)? '<div id="OpBlUr" style="position:absolute;visibility:hidden;width:0px;height:0px;"><form><input type="text" style="width:0px;height:0px;"><\/form><\/div>'
		: '') + d_htm
	);
	sw_layer.z = 0x33;
	d_i = sw_layer.elements.length; while(d_i--)
	{
		sw_layer.addProps(d_o = sw_layer.elements[d_i]);
		if(d_o.is_image && !d_o.original && !d_o.clone)
			sw_layer.n4? d_o.oimg.src = spacer : d_o.oimg.style.visibility = 'hidden';
	}
	sw_layer.mkWzDom();
	if(window.onload) sw_layer.loadFunc = window.onload;
	if(window.onunload) sw_layer.uloadFunc = window.onunload;
	window.onload = sw_layer.initz;
	window.onunload = sw_layer.finlz;
	sw_layer.setDwnHdl(PICK);
}
function ADD_DHTML(d_o) // layers only!
{
	d_o = new DDObj(d_o);
	sw_layer.addElt(d_o);
	sw_layer.addProps(d_o);
	sw_layer.mkWzDom();
}




////////////////////////////////////////////////////////////
// If not needed, all code below this line may be removed


// For backward compatibility
sw_layer.d = document;			// < v. 2.72
var RESET_ZINDEX = RESET_Z; // < 3.44
var KEYDOWN_RESIZE = RESIZABLE; // < 4.43
var CURSOR_POINTER = CURSOR_HAND; // < 4.44
var NO_SCROLL = '';		 // < v. 4.49




////////////////////////////////////////////////////////////
// FUNCTIONS FOR EXTENDED SCRIPTING
// Use these for your own extensions,
// or to call functions defined elsewhere



/* my_PickFunc IS AUTOMATICALLY CALLED WHEN AN ITEM STARTS TO BE DRAGGED.
The following objects/properties are accessible from here:

- sw_layer.e: current mouse event
- sw_layer.e.property: access to a property of the current mouse event.
  Mostly requested properties:
  - sw_layer.e.x: document-related x co-ordinate
  - sw_layer.e.y: document-related y co-ord
  - sw_layer.e.src: target of mouse event (not identical with the drag drop object itself).
  - sw_layer.e.button: currently pressed mouse button. Left button: sw_layer.e.button <= 1

- sw_layer.obj: reference to currently dragged item.
- sw_layer.obj.property: access to any property of that item.
- sw_layer.obj.method(): for example sw_layer.obj.resizeTo() or sw_layer.obj.swapImage() .
  Mostly requested properties:
	- sw_layer.obj.name: image name or layer ID passed to SET_DHTML();
	- sw_layer.obj.x and sw_layer.obj.y: co-ordinates;
	- sw_layer.obj.w and sw_layer.obj.h: size;
	- sw_layer.obj.is_dragged: 1 while item is dragged, else 0;
	- sw_layer.obj.is_resized: 1 while item is resized, i.e. if <ctrl> or <shift> is pressed, else 0

For more properties and details, visit the API documentation
at http://www.walterzorn.com/dragdrop/api_e.htm (english) or
http://www.walterzorn.de/dragdrop/api.htm (german)	*/
function my_PickFunc()
{
}




/* my_DragFunc IS CALLED WHILE AN ITEM IS DRAGGED
See the description of my_PickFunc above for what's accessible from here. */
function my_DragFunc()
{
	//window.status = 'sw_layer.elements.' + sw_layer.obj.name + '.x  = ' + sw_layer.obj.x + '	 sw_layer.elements.' + sw_layer.obj.name + '.y = ' + sw_layer.obj.y;
}




/* my_ResizeFunc IS CALLED WHILE AN ITEM IS RESIZED
See the description of my_PickFunc above for what's accessible from here. */
function my_ResizeFunc()
{
	//window.status = 'sw_layer.elements.' + sw_layer.obj.name + '.w  = ' + sw_layer.obj.w + '	 sw_layer.elements.' + sw_layer.obj.name + '.h = ' + sw_layer.obj.h;
}




/* THIS ONE IS CALLED ONCE AN ITEM IS DROPPED
See the description of my_PickFunc for what's accessible from here.
Here may be investigated, for example, what's the name (sw_layer.obj.name)
of the dropped item, and where (sw_layer.obj.x, sw_layer.obj.y) it has been dropped... */
function my_DropFunc()
{
}



// SOWRE MODIFICATIONS


function SW_ADD_LAYER(d_o)
{
	if (window.sw_layer && sw_layer.elements && sw_layer.elements.length > 0){
		ADD_DHTML(d_o);
	} else {
		SET_DHTML(d_o);
	}
}

function sw_hideSelects(){
    if(!window.attachEvent) return false;
    sow_openedLayers = sow_openedLayers + 1;
    var selects = document.getElementsByTagName("select");
    for( var i=0; i<selects.length; i++ ){
    	if(selects[i].id != "NOHIDEONLAYER"){
    		selects[i].style.visibility = "hidden";
    	}
   	}
}

function sw_layer_hideSelects(){
	if(document.readyState=="complete"){
		sw_hideSelects();
	}
}

function sw_showSelects(){
    if(!window.attachEvent) return false;
    if (sow_openedLayers > 0){
    	sow_openedLayers = sow_openedLayers - 1;
    }
    if (sow_openedLayers == 0){
	    var selects = document.getElementsByTagName("select");
	    for( var i=0; i<selects .length; i++ ){
    		if(selects[i].id != "NOHIDEONLAYER"){
    			selects[i].style.visibility = "visible";
    		}
	    }
	}
}
	
function sw_chargeLayersMSIE(){
	if (document.readyState == "complete") {
		for(var i = 0 ; i < sw_layers_inicialize.length ; i++){
			eval("setTimeout('"+sw_layers_inicialize[i]+"', 1);");
		}
	}	
}

function sw_chargeLayersMozilla(){
	for(var i = 0 ; i < sw_layers_inicialize.length ; i++){
		eval("setTimeout('"+sw_layers_inicialize[i]+"', 1);");
	}
}
