$(function(){
		   $(window).load(function(){xmlLoaded(),setTimer();})
		   var slide = 928,
		   spd = 800,
		   spd02 = 1200,
		   int = 1,
		   times = 5000,
		   img_num = 0,
		   img_id = 1,
		   img_array = new Array("<img src='update/img_01.jpg' alt='' width='915' height='309' />",
								 "<img src='update/img_02.jpg' alt='' width='915' height='309' />",
								 "<img src='update/img_03.jpg' alt='' width='915' height='309' />"
								 );
		   
		   function xmlLoaded(){
			   $.ajax({
					 url:"update/toppage.xml",
					 dataType:"xml",
					 success:function(data){
						 $("#news p").append($("text",data).text()),
						 $("links",data).each(function(){
													  $("#box").append("<a href='"+$("url",this).text()+"' id='p_0"+img_id+"' class='photo' target='"+$("target",this).text()+"'>"+img_array[img_num]+"</a>");
													  img_num = img_num+1;
													  img_id = img_id+1;
													   })}
						 })
		   }
		   

		   /*SLIDE ANIMATION--------------------------------------------------------------------------------------------------------*/
		   function slide_01(){
			   int = 1;clearTimer();
			   $("#visual #p_03").fadeOut(spd,function(){$("#p_01").css({"z-index":"10"},{"opacity":"0"}).fadeIn(spd02);
													$(this).css("z-index","4");setTimer()})};
		   function slide_02(){
			   int = 2;clearTimer();
			   $("#visual #p_01").fadeOut(spd,function(){$("#p_02").css({"z-index":"10"},{"opacity":"0"}).fadeIn(spd02);
													$(this).css("z-index","4");setTimer()})};
		   function slide_03(){		  
			   int = 0;clearTimer();
			   $("#visual #p_02").fadeOut(spd,function(){$("#p_03").css({"z-index":"10"},{"opacity":"0"}).fadeIn(spd02);
													$(this).css("z-index","4");setTimer()})};
		   /*
		   function slide_03(){		  
			   alert("3");
			   int = 0;clearTimer();
			   $("#p_03").css("visibility","visible");	
			   $("#visual a[id!='p_03']").animate(
													{marginLeft: slide},{duration: spd, easing: ease,
													complete: function(){$("#p_03").css("z-index","10");
													$(this).css("visibility","hidden").css("z-index","4");margin_Zero()}});};*/
		   /*AUTO SLIDE--------------------------------------------------------------------------------------------------------*/
		   function slide_array(){
			   if(int == 1){
				   slide_02();
			   }else if(int == 2){
				   slide_03();
			   }else if(int ==0){
				   slide_01();
			   };};
			   
		   /*TIMER FUNCTION--------------------------------------------------------------------------------------------------------*/
		   function setTimer(){if(window.intervalld == null){window.intervalld = setInterval(function(){slide_array()},times);}}
		   function clearTimer(){clearInterval(window.intervalld);window.intervalld = null;}
		   });
