function $A(C){if(!C){return[]}if(C.toArray){return C.toArray()}var B=C.length||0,A=new Array(B);while(B--){A[B]=C[B]}return A}Object.extend=function(A,C){for(var B in C){A[B]=C[B]}return A};Object.extend(Object,{inspect:function(A){try{if(Object.isUndefined(A)){return"undefined"}if(A===null){return"null"}return A.inspect?A.inspect():A.toString()}catch(B){if(B instanceof RangeError){return"..."}throw B}},toQueryString:function(A){return $H(A).toQueryString()},toHTML:function(A){return A&&A.toHTML?A.toHTML():String.interpret(A)},keys:function(A){var B=[];for(var C in A){B.push(C)}return B},values:function(B){var A=[];for(var C in B){A.push(B[C])}return A},isElement:function(A){return A&&A.nodeType==1},isArray:function(A){return A&&A.constructor===Array},isHash:function(A){return A instanceof Hash},isFunction:function(A){return typeof A=="function"},isString:function(A){return typeof A=="string"},isNumber:function(A){return typeof A=="number"},isUndefined:function(A){return typeof A=="undefined"}});var Class={create:function(){var E=null,D=$A(arguments);if(Object.isFunction(D[0])){E=D.shift()}function A(){this.initialize.apply(this,arguments)}Object.extend(A,Class.Methods);A.superclass=E;A.subclasses=[];if(E){var B=function(){};B.prototype=E.prototype;A.prototype=new B;E.subclasses.push(A)}for(var C=0;C<D.length;C++){A.addMethods(D[C])}if(!A.prototype.initialize){A.prototype.initialize=function(){}}A.prototype.constructor=A;return A}};Class.Methods={addMethods:function(G){var C=this.superclass&&this.superclass.prototype;var B=Object.keys(G);if(!Object.keys({toString:true}).length){B.push("toString","valueOf")}for(var A=0,D=B.length;A<D;A++){var F=B[A],E=G[F];if(C&&Object.isFunction(E)&&E.argumentNames().first()=="$super"){var H=E,E=Object.extend((function(I){return function(){return C[I].apply(this,arguments)}})(F).wrap(H),{valueOf:function(){return H},toString:function(){return H.toString()}})}this.prototype[F]=E}return this}};

	var isIE = (navigator.appName == "Microsoft Internet Explorer");
	var isFF = (!isIE && !(navigator.appVersion.indexOf("MSIE")>-1));
	var isOPR = (navigator.userAgent.indexOf("Opera")!=-1);
	var isIE6 = navigator.userAgent.indexOf("MSIE 6.0") >= 0;
	var isIE7 = navigator.userAgent.indexOf("MSIE 7.0") >= 0;
	var isIE8 = navigator.userAgent.indexOf("MSIE 8.0") >= 0;
	if (isOPR || isIE7) { isIE = false; };
	
	// Сахер
	var $ = function(id)
	{
		return document.getElementById(id);
	}
	window.onload = function()
	{
		if ($('main_menu')) menuInit($('main_menu'));
		if ($('days')) menuInit($('days'));
		if($('YMapsID'))
		{
			var map = new YMaps.Map(document.getElementById("YMapsID"));
			map.setCenter(new YMaps.GeoPoint(37.64, 55.76), 10);
		}
		if($('plans'))
		{
			var plans_hash = document.location.hash.replace( /^#/, '' );
			if(plans_hash)
				$('plans').className = 'plans '+plans_hash;
		}
	}
	
	var menuInit = function(menu)
		{
		menuList = menu.getElementsByTagName('img');

		for (i=0; i<menuList.length; i++)
			{
			if (!/slash/.exec(menuList[i].src) && menuList[i].className!='active')
				{
				menuList[i].onmouseover = function() { if (!/_a.png([?]new)?$/.test(this.src) && !this.style.opacity) this.src = this.src.replace('.png', '_a.png') }
				menuList[i].onmouseout = function() { if (/_a.png([?]new)?$/.test(this.src)) this.src = this.src.replace('_a.png', '.png') }
				}
			}
		}
	
	var Box = {

	openWin: function(obj, filter)
		{
		if (!$('imgbox') && !$('imgdark'))
			{
			imageDark = document.createElement('div');
			imageDark.id = 'imgdark';
			imageDark.style.background = '#000';
			if (isIE || isIE7)
				imageDark.style.filter = 'Alpha(opacity=60)';
			else
				imageDark.style.opacity = '0.6';

			if (!isIE)
				{
				imageDark.style.position = 'fixed';
				imageDark.style.top = '0';
				}
			else
				{
				imageDark.style.position = 'absolute';
				}

			imageDark.style.left = '0';
			imageDark.style.bottom = '0';
			imageDark.style.right = '0';
			imageDark.style.zIndex = '10000';

			//imageDark.style.border = 'solid 1px red';
			imageDark.onclick = function() { $('imgbox').style.display = 'none'; $('imgdark').style.display = 'none' }
			document.getElementsByTagName('body')[0].appendChild(imageDark)

			imageBox = document.createElement('div');
			if (!isIE)
				{
				imageBox.style.position = 'fixed';
				imageBox.style.top = '50%';
				imageDark.style.height = '100%';
				imageDark.style.width = '100%';
				}
			else
				{
				imageBox.style.position = 'absolute';
				imageBox.style.top = document.documentElement.scrollTop +150+'px';
				imageDark.style.top = document.documentElement.scrollTop;
				imageDark.style.height = document.documentElement.clientHeight + 'px';
				imageDark.style.width = document.documentElement.clientWidth + 'px';
				}

			imageBox.id = 'imgbox';
			imageBox.style.background = '#fff';
			imageBox.style.padding = '15px';
			imageBox.style.left = '50%';
			imageBox.style.zIndex = '10001';
			imageBox.style.marginLeft = '-32px';
			imageBox.style.marginTop = '-32px';
			document.getElementsByTagName('body')[0].appendChild(imageBox);

			}
		$('imgbox').style.width = 'auto';
		openedImage = '<img style="visibility: hidden" onload="Box.winPosition(this)" alt="'+obj.title.replace('"', '')+'" id="loading_img" src="'+obj.rel+(filter?'/':'')+filter+'" />';
		$('imgdark').innerHTML = openedImage;

		$('imgbox').style.marginLeft = '-32px';
		$('imgbox').style.marginTop = '-32px';
		$('imgbox').style.display = 'block';
		$('imgdark').style.display = 'block';
		$('imgbox').innerHTML = '<img alt="x" style="position: absolute; right: -8px; top: -8px; cursor: pointer;" onclick="$(\'imgbox\').style.display = \'none\'; $(\'imgdark\').style.display = \'none\'" src="/images/x.gif" /><img id="boxed_img" alt="" src="/images/pl.gif" />';

		if (isIE) window.onscroll = function()
			{
			$('imgbox').style.top = document.documentElement.scrollTop + 150 +'px';
			$('imgdark').style.top = document.documentElement.scrollTop + 'px';
			}

		if (isIE) window.onresize = function()
			{
			imageDark.style.height = document.documentElement.clientHeight + 'px';
			imageDark.style.width = document.documentElement.clientWidth + 'px';
			}

		return false;
		},

	winPosition: function(obj)
		{
		$('boxed_img').src=obj.src;

		$('imgbox').innerHTML += (obj.alt?'<p style="font-size: 1.2em">'+obj.alt+'</p>':'')
		$('imgbox').style.width = obj.offsetWidth + 'px';

		if (!isIE)
			$('imgbox').style.marginTop=-(parseInt(obj.offsetHeight/2))+'px';
			$('imgbox').style.marginLeft=-(parseInt(obj.offsetWidth/2))+'px';
		}
	}

	// Комплитар
	var Autocompleter = { }
	Autocompleter = Class.create({
  		initialize: function(element, url) {

    		var autocompleter = this;

			this.id = element;
			this.selected = null;
			this.lis = new Array;
			this.input = null;
			this.url = url;
			this.focused = false;

			autocompleter.ac = {};

			this.input = $(this.id);
			//$(this.id).autocomplete = 'off';
			this.input.onkeyup = function(event) { if (!this.value && $('ac_'+this.id) && !autocompleter.focused) { $('ac_'+this.id).style.display='none'; } autocompleter.autocomplete(autocompleter, event, this); return false };
			this.input.onblur = function() { if ($('education')) cloneEdu($('education')); if ($('ac_'+this.id)) $('ac_'+this.id).style.display = 'none' };
			this.input.onfocus = function(event) { if (this.value == '') autocompleter.acFocus(autocompleter, this, event) }
    		this.initialized = true;
		  },

		autocomplete: function(autocompleter, event, obj) {
			//$('test').innerHTML += this.selected + '<br />';
			event = event || window.event;
			//obj.autocomplete = 'off';

			if ((event.keyCode != 40 && event.keyCode != 38 && event.keyCode != 13) && obj.value)
			    {
			    autocompleter.focused = false;
				obj.onkeydown = function(event) { autocompleter.autocompleteNavigation(autocompleter,event) }

			    lookup({
			    url:'/api/'+autocompleter.url,
			    values:'query='+encodeURIComponent(obj.value),
			    postFunction: function(transport)
			    	{
			    	if (!$('ac_'+obj.id))
			    	    {
			    	    newAC = document.createElement('span')
			    	    newAC.id = 'ac_'+obj.id;
			    	    newAC.className = 'autocompliter';
			    	    newAC.style.position = 'absolute';
			    	    newAC.style.zIndex = '20';
			    	    obj.parentNode.style.position = 'relative';
			    	    newAC.style.top = obj.offsetHeight + obj.offsetTop + 'px';
			    		obj.parentNode.appendChild(newAC);
			    		autocompleter.ac = newAC;
			    	    }

			    	autocompleter.ac.style.display = 'block';
			    	autocompleter.ac.innerHTML = transport.responseText;
			    	//$('test').innerHTML = newAC.innerHTML;
			    	autocompleter.lis = $(autocompleter.ac.id).getElementsByTagName('a');
			    	autocompleter.selected = null;
			    	for (i=0; i<autocompleter.lis.length; i++)
			    	    {
			    		//$('test').innerHTML += this.lis[i]+'<br />'
			    		autocompleter.lis[i].num = i;
			    		autocompleter.lis[i].onmousedown = function() { obj.value = this.innerHTML.replace(/<small>(.*?)<\/small>/i,''); obj.value = obj.value.replace(/<(.*?)>/ig,''); if ($(obj.id+'_id')) {$(obj.id+'_id').value=this.id;} $('ac_'+obj.id).style.display = 'none'; }
			    		autocompleter.lis[i].onmouseover = function() { if (autocompleter.selected) { autocompleter.selected.className = ''; } autocompleter.selected = this; this.className = 'active' }
			    		autocompleter.lis[i].onmouseout = function() { this.className = '' }
			    	    }
			    	//alert(autocompleter.lis)
			    	}
			    	});
			    }
			},

		autocompleteNavigation: function(autocompleter,event)
		    {
			event = event || window.event;

		    if (event.keyCode == 40)
		    	{
		    	if (event.preventDefault)
		    		event.preventDefault();
		    	else
		    		event.returnValue = false;

		    	if (!autocompleter.selected && this.lis.length>0)
		    		{
		    		autocompleter.selected = this.lis[0];
		    		autocompleter.lis[0].className = 'active';
		    		}
		    	else
		    		{
		    		autocompleter.selected.className = '';
		    		if (autocompleter.selected.num != autocompleter.lis.length-1 )
		    			autocompleter.selected = autocompleter.lis[autocompleter.selected.num+1];
		    		else
		    			autocompleter.selected = autocompleter.lis[0];

		    		autocompleter.selected.className = 'active';
		    		}
		    	}

		    if (event.keyCode == 38)
		    	{
		    	if (event.preventDefault)
		    		event.preventDefault();
		    	else
		    		event.returnValue = false;

		    	if (!autocompleter.selected)
		    		{
		    		autocompleter.selected = autocompleter.lis[autocompleter.lis.length-1];
		    		autocompleter.lis[autocompleter.lis.length-1].className = 'active';
		    		}
		    	else
		    		{
		    		autocompleter.selected.className = '';
		    		if (autocompleter.selected.num != 0)
		    			autocompleter.selected = autocompleter.lis[autocompleter.selected.num-1];
		    		else
		    			autocompleter.selected = autocompleter.lis[autocompleter.lis.length-1]

		    		autocompleter.selected.className = 'active';
		    		}
		    	}

		    if (event.keyCode == 13)
		    	{
		    	if (event.preventDefault)
		    		event.preventDefault();
		    	else
		    		event.returnValue = false;

		    	autocompleter.input.value = autocompleter.selected.innerHTML.replace(/<small>(.*?)<\/small>/i,'');
		    	autocompleter.input.value = autocompleter.input.value.replace(/<(.*?)>/ig,'');
		    	autocompleter.ac.style.display = 'none';
		    	if ($(autocompleter.input.id+'_id')) $(autocompleter.input.id+'_id').value=autocompleter.selected.id;
		    	}
		    },

		acFocus: function(autocompleter, obj, event)
			{
			autocompleter.focused = true;
			obj.onkeydown = function(event) { autocompleter.autocompleteNavigation(autocompleter,event) }

    	    lookup({
    	    url:'/api/'+autocompleter.url,
    	    values:'empty=true',
    	    postFunction: function(transport)
    	    	{

    	    	if (!$('ac_'+obj.id))
    	    	    {
    	    	    newAC = document.createElement('span')
    	    	    newAC.id = 'ac_'+obj.id;
    	    	    newAC.className = 'autocompliter';
    	    	    newAC.style.position = 'absolute';
    	    	    newAC.style.zIndex = '20';
    	    	    obj.parentNode.style.position = 'relative';
    	    	    newAC.style.top = obj.offsetHeight + obj.offsetTop + 'px';
    	    		obj.parentNode.appendChild(newAC);
    	    		autocompleter.ac = newAC;
    	    	    }

    	    	autocompleter.ac.style.display = 'block';
    	    	autocompleter.ac.innerHTML = transport.responseText;
    	    	//$('test').innerHTML = newAC.innerHTML;
    	    	autocompleter.lis = $(autocompleter.ac.id).getElementsByTagName('a');
    	    	autocompleter.selected = null;
    	    	for (i=0; i<autocompleter.lis.length; i++)
    	    	    {
    	    		//$('test').innerHTML += this.lis[i]+'<br />'
    	    		autocompleter.lis[i].num = i;
    	    		autocompleter.lis[i].onmousedown = function() { obj.value = this.innerHTML.replace(/<small>(.*?)<\/small>/i,''); obj.value = obj.value.replace(/<(.*?)>/ig,''); if ($(obj.id+'_id')) {$(obj.id+'_id').value=this.id;} $('ac_'+obj.id).style.display = 'none'; }
    	    		autocompleter.lis[i].onmouseover = function() { if (autocompleter.selected) { autocompleter.selected.className = ''; } autocompleter.selected = this; this.className = 'active' }
    	    		autocompleter.lis[i].onmouseout = function() { this.className = '' }
    	    	    }
    	    	//alert(autocompleter.lis)
    	    	}
    	    	});

			}
		});
	
	//аякс
	function getHTTP()
		{
		var xmlhttp;
		/*@cc_on
		@if (@_jscript_version >= 5)
			try
				{
				xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
				}
			catch (e)
				{
				try
					{
					xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
					}
				catch (E)
					{
					xmlhttp = false;
					}
				}
		@else
			xmlhttp = false;
		@end @*/
		if (!xmlhttp && typeof XMLHttpRequest != 'undefined')
			{
			try
				{
				xmlhttp = new XMLHttpRequest();
				}
			catch (e)
				{
				xmlhttp = false;
				}
			}
		return xmlhttp;
		}

	function lookup(lookupSettings)
		{
		if (!lookupSettings) lookupSettings = new Object();

		if (!lookupSettings.values)   lookupSettings.values   = '';
		if (!lookupSettings.dest)  lookupSettings.dest = false;
		if (!lookupSettings.cache)  lookupSettings.cache = false;
		if (!lookupSettings.postFunction)   lookupSettings.postFunction   = '';


		if (lookupSettings.url)
			{
			if (lookupSettings.cache && cacheStore[lookupSettings.url+'?'+lookupSettings.values])
				{
				try { document.getElementById(lookupSettings.dest).innerHTML = cacheStore[lookupSettings.url+'?'+lookupSettings.values].responseText }
				catch (e) { }
				if (lookupSettings.postFunction) lookupSettings.postFunction(cacheStore[lookupSettings.url+'?'+lookupSettings.values]);
				}
			else
				{
				this.working = false;
				if (!this.working && (this.http = getHTTP()))
					{
					var http = this.http;
					this.http.open("POST", lookupSettings.url, true);
					this.http.onreadystatechange = function()
						{
						if (http.readyState == 4)
							{
							if (lookupSettings.cache)
								{
								cacheStore[lookupSettings.url+'?'+lookupSettings.values] = http;
								}
							try { destObj = document.getElementById(lookupSettings.dest).innerHTML = http.responseText }
							catch (e) { }
							if (lookupSettings.postFunction) lookupSettings.postFunction(http);
							this.working = false;
							this.http = false;
							}
						}
					this.working = true;
					this.http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
					this.http.send(lookupSettings.values);
					}
				}
			}
		}
		
/* Прокрутка */
var mainTimer = false;
var canMove = true;
var inted=0;
var scrollLength;
var parentWidth;
var inted_b=-1;
var obLength;
var objElements;
var parentObj;


function move(obj,direction,parentElement,target)
{
//	if (!parentWidth) parentWidth = document.getElementById(parentElement).offsetWidth;
	parentObj = parentElement;
	obLength = $(parentElement).offsetWidth;
    if (mainTimer) return false;

    //		if (!target) target = 'gallery';
    obj.time = 0;
    obj.start = obj.style.left.replace('px','')-0;
    movedObj = obj;
    movedPerent = parentElement;
	scrollLength = obLength/3;
	if(parentObj=='photo') scrollLength=80;

    if (direction == 'forward')
    {

        if (eval(obj.style.left.replace('px', ''))<obLength-obj.offsetWidth+69)
        {
            // А нефик
        }
        else
        {
            mainTimer = setInterval('forwardMovement(movedObj,movedPerent,scrollLength,parentObj)', 50);
        }
    }
    else
    {
        if (eval(obj.style.left.replace('px', '')) < 0)
            mainTimer = setInterval('backwardMovement(movedObj,movedPerent,scrollLength,parentObj)', 50);
    }
}

function forwardMovement(obj,parentElement,scrollLength,target)
{
    scrollLength = -scrollLength;
    left = Math.round(linear(obj.time, obj.start, scrollLength, 10));
    obj.style.left = left + 'px';

	if (left <= 0)
	{
		if (document.getElementById(target+'_l')) document.getElementById(target+'_l').style.display = 'block';
	}
    if (obj.offsetWidth-obLength+left < 11)
    {
        // Приехали
        document.getElementById(target+'_r').style.display = 'none';
        clearInterval(mainTimer);
        mainTimer = false;
    }

    obj.time++;
    if (obj.time == 15)
    {
        clearInterval(mainTimer);
        mainTimer = false;
        if (canMove) move(obj,'forward',null,target);
    }
}

function backwardMovement(obj,parentElement,scrollLength,target)
{
    left = Math.round(linear(obj.time, obj.start, scrollLength, 10));
    //		if (!target) target = 'gallery';
    obj.style.left = left + 'px';
	document.getElementById(target+'_r').style.display = 'block';
    if (left >= 0)
    {
        // Приехали
        obj.style.left = '0px';
    	   	document.getElementById(target+'_l').style.display = 'none';
        clearInterval(mainTimer);
        mainTimer = false;
    }

    obj.time++;
    if (obj.time == 11)
    {
        if (left >= 0)
        {
            if (obj.id!='partners') document.getElementById(target+'_l').style.display = 'none';
        }
        clearInterval(mainTimer);
        mainTimer = false;
        if (canMove) move(obj,'backward',null,target);
    }
}
function backOut (t, b, c, d, s)
{
    if (s == undefined) s = 1.70158;
    return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
}

function backIn (t, b, c, d, s)
{
    if (s == undefined) s = 1.70158;
    return c*(t/=d)*t*((s+1)*t - s) + b;
}

function easeIn (t, b, c, d)
{
    return c*t/d + b;
}

function linear (t, b, c, d)
{
    return c*t/d + b;
}


/*Pop_up*/
Linear = function (t, b, c, d) {
    return c*t/d + b;
}
function getElementPosition(obj)
{
	var elem = obj

	var l = 0;
	var t = 0;
	while (elem)
	{
       	l += elem.offsetLeft;
      	t += elem.offsetTop;
     	elem = elem.offsetParent;
	}
  	obj.l = l;
  	obj.t = t;
}

rising = {
	
	get: function(obj, optional) {
		
		if (!optional) optional = {}
		
		getElementPosition(obj)
		
		if (!$('p_'+obj.rel.replace(/\//g,'_')))
			{
			nImg = document.createElement('img');
			nImg.loaded = false;
			
			if (optional.className)
				nImg.className = optional.className;
				
			
			
			nImg.id = 'p_'+obj.rel.replace(/\//g,'_');
			nImg.src = obj.rel;
			nImg.style.position = 'absolute';
			nImg.style.top = '-2000px';
			nImg.style.zIndex = '10001';
			nImg.style.boxShadow = '0 0 10px #000';
			nImg.style.MozBoxShadow = '0 0 10px #000';
			nImg.style.WebkitBoxShadow = '0 0 10px #000';
//			nImg.style.filter = 'progid:DXImageTransform.Microsoft.dropShadow(color=#000, offX=0, offY=0);'
			nImg.style.visibility = 'hidden';
			nImg.style.cursor = 'pointer';
			nImg.onclick = function() { if (this.working) return; this.oot = this.offsetTop; this.ool = this.offsetLeft; this.timer = setInterval(function() { rising.close($('p_'+obj.rel.replace(/\//g,'_'))) }, 15) }
			document.getElementsByTagName('body')[0].appendChild(nImg);
			}
		
		$('p_'+obj.rel.replace(/\//g,'_')).style.top = obj.t + 'px';
		$('p_'+obj.rel.replace(/\//g,'_')).style.left = obj.l + 'px';

		$('p_'+obj.rel.replace(/\//g,'_')).ot = parseInt($('p_'+obj.rel.replace(/\//g,'_')).style.top);
		$('p_'+obj.rel.replace(/\//g,'_')).ol = parseInt($('p_'+obj.rel.replace(/\//g,'_')).style.left);	
		
		
		$('p_'+obj.rel.replace(/\//g,'_')).parentImg = obj
		$('p_'+obj.rel.replace(/\//g,'_')).t = 0;
		
		$('p_'+obj.rel.replace(/\//g,'_')).h = obj.offsetHeight;
		$('p_'+obj.rel.replace(/\//g,'_')).w = obj.offsetWidth;
		
		
		
		$('p_'+obj.rel.replace(/\//g,'_')).style.display = 'block';
		
		
		if (!$('p_'+obj.rel.replace(/\//g,'_')).loaded)
			{
			if (optional.preLoadFunction) optional.preLoadFunction();
			$('p_'+obj.rel.replace(/\//g,'_')).onload = function() {
							$('p_'+obj.rel.replace(/\//g,'_')).loaded = true;
							if (optional.onLoadFunction) 
								{
								optional.onLoadFunction();
								}
								
								if (!$('p_'+obj.rel.replace(/\//g,'_')).realWidth)
									{
									$('p_'+obj.rel.replace(/\//g,'_')).realWidth = nImg.offsetWidth;
									$('p_'+obj.rel.replace(/\//g,'_')).realHeight = nImg.offsetHeight;
									}
								
								$('p_'+obj.rel.replace(/\//g,'_')).style.width = obj.offsetWidth + 'px';
								$('p_'+obj.rel.replace(/\//g,'_')).style.height = obj.offsetHeight + 'px';
								
								$('p_'+obj.rel.replace(/\//g,'_')).style.visibility = 'visible';
								//nImg.style.display = 'none';
								
								$('p_'+obj.rel.replace(/\//g,'_')).timer = setInterval(function() { rising.open($('p_'+obj.rel.replace(/\//g,'_'))) }, 15) 
							}
			}
		else
			{
			$('p_'+obj.rel.replace(/\//g,'_')).style.height = obj.offsetHeight + 'px';
			$('p_'+obj.rel.replace(/\//g,'_')).style.width = obj.offsetWidth + 'px';
			$('p_'+obj.rel.replace(/\//g,'_')).timer = setInterval(function() { rising.open($('p_'+obj.rel.replace(/\//g,'_'))) }, 15)
			}
			
		if (optional.styles)
			{
			for (prop in optional.styles)
			    {
			    nImg.style[prop] = optional.styles[prop];
			    }
			}
		
		return false;
	},
	
	open: function(obj) {
		obj.working = true;
		
		obj.t++;
		obj.style.width = parseInt(Linear(obj.t, obj.w, obj.realWidth-obj.w, 10)) + 'px';
		obj.style.height = parseInt(Linear(obj.t, obj.h, obj.realHeight-obj.h, 10)) + 'px';
		
		if (parseInt(obj.style.top) <= 20)
			obj.style.top = '20px';
		else
			obj.style.top = parseInt(Linear(obj.t, obj.ot, -(obj.realHeight/2 - obj.parentImg.offsetHeight/2), 10)) + 'px';
			
		if (parseInt(obj.style.left) <= 20)
			obj.style.left = '20px';
		else
			obj.style.left = parseInt(Linear(obj.t, obj.ol, -(obj.realWidth/2 - obj.parentImg.offsetWidth/2), 10)) + 'px';
		
		if ((parseInt(obj.style.left)+obj.offsetWidth) >= document.getElementsByTagName('body')[0].offsetWidth - 20)
			{
			obj.style.left = 'auto';
			obj.style.right = '20px';
			}
		else
			{
			obj.style.right = 'auto';
			}
	
		if (obj.t == 10)
			{
			clearInterval(obj.timer);
			obj.working = false;
			obj.t = 0;
			obj.style.width = obj.realWidth + 'px';
			obj.style.height = obj.realHeight + 'px';
			}
		
	},
	
	close: function(obj) {
		obj.t++;
		obj.working = true;
		obj.style.width = parseInt(Linear(obj.t, obj.realWidth, obj.w-obj.realWidth, 10)) + 'px';
		obj.style.height = parseInt(Linear(obj.t, obj.realHeight, obj.h-obj.realHeight, 10)) + 'px';

		obj.style.top = parseInt(Linear(obj.t, obj.oot, obj.ot - obj.oot, 10)) + 'px';
		
		if (parseInt(obj.style.top) <= 20)
			obj.style.top = '20px';
		
		obj.style.left = parseInt(Linear(obj.t, obj.ool, obj.ol - obj.ool, 10)) + 'px';
		
		if (parseInt(obj.style.left) <= 20)
			obj.style.left = '20px';
		
		if ((parseInt(obj.style.left)+obj.offsetWidth) >= document.getElementsByTagName('body')[0].offsetWidth - 20)
			{
			obj.style.left = 'auto';
			obj.style.right = '20px';
			}
		else
			{
			obj.style.right = 'auto';
			}
		
		if (obj.t == 10)
			{
			clearInterval(obj.timer);
			obj.timer = null
			obj.working = false;
			obj.t = 0
			obj.style.display = 'none';
			obj.style.width = obj.w + 'px';
			obj.style.height = obj.h + 'px';
			}
	}
}

function getFloorInfo(num){
    lookup({
        url: '/api/floor.api.php',
        values: 'floor='+num,
	postFunction: function(transport)
        {
            $('floor_info').innerHTML = transport.responseText;
        }
    });
}
