Browse Source

企业页面

xuchunyang 8 years ago
parent
commit
1d2e5bae47

+ 79 - 0
cmp-portal/js/cmp-pwdReset01.js

@ -0,0 +1,79 @@
1
//重置企业账户密码
2
$(function() {
3
	var companyEmailVal;
4
	var setemail = false;
5

6
	/*校验按钮显示状态*/
7
	$('.companyEmail').on('keyup', function() {
8
		if($(this).val() == "") {
9
			$("#nxetseep").attr("disabled", true);
10
		} else {
11
			$("#nxetseep").attr("disabled", false);
12
		}
13
	});
14

15
	/*校验企业邮箱*/
16
	$('.companyEmail').on('blur', function() {
17
		checkEmail();
18
	});
19

20
	/*重置密码提交*/
21
	$('#nxetseep').on('click', function() {
22
		mailRegistration();
23
	});
24

25
	function checkEmail() {
26
		companyEmailVal = $(".companyEmail").val();
27
		var gunf = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
28
		if(gunf.test(companyEmailVal.trim())) {
29
			$.ajax("/ajax/isRegOrg", {
30
				data:{"email":companyEmailVal},
31
				type: "GET",
32
				dataType: 'json',
33
				async: false,
34
				success: function($data) {
35
					if($data.data == true) {
36
						$(".msgLog1 span").text("该企业账号不存在,请检查后重试");
37
					} else {
38
						$(".msgLog1 span").text("");
39
						setemail = true;
40
					}
41
				},
42
				error: function() {
43
					$.MsgBox.Alert('提示', '服务器请求失败')
44
				},
45
			});
46
		} else {
47
			$(".msgLog1 span").text("请输入正确是邮箱地址");
48
		}
49
	}
50

51
	function mailRegistration() {
52
		if(setemail) {
53
			$.ajax("/ajax/resetWithOrgEmail", {
54
				data: {
55
					"mail": companyEmailVal,
56
				},
57
				type: "GET",
58
				dataType: 'json',
59
				async: false,
60
				success: function($data) {
61
					console.log($data)
62
					if($data.success) {
63
						if($data.data){
64
							location.href = "cmp-pwdReset02.html?companyEmailVal=" + companyEmailVal;
65
						}else{
66
							$.MsgBox.Alert('提示', '邮箱验证发送失败');
67
						}
68
					}
69
				},
70
				error: function() {
71
					$.MsgBox.Alert('提示', '服务器请求失败');
72
				}
73
			});
74
		} else {
75
			checkEmail();
76
		}
77
	}
78

79
})

+ 108 - 0
cmp-portal/js/cmp-pwdReset03.js

