var thispageurl = window.location.href.toLowerCase();
function addfans(star_id)
{
	if(myuid <=0 )
	{
		WishListAction('成为TA的粉丝');
		return false;
	}
	var req = AjaxRequest();
	var mydate = new Date();
	req.open('get',('/interface/pageservice.php?act=addfans&star_id='+star_id+'&rand='+mydate.getMilliseconds()),false);
	req.onreadystatechange = function ()
	{
		if(req.readyState == 4 && req.status == 200 && req.responseText != null)
		{
			if(req.responseText.indexOf("<result>1</result>") > 0)
			{
				WishListNotice('成为TA的粉丝','恭喜，您已成为TA的粉丝');
			}
			else if(req.responseText.indexOf("<result>-1</result>") > 0)
			{
				WishListNotice('成为TA的粉丝','您已经是TA的粉丝');
			}
			else if(req.responseText.indexOf("<result>-2</result>") > 0)
			{
				WishListAction('成为TA的粉丝');return false;
			}
		}
		return false;
	};
	req.send(null);
	return false;
}

function gid(id){return document.getElementById?document.getElementById(id):null;}
function gna(id){return document.getElementsByName?document.getElementsByName(id):null;}
function gname(name){return document.getElementsByTagName?document.getElementsByTagName(name):new Array()}
var get_e_src = function(e){if(e) return e.target;if(window.event) return window.event.srcElement;return null;};
function Browser(){var ua, s, i;this.isIE = false;this.isNS = false;this.isOP = false;this.isSF = false;ua = navigator.userAgent.toLowerCase();s = "opera";if ((i = ua.indexOf(s)) >= 0){this.isOP = true;return;}s = "msie";if ((i = ua.indexOf(s)) >= 0) {this.isIE = true;return;}s = "netscape6/";if ((i = ua.indexOf(s)) >= 0) {this.isNS = true;return;}s = "gecko";if ((i = ua.indexOf(s)) >= 0) {this.isNS = true;return;}s = "safari";if ((i = ua.indexOf(s)) >= 0) {this.isSF = true;return;}}
function InitRequest(){var C_req = null;try{C_req = new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{C_req = new ActiveXObject("Microsoft.XMLHTTP");}catch(oc){C_req = null;}}if (!C_req && typeof XMLHttpRequest != "undefined"){try{C_req = new XMLHttpRequest();}catch(fa){alert("对不起!您的浏览器不支持该功能,请使用Internet Explorer 6.0或FireFox浏览器!");C_req = null;}}return C_req;}
function ScreenConvert(){var browser = new Browser();var objScreen = gid("ScreenOver");if(!objScreen) var objScreen = document.createElement("div");var oS = objScreen.style;objScreen.id = "ScreenOver";oS.display = "block";oS.top = oS.left = oS.margin = oS.padding = "0px";if (document.body.clientHeight)	{var wh = document.body.clientHeight + "px";}else if (window.innerHeight){var wh = window.innerHeight + "px";}else{var wh = "100%";}oS.width = "100%";oS.height = wh;oS.position = "absolute";oS.zIndex = "3";if ((!browser.isSF) && (!browser.isOP)){oS.background = "#cccccc";}else{oS.background = "#cccccc";}oS.filter = "alpha(opacity=40)";oS.opacity = 40/100;oS.MozOpacity = 40/100;document.body.appendChild(objScreen);var allselect = gname("select");for (var i=0; i<allselect.length; i++) allselect[i].style.visibility = "hidden";}
var t_DiglogX,t_DiglogY,t_DiglogW,t_DiglogH;
function DialogLoc(){var dde = document.documentElement;if (window.innerWidth){var ww = window.innerWidth;var wh = window.innerHeight;var bgX = window.pageXOffset;var bgY = window.pageYOffset;}else{var ww = dde.offsetWidth;var wh = dde.offsetHeight;var bgX = dde.scrollLeft;var bgY = dde.scrollTop;}t_DiglogX = (bgX + ((ww - t_DiglogW)/2));t_DiglogY = (bgY + ((wh - t_DiglogH)/2));}
function DialogShow(showdata,ow,oh,w,h){var objDialog = gid("DialogMove");if (!objDialog) objDialog = document.createElement("div");t_DiglogW = ow;t_DiglogH = oh;DialogLoc();objDialog.id = "DialogMove";var oS = objDialog.style;oS.display = "block";oS.top = t_DiglogY + "px";oS.left = t_DiglogX + "px";oS.margin = "0px";oS.padding = "0px";oS.width = w + "px";oS.height = h + "px";oS.position = "absolute";oS.zIndex = "5";oS.background = "#FFF";oS.border = "solid #000 2px";objDialog.innerHTML = showdata;document.body.appendChild(objDialog);}
function DialogHide(){ScreenClean();var objDialog = gid("DialogMove");if (objDialog) objDialog.style.display = "none";}
function ScreenClean(){var objScreen = gid("ScreenOver");if (objScreen) objScreen.style.display = "none";var allselect = gname("select");for (var i=0; i<allselect.length; i++) allselect[i].style.visibility = "visible";}

function WishListAction(title)
{
	ScreenConvert();
	DialogShow("<div id=\"DialogLoading\"><table width=\"268\" height=\"78\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" ><tr><td valign=\"top\"><table width=\"268\" height=\"28\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"#F8F7F5\"><tr><td width=\"213\"><span class=\"STYLE2\"> &nbsp;"+
	title+"</span></td><td width=\"55\"><a href=\"javascript:DialogHide();\" target=\"_self\"><img src=\"/images/ico-close.gif\" width=\"52\" height=\"21\" border=\"0\" /></a></td></tr></table><table width=\"268\" height=\"50\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td align=\"center\">请&nbsp;<span class=\"yellowcolor\"><a href=\"http://passport.yoka.com/register.php?from="+
	window.location.href+"\" target='_self' style='color:#ff6600;'>马上注册</a></span>&nbsp;或&nbsp;<span class=\"yellowcolor\"><a style='color:#ff6600;' href=\"http://passport.yoka.com/?from="+
	window.location.href +"\" target='_self'>登录</a></span></td></tr></table></td></tr></table></div>",300,84,268,78);
}

function WishListNotice(title,notice)
{
	ScreenConvert();
	DialogShow("<div id=\"DialogLoading\"><table width=\"268\" height=\"78\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" ><tr><td valign=\"top\"><table width=\"268\" height=\"28\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"#F8F7F5\"><tr><td width=\"213\"><span class=\"STYLE2\"> &nbsp;"+
	title+"</span></td><td width=\"55\"><a href=\"javascript:DialogHide();\" target=\"_self\"><img src=\"/images/ico-close.gif\" width=\"52\" height=\"21\" border=\"0\" /></a></td></tr></table><table width=\"268\" height=\"50\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td align=\"center\"><span>"+
	notice+"</span></td></tr></table></td></tr></table></div>",300,84,268,78);
}

function AjaxRequest()
{
	var ajaxReq = false
	
	if( window.XMLHttpRequest ) 
	{
		//FireFox,Opera,IE7
		try 
		{
			ajaxReq = new XMLHttpRequest();
		} 
		catch( e ) 
		{
			ajaxReq = false;
		}
	}
	else if(window.ActiveXObject)
	{
		//IE6
	    try
	    {
		    ajaxReq = new ActiveXObject("Msxml2.XMLHTTP");
	    } 
	    catch( e ) 
	    {
		    try 
		    {
			    ajaxReq = new ActiveXObject("Microsoft.XMLHTTP");
		    } 
		    catch(e) 
		    {
			    ajaxReq = false;
		    }
	    }
	}
	
	return ajaxReq;
}
