﻿var Request = {
	QueryString: function(key) {
		var search = location.search.slice(1).toLowerCase();
		var arr = search.split("&");
		for (var i = 0; i < arr.length; i++) {
			var ar = arr[i].split("=");
			if (ar[0] == key) {
				return ar[1];
			}
		}

	}
}

$(function() {
	$(".alipaylogin").click(function() {
		var strLoginType = $.trim($(this).attr("logintype"));
		var strReturnUrl = ""

		switch (strLoginType) {
			case "default": //login.m18.com域登录
				strReturnUrl = Request.QueryString("returnurl");
				break;
			/*case "layer": //浮层登录        ========已在http://login.m18.com/js/login.js中实现
			strReturnUrl = "http://" + window.location.host + "/logintransfer.html?t=callback";
			break;*/ 
			case "other": //不是login.m18.com域且不为浮存登录
				strReturnUrl = "http://" + window.location.host + "/logintransfer.html?t=refresh";
				break;

		}

		if (strReturnUrl == undefined) strReturnUrl = "";

		window.open("http://login.m18.com/Alipay/alipayTransferRequest.aspx?logintype=" + strLoginType + "&returnurl=" + strReturnUrl);
	});
});
