var srcV=new Array;
var altV=new Array;
var widthV=new Array;
var heightV=new Array;
var indexV;

$(function(){
	
	$.ajaxSetup({ cache: false });
	$.ajax({url:"/pc/image-list.xml",
			dataType:"xml",
			timeout: 1000,

			success:function(xml){
				
				$("image img",xml).each(function(index,image){
					
					srcV[index]=$(image).attr("src");
					altV[index]=$(image).attr("alt");
					widthV[index]=$(image).attr("width");
					heightV[index]=$(image).attr("height");
					indexV=index;
				});
				
				for(var i=0;i<=indexV;i++) {
					
					$(".mobileImageInner").prepend("<img src='"+srcV[i]+"' alt='' width='"+widthV[i]+"' height='"+heightV[i]+"' id='image"+i+"' />");
					$(".mobileImageInner").children("img").hide();
	
				};
				
				$(".mobileImageInner").css({
					width:"150px",
					height:"90px",
					position:"relative"
				});
				$(".mobileImageInner img").css({
					width:"150px",
					top:"0",
					left:"0",
					position:"absolute"
				});
				$(".mobileImageInner").children("img#image0").show();
				
				var imageNum=0;
				var imageNum2=1;
				var imageNo1;
				var imageNo2;

				timer=setInterval(showImage,10000);
				
				function showImage(){
					
					imageNo1="#image"+imageNum;
					imageNo2="#image"+imageNum2;
					
					imageNum++;
					imageNum2++;
					
					if(imageNum==indexV) {
						imageNum2=0;
					}else if(imageNum>indexV) {
						imageNum=0;
						imageNum2=1;
					}
					
					$(imageNo1).fadeOut(1000);
					$(imageNo2).fadeIn(1000);
					
				}

	   }
	 });
	 
});


