var scocoSinaChild;
function scocoSinaChildClose()
{
	scocoSinaChild.close();
}
function toSinaLogin()
{
	scocoSinaChild = window.open("sina_login.php","TencentLogin","width=600,height=380,menubar=0,scrollbars=1, resizable=1,status=1,titlebar=0,toolbar=0,location=1");
}
function alertSina()
{
	closeDialog();
	art.dialog({
		id: 'reg',
		icon: 'face-smile',
		title: '欢迎注册色无界摄影网!',
	    content: '<div id="scocodialog"><p><span>登录名：</span><input type="text" name="reguser" id="reguser" /><em></em></p><p><span>密 &nbsp;码：</span><input type="password" name="regpwd" id="regpwd" /><em></em></p><p><a href="javascript:void(0);" onClick="bindScocoSina();">已有SCOCO帐号？绑定帐号</a></p></div>',
	    okVal: '注册',
	    ok: function () {
	    	var reguser = $("#reguser").val();
	    	var regpwd = $("#regpwd").val();
			$.post(
				"ajaxReg.php",
				{"action":"reg","type":"sina","username":reguser,"password":regpwd},
				function(o){
					alert(o.msg);
					if(o.status=='1')
					{
						closeDialog();
						window.location='home.php';
					}
				},
				"json"
			);
	        return false;
	    },
	    cancelVal: '取消',
	    cancel: true
	});
}
function bindScocoSina()
{
	closeDialog();
	art.dialog({
		id: 'bind',
		icon: 'face-smile',
		title: '欢迎绑定帐号',
	    content: '<div id="scocodialog"><p><span>登录名：</span><input type="text" name="binduser" id="binduser" /></p><p><span>密 &nbsp;码：</span><input type="password" name="bindpwd" id="bindpwd" /></p><p><a href="javascript:void(0);" onClick="alertSina();">返回上一步</a></p></div>',
	    okVal: '登录绑定',
	    ok: function () {
	    	var binduser = $("#binduser").val();
	    	var bindpwd = $("#bindpwd").val();
			$.post(
				"ajaxReg.php",
				{"action":"bind","type":"sina","username":binduser,"password":bindpwd},
				function(o){
					alert(o.msg);
					if(o.status=='1')
					{
						closeDialog();
						window.location='home.php';
					}
				},
				"json"
			);
	        return false;
	    },
	    cancelVal: '取消',
	    cancel: true
	});
}
