// Switch image
function switchImage(imgName, imgSrc) { if (document.images) {
if (imgSrc != "none") { document.images[imgName].src = imgSrc; } } 
}
//-->

// Open script
function openWindow(theURL,winName,features) { //v2.0
   window.open(theURL,winName,features);
}
//-->

// Close script
function closeWindow() {
window.close();
 }
//-->

// Fake script
function fake() { //v1.0
}
//-->

// Rollover script
function swapImgRestore() { //v3.0
  var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.p) d.p=new Array();
    var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
}

function findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document); return x;
}

function swapImage() { //v3.0
  var i,j=0,x,a=swapImage.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=findObj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->

// Hide-Show layers script
function Showtime() { //v9.0
 var i,p,v,obj,args=Showtime.arguments;
 for (i=0; i<(args.length-2); i+=3) 
 with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
  if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
  obj.visibility=v; }
}
//-->

// DIV goto script
function Jumpbox() { //v3.0
  var i, args=Jumpbox.arguments; document.Back_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
//-->

	/* popup class (C) 2008 icomplete.com */
	function popup()
	{		
		var cursorX;
		var cursorY;
		var showing = false;
		var ctext = '';
		var popupTimeout = -1;
		
		this.init = function()
		{		
			document.body.onmousemove = function(e) 
			{
				if (!e) var e = window.event;
				cursorX = e.clientX;
				cursorY = e.clientY+20;

				//var scrollx, scrolly;
				
				var scrollx = 0;
				var scrolly = 0;
				if( typeof( window.pageYOffset ) == 'number' )
				{
					//Netscape compliant
					scrollx = window.pageXOffset;
					scrolly = window.pageYOffset;
				}
				else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) )
				{
					//DOM compliant
					scrolly = document.body.scrollTop;
					scrollx = document.body.scrollLeft;
				} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) )
				{
					//IE6 standards compliant mode
					scrolly = document.documentElement.scrollTop;
					scrollx = document.documentElement.scrollLeft;
				}		
				
				cursorX += scrollx;
				cursorY += scrolly;
				
				if (showing!==false)
				{
					ws = wndSize();
					ws.x -= 20;	
				
					if (showing.showRight)
						xpos = cursorX;	
					else
						xpos = cursorX - 250;
						
						
					showing.style.left = xpos+"px";
					showing.style.top = cursorY+"px";
					
					if (xpos + showing.offsetWidth > ws.x)
						showing.style.left = ws.x-showing.offsetWidth+"px";
				}
			}
		}

		this.showDelayed = function(title, text, delay, opts)
		{
			var title_ = title;
			var text_ = text;
			var delay_ = delay;
			var opts_ = opts;
			var class_ = this;
			var fo = function()
			{
				class_.show(title_, text_, opts_);
				
				
			}
			if (popupTimeout != -1)
			{
				window.clearTimeout(popupTimeout);
				popupTimeout = -1;
			}
			
			popupTimeout = window.setTimeout(fo, delay*1000);
			
			
		}
		
		this.show = function(title, text, opts)
		{
			if (!opts)
				opts = [];
				
			if (!opts.popupclass)
				opts.popupclass = 'jspopup';
			
			this.animStop();
			
			if (ctext == (title+text))
				return;
			else
				this.hide();
			
			ctext = title+text;
			
			try
			{
				var pdiv = document.createElement('div');
				pdiv.className = opts.popupclass;				
				
				if (opts && opts.showRight)
				{
					pdiv.style.left = cursorX+"px";		
					pdiv.showRight = true;
				}
				else
				{
					pdiv.style.left = (cursorX-250)+"px";		
					pdiv.showRight = false;
				}
					
				pdiv.style.top = cursorY+"px";

				var bolder = document.createElement('b');
				bolder.appendChild(document.createTextNode(title));
				pdiv.appendChild(bolder);
				pdiv.appendChild(document.createTextNode(text));
	
				
				/*document.body.appendChild(pdiv);*/
				// IE FIX
				document.getElementById('popupcontainer541').appendChild(pdiv);
				showing = pdiv;				
			}
			catch (e)
			{

			}
		}

		this.hide = function()
		{
			if (popupTimeout != -1)
			{
				window.clearTimeout(popupTimeout)
				popupTimeout = -1;
			}
			
			if (showing === false)
				return;
	
			showing.parentNode.removeChild(showing);
			showing = false;
			ctext = '';

		}

		this.hideDelayed = function(wait)
		{
			if (popupTimeout != -1)
			{
				window.clearTimeout(popupTimeout);
				popupTimeout = -1;
			}
			
			if (showing === false)
				return;

			/* prepare fade out function closure */
			function animate(t)
			{
				if (t.anim.stop)
				{
					return;
				}
				
				if (t.anim.wait > 0)
				{
					t.anim.wait --;
					window.setTimeout(function() {animate(t);}, 1000);
					return;
				}
				
				t.anim.step = t.anim.step / 1.4;
				
				var _vopac = parseInt(t.anim.step);
				if (_vopac < 10)
				{
					_vopac = "0"+_vopac;
				}
				if (_vopac >= 99)
				{
					t.anim.node.style.opacity = '1';
					t.anim.node.style.filter = '';
				}
				else
				{
					t.anim.node.style.opacity='0.'+_vopac;
					t.anim.node.style.filter = "alpha(opacity=" + _vopac + ")"; 
				}

				if (t.anim.step > 1)
				{
					window.setTimeout(function() {animate(t);}, 50);
				}
				else
					t.animStop();
			}

	
			var _t = showing;
			showing = false;
			ctext = '';
			
			if (typeof(wait)=='undefined')
				wait = 0;
			
			this.anim = {};
			this.anim.node = _t;
			this.anim.step = 99;
			this.anim.wait = wait;
			this.anim.stop = false;
			animate(this);
		}

		this.animStop = function ()
		{
			if (typeof(this.anim) != 'undefined' && typeof(this.anim.node) != 'undefined')
				this.anim.node.parentNode.removeChild(this.anim.node);
			this.anim = {};
			this.anim.stop = true;
			this.anim.wait = 0;
		}
		

	}


	var popupcu = new popup;
	function prepare_callus_popup()
	{
		
		popupcu.init();

		try
		{
			var cu = document.getElementById('callus');
			cu.setAttribute('alt2', cu.getAttribute('alt'));
			cu.setAttribute('alt', '');
			cu.onmouseover = function () {popupcu.show("", cu.getAttribute('alt2'), {showRight:true, popupclass:'blackpopup'});};
			cu.onmouseout = function () {popupcu.hideDelayed();}		
		}
		catch (eccd)
		{
		}

		
		var l = document.getElementById('icompletelogo');
		l.setAttribute('alt2', l.getAttribute('alt'));
		l.setAttribute('alt', '');
		
		l.onmouseover = function () {popupcu.show("", l.getAttribute('alt2'), {showRight:true, popupclass:'blackpopup'});};
		l.onmouseout = function () {popupcu.hideDelayed();}
	}
	
	
	
	
	
	
function wndSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  return {'x':myWidth, 'y':myHeight};
}






/* ANIMATION FRAMEWORK */


window.getScrollPos = function ()
{
	var scrollx = 0;
	var scrolly = 0;
	if( typeof( window.pageYOffset ) == 'number' )
	{
		//Netscape compliant
		scrollx = window.pageXOffset;
		scrolly = window.pageYOffset;
	}
	else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) )
	{
		//DOM compliant
		scrolly = document.body.scrollTop;
		scrollx = document.body.scrollLeft;
	} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) )
	{
		//IE6 standards compliant mode
		scrolly = document.documentElement.scrollTop;
		scrollx = document.documentElement.scrollLeft;
	}
	
	return {x:scrollx, y:scrolly};
}




function myevent(e_)
{
	// get event object
	if (!e_) 
		this.e = window.event;
	else
		this.e = e_;
	
	this.getEventSource = function()
	{
		var e = this.e;
		if (e.target) targ = e.target;
		else if (e.srcElement) targ = e.srcElement;
		if (targ.nodeType == 3) // defeat Safari bug
			targ = targ.parentNode;
			
		return targ;
	}

	this.getMousePos = function(addScrolls)
	{
		var posx = 0;
		var posy = 0;
		var e = this.e;
		if (e.pageX || e.pageY)
		{
			posx = e.pageX;
			posy = e.pageY;
		}
		else if (e.clientX || e.clientY)
		{
			posx = e.clientX + document.body.scrollLeft
				+ document.documentElement.scrollLeft;
			posy = e.clientY + document.body.scrollTop
				+ document.documentElement.scrollTop;
		}
		
		if (addScrolls)
			var scroll = window.getScrollPos();
		else
			var scroll = {x:0, y:0};
		return {x:posx+scroll.x, y:posy+scroll.y};
	}
	
	this.getClientMousePos = function(withinNode)
	{
		var mp = this.getMousePos();
		var rel_mp = myNode(withinNode).findPos();
	
		return {x:mp.x-rel_mp.x, y:mp.y-rel_mp.y};
	}

}


