var GAurl="/inc/ajax/1st_page.php";

function first_page(num)
	{
	num++;
	if (!d.getElementById(('actual'+num))) num=0;
	inc_first_page(num);
	fp_id=setTimeout('first_page('+num+');',7500)
	}
	
function stop_first_page()
	{
	clearTimeout(fp_id)
	}

function start_first_page(num)
	{
	fp_id=setTimeout('first_page('+num+');',7500)
	}

function sel_first_page(num)
	{
	stop_first_page();
	inc_first_page(num)
	}
	
function inc_first_page(num)
	{
	c=0;
	while (d.getElementById(('actual'+c)))
		{
		if(c==num)
			{
			d.getElementById(('actual'+c)).className='show';
			d.getElementById(('slli'+c)).className='selc'
			}
		else
			{
			d.getElementById(('actual'+c)).className='hide';
			d.getElementById(('slli'+c)).className=''
			}
		c++
		}
	}


function handlehRA()
	{
  if (httpRA.readyState==4)
  	{
    rez1=httpRA.responseText.split('ζ');
  	pl=d.getElementById('sl_a');
  	ppp=d.getElementById('sl');
		
		for (b=0;b<2;b++)
			{
			c=b*9;
			div=ce('div');
			div.className='hide';
			div.id='actual'+(b+1);
			
			aa=sa(sa(ce('a'),'title',rez1[c+1]),'href',rez1[c+0]);
			if (rez1[c+2]) //ja ir bilde
				{
				idiv=ce('div');
				idiv.className='slimgl';
				ia=aa.cloneNode(false);
				ac(idiv,ac(ia,sa(sa(sa(sa(img=ce('img'),'src',rez1[c+2]),'alt',rez1[c+1]),'width',rez1[c+3]),'height',rez1[c+4])));
				if (rez1[c+5]) //ja ir pie bildes virsraksts
					ac(idiv,ac(ce('p'),ctn(rez1[c+5])));
				ac(div,idiv)
				}
			
			p=ce('h3');
  		par=rez1[c+7].split('');
  		for (kk in par) ac(ac(aa,ctn(par[kk])),ce('br'))
		
			//ac(ac(ac(div,ac(ce('h1'),ac(aa,ctn(rez1[c+1])))),ac(ce('span'),ctn(rez1[c+6]))),p);
			//ac(ac(div,ac(ce('h1'),ac(aa,ctn(rez1[c+1])))),p);
			ac(div,ac(p,aa));
			
			//lp=ce('p');
			//ac(lp,ac(aa.cloneNode(false),ctn('Tālāk...')));
			//if (rez1[c+8]) ac(lp,ctn(rez1[c+8]));
			//ac(div,lp);
			pl.insertBefore(div,pl.lastChild);
			//Pievienojam skaitu
			aaa=sa(ce('a'),'href','#');
			if (b==0) 
				{
				aaa.onmouseover=function(){sel_first_page(1)};
				aaa.onmouseout=function(){start_first_page(1)};
				}
			if (b==1)
				{
				aaa.onmouseover=function(){sel_first_page(2)};
				aaa.onmouseout=function(){start_first_page(2)};
				}
			li=ce('li');
			li.id='slli'+(b+1);
			ac(ppp,ac(li,ac(aaa,ctn(b+2))))
			}
		fp_id=setTimeout('first_page(0);',7500)
		}
	}

function rA(){
	if(httpRA.readyState==4 || httpRA.readyState==0){
  	httpRA.open('GET',GAurl+'?id='+user_id+'&rand='+Math.floor(Math.random()*1000000),true);
    httpRA.onreadystatechange=handlehRA; 
  	httpRA.send(null)
	}
}

var httpRA=getHTTPObject();