﻿jQuery(function($){
  var domain = window.location.host.toLowerCase();
 
      var returnurl = "http://sns1.cio360.net/space/login.php?op=login&url=http://epaper.cio360.net/zgjsjb/paperindex.htm"
      var returnurlexit = "http://sns1.cio360.net/space/login.php?op=cexit&url="+window.location.href;
      //如果是电子报的头退出后返回电子报首页
      if(window.location.href.indexOf("http://www.cio360.net/Page/1952/Default.aspx")>=0)
      {
        returnurlexit = "http://sns1.cio360.net/space/login.php?op=cexit&url=http://epaper.cio360.net/zgjsjb/paperindex.htm";
      }
      
      $('#sns_exit').attr("href", returnurlexit);
      $('#sns_exit').attr("target", "_parent");
      $.get("DesktopModules/SNSUser/SNSUser_JSON.ashx",{t:(new Date()).getTime()},function(data){
           eval(data);
           if(!!!window.cio360_SNSUser.UID){//登陆前 
              var currentUrl =window.location.href;
                  $('#sns_defore').show();
           }else{//登陆后
               $('#sns_defore').hide();
               $('#sns_after').show();
               $('#sns_user').text(window.cio360_SNSUser.Alias);
               
               
                //$('#freeregist').html("<img id=\"Img4\" src=\"/DesktopModules/Login/4.gif\" alt=\"\"  /><span>我的空间</span>");
              //  $('#freeregist').attr("href","http://sns.cio360.net/space/index.php?ownerId=" +window.cio360_SNSUser.UID );
    	       
    	   
           }
      });
	  
	var curtab = GetQueryString();

    var tabs = $("#zhd_menu a").each(function () {
        if ($(this).attr('tabid') == curtab) {
            $(this).addClass("curentTab");
        } else {
            $(this).removeClass("curentTab");
        }
    });
	
});


//获取url参数
//获取url参数
function GetQueryString() {
    var url = window.location.href.toLowerCase();
    var tid = /http:\/\/www.cio360.net\/h\/([0-9]+)\.html/.exec(url);
    if (tid)
        return tid[1];
    else
        return null;
}