function myNode(node)
{
	if (node.isMyNode)
		return node;
	
	node.isMyNode = true;
	node.findPos = function()
	{
		var ctobj = this;
		var curleft = 0;
		var curtop = 0;

		if (ctobj.offsetParent)
		{
			do
			{
				curleft += ctobj.offsetLeft;
				curtop += ctobj.offsetTop;
			} while (ctobj = ctobj.offsetParent);
		}
	
		return {x:curleft, y:curtop};
	}
	
	node.setOpacity = function(percentOpaque)
	{
		if (percentOpaque == 100)
		{
			this.style.opacity = '';
			this.style.filter = ''; 
			return;
		}
		
		var _vopac = percentOpaque/100;
		if (_vopac < 0.01)
		{
			_vopac = '0';
		}
		else
		{
			if (_vopac < 0.1)
				_vopac = '0.0'+percentOpaque;
		}
		
		this.style.opacity=_vopac;
		this.style.filter = "alpha(opacity=" + percentOpaque + ")"; 
	}
	
	node.childNodesByName = function(name, recursive)
	{
		var ret = [];
		var n = this.childNodes;
		for (var i=0; i<n.length; i++)
		{
			if (n[i].nodeName.toLowerCase() == name.toLowerCase())
				ret.push(n[i]);
			else if (recursive)
			{
				// IE fix - text nodes cannot be used as myNode
				if(n[i].nodeName.toLowerCase() != '#text')
					ret = ret.concat(myNode(n[i]).childNodesByName(name, true))
			}
		}
		
		return ret;
	}
	
	node.childNodesByClassName = function(name, recursive)
	{
		var ret = [];
		var n = this.childNodes;
		for (var i=0; i<n.length; i++)
		{						
			if (typeof(n[i].className) =='string' && n[i].className.toLowerCase() == name.toLowerCase())
				ret.push(n[i]);
			else if (recursive)
			{
				// IE fix - text nodes cannot be used as myNode
				if(n[i].nodeName.toLowerCase() != '#text')
					ret = ret.concat(myNode(n[i]).childNodesByClassName(name, true))
			}
		}
		
		return ret;
	}
	
	return node;
}



