define(function(require, exports, module) {
    var common = require('common'); 
    if($("#sacn_ajax").length>0){
        //加载jQuery1.8.2.js
        var own_url = '../public/js/';
        var my_script = document.createElement('script');
        my_script.type = 'text/javascript';
        my_script.src = own_url+'jQuery1.8.2.js';
        document.getElementsByTagName('head')[0].appendChild(my_script);
        //ajax function
        function ajax(key,img) {
            $.ajax({
                url: own_form+"a=dogetimg&total="+img_num,
                type: "post",
                data: {'key':key,'img':img},
                dataType: "json",
                success: function(data){
                    var Out = data;
                    $.each(Out, function(pro,val){
                        if(pro == "tip"){
                            document.getElementById("status").innerHTML = val;
                        }
                        if(pro == "width"){
                            document.getElementById("progress").style.width = val;
                        }
                        if(pro == "percent"){
                            document.getElementById("percent").innerHTML = val;
                        }
                        if(pro == "button"){
                            document.getElementById("button").innerHTML = val;
                        }
                    });
                }
            });
        }
        
        $(document).ready(function(){
            for(i; i<strjson.length; i++){
                var key=i;
                var img=strjson[i];
                ajax(key,img);
            } 
        });
        
    }
	
});


