﻿// JScript 文件

   function ajaxFileUpload()
	{
		
		//starting setting some animation when the ajax starts and completes
		$("#loading")
		.ajaxStart(function(){
			$(this).show();
		})
		.ajaxComplete(function(){
			$(this).hide();
		});
		
		/*
			prepareing ajax file upload
			url: the url of script file handling the uploaded files
                        fileElementId: the file type of input element id and it will be the index of  $_FILES Array()
			dataType: it support json, xml
			secureuri:use secure protocol
			success: call back function when the ajax complete
			error: callback function when the ajax failed
			
                */
		
			$.ajaxFileUpload
		({
				url:'FileUpLoad.ashx', 
				secureuri:false,
				fileElementId:'FileUpLoad1',
				dataType: 'json',
				success: function (data, status)
				{
				
					if(typeof(data.error) != 'undefined')
					{
					
					
						if(data.error != '')
						{
							alert(data.error);
							  $("#loaded").hide();
						}else
						{
						    if($("#HiddenURLID").attr('value')=="")
						    {
						        $("#HiddenURLID").attr('value',data.id);
						    }else
						    {
						        $("#HiddenURLID").attr('value',$("#HiddenURLID").attr('value')+","+data.id);						    
						        document.getElementById("ulul").innerHTML+="<li><img src=\".."+data.msg+"\"  width=\"150px\" height=\"120px\" /></li>";
			                    $("#loaded").show();
						    }
						
						}
					}
				},
				error: function (data, status, e)
				{
					alert(e);
					 $("#loaded").hide();
					 
				}
			}
		)
		
		return false;

	}  
	 function ajaxFileUpload1()
	{
	
		//starting setting some animation when the ajax starts and completes
		$("#loading")
		.ajaxStart(function(){
		
			$(this).show();
		})
		.ajaxComplete(function(){
			$(this).hide();
		});
		
		/*
			prepareing ajax file upload
			url: the url of script file handling the uploaded files
                        fileElementId: the file type of input element id and it will be the index of  $_FILES Array()
			dataType: it support json, xml
			secureuri:use secure protocol
			success: call back function when the ajax complete
			error: callback function when the ajax failed
			
                */
              
		$.ajaxFileUpload
		({
				url:'FileUpLoad.ashx', 
				secureuri:false,
				fileElementId:'FileActivity',
				dataType: 'json',
				success: function (data, status)
				{
				
					if(typeof(data.error) != 'undefined')
					{
					
					
						if(data.error != '')
						{
							alert(data.error);
						}else
						{
						$(".ImageCss").attr('src',".."+data.msg);
						$("#HiddenActivityImage").attr('value',data.id);
						}
					}
				},
				error: function (data, status, e)
				{
					alert(e);
					 
				}
			}
		)
		
		return false;

	}  
	
	
	
	 function ajaxFileUpload2()
	{
	$(":button").attr("disabled", "disabled");
	
	
	$(":file").each(function(i){ 
        _fileElementId=$(this).attr("id");
	
		//starting setting some animation when the ajax starts and completes
	
	
		$("#"+_fileElementId+"_loading")
		.ajaxStart(function(){
		
			$(this).show();
		})
		.ajaxComplete(function(){
			$(this).hide();
		});
		
		
		/*
			prepareing ajax file upload
			url: the url of script file handling the uploaded files
                        fileElementId: the file type of input element id and it will be the index of  $_FILES Array()
			dataType: it support json, xml
			secureuri:use secure protocol
			success: call back function when the ajax complete
			error: callback function when the ajax failed
			
                */
                //vvv='1';
                //jQuery.createUploadForm('ImageFile1', s.fileElementId)
               
		$.ajaxFileUpload
		({
				url:'FileUpLoadClubImg.ashx?id='+$("._GreatCss").attr("value")+'&cheIs='+$("#cheIs").attr("checked"), 
				secureuri:false,
				fileElementId:_fileElementId,
				dataType: 'json',
				success: function (data, status)
				{
					if(typeof(data.error) != 'undefined')
					{
					
					
						if(data.error != '')
						{
						    $("#"+_fileElementId+"_loaded").html(data.error);
						    $("#"+_fileElementId+"_loaded").show();
						    	$(":button").attr("disabled", "");
						}else
						{
						 $("#"+_fileElementId+"_loaded").show();	
						 	$(":button").attr("disabled", "");	 
						}
					}
				},
				error: function (data, status, e)
				{
					alert("错误信息："+e);
						$(":button").attr("disabled", "");
					 
				}
			}
		)
		  
		  
		 });
		
		return false;

	}  
	