/* Roll panel site widget */
function rollPanel(node, rollHeight, leftPosition, topPosition)
{
	this.control = myNode(node);
	this.rollHeight = rollHeight;

	this.rollPanel = myNode(document.getElementById(node.getAttribute('id')+'-roller'));
	this.height = 0;
	this.over = false;
	this.animating = false;
	this.rollPanel.style.height='0px';
	
	/* process links for animation */
	var links = this.rollPanel.childNodesByName('a', true);
	for (var i=0; i<links.length; i++)
	{
		var link = myNode(links[i]);
		var cls = function(class_, node_)
		{
			node_.anim_step = 0;
			node_.anim_forward = false;
			node_.start_backward = false;
			
			node_.onmouseover = function()
			{
				
				if (node_.anim_step == 0 && !node_.anim_forward)
				{
					node_.anim_forward = true;
					class_.link_anim(node_);
				}
				node_.anim_forward = true;
				node_.start_backward = false;
			}
			
			node_.onmouseout = function()
			{
				node_.start_backward = true;
			}
		}
		cls(this, link);
	}
	
	this.link_anim = function(node)
	{
		var x = node.findPos();
		var y = x.y;
		x = x.x;

		var parx = node.parentNode.findPos()
		var pary = parx.y;
		parx = parx.x;
		x = x-parx - 10;
		y = y-pary+node.offsetHeight/2 - 2;
		
		if (node.anim_forward)
		{
			if (node.anim_step == 0)
			{
				var el = document.createElement('div');
				el.style.position = 'absolute';
				el.style.left = x+'px';
				el.style.top = y+'px';
				el.style.width = 4+'px';
				el.style.height = 4+'px';
				el.style.padding='0px';
				el.style.overflow = 'hidden';
				el.className = 'boxanim';
					
				node.parentNode.appendChild(el);
				node.animation = el;
				
				node.anim_step++;
			}
			else if (node.anim_step <4)
			{
				var el = node.animation;
				el.style.left = (x-node.anim_step)+'px';
				el.style.top = (y-node.anim_step)+'px';
				el.style.width = (4+node.anim_step*2)+'px';
				el.style.height = (4+node.anim_step*2)+'px';
				
				node.anim_step++;
			}
			
			if (node.anim_step >= 4 && node.start_backward)
				node.anim_forward = false;
		}
		else
		{
			node.anim_step--;
			if (node.anim_step == 0)
			{
				node.animation.parentNode.removeChild(node.animation);
				node.animation = null;
				return;
			}
			
		}
		
		
		var that = this;
		window.setTimeout(function() { that.link_anim(node); }, 30);
	}
	
	/* links animation code ends here */
	
	this.rp_over = function(e)
	{
		var pos = this.control.findPos();
		this.leftPosition = pos.x;
		this.topPosition = pos.y+5;
		this.over = true;

		if (!this.animating)
		{
			this.animating = true;
			this.animate();
		}
	}
	
	this.rp_out = function(e)
	{
		this.over = false;

		if (!this.animating)
		{
			this.animating = true;
			var that = this;
			
			// we have to introduce some inertion to compensate for events fired from links (out->over) so moving accross links won't close the panel
			// wait 0,5 sec before closing full-opened panel!
			window.setTimeout(function() {that.animate()}, 500);
		}
	}
	
	/* last ANIMATE function that generated high load under IE 6/7
	this.animate = function()
	{	
		if (this.over)
			this.height = Math.ceil((this.rollHeight + this.height*3) / 4);
		else
			this.height = Math.floor(this.height / 2);

		if (this.height > this.rollHeight/1.2)
			var cl_ = 'open';
		else
			var cl_ = 'closed';
		
		if (this.rollPanel.className != cl_)
			this.rollPanel.className = cl_;

		var rstyle = this.rollPanel.style;

		rstyle.left = this.leftPosition+'px';
		rstyle.top = (this.topPosition - this.height) + 'px';
		rstyle.height = this.height + 'px';
		
		var opacity = Math.ceil((this.height / this.rollHeight)*100);
		
		if (opacity > 80)
			opacity = 100;
		this.rollPanel.setOpacity(opacity);

		var that = this;
		window.setTimeout(function() {that.animate()}, 60);
	}	*/
	
	this.animate = function()
	{	
		if (this.over)
			this.height = Math.ceil((this.rollHeight + this.height*3) / 4);
		else
			this.height = Math.floor(this.height / 2);

		if ( (this.height == this.rollHeight && this.over) ||
			 (this.height == 0 && !this.over) )
		{
			this.animating = false;
			return;
		}

		/* IE7 - CPU hog FIX */
		if (this.height > this.rollHeight/1.2)
			var cl_ = 'open';
		else
			var cl_ = 'closed';
		
		if (this.rollPanel.className != cl_)
			this.rollPanel.className = cl_;

		var rstyle = this.rollPanel.style;

		rstyle.left = this.leftPosition+'px';
		rstyle.top = (this.topPosition - this.height) + 'px';
		rstyle.height = this.height + 'px';
		
		var opacity = Math.ceil((this.height / this.rollHeight)*100);
		
		if (opacity > 80)
			opacity = 100;
		this.rollPanel.setOpacity(opacity);

		var that = this;
		window.setTimeout(function() {that.animate()}, 60);
	}	



	var that = this;
	node.onmouseover = function (e)
	{
		that.rp_over(e);
	}
	
	node.onmouseout = function (e)
	{
		that.rp_out(e);
	}
	
	this.rollPanel.onmouseover = function (e)
	{
		that.rp_over(e);
	}
	
	this.rollPanel.onmouseout = function(e)
	{
		that.rp_out(e);
	}

	var pos = this.control.findPos();
	this.leftPosition = pos.x;
	this.topPosition = pos.y+5;
}

/* Fisheye control */

