var doOnce=1;
function rand( min, max )
{
	if( max )
	{
		return Math.floor(Math.random() * (max - min + 1)) + min;
	}
	else
	{
		return Math.floor(Math.random() * (min + 1));
	}
}function getphp(page,sendget,resultid,openin)
{
    //<div class='slide item'><a class=title onclick='this.href=document.getElementById(\"link1\").innerHTML;' href='' target='_blank'>#title#</a> <div id='description#count#' class='description'>#description#</div><div class='pubDate'>#pubDate#</div></div>
    //var uri="<div class=slide item><a class=title onclick=this.href=document.getElementById(link1).innerHTML; href= target=_blank>#title#</a> <div id=description#count# class=description>#description#</div><div class=pubDate>#pubDate#</div></div>";
    //page="expressen2.php";
    page="xml/rss.php?ant=7&mytemplate=2&trimdescription=180";
    var myurl=page+"?&trand="+rand(1,1001);
    try{xmlHttp=new XMLHttpRequest(); }
    catch (e)
    {try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
    catch (e)
    {try{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
    catch (e)
    {alert("Ajax is not supported by your browser.");return false;}}}

    xmlHttp.onreadystatechange=function()
    {
	    if(xmlHttp.readyState==4)
	    {
		    if(openin=="div")
		    {
		    	document.getElementById(resultid).innerHTML="";
		    	document.getElementById(resultid).innerHTML=xmlHttp.responseText;
                if(doOnce==1)
                {
                    $('.slideshow').divSlideShow();

                	//make one slideshow with id selector
                	$('#rss').divSlideShow({
                		height:30,
                		width:900,
                		arrow:"split",
                		loop:99,
                		slideContainerClass:"slide-container",
                		separatorClass:"separator",
                		controlClass:"control",
                		leftArrowClass:"control",
                		rightArrowClass:"control",
                		controlActiveClass:"control-active",
                		controlHoverClass:"control-hover",
                		controlContainerClass:"control-container"

                	});
                    //doOnce++;
                }
		    }
		    else if(openin=="window")
		    {
		    	mywindow(xmlHttp.responseText);
		    }
		    else
		    {
		    	return xmlHttp.responseText;
		    }
	    }
    }
    xmlHttp.open("GET", myurl, true);
    xmlHttp.send(null);
}
function updaterss()
{
    getphp("","","rss","div");
    setTimeout('updaterss()',300000);//whait 5 mmin before update news
}
