var LEFT=0;
var RIGHT=0;
var TOP=0;
var WIDTH_IMG = 120;
var HEIGHT_IMG = 81;
var IMG_DIR = "/files/images/1str/";
var IMG_TYPE = ".jpg";
var IMAGES_URL = "/files/images/1str/";
var BGRND_COLOR="#fff";
var LIGHT_COLOR="#fff";
var SIDE_BGRD_COLOR="#fff";
var TOP_Z_INDEX=5;
var USE_ACCELERATOR=false;

function n(aA)
{
    if(window.XMLHttpRequest)
    {
        at=new XMLHttpRequest();
		if (navigator.appName == "Microsoft Internet Explorer")
			ag=true;
    }
    else if(window.ActiveXObject)
    {
        at=new ActiveXObject("Microsoft.XMLHTTP");
        ag=true;
    }
    at.open("GET",aA,true);
};
function O()
{
    if(an)return;
    an=true;
    if(!ao)af++;
    else af--;
    if(af>COUNT_ID)af-=COUNT_ID;
    if(af<=0)af+=COUNT_ID;
    n(IMAGES_URL+af.toString()+".xml");
    at.onreadystatechange=l;
    at.send(null);
};
var an=false;
var pause=false;
var af=0;
var ag=false;
var width=615;
var V=Math.ceil(width/WIDTH_IMG)+1;
var at;
var ap=0;
var aj=new Array();
function l()
{
    try
    {
        if(at.readyState==4)
        {
            if(at.status==200)
            {
                var ah=at.responseXML.getElementsByTagName("i");
                for(var i=0;i<ah.length;i++)
                {
                    var ax=ah[i].childNodes[0].firstChild.nodeValue+"_SPRT_"+ah[i].childNodes[1].firstChild.nodeValue;
                    if(ah[i].childNodes[2])ax+="_SPRT_"+ah[i].childNodes[2].firstChild.nodeValue;
                    aj[aj.length]=ax;
                }
                an=false;
                if(ap==0)
                {
                    if(aj.length<V*COUNT_LINES)O();
                    else o();
                }
            }
            else
            {
                an=false;
                S("AJAX status = "+at.status);
            }
        }
    }
    catch(ae)
    {
        an=false;
        k(ae);
    }
};
function k(aq)
{
    if(!(typeof console=='undefined'))console.ad(aq);
};
function S(aq)
{
    if(!(typeof console=='undefined'))console.aE(aq);
};
function m(aq)
{
    if(!(typeof console=='undefined'))console.am(aq);
};
function log(aq)
{
    if(!(typeof console=='undefined'))console.log(aq);
};
function R()
{
    aj.splice(0,1);
    if(aj.length<=COUNT_LINES*3)O();
};
function c(j,i)
{
    var ax;
    try
    {
        var t=j*HEIGHT_IMG;
        var r=i*WIDTH_IMG-WIDTH_IMG;
        var aa=g("div",
        {
            id:"divimg"+j.toString()+i.toString(),style:"position:absolute; top:"+t+"px; right:"+r+"px;"
        }
        );
        var aw="";
        var U="";
        var az="";
        if(aj.length>0)
        {
            ax=aj[0];
            var ak=ax.indexOf("_SPRT_",0);
            var al=ax.indexOf("_SPRT_",ak+1);
            aw=IMG_DIR+ax.substring(0,ak)+IMG_TYPE;
            if(al!=-1)
            {
                U=ax.substring(ak+6,al);
                az=ax.substring(al+6);
            }
            else
            {
                U=ax.substring(ak+6);
                az="";
            }
            R();
        }
        var ar=g("img",
        {
            id:"img"+j.toString()+i.toString(),src:aw,width:WIDTH_IMG,height:HEIGHT_IMG,border:"0px",alt:"Нажмите на картинку для перехода на страницу проекта"
        }
        );
        var d=2;
        if(ag)d=0;
        var W=g("div",
        {
            id:"selimg"+j.toString()+i.toString(),style:"position:absolute; top:0px; left:0px; width:"+(WIDTH_IMG-d).toString()+"px; height:"+(HEIGHT_IMG-d).toString()+"px; border-style:double; border-width:1px; border-color:"+LIGHT_COLOR+";display:none;"
        }
        );
        aa.onmouseover=L;
        aa.onmouseout=K;
        var T=g("a",
        {
            id:"aimg"+j.toString()+i.toString(),href:U,title:az
		}
        );
		
        var Ju=g("div",
        {
            id:"selimgx"+j.toString()+i.toString(),style:"position:absolute; top:0px; left:0px; width:"+(WIDTH_IMG-d).toString()+"px; height:"+(HEIGHT_IMG-d).toString()+"px; border-style:double; border-width:1px; border-color:"+LIGHT_COLOR+";"
        }
        );
		
        T.appendChild(ar);
        T.appendChild(W);
		T.appendChild(Ju);
        aa.appendChild(T);
        id('mather').appendChild(aa);
    }
    catch(ae)
    {
        k(ae);
    }
};
var au;
var aut;
function L(e)
{
    if(au)au.style.display="none";
    au  = id("sel"+this.id.substring(3));
	aut = this.id.substring(3);
	au.style.display="";
};
function K(e)
{
    id("sel"+this.id.substring(3)).style.display="none";
};
function o()
{
    ap=1;
    var div=g("div",
    {
        id:"mather",style:"position:relative; top:"+TOP+"px; left:"+LEFT+"px; width:"+width+"px; height:"+(COUNT_LINES)*HEIGHT_IMG+"px; background:"+BGRND_COLOR+"; z-Index:"+TOP_Z_INDEX+";"
    }
    );
    id("scrollipuper").appendChild(div);
    for(var j=0;j<COUNT_LINES;j++)
    {
        for(var i=0;i<V;i++)
        {
            c(j,i);
        }
    }
    var Y=g("div",
    {
        id:"left",style:"position:absolute; top:0px; left:-"+LEFT+"px; width:"+LEFT+"px; height:"+COUNT_LINES*HEIGHT_IMG+"px; background:"+SIDE_BGRD_COLOR+"; z-Index:"+TOP_Z_INDEX+";"
    }
    );
    div.appendChild(Y);
    if(ag)RIGHT-=22;
    var Z=g("div",
    {
        id:"right",style:"position:absolute; top:0px; right:-"+RIGHT+"px; width:"+RIGHT+"px; height:"+COUNT_LINES*HEIGHT_IMG+"px; background:"+SIDE_BGRD_COLOR+"; z-Index:"+TOP_Z_INDEX+";"
    }
    );
    div.appendChild(Z);
    P();
};
function id(name)
{
    return document.getElementById(name);
};
function add(ac,as)
{
    id(as).appendChild(ac);
};
var X=1;
var av=SCROLL_SPEED;
function M()
{
    av=SCROLL_SPEED;
    X=1;
    pause=true;
};
function N()
{
	document.getElementById('bl').style.display = 'none';
	pause=false;
};
function A(d,s)
{
    X=d;
    av=s;
    pause=false;
    if(SCROLL_TYPE==0)ao=true;
    else ao=false;
};
function D()
{
    A(1,SCROLL_SPEED);
};
function B()
{
    A(1,SCROLL_SPEED*10);
};
function C()
{
    A(3,SCROLL_SPEED*10);
};
function G(d,s)
{
    X=d;
    av=s;
    pause=false;
    if(SCROLL_TYPE==0)ao=false;
    else ao=true;
};
function J()
{
    G(1,SCROLL_SPEED);
};
function H()
{
    G(1,SCROLL_SPEED*10);
};
function I()
{
    G(3,SCROLL_SPEED*10);
};
function v()
{
    if(!pause)
    {
        for(var j=0;j<COUNT_LINES;j++)
        {
            for(var i=0;i<V;i++)
            {
                z("img"+j.toString()+i.toString(),j);
            }
        }
    }
    P();
};
var w=width;
function F(e)
{
	pause = true;
	

	var ab;
    if(e)
    {
        if(typeof(e.pageX)=='number')ab=e.pageX;
        else ab=e.clientX;
    }
    else
    {
        e=window.event;
        ab=e.clientX;
        if(document.documentElement&&(document.documentElement.scrollTop||document.documentElement.scrollLeft))ab+=document.documentElement.scrollLeft;
        else if(document.body&&(document.body.scrollTop||document.body.scrollLeft))ab+=document.body.scrollLeft;
    }
	document.getElementById('bl').style.left = ab - 230;
	mymagicsrc = document.getElementById(aut).src;
	mymagicsrc = mymagicsrc.replace(/\/\/www\./,'//');

	document.getElementById('vbn').innerHTML = obl[mymagicsrc]['tx'];
	document.getElementById('bl').style.display = 'block';

};
function f(ai)
{
    if(typeof aj[0]=='undefined')return;
    try
    {
        var ax=aj[0];
        var ak=ax.indexOf("_SPRT_",0);
        var al=ax.indexOf("_SPRT_",ak+1);
        id(ai).src=IMG_DIR+ax.substring(0,ak)+IMG_TYPE;
        if(al!=-1)
        {
            id("a"+ai).href=ax.substring(ak+6,al);
            id("a"+ai).title=ax.substring(al+6);
        }
        else
        {
            id("a"+ai).href=ax.substring(ak+6);
            id("a"+ai).title="";
        }
        R();
    }
    catch(ae)
    {
        k(ae);
    }
};
var ao=false;
function z(ai,type)
{
    var div=id("div"+ai);
    var aD=div.style.right;
    var aC=parseInt(aD.substring(0,aD.length-2));
    if((SCROLL_TYPE!=0&&!ao)||(SCROLL_TYPE==0&&ao))
    {
        aC-=X;
        if(aC<-WIDTH_IMG)
        {
            aC+=V*WIDTH_IMG;
            f(ai);
            div.style.display='none';
        }
        else if(aC<=width&&div.style.display=='none')div.style.display='';
    }
    else
    {
        aC+=X;
        if(aC>width)
        {
            aC-=V*WIDTH_IMG;
            f(ai);
            div.style.display='none';
        }
        else if(aC>=-WIDTH_IMG&&div.style.display=='none')div.style.display='';
    }
    div.style.right=aC.toString()+"px";
};
var ay;
function Q()
{
    if(ay)
    {
        clearTimeout(ay);
        ay=0;
    }
};
function P()
{
    Q();
    ay=setTimeout("v()",100/av);
};
function startSP()
{
    O();
	id('scrollipuper').onmouseover=F;
	id('scrollipuper').onmouseout=N;
	
    if(USE_ACCELERATOR)
    {
        id('scrollipuper').onmouseover=F;
        id('scrollipuper').onmousemove=F;
        id('scrollipuper').onmouseout=N;
    }
};
function g(name,attributes)
{
    var ac=document.createElement(name);
    if(typeof attributes=='object')
    {
        for(var i in attributes)
        {
            ac.setAttribute(i,attributes[i]);
            if(i.toLowerCase()=='class')
            {
                ac.className=attributes[i];
            }
            else if(i.toLowerCase()=='style')
            {
                ac.style.cssText=attributes[i];
            }
        }
    }
    for(var i=2;i<arguments.length;i++)
    {
        var aB=arguments[i];
        if(typeof aB=='string')
        {
            aB=document.createTextNode(aB)
        };
        ac.appendChild(aB);
    }
    return ac;
}