function fisheye()
{
	this.control = document.getElementById('fisheye');
	this.buttons = [];
	this.mousex = -1;
	this.mousey = -1;
	this.onclick = -1;
	
	
	var b = this.control.childNodes;
	var ii = 0;
	for (var i=0; i<b.length; i++)
	{
		var bb = b[i];
		
		if (bb.nodeName.toUpperCase() == 'IMG')
		{
			ii++;
			bb = myNode(bb);
			
			// get all button positions / dimensions
			var btn_object = {};
			btn_object.element = bb;
			bb.setAttribute('srca', bb.getAttribute('src'));
					
			/* firefox 3 fix - set width and height, then remove height */
			btn_object.x = bb.findPos();
			btn_object.y = btn_object.x.y + bb.offsetHeight/2;
			btn_object.x = btn_object.x.x + bb.offsetWidth/2+5*i-5*9;
			btn_object.w = bb.offsetWidth;
			btn_object.h = bb.offsetHeight;
			bb.removeAttribute('height');
			
			bb.style.marginLeft='5px';
			bb.style.marginRight='5px';
			
			/* align - bottom */
			bb.style.position='relative';
			
			 //for debugging 
			/*var ee = document.createElement('div');
			ee.style.position='absolute';
			ee.style.background='red';
			ee.style.left = btn_object.x+'px';
			ee.style.top  = btn_object.y+'px';
			ee.style.width='10px';
			ee.style.height='10px';
			document.body.appendChild(ee);*/
			
			this.buttons.push(btn_object);
			
			// prepare button events
			var that = this;
			cls = function(data)
			{
				btn_object.element.onclick = function cancelProp(e)
				{
					if (that.onclick != -1)
						that.onclick(e, data);
				}
			}
			cls(ii);
		}
	}
	
	// set 'fisheye' effect limiter
	this.add_limiter = this.buttons[2].x-this.buttons[0].x;
	
	// define events
	this.fe_container_resize = function(e)
	{
		var b = this.buttons;
		for (var i=0; i<b.length; i++)
		{
			var bb = b[i];
			
			bb.x = bb.element.findPos();
			bb.y = bb.x.y + bb.element.offsetHeight/2;
			bb.x = bb.x.x + bb.element.offsetWidth/2+5*i-4*10;
		}
	}
			
	this.fe_mousemove = function(e)
	{
		var e = new myevent(e);
		var mousepos = e.getMousePos(false);
		
		this.mousex = mousepos.x;
		this.mousey = mousepos.y;
		
		window.status = "x: "+mousepos.x + "y: "+mousepos.y;
	}

	this.fe_mouseout = function(e)
	{
		this.mousex = -2;
		this.mousey = -2;
	}
	
	// set event handlers
	try
	{
		var that = this;
		this.control.onmousemove = function(e)
		{
			that.fe_mousemove(e);
		};
		
		this.control.onmouseover = function(e)
		{
			that.fe_mousemove(e);
		};
		
		this.control.onmouseout = function(e)
		{
			that.fe_mouseout(e);
		};
		
		window.onresize = function (e)
		{
			that.fe_container_resize();
		}	
	}
	catch (e)
	{

	}
	
	
	this.animate = function()
	{
		var that = this;
		window.setTimeout(function() {that.animate()}, 20);

		if (this.mousex==-1 && this.mousey==-1)
			return;

		var x = this.mousex;
		var y = this.mousey;	

		// iterate throught all buttons and animate them appropriately
		for (var i=0; i<this.buttons.length; i++)
		{
			var bb = this.buttons[i];
			
			if (this.mousex == this.mousey && this.mousex == -2)
				marg_add = 0;
			else
				marg_add = Math.max(0, this.add_limiter-Math.abs(x-bb.x));
			
			if (marg_add < 1)
				marg_add = 0;

			
			var prev_w = bb.element.offsetWidth;
			var new_w = (marg_add/this.add_limiter)*20 + bb.w;
			var anim_w = Math.ceil((prev_w*4 + new_w)/5);
						
			if (Math.abs(anim_w - bb.w) < 5)
				anim_w = Math.floor((prev_w*4 + new_w)/5);

			bb.element.width = anim_w;
			
			/* align - bottom */
			bb.element.style.top = 0-(anim_w-bb.w)+"px";
			
			var newsrc = '';
			if (anim_w > bb.w)
				newsrc  = bb.element.getAttribute('srcb');
			else
				newsrc = bb.element.getAttribute('srca');
			
			// firefox bugfix (changing image src causes CPU saturation / memory leaks)	
			if (bb.element.savedSrc != newsrc)
			{
				bb.element.src = newsrc;
				bb.element.savedSrc = newsrc;
			}
			// ->>

			var margin = Math.max(5, Math.ceil(marg_add/8))+"px";
			bb.element.style.marginLeft=margin;
			bb.element.style.marginRight=margin;
		}
	}
	
	this.animate();
}