@ -0,0 +1,108 @@
1
//重置企业账户密码
2
$(function() {
3
	var newPasswordval, newPasswordokval;
4
	var setnewP = false;
5
	var setnewPok = false;
6
	var sc = GetQueryString("sc");
7
	ifstate(); 
8
	/*校验注册按钮显示状态*/
9
	$('#cmpCoverUl').on('keyup', "#newPassword,#newPasswordok", function() {
10
		if($("#newPassword").val() == "" || $("#newPasswordok").val() == "") {
11
			$("#paswSubmit").attr("disabled", true);
12
		} else {
13
			$("#paswSubmit").attr("disabled", false);
14
		}
15
	});
16

17
	/*校验密码*/
18
	$('#newPassword').on('blur', function() {
19
		checkNewPassword();
20
	});
21

22
	/*校验确认密码*/
23
	$('#newPasswordok').on('blur', function() {
24
		checkNewPasswordOK();
25
	});
26

27
	/*重置密码提交*/
28
	$('#paswSubmit').on('click', function() {
29
		resetPwdfun() 
30
	});
31

32
	function checkNewPassword() {
33
		newPasswordval = $("#newPassword").val();
34
		if(newPasswordval.length < 6) {
35
			$(".msgReset1 span").text("密码由6-24个字符组成,区分大小写");
36
		} else {
37
			$(".msgReset1 span").text("");
38
			setnewP = true;
39
		}
40
	}
41

42
	function checkNewPasswordOK() { 
43
		newPasswordokval = $("#newPasswordok").val();
44
		if(newPasswordokval.length < 6) {
45
			$(".msgReset2 span").text("密码由6-24个字符组成,区分大小写");
46
		} else if(newPasswordval != newPasswordokval) {
47
			$(".msgReset2 span").text("两次输入不一致,请重新输入");
48
		} else {
49
			$(".msgReset2 span").text("");
50
			setnewPok = true;
51
		}
52
	}
53
	
54
	function ifstate() {
55
		$.ajax("/ajax/validMailState", {
56
			data: {
57
				"state": sc,
58
			},
59
			type: "GET",
60
			dataType: 'json',
61
			async: false,
62
			success: function($data) {
63
				console.log($data)
64
				if($data.success) {
65
					if($data.data){
66
						$(".unreset").removeClass("displayNone");
67
						$(".onreset").addClass("displayNone");
68
					}else{
69
						$(".unreset").addClass("displayNone");
70
						$(".onreset").removeClass("displayNone");
71
						$("#butGo").on("click",function(){
72
							location.href = "cmp-pwdReset01.html";
73
						})
74
					}
75
				}
76
			},
77
			error: function() {
78
				$.MsgBox.Alert('提示', '服务器请求失败');
79
			}
80
		});
81
	}
82

83
	function resetPwdfun() {
84
		if(setnewP && setnewPok) {
85
			$.ajax("/ajax/resetPwByOrgEmail", {
86
				data: {
87
					"state": sc,
88
					"pw": newPasswordokval,
89
				},
90
				type: "POST",
91
				dataType: 'json',
92
				async: false,
93
				success: function($data) {
94
					console.log($data)
95
					if($data.success && $data.data) {
96
						location.href = "cmp-pwdResetok.html";
97
					}
98
				},
99
				error: function() {
100
					$.MsgBox.Alert('提示', '服务器请求失败');
101
				}
102
			});
103
		} else {
104
			checkEmail();
105
		}
106
	}
107

108
})

+ 69 - 0
cmp-portal/js/cmp-setAuth.js

@ -0,0 +1,69 @@
1
//密码修改
2
$(function() {
3
	var oldPwdVal, newPwdVal, newPwdOkVal;
4
	var setoldpwd = false;
5
	var setnewpwd = false;
6
	var setnewpwd2 = false;
7

8
	/*校验保存按钮显示状态*/
9
	$('#cmpAllUl').on('keyup', "#oldPwd,#newPwd,#newPwdOk", function() {
10
		if($("#oldPwd").val() == "" || $("#newPwd").val() == "" || $("#newPwdOk").val() == "") {
11
			$("#newpwdSubmit").attr("disabled", true);
12
		} else {
13
			$("#newpwdSubmit").attr("disabled", false);
14
		}
15
	});
16

17
	/*校验旧密码*/
18
	$('#oldPwd').on('blur', function() {
19
		checkOldPwd();
20
	});
21

22
	/*校验新密码*/
23
	$('#newPwd').on('blur', function() {
24
		checkNewPwd();
25
	});
26

27
	/*校验新密码*/
28
	$('#newPwdOk').on('blur', function() {
29
		checkNewPwd2();
30
	});
31

32
	/*注册提交*/
33
	$('#newpwdSubmit').on('click', function() {
34
		
35
	});
36

37
	function checkOldPwd() {
38
		oldPwdVal = $("#oldPwd").val();
39
		if(oldPwdVal.length < 6) {
40
			$(".msgPwd1 span").text("密码由6-24个字符组成,区分大小写");
41
		} else {
42
			$(".msgPwd1 span").text("");
43
			setoldpwd = true;
44
		}
45
	}
46

47
	function checkNewPwd() {
48
		newPwdVal = $("#newPwd").val();
49
		if(newPwdVal.length < 6) {
50
			$(".msgPwd2 span").text("密码由6-24个字符组成,区分大小写");
51
		} else {
52
			$(".msgPwd2 span").text("");
53
			setnewpwd = true;
54
		}
55
	}
56

57
	function checkNewPwd2() {
58
		newPwdOkVal = $("#newPwdOk").val();
59
		if(newPwdOkVal.length < 6) {
60
			$(".msgPwd3 span").text("密码由6-24个字符组成,区分大小写");
61
		} else if(newPwdVal != newPwdOkVal) {
62
			$(".msgPwd3 span").text("两次输入不一致,请重新输入");
63
		} else {
64
			$(".msgPwd3 span").text("");
65
			setnewpwd2 = true;
66
		}
67
	}
68
	
69
})

