/*************************************************************
* Coded : Semenihin Maksim (Semenihin.Maksim@gmail.com) ©2009*
*************************************************************/

/*
core.js
find поиск елемента  по id , false если такого нету 
getElInf возвращает left top width height елемента , false если такого нету 
//pos2 = core.getElInf(cub2);
// return {"left":l, "top":t, "width": w, "height":h};
WinCx
WinCy
WinX
WinY
WinXc
WinYc
getElScrollTop
getElScrollLeft

hide прячет елемент
показывает елемент
show
hidden
centrEl*/

<!--
var core  = {
find     :function(id) 	
	{
if  (typeof id == 'string') 
{
  if (document.getElementById(id))  { 
  return document.getElementById(id) }
  else
  { 
  return false;

}
}
{
return false
}	
	},






Xmlfind     :function(name) 	
	{
//alert(name)
//alert(XMLHttpRequestObject.responseText)
  
if  (typeof name == 'string') 
{

  if (XMLHttpRequestObject.responseXML.getElementsByTagName(name))  
  { 
  return XMLHttpRequestObject.responseXML.getElementsByTagName(name) 
  //alert( XMLHttpRequestObject.responseXML.getElementsByTagName(name))
  }
  else
  { 
  return false;

}
}
{
return false
}	
	},



getElScrollTop :function (el)
{
  return self.pageYOffset || (core.find(el) && core.find(el).scrollTop) || (core.find(el) && core.find(el).scrollTop)
 },

getElScrollLeft :function (el)
{
  return self.pageXOffset || (core.find(el) && core.find(el).scrollLeft) || (core.find(el) && core.find(el).scrollLeft)
 },


getElInf :	function(elemId)
{
    var elem = core.find(elemId);
	
    var w = elem.offsetWidth;
    var h = elem.offsetHeight;
	
    var l = 0;
    var t = 0;
	
    //while (elem)
    //{
        l += elem.offsetLeft;
        t += elem.offsetTop;
        elem = elem.offsetParent;
    //}
    
    return {"left":l, "top":t, "width": w, "height":h};

},
mouseXY  :function(e)
{


  var x = 0, y = 0;

  if (!e) e = window.event;

  if (e.pageX || e.pageY)
  {
    x = e.pageX;
    y = e.pageY;
  }
  else if (e.clientX || e.clientY)
  {
    x = e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) - document.documentElement.clientLeft;
    y = e.clientY + (document.documentElement.scrollTop || document.body.scrollTop) - document.documentElement.clientTop;
  }
  return {"x":x, "y":y};
  
},
show	 :function(id,full) 
{
document.getElementById(id).style.visibility='visible';
},
hide	 :function(id,full) 
{
document.getElementById(id).style.visibility='hidden';

},


hidden :function(id) 
{


//alert(document.getElementById(id).style.visibility)
if (document.getElementById(id).style.visibility='hidden') return 'true'
if (document.getElementById(id).style.visibility='visible')return 'false'

},

centrEl :function(id){
el=core.getElInf(id);
//alert(core.WinCy()-el.height/2)

core.find(id).style.top=core.WinCy()-el.height/2+core.getElScrollTop();
core.find(id).style.left=core.WinCx()-el.width/2;


//alert(core.WinCx())//-el.height/2;

//alert()
//alert(core.WinCy())
	
},

WinCx : function()
{

var getClientWidth=  window.opera?document.documentElement.clientWidth:document.body.clientWidth;



return parseInt(getClientWidth/2);
},
WinCy : function()
{
 if (window.opera)
{ var getClientHeight=document.documentElement.clientHeight}
else
{var getClientHeight=document.body.clientHeight}

if (document.documentElement.clientHeight) var getClientHeight=document.documentElement.clientHeight
 
return parseInt(getClientHeight/2);

},
WinX : function()
{

var getClientWidth=  window.opera?document.documentElement.clientWidth:document.body.clientWidth;



return parseInt(getClientWidth);
},
WinY : function()
{

if (window.opera)
{ var getClientHeight=document.documentElement.clientHeight}
else
{var getClientHeight=document.body.clientHeight}
 if (document.documentElement.clientHeight) var getClientHeight=document.documentElement.clientHeight
 
return parseInt(getClientHeight);

},


WinYc : function()
{
return (document.body.scrollHeight > document.body.offsetHeight)?document.body.scrollHeight:document.body.offsetHeight;
},

//Размер документа по горизонтали
WinXc : function()
{

return (document.body.scrollWidth > document.body.offsetWidth)?document.body.scrollWidth:document.body.offsetWidth;
}




}
-->
