var _list=Object;
    _list.rowLoaded=0;
    _list.nrRowsPerCall=10;
    _list.currentPage=1; 
    _list.first=1;
    _list.last=null;
    _list.rowLoaded=0;
    _list.elementHeight=75;
    _list.setSize=function(nr){
	    $("mycarousel_detail_right").style.height=(parseInt(nr)*_list.elementHeight)+"px";	    
    }
    _list.moveToFirst=function(){
	   // alert("hi");
	    
	    $("id_detail_list").scrollTop=parseInt($("id_detail_list").scrollTop)+_list.elementHeight;	
	    //alert($("id_detail_list").scrollTop);    
    }
    
    _list.add=function(content){
	    var _el=document.createElement("div");
	        _el.innerHTML=content;
	    $("mycarousel_detail_right").appendChild(_el);
	    _el.style.display= "block";
	    _el.style.height = _list.elementHeight+"px" ; 
    } 

    
function itemLoadCallback()
										{
										    _list.currentPage=(_list.currentPage!="" ? _list.currentPage : 1 );//alert(carousel.options.start);
										    
										    //alert("stop0");
										    
										    new Ajax.Request('carusel.php', {
															  method: 'get',
															  parameters: {
																    first: _list.first,
														            last: _list.last,
														            c: currentCatId,
														            nr: _list.currentPage
																  },
															  onSuccess: function(transport){
															      var response = transport.responseXML || "no response text";
															      if(Prototype.Browser.IE)
															      {
																     xmlDocument = new ActiveXObject('Microsoft.XMLDOM');
															         xmlDocument.async = true;  
															         var response = xmlDocument.loadXML(transport.responseText);  
																      //if(response)alert(xmlDocument.documentElement.childNodes.length);
																      response=xmlDocument.documentElement;
																     // mycarousel_itemAddCallback(carousel, carousel.first, carousel.last, nod);
															      
															         
														          } 
														          my_itemAddCallback( _list.first, _list.last, response);
															     // alert("Success! \n\n" + transport.responseText);
															    }
										
															  });
										    
										    
										
										    _list.currentPage++;
										   
										   
										};
										
function my_itemAddCallback( first, last, xml)
{
    // Set the size of the carousel
    //_list.setSize(parseInt(jQuery('total', xml).text()));
    if($("nav_list_head"))$("nav_list_head").innerHTML=parseInt(jQuery('total', xml).text());
    //_list.setSize(_list.rowLoaded+);
    //alert("aci");
    //alert(jQuery('image', xml).length);
    //alert( xml.getElementsByTagName("image").length);
    var _size=jQuery('image', xml).length;
   // alert(_size);
    _list.setSize(_list.rowLoaded+_size);
    var colectionImg=jQuery('image', xml);
    var colectionId=jQuery('adId', xml);
    var colectionTxt=jQuery('title', xml);
    var colectionLink=jQuery('link', xml);
    //if(carousel.options.vertical)alert("YERTICAL");
    for(var z=0;z<_size;z++)
    {
	  //alert(first + 1);
	  var _img=(colectionImg[z].firstChild ? colectionImg[z].firstChild.nodeValue : "");
	  var _txtId=colectionId[z].firstChild.nodeValue;
	  var _title=colectionTxt[z].firstChild.nodeValue;
	  var _link=colectionLink[z].firstChild.nodeValue;
	  
		_list.add( myVerical_getItemHTML(_img,_txtId,_title,_link)); 
	    _list.rowLoaded=_list.rowLoaded+1;
    }
    //alert("hop");
    _list.moveToFirst();
 
   // setTimeout("$('mycarousel').style.display='block';",5000);alert("e");
};

		/**
 * Item html creation helper.photo_icon.gif
 */
function myVerical_getItemHTML(url,adId,myTxt,mylink)
{
	  var _l_det=($('mycarousel_detail_right') ? "#" : mylink );
	  var _jsCall='onmousedown="Biz.OpenAds('+adId+');return false;"' ;
	       _jsCall=($('mycarousel_detail_right') ? _jsCall: "" );
	  var out='<div style="overflow: hidden;width: 100%;" >'; 
	  out+='<a href="'+mylink+'" >';
	  if(url!="")
	  {
	    
	  }else{
		  url="../images/no_image_carusel.gif";
	  } 
	      out+='<img src="' + url + '" width="60px"  style="float: left; margin-top: 0px; margin-right: 8px; "  alt="" />';
	    //  out+='</a>';
     
	      out+='<div style="margin-top: 5px; ">'+myTxt+'</div></a></div>';
    return out;
};
// function onLoadDoc()
// {
// 	//itemLoadCallback();
// }
itemLoadCallback();								