+ 11 - 0
cmp-portal/js/cmp-setPwd.js

@ -0,0 +1,11 @@
1
//企业认证
2
$(function() {
3
	
4
	$('input[type="file"]').change(function(e){
5
		alert("d")
6
	    console.log(e)//e就是你获取的file对象
7
	})
8
	
9
	
10
	
11
})

+ 96 - 0
cmp-portal/js/cmp-settled-log.js

@ -0,0 +1,96 @@
1
//企业登录
2
$(function() {
3

4
	var companyNameVal, companyEmailVal;
5
	var setpass = false;
6
	var setemail = false;
7

8
	/*校验登录按钮显示状态*/
9
	$('#cmpCoverUl').on('keyup', ".companyEmail,#companyPasw", function() {
10
		if($(".companyEmail").val() == "" || $("#companyPasw").val() == "") {
11
			$("#loginSubmit").attr("disabled", true);
12
		} else {
13
			$("#loginSubmit").attr("disabled", false);
14
		}
15
	});
16

17
	/*校验企业邮箱*/
18
	$('.companyEmail').on('blur', function() {
19
		checkEmail();
20
	});
21

22
	/*校验登录密码*/
23
	$('#companyPasw').on('blur', function() {
24
		checkPasw();
25
	});
26

27
	/*注册提交*/
28
	$('#loginSubmit').on('click', function() {
29
		mailRegistration();
30
	});
31

32
	function checkEmail() {
33
		companyEmailVal = $(".companyEmail").val();
34
		var gunf = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
35
		if(gunf.test(companyEmailVal.trim())) {
36
			setemail = true;
37
			/*$.ajax("/ajax/isRegOrg", {
38
				data:{"email":companyEmailVal},
39
				type: "GET",
40
				dataType: 'json',
41
				async: false,
42
				success: function($data) {
43
					if($data.data == true) {
44
						$(".msgLog1 span").text("该企业账号不存在,请检查后重试");
45
					} else {
46
						$(".msgLog1 span").text("");
47
						setemail = true;
48
					}
49
				},
50
				error: function() {
51
					$.MsgBox.Alert('提示', '服务器请求失败')
52
				},
53
			});*/
54
		} else {
55
			$(".msgLog1 span").text("请输入正确是邮箱地址");
56
		}
57
	}
58

59
	function checkPasw() {
60
		companyPaswVal = $("#companyPasw").val();
61
		if(companyPaswVal.length < 6) {
62
			$(".msgLog2 span").text("密码由6-24个字符组成,区分大小写");
63
		} else {
64
			$(".msgLog2 span").text("");
65
			setpass = true;
66
		}
67
	}
68

69
	function mailRegistration() {
70
		if(setpass && setemail) {
71
			$.ajax("/ajax/orgLogin", {
72
				data: {
73
					"lk": companyEmailVal,
74
					"pw": companyPaswVal
75
				},
76
				type: "POST",
77
				dataType: 'json',
78
				async: false,
79
				success: function($data) {
80
					console.log($data)
81
					if($data.success || $data.data) {
82
						location.href = "cmp-workspaces.html";
83
					} else if($data.success || $data.data == null){
84
						$.MsgBox.Alert('提示', '登录账号与密码不匹配');
85
					}
86
				},
87
				error: function() {
88
					$.MsgBox.Alert('提示', '服务器请求失败');
89
				}
90
			});
91
		} else {
92
			checkEmail();
93
			checkPasw();
94
		}
95
	}
96
})

+ 159 - 0
cmp-portal/js/cmp-settled-reg.js

