
function layerLoader(link,width,height){var c=document.getElementById('tm-layeraction');if(!c)
{c=document.createElement('div');c.setAttribute('id','tm-layeraction');var t=layerLoaderCreateElement('table','tm-layeraction-table');var b=layerLoaderCreateElement('tbody');var t1=layerLoaderCreateElement('tr');var t2=layerLoaderCreateElement('tr');var t3=layerLoaderCreateElement('tr');var t11=layerLoaderCreateElement('td','tm-layeraction-lefttop');var t12=layerLoaderCreateElement('td','tm-layeraction-top');var t13=layerLoaderCreateElement('td','tm-layeraction-righttop');var t21=layerLoaderCreateElement('td','tm-layeraction-left');var t22=layerLoaderCreateElement('td','tm-layeraction-content');var t23=layerLoaderCreateElement('td','tm-layeraction-right');var t31=layerLoaderCreateElement('td','tm-layeraction-leftbottom');var t32=layerLoaderCreateElement('td','tm-layeraction-bottom');var t33=layerLoaderCreateElement('td','tm-layeraction-rightbottom');var wrap=layerLoaderCreateElement('div','tm-layeraction-wrapper');var container=layerLoaderCreateElement('div','tm-layeraction-container');wrap.appendChild(container);t22.appendChild(wrap);t1.appendChild(t11);t1.appendChild(t12);t1.appendChild(t13);t2.appendChild(t21);t2.appendChild(t22);t2.appendChild(t23);t3.appendChild(t31);t3.appendChild(t32);t3.appendChild(t33);b.appendChild(t1);b.appendChild(t2);b.appendChild(t3);t.appendChild(b);c.appendChild(t);c._content=container;c._wrapper=wrap;document.body.appendChild(c);c.style.display='none';c._loading=false;c._bg=document.createElement('div');c._bg.setAttribute('id','tm-layeraction-bg');c._bg.style.display='none';document.body.appendChild(c._bg);c._bg.onclick=function(){LayerActionClose();}
t13._close=layerLoaderCreateElement('div','tm-layeraction-close');t13._close.onclick=function(){LayerActionClose();}
t13.appendChild(t13._close);}
if(c._loading)
return;c._open=true;c._loading=true;var browse={'height':TMLayerActionBrowse.height(),'width':TMLayerActionBrowse.width(),'cHeight':TMLayerActionBrowse.contentHeight(),'cWidth':TMLayerActionBrowse.contentWidth()};var bgWidth=(browse.cWidth>browse.width)?browse.cWidth:browse.width;var bgHeight=(browse.cHeight>browse.height)?browse.cHeight:browse.height;c._bg.style.width=bgWidth.toString()+'px';c._bg.style.height=bgHeight.toString()+'px';c._bg.style.display='block';c._width=(typeof width=='undefined')?false:width;c._height=(typeof height=='undefined')?false:height;var request=new Ajax.Request(link,{requestHeaders:{'TM-LAYERACTION-AJAX':'1'},onSuccess:function(transport){var c=document.getElementById('tm-layeraction');c._loading=false;if(!c._open)
return;c._content.innerHTML=transport.responseText;c.style.visibility='hidden';c.style.display='';var dimension=$(c._content).getDimensions();var browse={'height':TMLayerActionBrowse.height(),'width':TMLayerActionBrowse.width(),'cHeight':TMLayerActionBrowse.contentHeight(),'cWidth':TMLayerActionBrowse.contentWidth()}
maxWidth=((browse.cWidth>browse.width)?browse.width:browse.cWidth)-15;maxHeight=((browse.cHeight>browse.height)?browse.height:browse.cHeight)-15;if(!c._width)
c._width=dimension.width;if(!c._height)
c._height=dimension.height;if(c._width>maxWidth)
c._width=maxWidth;if(c._height>maxHeight)
c._height=maxHeight;c._wrapper.style.width=c._width.toString()+'px';c._wrapper.style.height=c._height.toString()+'px';c.style.left=(Math.round(((browse.width-c._width)/2)+TMLayerActionBrowse.scrollX())).toString()+'px';c.style.top=(Math.round(((browse.height-c._height)/2)+TMLayerActionBrowse.scrollY())).toString()+'px';var scripts=c._content.getElementsByTagName('script');for(var iS=0;iS<scripts.length;iS++)
{eval(scripts[iS].innerHTML);}
c.style.visibility='visible';}});}
function LayerActionClose(){var bg=document.getElementById('tm-layeraction-bg');var c=document.getElementById('tm-layeraction');bg.style.display='none';c.style.display='none';c._open=false;}
function layerLoaderCreateElement(tagName,className)
{var c=document.createElement(tagName);if(typeof className!='undefined')
c.className=className;return c;}
var TMLayerActionBrowse={contentWidth:function()
{if(document.documentElement&&document.documentElement.scrollWidth)
return document.documentElement.scrollWidth;else if(document.body&&document.body.scrollWidth)
return document.body.scrollWidth;return false;},contentHeight:function()
{if(document.documentElement&&document.documentElement.scrollHeight)
return document.documentElement.scrollHeight;else if(document.body&&document.body.scrollHeight)
return document.body.scrollHeight;return false;},width:function()
{var myWidth=0;if(typeof(window.innerWidth)=='number')
{myWidth=window.innerWidth;}
else if(document.documentElement&&document.documentElement.clientWidth)
{myWidth=document.documentElement.clientWidth;}
else if(document.body&&document.body.clientWidth)
{myWidth=document.body.clientWidth;}
return myWidth;},height:function()
{var myHeight=0;if(typeof(window.innerHeight)=='number')
{myHeight=window.innerHeight;}
else if(document.documentElement&&document.documentElement.clientHeight)
{myHeight=document.documentElement.clientHeight;}
else if(document.body&&document.body.clientHeight)
{myHeight=document.body.clientHeight;}
return myHeight;},scrollX:function(){if(document.documentElement&&document.documentElement.scrollLeft)
return document.documentElement.scrollLeft;else if(document.body&&document.body.scrollLeft)
return document.body.scrollLeft;else if(window.pageXOffset)
return window.pageXOffset;else if(window.scrollX)
return window.scrollX;return 0;},scrollY:function(){if(document.documentElement&&document.documentElement.scrollTop)
return document.documentElement.scrollTop;else if(document.body&&document.body.scrollTop)
return document.body.scrollTop;else if(window.pageYOffset)
return window.pageYOffset;else if(window.scrollY)
return window.scrollY;return 0;}}
