function LoadCatalogData(){
	var CatalogLoading = parseInt($('CatalogLoading').value);
	if(isNaN(CatalogLoading)){
		CatalogLoading  = 0
	}
	if(CatalogLoading==0){
		$('CatalogLoading').value=1;
		var DeviceID = $('DeviceID').value
		var CategoryID = $('CategoryID').value
		var CatalogPage = $('CatalogPage').value
		var CatalogSuffix = $('CatalogSuffix').value
		var CatalogSort = $('CatalogSort').value
		var Exclude = $('CatalogExclude').value
		if($('DeviceCount').value==100 || $('DeviceCount').value<100 ){
			var Base = parseInt($('DeviceCount').value)+2
		}else{
			var Base = parseInt($('DeviceCount').value);//+1
		}
		
		//~ alert(Base)
		var url = "managecatalog.php?DeviceID="+DeviceID
		url += "&CatalogPage="+CatalogPage
		url += "&CatalogSuffix="+CatalogSuffix
		url += "&CatalogSort="+CatalogSort
		url += "&Exclude="+Exclude
		url += "&Base="+Base
		url += "&CategoryID="+CategoryID
		
			new Ajax.Request(url, {
			asynchronous:true,
			method: 'get',
			onSuccess: function(transport){	
				var ScrollCount = $('ScrollCount').value;
				ScrollCount ++;
				
				$('ScrollCount').value = ScrollCount;
				var ScrollData = transport.responseText;
				//~ AppendNode(ScrollData)
				$('InfiniteScroll').innerHTML +=ScrollData
				//~ ResizeContainer();
				$('CatalogLoading').value=0;
				$('DeviceCount').value = Base+parseInt($('DeviceScrollBy').value);
			}
		});
	}
	
	
	
	
	
	//~ DeviceXMLFile = $('DeviceFile').value
	//~ DeviceBase = $('DeviceCount').value
	//~ DeviceScrollBy = $('DeviceScrollBy').value
	//~ DeviceID = $('DeviceID').value
	//~ CatalogExclude= $('CatalogExclude').value
	//~ CatalogSkinList = $('CatalogSkinList').value.split(',');
	//~ DeviceMax = parseInt(DeviceBase)+parseInt(DeviceScrollBy);
	//~ alert(DeviceBase);
	//~ alert(DeviceMax);
	
	//~ CatalogHTML = '';
	//~ if($('CatalogLoading').value==0){
		//~ var DeviceXML = new JKL.ParseXML(DeviceXMLFile);
		//~ var DeviceData = DeviceXML.parse();
		//~ $('CatalogLoading').value	= 1;
		//~ alert('scroll'+$('CatalogLoading').value)
		
		//~ LoopMax = DeviceData.device.skins.skin.length;
		//~ i = 0;
		//~ DeviceCount = 0;
		//~ for(var i = 0; i < LoopMax; i++){
		//~ while(i<LoopMax){
			//~ $('CatalogTest').innerHTML += i+'<BR>';
			//~ ArtistType= DeviceData.device.skins.skin[i].artisttype; 
			//~ SkinID = DeviceData.device.skins.skin[i].id;
			//~ SkinExists = ArrayValue(CatalogSkinList, SkinID);
			//~ alert(SkinExists);
			//~ UseImage = 1;
			//~ if(CatalogExclude==ArtistType){
				//~ UseImage = 0;
			//~ }
			//~ if(UseImage == 1){
				//~ if(SkinExists!=0){
					//~ UseImage = 0;
				//~ }
			//~ }
					
			//~ if(UseImage == 1){
				//~ if(DeviceCount > (DeviceBase-1) && DeviceCount < DeviceMax){
					//~ $('CatalogTest').innerHTML += '!!!<br>'
					//~ CatalogSkinList.push(SkinID);
					//~ ManageList(SkinID, 'CatalogSkinList','add')
					//~ ArtistName = DeviceData.device.skins.skin[i].artist; 
					
						
					
						
						//~ SkinName = DeviceData.device.skins.skin[i].name;
						//~ SkinName = DeviceData.device.skins.skin[i].name;
						//~ alert(SkinName);
						//~ SkinName = SkinName.replace('+',' ');
						//~ ProdDirName = SkinName;
						//~ ProdDirName = ProdDirName.replace(/ /g,'');
						//~ ProdDirName = ProdDirName.replace('+','');
						//~ ProdDirName = ProdDirName.replace(/&/g,'');
						//~ ProdDirName = ProdDirName.replace(/&amp;/g,'');
						//~ ProdDirName = ProdDirName.replace(/'/g,'');
						//~ ProdDirName = ProdDirName.replace('(','');
						//~ ProdDirName = ProdDirName.replace(')','');
						//~ ProdDirName = ProdDirName.replace('-','');
						//~ ProdDirName = ProdDirName.replace('.','');
									
						//~ DirArtistName =ArtistName;
						//~ DirArtistName = DirArtistName.replace(/ /g,'');
						//~ DirArtistName = DirArtistName.replace(/%20/g,'');
						//~ DirArtistName = DirArtistName.replace(/'/g,'');
						
						
						
						//~ if (ArtistName==""){
							//~ ArtistName="GelaSkins";
						//~ }
					
						//~ if(DeviceID==29){ //prints			
							//~ CatalogHTML += '<div class="InlineBase Prints CatalogCell valigncenter " align="center" style="text-align:center;">';
						//~ }else{
							//~ CatalogHTML += '<span align="center" valign="top" class="InlineBase CatalogCell">';
						//~ }
						
						//~ CatalogHTML +=  '<a href="skins.php?SkinID='+SkinID+'&DeviceID='+DeviceID+'&s=a">';
						//~ if(DeviceID == 22){
							//~ CatalogHTML +=  '<img src="images/skindispatcher.php?imagename=images/skins/'+SkinID+'-'+ProdDirName+"/"+DeviceID+"_"+DirArtistName+"_"+ProdDirName+'_DSalt1_500-white.jpg&size=165&dim=x" alt="'+ArtistName+' - '+SkinName+'" title="'+ArtistName+' - '+SkinName+'" border="0" onmouseover="this.src=\'images/skindispatcher.php?imagename=images/skins/'+SkinID+'-'+ProdDirName+"/"+DeviceID+"_"+DirArtistName+"_"+ProdDirName+'_500-white.jpg&size=150&dim=x\'" onmouseout="this.src=\'images/skindispatcher.php?imagename=images/skins/'+SkinID+'-'+ProdDirName+"/"+DeviceID+"_"+DirArtistName+"_"+ProdDirName+'_DSalt1_500-white.jpg&size=150&dim=x\'" >';
						//~ }else if( DeviceID == 38 ){
							//~ CatalogHTML +=  '<img src="images/skindispatcher.php?imagename=images/skins/'+SkinID+'-'+ProdDirName+"/"+DeviceID+"_"+DirArtistName+"_"+ProdDirName+'_DSalt1_500-white.jpg&size=165&dim=x" alt="'+ArtistName+' - '+SkinName+'" title="'+ArtistName+' - '+SkinName+'" border="0" onmouseover="this.src=\'images/skindispatcher.php?imagename=images/skins/'+SkinID+'-'+ProdDirName+"/"+DeviceID+"_"+DirArtistName+"_"+ProdDirName+'_500-white.jpg&size=150&dim=x\'" onmouseout="this.src=\'images/skindispatcher.php?imagename=images/skins/'+SkinID+'-'+ProdDirName+"/"+DeviceID+"_"+DirArtistName+"_"+ProdDirName+'_DSalt1_500-white.jpg&size=150&dim=x\'" >';
						//~ }else{
							//~ CatalogHTML +=  '<img src="images/skindispatcher.php?imagename=images/skins/'+SkinID+'-'+ProdDirName+"/"+DeviceID+"_"+DirArtistName+"_"+ProdDirName+'_500-white.jpg&size=165&dim=x" alt="'+ArtistName+' - '+SkinName+'" title="'+ArtistName+' - '+SkinName+'" border="0" >';
						//~ }
						
						//~ CatalogHTML +=  '</a><br>';
							//~ if (ArtistName==""){
								//~ ArtistName="GelaSkins";
							//~ }
							//~ CatalogHTML +=  '<div align="center"><a href="skins.php?DeviceID='+DeviceID+'&SkinID='+ SkinID+'&s=a" class="Catalog_SkinName" >'+SkinName+'</a></div>';	
							//~ CatalogHTML +=  '<div align="center"><a href="skins.php?DeviceID='+DeviceID+'&SkinID='+ SkinID+'&s=a" class="Catalog_ArtistName">'+ArtistName+'</a></div>';
						//~ CatalogHTML +=  '</span>';
					//~ }
					//~ DeviceCount++;
			//~ }else{
				//~ if( DeviceCount > DeviceMax){
					//~ break;
				//~ }
			//~ }
			//~ i++;
		//~ }
		//~ $('CatalogLoading').value	=0;
	//~ }
	

 //~ $('CatalogTest').innerHTML += DeviceMax+'!!!<br>'
	//~ $('DeviceCount').value = DeviceMax;
	//~ return CatalogHTML;
	
	
	
}

function AppendNode(ScrollData){
	var theNewParagraph = document.createElement('<div>');
	
	theNewParagraph.innerHTML = ScrollData;
	//~ theTextOfTheParagraph.innerHTML=;
	
	//~ document.createTextNode();
	//~ theNewParagraph.appendChild(theTextOfTheParagraph);

	$('InfiniteScroll').appendChild(theNewParagraph);
	alert(1);
}