@ -0,0 +1,159 @@
1
//企业注册
2
$(function() {
3

4
	var companyNameVal, companyEmailVal, companyPaswVal;
5
	var setname = false;
6
	var setpass = false;
7
	var setemail = false;
8
	var ifxuanze = true;
9

10
	/*校验注册按钮显示状态*/
11
	$('#cmpSettledul').on('keyup', "#companyName,.companyEmail,#companyPasw", function() {
12
		if($("#companyName").val() == "" || $(".companyEmail").val() == "" || $("#companyPasw").val() == "") {
13
			$("#registerSubmit").attr("disabled", true);
14
		} else {
15
			$("#registerSubmit").attr("disabled", false);
16
		}
17
	});
18

19
	/*校验企业名称*/
20
	$('#companyName').on('blur', function() {
21
		checkName();
22
	});
23

24
	/*校验企业邮箱*/
25
	$('.companyEmail').on('blur', function() {
26
		checkEmail();
27
	});
28

29
	/*校验登录密码*/
30
	$('#companyPasw').on('blur', function() {
31
		checkPasw();
32
	});
33

34
	/*校验单选框*/
35
	$(".cmpAgree").on("click", function() {
36
		if($(this).hasClass("ifxuanze")) {
37
			$(this).removeClass("ifxuanze");
38
			$(this).attr("src", "images/business_button_xuanze_nor.png")
39
			ifxuanze = false;
40
		} else {
41
			$(this).addClass("ifxuanze");
42
			$(this).attr("src", "images/business_button_xuanze_hig.png");
43
			ifxuanze = true;
44
		}
45
	})
46

47
	/*注册提交*/
48
	$('#registerSubmit').on('click', function() {
49
		if(ifxuanze) {
50
			mailRegistration();
51
		} else {
52
			$.MsgBox.Alert('提示', '请确认后勾选此选项')
53
		}
54
	});
55

56
	function checkName() {
57
		companyNameVal = $("#companyName").val();
58
		if(companyNameVal.length==""){
59
			$(".msgReg1 span").text("请输入您的企业名称");
60
		}else{
61
			$.ajax("/ajax/isOrgUser", {
62
				data: {
63
					"orgName": companyNameVal
64
				},
65
				type: "GET",
66
				dataType: 'json',
67
				async: false,
68
				success: function($data) {
69
					console.log($data)
70
					if($data.success && $data.data) {
71
						$(".msgReg1 span").text("");
72
						setname = true;
73
					} else {
74
						if($data.code == 2) {
75
							$(".msgReg1 span").html('该企业已注册企业账户,若您是企业管理者,<a class="cmpColor" href="cmp-settled-reback.html">您可以点击这里找回账户</a>');
76
						} else if($data.code == 3) {
77
							$(".msgReg1 span").text("该企业已成为【科袖认证企业】,若有问题请联系客服 010-62343359");
78
						}
79
					}
80
				},
81
				error: function() {
82
					$.MsgBox.Alert('提示', '服务器请求失败')
83
				},
84
			});
85
		}
86
	}
87

88
	function checkEmail() {
89
		companyEmailVal = $(".companyEmail").val();
90
		var gunf = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
91
		if(gunf.test(companyEmailVal.trim())) {
92
			$.ajax("/ajax/isRegOrg", {
93
				data:{"email":companyEmailVal},
94
				type: "GET",
95
				dataType: 'json',
96
				async: false,
97
				success: function($data) {
98
					console.log($data)
99
					if($data.data == false) {
100
						$(".msgReg2 span").text("该邮箱已注册企业账户,请使用其他邮箱");
101
					} else {
102
						$(".msgReg2 span").text("");
103
						setemail = true;
104
					}
105
				},
106
				error: function() {
107
					$.MsgBox.Alert('提示', '服务器请求失败')
108
				},
109
			});
110
		} else {
111
			$(".msgReg2 span").text("请输入正确是邮箱地址");
112
		}
113
	}
114

115
	function checkPasw() {
116
		companyPaswVal = $("#companyPasw").val();
117
		if(companyPaswVal.length < 6) {
118
			$(".msgReg3 span").text("密码由6-24个字符组成,区分大小写");
119
		} else {
120
			$(".msgReg3 span").text("");
121
			setpass = true;
122
		}
123
	}
124

125
	function mailRegistration() {
126
		if(setname && setpass && setemail) {
127
			$.ajax("/ajax/regOrgMail", {
128
				data: {
129
					"orgName": companyNameVal,
130
					"mail": companyEmailVal,
131
					"password": companyPaswVal
132
				},
133
				type: "POST",
134
				dataType: 'json',
135
				async: false,
136
				success: function($data) {
137
					console.log($data)
138
					if($data.success) {
139
						location.href = "cmp-settled-active.html?companyEmailVal=" + companyEmailVal;
140
					} else {
141
						if($data.code == -1) {
142
							$.MsgBox.Alert('提示', '该邮箱已注册企业账户,请使用其他邮箱');
143
						} else if($data.code == -2) {
144
							$.MsgBox.Alert('提示', '邮箱发送失败');
145
						}
146
					}
147
				},
148
				error: function() {
149
					$.MsgBox.Alert('提示', '服务器请求失败');
150
				}
151
			});
152
		} else {
153
			checkName();
154
			checkEmail();
155
			checkPasw();
156
		}
157
	}
158

159
})

