﻿// JavaScript Document
var assitant = "http://assistant.youshang.com";
var now = new Date();
//var rootPath = assitant + "/login.do?paction=checkLogin&nickName=true&psret=";
//var checkPath = "http://club.youshang.com/sso/clogin.php?action=login";
var checkPath = "http://club.youshang.com/sso/index.php?action=checkLogin&nickName=true&time="+(now.getTime() / 1000);
function myAjaxResultFrame_onResult(obj){
	var txt = obj.contentWindow.document.body.innerHTML;
	var islogin;
	if(txt) {
		var arr = explode(txt,"|",true);
		document.getElementById('status').innerHTML = '<a href="http://club.youshang.com/'+arr[1]+'/">个人空间</a>&nbsp;&nbsp;<a href="http://club.youshang.com/spacecp.php?docp=me">空间管理</a>&nbsp;&nbsp;<a href="http://club.youshang.com/spacecp.php?action=spaceblogs&op=add">发表日志</a>&nbsp;&nbsp;<a href="http://club.youshang.com/spacecp.php?action=spaceimages&op=add">发布图片</a>&nbsp;&nbsp;<a href="http://club.youshang.com/ysbbs/post.php?action=newthread">发表帖子</a>&nbsp;&nbsp;<a href="http://club.youshang.com/spacecp.php?action=groups&op=add">创建圈子</a>&nbsp;&nbsp;<a href="http://club.youshang.com/sso/index.php?action=logout&referer=http://club.youshang.com/index.php">安全退出</a>';
	} else {
		document.getElementById('status').innerHTML = '<a href="http://club.youshang.com/sso/index.php?action=login&referer=http://club.youshang.com/index.php">登录</a>&nbsp;&nbsp;<a href="http://club.youshang.com/sso/index.php?action=register&referer=http://club.youshang.com/index.php">注册</a>&nbsp;&nbsp;<a href="'+assitant+'/getpwd/retrievePwd.do">找回密码</a>';
	}
}
function explode(inputstring, separators, includeEmpties) {
	inputstring = new String(inputstring);
	separators = new String(separators);
	
	if(separators == "undefined") {
	separators = " :;";
	}
	
	fixedExplode = new Array(1);
	currentElement = "";
	count = 0;
	
	for(x=0; x < inputstring.length; x++) {
	char = inputstring.charAt(x);
	if(separators.indexOf(char) != -1) {
	if ( ( (includeEmpties <= 0) || (includeEmpties == false)) && (currentElement == "")) { }
	else {
	fixedExplode[count] = currentElement;
	count++;
	currentElement = ""; } }
	else { currentElement += char; }
	}
	
	if (( ! (includeEmpties <= 0) && (includeEmpties != false)) || (currentElement != "")) {
	fixedExplode[count] = currentElement; }
	return fixedExplode;
}
//document.write('<iframe src="'+rootPath+encodeURIComponent(checkPath)+'" style="display:none" name="myAjaxResultFrame" onload="myAjaxResultFrame_onResult(this);"></iframe>');
document.write('<iframe src="'+checkPath+'" style="display:none" name="myAjaxResultFrame" onload="myAjaxResultFrame_onResult(this);"></iframe>');