/**
 * @author akihiko
 */
img_arry = new Array();

$(function(){
   // getxml();
   $(".onta").hover(function(){
   	$(this).css({
		opacity:"1"
	});
   },function(){
    	$(this).css({
		opacity:"0"
	});
   }
  ); 
});


function getxml(){
    $.ajax({
        url: 'http://api.photozou.jp/rest/photo_list_public?type=public&user_id=255127&limit=1000',
        type: 'GET',
        dataType: 'xml',
        timeout: 30000,
        error: function(){
            alert("xmlファイルの読み込みに失敗しました");
        },
        success: function(xml){
            $(xml).find("photo").each(function(){
                var photo_url = $(this).find("image_url");
                photo_url = $(photo_url).text();                
                var add_html = "<div class='img_wrap'><img src='" + photo_url + "'></div>";
                img_arry.push(add_html);
            });
            append_img();
        }
    });
}

function append_img(){
    img_arry = img_arry.shuffle();
    for (i = 0; i < img_arry.length; i++) {
    
        $("body").append(img_arry[i]);
    }
    
}

Array.prototype.shuffle = function(){
    var i = this.length;
    while (i) {
        var j = Math.floor(Math.random() * i);
        var t = this[--i];
        this[i] = this[j];
        this[j] = t;
    }
    return this;
}