+ 53 - 0
cmp-portal/js/cmp-settled-regOk.js

@ -0,0 +1,53 @@
1
//企业注册激活成功
2
$(function() {
3
	var sc = GetQueryString("sc");
4
	activationFun();
5

6
	function activationFun() {
7
		$.ajax("/ajax/regOrgMail/" + sc, {
8
			type: "GET",
9
			dataType: 'json',
10
			async: false,
11
			success: function($data) {
12
				console.log($data)
13
				if($data.success) {
14
					$(".tit-hh4").find("span").text("注册成功");
15
					$(".importTip").text("您的企业账户已注册成功!");
16
					$("#successImg").removeClass("failImg").addClass("successImg");
17
					$("#butGo").text("登录企业账户");
18
					$("#butGo").on("click", function() {
19
						location.href = "cmp-settled-log.html";
20
					})
21
				} else {
22
					$(".tit-hh4").find("span").text("注册失败");
23
					$("#successImg").removeClass("successImg").addClass("failImg");
24
					if($data.code == -1) {
25
						$(".importTip").text("很抱歉,当前的链接已失效");
26
						$("#smalltip").text("小提醒:邮件内的链接有效时长为10分钟。");
27
						$("#butGo").text("重新注册");
28
						$("#butGo").on("click", function() {
29
							location.href = "cmp-settled-reg.html";
30
						})
31
					} else if($data.code == -3) {
32
						$(".importTip").text("当前邮箱已注册企业账户");
33
						$("#smalltip").text("请更换一个邮箱重新注册");
34
						$("#butGo").text("重新注册");
35
						$("#butGo").on("click", function() {
36
							location.href = "cmp-settled-reg.html";
37
						})
38
					} else if($data.code == 2) {
39
						$(".importTip").text("您输入的企业已注册企业账户");
40
						$("#smalltip").text("您可以点击下方按钮找回企业账户,或直接联系客服 010-62343359");
41
						$("#butGo").text("找回企业账户");
42
						$("#butGo").on("click", function() {
43
							location.href = "cmp-settled-reback.html";
44
						})
45
					}
46
				}
47
			},
48
			error: function() {
49
				$.MsgBox.Alert('提示', '服务器请求失败')
50
			},
51
		});
52
	}
53
})

+ 224 - 0
cmp-portal/js/public/ajaxfileupload.js