function hpages()
{
	this.onhide = false;
	this.onShow = function(number) { };
	this.onShowing = function(number, animstep) { };
	
	var els = myNode(document.body).childNodesByClassName('hpage', true);
	this.elements = [];
	for (var i=0; i<els.length; i++)
		this.elements.push({node: myNode(els[i]), animStop:true, number:i});

	this.show = function(num)
	{
		if (! (num >= 0 && num < this.elements.length) )
			return;		
		var el = this.elements[num];
		
		if (!el.animStop)
			return;

		for (var i=0; i<this.elements.length; i++)
			this.hide(i);
		
		el.animStep = 0;
		el.animStop = false;
		el.animForward = true;
		this.anim(el);
	}
	
	this.hide = function(num)
	{
		if (! (num >= 0 && num < this.elements.length) )
			return;		
		var el = this.elements[num];

		if (el.animStop)
			return;
		el.animForward = false;

		if (this.onhide !== false)
			this.onhide(this.elements[num].node, this.elements[num].number);	
	}

	this.anim = function(element)
	{
		var node = element.node;
		node.style.display = 'block';
		
		if (element.animForward)
		{
			if (element.animStep <= 10)
			{	
				element.animStep+=0.5;
				element.animStep = Math.min(element.animStep, 10.5);
				//if (element.animStep*10 == 100)
				//	node.setOpacity(99); // FIREFOX fix - centering works diffrently when we have aplha channel
				//else
				node.setOpacity(element.animStep*10);
				if (element.animStep > 10)
					this.onShow(element.number);
				else
					this.onShowing(element.number, element.animStep);
			}
		}
		
		if (!element.animForward)
		{
			element.animStep = Math.min(element.animStep, 10);
			
			if (element.animStep >= 1)
			{	
				element.animStep-=1;
				node.setOpacity(element.animStep*10);
			}
			else
			{
				node.style.display = "none";
				element.animStop = true;
			}
		}
	
		if (!element.animStop)
		{
			var that = this;
			window.setTimeout(function() { that.anim(element); }, 30);
		}
	}

}

var preload_container = false;
function preload_images(arr_paths)
{	
	if (!preload_container)
	{
		document.write("<div id='preload431' style='display: ehidden'>&nbsp;</div>");
		preload_container = document.getElementById('preload431');		
	}
	
	for (var iter =0; arr_paths.length>0 && iter <= 10; iter++)
	{
		var p = arr_paths.pop();
		var i_ = document.createElement('img');
		i_.setAttribute('src', p);
		i_.style.display='none';

		/* IE 6/7 BUG */ // document.body.appendChild(i_); use preload container / document.write
		preload_container.appendChild(i_);
		
		if (iter==10)
			i_.onload = function () {window.setTimeout(function() {preload_images(arr_paths);}, 50)};			
	}
}


