var base_url = document.baseURI || document.URL;
base_url = base_url.replace('http://', '');
var host = 'http://' + base_url.substring(0, base_url.search(/\//i));
var http_server = 'http://' + base_url.substring(0, base_url.search(/\//i)) + '/';
if (!userApp)
{
  var userApp = navigator.userAgent.toLowerCase();
  var isMSIE = true;
  var isOpera = false;
  var isGecko = false;
  var isSafari = false;
  if(userApp.search(/opera/i)!=-1)
  {
    isOpera=true;
  }
  if(userApp.search(/gecko/i)!=-1)
  {
    isGecko=true;
  }
  if(userApp.search(/apple/i)!=-1)
  {
    isSafari = true;
  }
  if(isGecko || isOpera || isSafari)
  {
    isMSIE=false;
    var tempVer = userApp.search(/\/([0-9\.]+)/);
    if (tempVer != -1)
    {
      tempVer += 1;
    }
  }
  else
  {
    var tempVer = userApp.search(/msie ([0-9\.]+)/);
    if (tempVer != -1)
    {
      tempVer += 'msie '.length;
    }
  }
  if (tempVer != -1)
  {
    var uaVersion = parseFloat(userApp.substr(tempVer));
  }
}
var defaults =
{
  windowName:'Window',
  windowX:100,
  windowY:100,
  windowWidth:800,
  windowHeight:600,
  windowMenubar:'no',
  windowToolbar:'no',
  windowResizeable:'yes',
  windowScrollbars:'no',
  windowStatus:'no'
};

var common =
{
  el:function(id, parent)
  {
    var p = parent ? parent : document;
    return typeof id == 'string' ? p.getElementById(id) : id;
  },
  els:function(name, parent)
  {
    var p = parent ? parent : document;
    return p.getElementsByTagName(name);
  },
  addEvent:function(objElement, strEventType, ptrEventFunc)
  {
    if(objElement.addEventListener)
    {
      objElement.addEventListener(strEventType, ptrEventFunc, false);
    }
    else if(objElement.attachEvent)
    {
      objElement.attachEvent('on' + strEventType, ptrEventFunc);
    }
  },
  removeEvent:function(objElement, strEventType, ptrEventFunc)
  {
    if(objElement.removeEventListener)
    {
      objElement.removeEventListener(strEventType, ptrEventFunc, false);
    }
    else if(objElement.detachEvent)
    {
      objElement.detachEvent('on' + strEventType, ptrEventFunc);
    }
  },
  setCookie:function(name, value, expire, path)
  {
    document.cookie = name + '=' + escape(value)
      + ((expire == null)? '' : ('; expires=' + expire.toUTCString()))
      + ((path == null)? '' : ('; path=' + path));
  },
  getCookie:function(Name)
  {
    var search = Name + '=';
    if (document.cookie.length > 0)
    {
      offset = document.cookie.indexOf(search);
      if (offset != -1)
      {
        offset += search.length;
        end = document.cookie.indexOf(';', offset);
        if (end == -1)
        {
          end = document.cookie.length;
        }
        return unescape(document.cookie.substring(offset, end));
      }
    }
    return '';
  },
  getHeight:function(obj)
  {
    var height = obj.offsetHeight;
    if (height > 0 || obj.tagName.toLowerCase() != 'tr')
    {
      return height;
    }
    if (!obj.firstChild)
    {
      return 0;
    }
    return obj.firstChild.offsetHeight;
  },
  getH:function(obj)
  {
    var height = obj.offsetHeight;
    if (height > 0 || obj.tagName.toLowerCase() != 'tr')
    {
      return height;
    }
    if (!obj.firstChild)
    {
      return 0;
    }
    return obj.firstChild.offsetHeight;
  },
  getX:function(oElement)
  {
    var iPosX = oElement.offsetLeft;
    while (oElement.offsetParent != null)
    {
      oElement = oElement.offsetParent;
      iPosX += oElement.offsetLeft;
      if (oElement.tagName == 'BODY')
      {
        break;
      }
    }
    return iPosX;
  },
  getY:function(obj)
  {
    var y = 0;
    do
    {
      y += obj.offsetTop;
      obj = obj.offsetParent;
    }
    while (obj);
    return y;
  },
  getW:function(obj)
  {
    var width = obj.offsetWidth;
    if (width > 0 || obj.tagName.toLowerCase() != 'tr')
    {
      return width;
    }
    if (!obj.firstChild)
    {
      return 0;
    }
    return obj.lastChild.offsetLeft - obj.firstChild.offsetLeft + getWidth (obj.lastChild);
  }
};

var utils =
{
  window:function(url, name, x, y, width, height, menubar, toolbar, resizeable, scrollbars, status)
  {
    this.url = url;
    this.name = name ? name : defaults.windowName;
    this.x = x ? x : defaults.windowX;
    this.y = y ? y : defaults.windowY;
    this.width = width ? width : defaults.windowWidth;
    this.height = height ? height : defaults.windowHeight;
    this.menubar = menubar ? menubar : defaults.windowMenubar;
    this.toolbar = toolbar ? toolbar : defaults.windowToolbar;
    this.resizeable = resizeable ? resizeable : defaults.windowResizeable;
    this.scrollbars = scrollbars ? scrollbars : defaults.windowScrollbars;
    this.status = status ? status : defaults.windowStatus;
    window.open(
      this.url,
      this.name,
      'left=' + this.x + ', ' +
      'top = ' + this.y + ', ' +
      'width=' + this.width + ', ' +
      'height=' + this.height + ', ' +
      'menubar=' + this.menubar + ', ' +
      'toolbar=' + this.toolbar + ', ' +
      'resizable=' + this.resizeable + ', ' +
      'scrollbars=' + this.scrollbars + ', ' +
      'status=' + this.status
    );
  }
};

var remote = new Object();
remote.READY_STATE_ININITIALIZIED = 0;
remote.READY_STATE_LOADING = 1;
remote.READY_STATE_LOADED = 2;
remote.READY_STATE_INTERACTIVE = 3;
remote.READY_STATE_COMPLETE = 4;

remote.fLoader = function(url, onload, onerror)
{
  this.url = url;
  this.req = null;
  this.onload = onload;
  this.onerror = (onerror) ? onerror : this.defaultError;
  this.loadXMLDoc(url);
}

remote.fLoader.prototype =
{
  loadXMLDoc:function(url)
  {
    if (window.XMLHttpRequest)
    {
      this.req = new XMLHttpRequest();
    }
    else if (window.ActiveXObject)
    {
      try
      {
        this.req = new ActiveXObject('Msxml2.XMLHTTP');
      }
      catch(e)
      {
        this.req = new ActiveXObject('Microsoft.XMLHTTP');
      }
    }
    if (this.req)
    {
      try
      {
        var loader = this;
        this.req.onreadystatechange = function()
        {
          loader.onReadyState.call(loader);
        }
        this.req.open('GET', url, true);
        this.req.setRequestHeader('If-Modified-Since', 'Thu, 22 Nov 2001 00:00:01 GMT');
        this.req.send(null);
      }
      catch(err)
      {
        this.onerror.call(this);
      }
    }
  },
  onReadyState:function()
  {
    var req = this.req;
    var ready = req.readyState;
    if (ready == remote.READY_STATE_COMPLETE)
    {
      var httpStatus = req.status;
      if (httpStatus == 200 || httpStatus == 0 || httpStatus == 304)
      {
        this.onload.call(this);
      }
      else
      {
        this.onerror.call(this);
      }
    }
  },
  defaultError:function()
  {
    alert('error');
  }
}

var xmlDoc;
var xslDoc;
var objOut;
var cached = new Array();
var cache = false;
function loadDocs(xmlUrl, xslUrl, obj)
{
  objOut = common.el(obj);
  xmlDoc = null;
  xslDoc = null;
  new remote.fLoader(xmlUrl, onXmlLoad);
  new remote.fLoader(xslUrl, onXslLoad);
}
onXmlLoad = function()
{
  xmlDoc = this.req.responseXML;
  if(this.req.responseText.match(/<location>/g))
  {
    var re = new RegExp('<location>((.|\n)*?)<\/location>', 'gi');
    var locate = re.exec(this.req.responseText);
    locate = RegExp.$1;
    window.location = locate;
  }
  else
  {
    transformDo();
  }
}
onXslLoad = function()
{
  xslDoc = this.req.responseXML;
  transformDo();
}
transformDo = function()
{
  if(xmlDoc == null || xslDoc == null)
  {
    return;
  }
  if (window.ActiveXObject)
  {
    objOut.innerHTML = xmlDoc.transformNode(xslDoc);
    //evalScripts(objOut.innerHTML);
  }
  else
  {
    var xsltProcessor = new XSLTProcessor();
    xsltProcessor.importStylesheet(xslDoc);
    var fragment = xsltProcessor.transformToFragment(xmlDoc, document);
    objOut.innerHTML = '';
    objOut.appendChild(fragment);
  }
}
function getScroll()
{
  var scrollLeft, scrollTop;
  if (window.pageYOffset)
  {
    scrollTop = window.pageYOffset;
  }
  else if(document.documentElement && document.documentElement.scrollTop)
  {
    scrollTop = document.documentElement.scrollTop;
  }
  else if(document.body)
  {
    scrollTop = document.body.scrollTop;
  }
  if(window.pageXOffset)
  {
    scrollLeft = window.pageXOffset;
  }
  else if(document.documentElement && document.documentElement.scrollLeft)
  {
    scrollLeft = document.documentElement.scrollLeft;
  }
  else if(document.body)
  {
    scrollLeft = document.body.scrollLeft;
  }
  return [scrollLeft, scrollTop];
}

function getWindowSize()
{
  var windowWidth,windowHeight;
  if(window.innerWidth)
  {
    windowWidth = window.innerWidth;
  }
  else if(document.documentElement && document.documentElement.clientWidth)
  {
    windowWidth = document.documentElement.clientWidth;
  }
  else if(document.body)
  {
    windowWidth = document.body.offsetWidth;
  }
  if(window.innerHeight)
  {
    windowHeight = window.innerHeight;
  }
  else if(document.documentElement && document.documentElement.clientHeight)
  {
    windowHeight = document.documentElement.clientHeight;
  }
  else if(document.body)
  {
    windowHeight = document.body.clientHeight;
  }
  return [windowWidth, windowHeight];
}
function getMousePosition(e) 
{
	if (e.pageX || e.pageY)
	{
		var posX = e.pageX;
		var posY = e.pageY;
	}
	else if (e.clientX || e.clientY) 	
	{
		var posX = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
		var posY = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
	}
	return {x:posX, y:posY}	
}
function switchClass(objNode, strCurrClass, strNewClass)
{
  if (matchClass(objNode, strNewClass))
  {
    replaceClass(objNode, strCurrClass, strNewClass);
    return;
  }
  replaceClass(objNode, strNewClass, strCurrClass);
}
function removeClass(objNode, strCurrClass)
{
  replaceClass(objNode, '', strCurrClass);
}
function addClass(objNode, strNewClass)
{
  replaceClass(objNode, strNewClass, '');
}
function replaceClass(objNode, strNewClass, strCurrClass)
{
  var strOldClass = strNewClass;
  if (strCurrClass && strCurrClass.length)
  {
    strCurrClass = strCurrClass.replace(/\s+(\S)/g, '|$1');
    if (strOldClass.length)
    {
      strOldClass += '|';
    }
    strOldClass += strCurrClass;
  }
  if (!objNode.className)
  {
    objNode.className = '';
  }
  objNode.className = objNode.className.replace(new RegExp('(^|\\s+)(' + strOldClass + ')($|\\s+)', 'g'), '$1');
  objNode.className += ((objNode.className.length) ? ' ' : '') + strNewClass;
}
function matchClass(objNode, strCurrClass)
{
  return (objNode && objNode.className && objNode.className.match(new RegExp('(^|\\s+)(' + strCurrClass + ')($|\\s+)')));
}
var imgF = '/_/tpl/img/';
var xwindow = new Object();
var windowsObj = new Array();
xwindow.create = function(x, y, width, height, text, id, type, closer, title)
{
  this.x = x;
  this.y = y;
  this.width = width;
  this.height = height;
  this.text = text;
  this.id = id;
  this.closer = false;
  this.title = '&#160;';

  if(typeof title != 'undefined')
  {
    this.title = title;
  }
  if(typeof closer != 'undefined')
  {
    this.closer = true;
  }
  if(typeof common.el('win_' + id) != 'undefined')
  {
    xwindow.destroy(id);
  }
  switch(type)
  {
    case 'blank': this.showBlank(); break;
    default: this.showHint(); break;
  }
}

xwindow.create.prototype =
{
  showHint:function()
  {
    var eDIV = document.createElement('DIV');
    eDIV.className = 'framed';
    eDIV.style.position = 'absolute';
    eDIV.innerHTML = '<div class="f_tt"></div>' +
                     '<div class="f_r"><div class="f_rr"></div>' +
                       '<div class="f_b"><div class="f_bb"><div></div></div>' +
                       '<div class="f_l"><div class="f_ll"><div></div></div>' +
                       '<div class="f_c"><div class="f_cc" id="win_inner_' + this.id + '">' + this.text + '</div></div>' +
                       '</div></div></div>' +
                     '</div>';

    eDIV.id = 'win_' + this.id;
    eDIV.style.zIndex = '10' + this.id;
    document.body.appendChild(eDIV);
    windowsObj[this.id] = eDIV;
    this.eDIV = eDIV;
    eDIV.style.left = this.x + 30;
    eDIV.style.top = this.y;
  },
  showBlank:function()
  {
    var div = document.createElement('div');
    div.innerHTML = this.text;
    div.id = 'win_' + this.id;
    div.style.zIndex = '1' + this.id;
    div.className = 'blank';
    document.body.appendChild(div);
    div.style.top = this.y;
    div.style.left = this.x;
    windowsObj[this.id] = div;
  },
  render:function()
  {
    var scroll = getScroll();
    var windowSize = getWindowSize();
    if((common.getH(this.eDIV) + common.getY(this.eDIV)) > (scroll[1] + windowSize[1]))
    {
      this.eDIV.style.top = (scroll[1] + windowSize[1]) - common.getH(this.eDIV) - 30;
    }
  }
}

xwindow.destroy = function(id)
{
  try
  {
    document.body.removeChild(windowsObj[id]);
    return true;
  }
  catch(e)
  {
    return false;
  }
}
var images = new Array('ajax-loader-white.gif', 'ajax-loader.gif');
function init()
{
	for(var i = 0; i < images.length; i++)
	{
		var img = document.createElement('img');
		img.src = http_server + '_/tpl/img/' + images[i];
		img.style.position = 'absolute';
		img.style.left = '-1000px';
		img.style.top = '-1000px';
		document.body.appendChild(img);
	}
}
function refreshCaptcha(path)
{
	common.el('loader-animate-id').src = '/_/tpl/img/ajax-loader.gif';
	
}
function refreshCaptchaStatus()
{
	common.el('loader-animate-id').src = '/_/tpl/img/ajax-loader-static.gif';
	common.el('captcha-id').src = '/captcha.php?' + this.req.responseText;
}
var remoteSocket = null;
var disabledObj = null;
var userAgentVer = null;
var afterFunc = null;
function sendValues(url, method, _valuesArray, _namesArray, _afterFunc, _disObj)
{
  var formBody = null;
  disabledObj = null;
  afterFunc = null;
  if(typeof _disObj != 'undefined')
  {
    _disObj.disabled = true;
    disabledObj = _disObj;
  }
  if(typeof _afterFunc != 'undefined')
  {
    afterFunc = _afterFunc;
  }
  if(typeof _valuesArray != 'undefined' && _valuesArray != null)
  {
    for(var i = 0, length = _valuesArray.length; i < length; i++)
    {
      if(formBody == null)
      {
        formBody = _namesArray[i] + '=' + _valuesArray[i].replace(/&/g, '%26').replace(/=/g, '%3D').replace(/\?/g, '%3F');
      }
      else
      {
        formBody += '&' + _namesArray[i] + '=' + _valuesArray[i].replace(/&/g, '%26').replace(/=/g, '%3D').replace(/\?/g, '%3F');
      }
    }
  }
  remoteRequest (url, method, formBody);
}
function sendAllValues(url, node, _afterFunc, disObj)
{
  disabledObj = null;
  afterFunc = null;
  if(typeof _disObj != 'undefined')
  {
    _disObj.disabled = true;
    disabledObj = _disObj;
  }
  if(typeof _afterFunc != 'undefined')
  {
    afterFunc = _afterFunc;
  }
  var formBody = null;
  var inputs = $(node).getElementsByTagName('input');
  var re = /&/g;
  for(var i = 0, length = inputs.length; i < length; i++)
  {
	  if(inputs[i].disabled)
	  {
	    continue;
	  }
	  if((inputs[i].type == 'radio' || inputs[i].type == 'checkbox') && !inputs[i].checked)
	  {
	    continue;
	  }
	  if(formBody == null)
	  {
	    formBody = inputs[i].name + '=' + inputs[i].value.replace(/&/g, '%26').replace(/=/g, '%3D').replace(/\?/g, '%3F');
	  }
	  else
	  {
	    formBody += '&' + inputs[i].name + '=' + inputs[i].value.replace(/&/g, '%26').replace(/=/g, '%3D').replace(/\?/g, '%3F');
	  }
  }
  var selects = $(node).getElementsByTagName('span');
  for(var i = 0, length = selects.length; i < length; i++)
  {
    if(selects[i].title == '' || selects[i].parentNode.parentNode.parentNode.parentNode.className == 'elSel-dis')
    {
      continue;
    }
    if(formBody == null)
    {
      formBody = selects[i].lang + '=' + selects[i].title.replace(/&/g, '%26').replace(/=/g, '%3D').replace(/\?/g, '%3F');
    }
    else
    {
      formBody += '&' + selects[i].lang + '=' + selects[i].title.replace(/&/g, '%26').replace(/=/g, '%3D').replace(/\?/g, '%3F');
    }
  }
  var textareas = $(node).getElementsByTagName('textarea');
  for(var i = 0, length = textareas.length; i < length; i++)
  {
    if(textareas[i].disabled)
    {
      continue;
    }
    if(formBody == null)
    {
      formBody = textareas[i].name + '=' + textareas[i].value.replace(/&/g, '%26').replace(/=/g, '%3D').replace(/\?/g, '%3F');
    }
    else
    {
      formBody += '&' + textareas[i].name + '=' + textareas[i].value.replace(/&/g, '%26').replace(/=/g, '%3D').replace(/\?/g, '%3F');
    }
  }
  if(formBody != null)
  {
    remoteRequest (url, 'POST', formBody);
  }
  else
  {
    remoteRequest (url, 'GET', formBody);
  }
}
function remoteRequest (url, method, sendBody)
{
	remoteSocket = isMSIE ? new ActiveXObject ('Microsoft.XMLHTTP') : new XMLHttpRequest();
	if (!remoteSocket)
	{
		return false;
	}
	requestDo(url, method, sendBody);
}
function requestDo (url, method, sendBody)
{
	if (!remoteSocket)
	{
		return false;
	}
  remoteSocket.onreadystatechange = callback;
  remoteSocket.open(method, url, true);
  if(method == 'POST')
  {
   	remoteSocket.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8');
  }
  //remoteSocket.setRequestHeader('User-Agent', 'Opfiexnesa-' + agentver);
	remoteSocket.send(sendBody);
}
function callback()
{
	if (remoteSocket && remoteSocket.readyState == 4 && remoteSocket.status == 200)
	{
		if(disabledObj != null)
	  {
	      disabledObj.disabled = false;
	      disabledObj = null;
	  }
	  if(remoteSocket.responseText.match(/<location>/g))
		{
			var re = new RegExp('<location>((.|\n)*?)<\/location>', 'gi');
		  var locate = re.exec(remoteSocket.responseText);
		  locate = RegExp.$1;
		  window.location = http_server_uri + locate;
		}
		else
		{
		  if(afterFunc != null)
		  {
		    afterFunc(remoteSocket.responseText);
		    afterFunc = null;
		  }
		}
	  remoteSocket = null;
	}
}
function between(iVal, iStart, iEnd, bNoInclude)
{
	if(bNoInclude)
	{
		return (iVal > iStart && iVal < iEnd);
	}
	else
	{
		return (iVal >= iStart && iVal <= iEnd);
	}
}
function GetCorrectWord(iNum, aWords, bSkipNum)
{
	var iLast=Number(String(iNum).substr(-1));
	var sResult;
	if(iNum == 0)
	{
		return 'нет ' + aWords[2];
	}
	if(between(iNum, 5, 20))
	{
		sResult = aWords[2];
	}
	else
	{
		switch(iLast)
		{
			case 1: sResult = aWords[0]; break;
			case 2:
			case 3:
			case 4: sResult = aWords[1]; break;
			default: sResult = aWords[2]; break;
		}
	}
	return (bSkipNum) ? sResult : iNum + ' ' + sResult;
}


var comments = 
{
  id:0,
  obj:null,
  init:function(obj, id)
  {
  	this.id = id;
  	this.obj = obj;
  	obj.innerHTML = '<br /><img src="/_/tpl/img/ajax-loader.gif" width="16" height="16" style="position:relative;top:3px" />&#160;Загрузка...';
  	loadDocs(http_server + 'comments.php?id=' + this.id, http_server + '_/tpl/include/comments.xsl', this.obj.id);
	},
	add:function(value)
	{
	  if(value != '')
	  {
	  	this.obj.innerHTML = '<br /><img src="/_/tpl/img/ajax-loader.gif" width="16" height="16" style="position:relative;top:3px" />&#160;Загрузка...';
		  sendValues(http_server + 'comments.php?do=add&id=' + this.id, 'POST', new Array(value), new Array('value'), comments.addCallback);
		}
	},
	addCallback:function()
	{
	  loadDocs(http_server + 'comments.php?id=' + comments.id, http_server + '_/tpl/include/comments.xsl', comments.obj.id);
	},
	setCount:function(id)
	{
		new remote.fLoader(http_server + 'comments.php?do=count&id=' + id, comments.setCountCallback); 
	},
	setCountCallback:function()
	{
		var cnt = this.req.responseText.split(':');
		common.el('comments-link-' + cnt[0]).innerHTML = GetCorrectWord(cnt[1], Array('комментарий', 'комментария', 'комментариев'));
	}
};

var photo = 
{
	cur:null,
	showBig:function(obj)
	{
	  this.cur = obj.href;
	  new remote.fLoader(http_server + 'getis.php?name=' + obj.href.replace(http_server, ''), photo.showBigCallback);
	},
	showBigCallback:function()
	{
	  if(this.req.responseText != 'error')
	  {
	  	var wh = this.req.responseText.split(':');
			var ws = getWindowSize();
			var sc = getScroll();
			var mx = Math.round(ws[0] / 2) - Math.round(wh[0] / 2) - 60;
			var my = Math.round(ws[1] / 2) - Math.round(wh[1] / 2) + sc[1] - 20;
			new xwindow.create(mx, my, 'auto', 'auto', '<table cellpadding="3"><tr><td align="right"><a href="" onclick="xwindow.destroy(\'7\');return false">Закрыть</a></td></tr><tr><td style="background:url(\'/_/tpl/img/ajax-loader-white.gif\') center center no-repeat"><img src="' + photo.cur + '" width="' + wh[0] + '" height="' + wh[1] + '" /></td></tr></table>', '7');
		}
	}
}

var slider = 
{
	allCache:null,
	topPos:0,
	over:false,
	init:function(obj)
	{
	  this.allCache = common.els('img', obj);
	  for(var i = 0; i < this.allCache.length; i++)
	  {
	  	if(this.allCache[i].className == 'cur')
	  	{
	  		if(i > 2 && i < this.allCache.length - 3)
	  		{
	  			this.topPos = (i - 2) * 95;
				}
				else if(i >= this.allCache.length - 3)
				{
					this.topPos = (this.allCache.length - 5) * 95;
				}
				common.els('div', obj)[0].style.top = '-' + this.topPos + 'px';
	  	}
	  }
	  this.sheckButtons();
	  if(window.addEventListener)
		{
			window.addEventListener('DOMMouseScroll', wheel, false);
		}
		else
		{
			window.onmousewheel = document.onmousewheel = wheel;
		}
	},
	up:function(obj)
	{
	  if(this.topPos > 0)
	  {
	  	this.topPos -= 95;
	  	common.els('div', obj)[0].style.top = '-' + this.topPos + 'px';
		}
		this.sheckButtons();
	},
	down:function(obj)
	{
	  if(this.topPos < (this.allCache.length - 5) * 95)
	  {
	  	this.topPos += 95;
	  	common.els('div', obj)[0].style.top = '-' + this.topPos + 'px';
		}
		this.sheckButtons();
	},
	sheckButtons:function()
	{
		common.el('slider-up').style.visibility = this.topPos == 0 ? 'hidden' : 'visible';
		common.el('slider-down').style.visibility = this.topPos >= (this.allCache.length - 5) * 95 ? 'hidden' : 'visible';
	}
}

function handle(delta) 
{
	if(delta < 0)
	{
	  slider.down(common.el('slider-id'));
	}
	else
	{
	  slider.up(common.el('slider-id'));
	}
}
function wheel(event)
{
	if(!slider.over)
	{
		return;
	}
	var delta = 0;
	if(!event)
	{
	  event = window.event;
	}
	if(event.wheelDelta)
	{
		delta = event.wheelDelta / 120; 
		if(window.opera)
		{
			delta = -delta;
		}
	}
	else if(event.detail) 
	{
		delta = -event.detail/3;
	}
	if(delta)
	{
		handle(delta);
	}
	if(event.preventDefault)
  {
  	event.preventDefault();
    event.returnValue = false;
	}
}