@ -0,0 +1,224 @@
1
// JavaScript Document
2
jQuery.extend({
3

4
    createUploadIframe: function(id, uri)
5
 {
6
   //create frame
7
            var frameId = 'jUploadFrame' + id;
8
            
9
            if(window.ActiveXObject) {
10
                //var io = document.createElement('<iframe id="' + frameId + '" name="' + frameId + '" />');
11
            	if(jQuery.browser.version=="9.0" || jQuery.browser.version=="10.0"){  
12
                    var io = document.createElement('iframe');  
13
                    io.id = frameId;  
14
                    io.name = frameId;  
15
                }else if(jQuery.browser.version=="6.0" || jQuery.browser.version=="7.0" || jQuery.browser.version=="8.0"){  
16
                    var io = document.createElement('<iframe id="' + frameId + '" name="' + frameId + '" />');  
17
	                if(typeof uri== 'boolean'){
18
	                    io.src = 'javascript:false';
19
	                }
20
	                else if(typeof uri== 'string'){
21
	                    io.src = uri;
22
	                }
23
                }
24
            }else {
25
                var io = document.createElement('iframe');
26
                io.id = frameId;
27
                io.name = frameId;
28
            }
29
            io.style.position = 'absolute';
30
            io.style.top = '-1000px';
31
            io.style.left = '-1000px';
32

33
            document.body.appendChild(io);
34

35
            return io;   
36
    },
37
    createUploadForm: function(id, fileElementId, data)
38
 {
39
  //create form 
40
  var formId = 'jUploadForm' + id;
41
  var fileId = 'jUploadFile' + id;
42
  var form = jQuery('<form  action="" method="POST" name="' + formId + '" id="' + formId + '" enctype="multipart/form-data"></form>'); 
43
  var oldElement = jQuery('#' + fileElementId);
44
  var newElement = jQuery(oldElement).clone();
45
  jQuery(oldElement).attr('id', fileId);
46
  jQuery(oldElement).before(newElement);
47
  jQuery(oldElement).appendTo(form);
48
  
49
  //add data
50
  if(data) { 
51
    for (var i in data) { 
52
        $('<input type="hidden" name="' + i + '" value="' + data[i] + '" />').appendTo(form); 
53
    } 
54
  }
55
  //set attributes
56
  jQuery(form).css('position', 'absolute');
57
  jQuery(form).css('top', '-1200px');
58
  jQuery(form).css('left', '-1200px');
59
  jQuery(form).appendTo('body');  
60
  return form;
61
    },
62

63
    ajaxFileUpload: function(s) {
64
        // TODO introduce global settings, allowing the client to modify them for all requests, not only timeout  
65
        s = jQuery.extend({}, jQuery.ajaxSettings, s);
66
        var id = s.id;        
67
        //var id = s.fileElementId;        
68
		var form = jQuery.createUploadForm(id, s.fileElementId,s.data);
69
		var io = jQuery.createUploadIframe(id, s.secureuri);
70
		var frameId = 'jUploadFrame' + id;
71
		var formId = 'jUploadForm' + id;  
72
        
73
		if( s.global && ! jQuery.active++ ){
74
			// Watch for a new set of requests
75
			jQuery.event.trigger( "ajaxStart" );
76
		}            
77
        var requestDone = false;
78
        // Create the request object
79
        var xml = {};   
80
        if( s.global ){
81
         jQuery.event.trigger("ajaxSend", [xml, s]);
82
        }            
83
        
84
        var uploadCallback = function(isTimeout){  
85
			// Wait for a response to come back 
86
			var io = document.getElementById(frameId);
87
			try{    
88
				if(io.contentWindow){
89
					xml.responseText = io.contentWindow.document.body?io.contentWindow.document.body.innerHTML:null;
90
					xml.responseXML = io.contentWindow.document.XMLDocument?io.contentWindow.document.XMLDocument:io.contentWindow.document;
91
			    }else if(io.contentDocument){
92
			    	xml.responseText = io.contentDocument.document.body?io.contentDocument.document.body.innerHTML:null;
93
			    	xml.responseXML = io.contentDocument.document.XMLDocument?io.contentDocument.document.XMLDocument:io.contentDocument.document;
94
			    }      
95
			}catch(e){
96
				jQuery.handleError(s, xml, null, e);
97
			}
98
            if( xml || isTimeout == "timeout"){    
99
                requestDone = true;
100
                var status;
101
                try {
102
                    status = isTimeout != "timeout" ? "success" : "error";
103
                    // Make sure that the request was successful or notmodified
104
                    if( status != "error" ){
105
                        // process the data (runs the xml through httpData regardless of callback)
106
                        var data = jQuery.uploadHttpData( xml, s.dataType );                        
107
                        if( s.success ){
108
                        	// ifa local callback was specified, fire it and pass it the data
109
                    		s.success( data, status );
110
                        };                 
111
                        if( s.global ){
112
                        	// Fire the global callback
113
                        	jQuery.event.trigger( "ajaxSuccess", [xml, s] );
114
                        };                            
115
                    } else{
116
                     jQuery.handleError(s, xml, status);
117
                    }
118
                        
119
                } catch(e){
120
                    status = "error";
121
                    jQuery.handleError(s, xml, status, e);
122
                };                
123
                if( s.global ){
124
                	// The request was completed
125
            		jQuery.event.trigger( "ajaxComplete", [xml, s] );
126
                };
127

128
                // Handle the global AJAX counter
129
                if(s.global && ! --jQuery.active){
130
                 jQuery.event.trigger("ajaxStop");
131
                };
132
                if(s.complete){
133
                  s.complete(xml, status);
134
                };                 
135

136
                jQuery(io).unbind();
137
                setTimeout(function(){
138
                try{
139
					jQuery(io).remove();
140
					jQuery(form).remove(); 
141
                }catch(e){
142
		    	  	jQuery.handleError(s, xml, null, e);
143
            	}}, 100);
144
                xml = null;
145
            };
146
        }
147
        // Timeout checker
148
        if( s.timeout > 0 ){
149
            setTimeout(function(){if(!requestDone ){uploadCallback( "timeout" );}}, s.timeout);
150
        }
151
        try{
152
			var form = jQuery('#' + formId);
153
			jQuery(form).attr('action', s.url);
154
			jQuery(form).attr('method', 'POST');
155
			jQuery(form).attr('target', frameId);
156
            if(form.encoding){
157
                form.encoding = 'multipart/form-data';    
158
            }else{    
159
                form.enctype = 'multipart/form-data';
160
            }   
161
            jQuery(form).submit();
162

163
        } catch(e){   
164
            jQuery.handleError(s, xml, null, e);
165
        }
166
        /*if(window.attachEvent){
167
            document.getElementById(frameId).attachEvent('onload', uploadCallback);
168
        }
169
        else{
170
            document.getElementById(frameId).addEventListener('load', uploadCallback, false);
171
        }   */
172
        jQuery('#' + frameId).load(uploadCallback);
173
        return {abort: function () {}}; 
174

175
    },
176

177
    uploadHttpData: function( r, type ) {
178
        var data = !type;
179
        data = type == "xml" || data ? r.responseXML : r.responseText;
180
        // ifthe type is "script", eval it in global context
181
        if( type == "script" ){
182
         jQuery.globalEval( data );
183
        }
184
            
185
        // Get the JavaScript object, ifJSON is used.
186
        if( type == "json" ){
187
        	data = r.responseText;  
188
            var start = data.indexOf(">");  
189
            if(start != -1) {  
190
              var end = data.indexOf("<", start + 1);  
191
              if(end != -1) {  
192
                data = data.substring(start + 1, end);  
193
               }  
194
            }  
195
            eval( "data = " + data);  
196
        }
197
            
198
        // evaluate scripts within html
199
        if( type == "html" ){
200
         jQuery("<div>").html(data).evalScripts();
201
        }
202
            
203
        return data;
204
    },
205
    /*handleError: function( s, xml, status, e ) {
206
		// If a local callback was specified, fire it
207
		if ( s.error )
208
			s.error( xml, status, e );
209

210
		// Fire the global callback
211
		if ( s.global )
212
			jQuery.event.trigger( "ajaxError", [xml, s, e] );
213
	}*/
214
    handleError: function( s, xhr, status, e ) {
215
        // If a local callback was specified, fire it
216
        if ( s.error ) {
217
            s.error.call( s.context || s, xhr, status, e );
218
        }
219
        // Fire the global callback
220
        if ( s.global ) {
221
        	(s.context ? jQuery(s.context) : jQuery.event).trigger("ajaxError", [xhr, s, e] );
222
        }
223
    }
224
});