/* class for disabling user interactions with the webpage */
function modalDlg(targetOpacity)
{
	this.onShow = function() {};
	var notified = false;

	this.initialized = false;
	
	var x = window.getScrollPos().x;
	var y = window.getScrollPos().y;
	
	var hider = new myNode(document.createElement('div'));
	hider.style.position='absolute';
	hider.style.display='none';
	hider.style.left ='0px';
	hider.style.top = '0px';
	hider.style.right = x+'px';
	hider.style.bottom = y+'px';
	hider.style.background = '#000000';
	hider.style.zIndex = 20000;
	hider.setOpacity(0);
	this.hider =  hider;
	this.targetOpacity = targetOpacity;
	
	this.animc = 0;
	this.anim_show = true;
	this.anim_stopped = true;

	this.onscroll = function()
	{
		var x = window.getScrollPos();
		var y = x.y;
		x = x.x;
		
		hider.style.right = -x+'px';
		hider.style.bottom = -y+'px';
	}

	this.anim = function()
	{
		if (this.anim_show)
			//this.animc +=10;
			this.animc = Math.ceil((this.targetOpacity*2 + this.animc)/3);
		else
			this.animc = Math.max(Math.floor(this.animc/3), 0);
		
		this.hider.setOpacity(this.animc);
		
		this.anim_stop = !( (this.animc < this.targetOpacity && this.anim_show) || (this.animc>0 && !this.anim_show));
		
		if (this.animc == this.targetOpacity)
		{
			var that = this;
			window.setTimeout(function () {that.anim2()}, 200);
		}
		
		if (this.anim_stop && !this.anim_show)
		{
			//this.setScrollBarVisible(true);
			hider.style.display='none';
		}
		
		var that = this;
		if (!this.anim_stop)
			window.setTimeout(function () {that.anim()}, 50);
	}
	
	this.anim2 = function()
	{
		if (this.anim_change)
			return;
		
		var o = this.dialogContent;
		var to = 50;

		// set position
		var o = this.dialogContent;
		var w = wndSize();
		var h = w.y;
		w = w.x;
		var scroll_ = window.getScrollPos().y;
		o.x = (w / 2 - o.offsetWidth/2);
		o.y = (scroll_ + h / 2 - o.offsetHeight/2);
		o.style.left = o.x + "px";
		o.style.top = o.y + "px";
		//
		
		rev_opac = 100-o.opac;
		rev_opac = rev_opac/1.5;
		o.opac = 100-rev_opac;
		o.opac = Math.ceil(o.opac);
		o.opac+=1;

		if (this.noAlpha && o.opac <= 100)
			o.opac = 100;
	
		if (o.opac <= 100)
		{
			o.setOpacity(o.opac);
		}
		else
		{
			if (!notified)
				this.onShow();
			notified = true;
			to = 500;
		}
		
		var that = this;
		if (!o.anim_stop)
			window.setTimeout(function () {that.anim2()}, to);		
	}

	this.anim3 = function()
	{
		var o = this.dialogContent;
		
		if (this.out_distance_anim > 0)
		{
			this.out_distance_anim =  Math.floor(this.out_distance_anim/2);
			o.style.left = ((this.out_distance_anim-this.out_distance)+o.x)+'px';
			var that = this;
			window.setTimeout(function () {that.anim3()}, 50);	
		}
		else
		{
			this.anim_stop = true;
			this.anim_change = false;
			
			/* firefox FIX - set div size to 0 before removing to save scroll position */
			if (!this.noAlpha)
			{
				this.dialogContent.style.width='0px';
				this.dialogContent.style.height='0px';
				this.dialogContent.parentNode.removeChild(this.dialogContent);
			}
			else
			{
				this.dialogContent.style.display = 'none';
			}
			
			// COPIED FROM SHOW FUNCTION / change it !!!
			this.dialogNode = this.switch_to;
			
			if (!this.noAlpha)
				var dialogContent = myNode(this.dialogNode.cloneNode(true));
			else
				var dialogContent = myNode(this.dialogNode);
		
			dialogContent.style.position = 'absolute';
			dialogContent.left = '0px';
			dialogContent.top = '0px';
			dialogContent.style.zIndex = 20001;
			dialogContent.style.display = 'block';
			dialogContent.setOpacity(0);
			dialogContent.opac = 0;
			dialogContent.anim_stop = false;
			dialogContent.anim_change = false;
			if (!this.noAlpha)
				this.parentNode.appendChild(dialogContent);		
			
			
			//this.parentNode.replaceChild(dialogContent, this.dialogContent);
			
			
			this.dialogContent = dialogContent;
			// set position
			var o = this.dialogContent;
			var w = wndSize();
			var h = w.y;
			w = w.x;
			var scroll_ = window.getScrollPos().y;
			o.x = (w / 2 - o.offsetWidth/2);
			o.y = (scroll_ + h / 2 - o.offsetHeight/2);
			o.style.left = o.x + "px";
			o.style.top = o.y + "px";
			//
			
			
			
			this.anim2();
		}

	}

	this.show = function(dialogNode, parentNode_)
	{	
		notified = false;

		if (typeof(parentNode_)=='unset')
			parentNode_ = document.body;
		
		if (!this.initialized)
		{
			this.initialized = true;
			document.body.appendChild(this.hider);
		}
		
		this.dialogNode = dialogNode;
		this.parentNode = parentNode_;
		
		if (!this.noAlpha)
			var dialogContent = myNode(dialogNode.cloneNode(true));
		else
			var dialogContent = myNode(dialogNode);
	
		dialogContent.style.position = 'absolute';
		dialogContent.style.zIndex = 20001;
		dialogContent.style.display = 'block';
		dialogContent.setOpacity(0);
		dialogContent.opac = 0;
		dialogContent.anim_stop = false;
		dialogContent.anim_change = false;
		if (!this.noAlpha)
			parentNode_.appendChild(dialogContent);		
		
		dialogContent.setAttribute('height_', dialogContent.offsetHeight);
		
		this.dialogContent = dialogContent;
		// set position
		var o = this.dialogContent;
		var w = wndSize();
		var h = w.y;
		w = w.x;
		var scroll_ = window.getScrollPos().y;
		o.x = (w / 2 - o.offsetWidth/2);
		o.y = (scroll_ + h / 2 - o.offsetHeight/2);
		o.style.left = o.x + "px";
		o.style.top = o.y + "px";
		//
		
		
		
		hider.style.display='block';
		this.anim_show = true;
		//this.setScrollBarVisible(false);
		if (this.anim_stopped)
			this.anim();
	}

	this.hide = function()
	{
		if (!this.initialized)
		{
			this.initialized = true;
			document.body.appendChild(this.hider);
		}
		
		if (!this.dialogContent)
			return;
		
		this.dialogContent.anim_stop = true;
		/* firefox FIX - set div size to 0 before removing to save scroll position */
		
		if (!this.noAlpha)
		{
			this.dialogContent.style.width='0px';
			this.dialogContent.style.height='0px';
			if (this.dialogContent.parentNode && this.dialogContent.parentNode.removeChild)
				this.dialogContent.parentNode.removeChild(this.dialogContent);
		}
		else
			this.dialogContent.style.display='none';
		
		this.anim_show = false;
		if (this.anim_stopped)
			this.anim();
	}
	
	this.switchDlg = function(node)
	{
		this.out_distance = this.dialogContent.x + this.dialogContent.offsetWidth;
		this.out_distance_anim = this.out_distance;
		this.anim_change = true;
		this.switch_to = node;
		this.anim3();
	}

	this.setScrollBarVisible = function(show)
	{
		var st = document.documentElement.scrollTop;
		document.documentElement.style.overflow = (!show ? 'hidden' : '');
		document.documentElement.scrollTop = st;
	}

	var that = this;
	window.onscroll = function()
	{
		that.onscroll();
	}
	
}

function track_conversion_AJAX()
{
	var ___img = new Image();
	___img.src = "http://www.googleadservices.com/pagead/conversion/1040205659/?value=1.0&amp;label=FPE-CJvbchDbjoHwAw&amp;script=0";
	___img.onload = function() {
	};
}


var checkFnRunning = false;
var lfShowCounter = 0;
modalDlg_l = new modalDlg(60);
function showLoginForm()
{
	wcActive = true;
	
	document.getElementById('signupfr').src='quicklogin.html?'+(lfShowCounter++);
	function foc()
	{
		//		document.getElementById('signupfr').contentWindow.document.getElementById('loginform').style.display = 'block';
		try {
			document.getElementById('signupfr').contentWindow.make_focus();
		}
		catch (e)
		{
			window.setTimeout(function() {foc();}, 100);
			return;
		}

		// disable mouse WHEEL for IE
		try
		{
			var scroll = function(e)
			{
				if (!e) var e = document.getElementById('signupfr').contentWindow.event;

				e.cancelBubble = true;
				if (e.stopPropagation) e.stopPropagation();
						
				if (e.stop)
					e.stop();

				var v=0;
				if (e.detail)
					v = (-e.detail/Math.abs(e.detail));
				else
					v =(e.wheelDelta/Math.abs(e.wheelDelta));				
				v=-v;

				var al = document.getElementById('signupfr').contentWindow.document.body.getElementById('accountlist');
				al.scrollTop += v*20;
			}
			
			document.getElementById('signupfr').contentWindow.document.body.onmousewheel = function(e)
			{ scroll(e); return false;	}

			document.getElementById('signupfr').contentWindow.addEventListener('DOMMouseScroll', function(e)
				{
					scroll(e);
					return false;
				}, false);

			
		}
		catch (e)
		{}
	}

	modalDlg_l.onscroll();
	modalDlg_l.show(document.getElementById('loginform'), document.getElementById('loginformparent'));
	modalDlg_l.onShow = function() {foc();};
	
	if (!checkFnRunning)
	{
		checkFnRunning = true;
		checkLoginForm();
	}
}
document.onkeypress = function(e)
{
	if (!e) var e = window.event;
		var code = 0;
	if (e.keyCode) code = e.keyCode;
	else if (e.which) code = e.which;

	if (code == 27)
	{
		modalDlg_l.hide();
		modalDlg_l.onShow = function() {};
	}
}


function checkLoginForm()
{
	if(document.location.hash.indexOf('lwclosef') !=-1)
	{
		wcActive = false;
		modalDlg_l.hide();
		checkFnRunning = false;
		window.location.hash = '#';
		return;
	}
	window.setTimeout(function() {checkLoginForm();}, 500);
}


// disable mouse wheel
var wcActive = false;
var wheelCancel = function(e)
{
	if (!wcActive)
		return true;
	if (!e) var e = window.event;
	e.cancelBubble = true;
	if (e.stopPropagation) e.stopPropagation();
	if (e.preventDefault) e.preventDefault();

	//if (e.stop)
	//	e.stop();
	return false;
}

document.onmousewheel = function(e)
{
	return wheelCancel(e);
}
if (window.addEventListener)
	window.addEventListener('DOMMouseScroll', wheelCancel, false);
