var CookieR = false;
var jsver="0";
try{
    var jsver = MooTools.version;
    if (jsver == "1.11"){
        CookieR = Cookie.get("R");
    }else{
        CookieR = Cookie.read("R");
    }	
}catch(e){
	
}

if (null == CookieR || false == CookieR||""==CookieR){
	CookieR = "false";
}

function openEbook(vo){
	var window_width = screen.width;
	var window_height = screen.height - 25;
	var o_openEmag = window.open("/s/e/index.asp?vo="+vo,"","top=0,left=0,toolbar=0,directories=0,status=0,location=0,resizable=0,scrollbars=0,menubar=0,width="+window_width+",height="+window_height);
	o_openEmag.moveTo(-5, -25);
}
function oeb(obj){
	if (navigator.userAgent.indexOf("Maxthon") == -1){
		URL=obj.href;
    var width = screen.width;
    var height = screen.height;
    if (width > 1024){width = 1024;}
    if (height > 768){height = 768;}
    var left = ( screen.width - width ) / 2;
    var top = ( screen.height - height ) / 2;
    height -= 35;
    window.open(URL,'','width='+width+',height='+height+',top='+top+',left='+left+',scrollbars=0,resizable=1');
    return false;
	}
}
function openwin(url,w,h){
	childwin = window.open(url,"NewWindow","top=5,left=5,toolbar=0,directories=0,status=0,location=0,resizable=1,scrollbars=1,menubar=0,width="+w+",height="+h);
}
function change_pic_size(obj){
	var i_pic_clientHeight = obj.clientHeight;
	var i_pic_clientWidth = obj.clientWidth;
	if (obj.clientHeight > 120){
		obj.height = 120;
		obj.width = parseInt(120*i_pic_clientWidth/i_pic_clientHeight);
	}
}
function f_top(a,b,c,d){
	new Asset.css('/css/top.css', {id: 'myStyle'});
	f_newtop(a,b,c,d);
}
function f_catalog(){
    var s="<div id='id_g_catalog' onmouseover='f_CatalogShow();' onmouseout='f_CatalogHideDelay2();' class='org-a' style='margin:0 auto;position:absolute;top:164px;z-index:1111;background-color:#fff;border:1px solid #ccc;width:958px;padding-left:8px;display:none'>"; 
     s+=" <table border='0' cellpadding='0' width='100%' class='lh25'>";
	 s+="<tr><td width='14%'><a href='/scatalog3005.html'>摄影/摄像</a></td>";
	 s+="<td width='15%'><a href='/scatalog3008.html'>汽车</a></td>";
	 s+="<td width='14%'><a href='/scatalog3010.html'>财经</a></td>";
	 s+="<td width='14%'><a href='/scatalog3014.html'>科普</a></td>";
	 s+="<td width='14%'><a href='/scatalog3053.html'>DM杂志</a></td>";
	 s+="<td width='14%'><a href='/scatalog3063.html'>影视/音乐</a></td>";
	 s+="<td width='15%'><a href='/scatalog3064.html'>时事/新闻</a></td>";
	 s+="</tr><tr><td width='14%'><a href='/scatalog3066.html'>男性/女性</a></td>";
	 s+="<td ><a href='/scatalog3069.html'>社科综合</a></td>";
	 s+="<td ><a href='/scatalog3070.html'>法律/法规</a></td>";
	 s+="<td ><a href='/scatalog3076.html'>各项文化事业</a></td>";
	 s+="<td ><a href='/scatalog3078.html'>教育教学</a></td>";
	 s+="<td ><a href='/scatalog3081.html'>文学</a></td>";
	 s+="<td ><a href='/scatalog3082.html'>艺术</a></td></tr>";
	 s+="<tr><td ><a href='/scatalog3092.html'>医药/卫生</a></td>";
	 s+="<td ><a href='/scatalog3093.html'>农/林/牧/渔</a></td>";
	 s+="<td ><a href='/scatalog3095.html'>工业技术</a></td>";
	 s+="<td ><a href='/scatalog3102.html'>能源/动力</a></td>";
	 s+="<td ><a href='/scatalog3106.html'>自动化/计算机</a></td>";
	 s+="<td ><a href='/scatalog3108.html'>轻工/手工</a></td>";
	 s+="<td ><a href='/scatalog3109.html'>建筑/建材</a></td>";
	 s+="</tr><tr><td ><a href='/scatalog3111.html'>交通/运输</a></td>";
	 s+="<td ><a href='/scatalog3112.html'>航空航天</a></td>";
	 s+="<td ><a href='/scatalog3113.html'>环境科学</a></td>";
	 s+="<td ><a href='/scatalog3117.html'>商业/商务</a></td>";
	 s+="<td ><a href='/scatalog3011.html'>亲子育婴</a></td>";
	 s+="<td ><a href='/scatalog3036.html'>旅游/户外</a></td>";
	 s+="<td ><a href='/scatalog3475.html'>体育</a></td></tr>";
	 s+="<tr><td ><a href='/scatalog3476.html'>生活/时尚</a></td>";
	 s+="<td ><a href='/scatalog3477.html'>游戏/动漫</a></td>";
	 s+="<td ><a href='/scatalog3478.html'>健康/保健</a></td>";
	 s+="<td ><a href='/scatalog3480.html'>家居/装饰</a></td>";
	 s+="<td ><a href='/scatalog3481.html'>政府/政治</a></td>";
	 s+="<td ><a href='/scatalog3482.html'>经营/管理</a></td>";
	 s+="<td ><a href='/scatalog3483.html'>军事</a></td></tr><tr>";
	 s+="<td ><a href='/scatalog3484.html'>IT/互联网/数码</a></td>";
	 s+="<td ><a href='/scatalog3506.html'>包装/印刷</a></td>";
	 s+="<td ><a href='/scatalog3516.html'>金融/保险</a></td>";
	 s+="<td ><a href='/scatalog3533.html'>饮食/厨房</a></td>";
	 s+="<td ><a href='/scatalog3548.html'>民族/宗教</a></td>";
	 s+="<td ><a href='/scatalog3549.html'>休闲/娱乐</a></td>";
	 s+="<td ><a href='/scatalog3568.html'>外刊</a></td>";
	 s+="</tr><tr><td ><a href='/scatalog3589.html'>外文刊</a></td>";
	 s+="<td ><a href='/scatalog3670.html'>文化/文艺</a></td>";
	 s+="<td ><a href='/scatalog3687.html'>儿童</a></td>";
	 s+="<td ><a href='/scatalog3688.html'>收藏</a></td><td>";
	 s+="</td><td></td><td></td></tr></table><br>";
	 s+="</div>";
	 return s;
}
function f_UserInfo(){
    var t="";
    if (isUser()) {
        t +="<a href='/customer/'>"+f_GetEmail()+"</a>";
    } else {
        t+= "<a href='/customer/'>登录</a><a href='/customer/'>免费注册</a>";
    }
    t += "<a href='/2002/shoppingcart/shoppingcart.asp' target='_blank' title='我的购物清单'>购物车</a>";
    t+="<a href='/customer/' title='会员信息查询及管理'>会员中心</a>";
    t += "<a href='/customer/orders.asp'>订单查询</a>";
    t+="<a href='/2002/guestbook/'>客服服务</a>";
    t += "<a href=\"javascript:AddFavorite(document.title,document.location.href,'')\">收藏夹</a>";
    if (isUser()) {
        t += "<a href='javascript:f_logout()' title='安全退出登陆' target='_top'>退出</a>";
    }    
    return t;
}
function f_search(){
    var t="<form name='SearchFrm' method='GET' action='/search/index.asp'>";  
    t+= "<input type='hidden' name='MagID' value='0'>";
    t+="<select style='width: 90px;' id='stype' name='SearchID' size='1'>";
    t+="<option value='1' selected='selected'>刊物名称</option>";  
    t+="<option value='6'>网站全部内容</option>";  
    t+="<option value='2'>邮发代号/刊号</option>";  
    t+="</select>";
    t+="<input value='14118种刊物' autocomplete='off' maxlength='50' results='8' name='SearchWord' size='24' class='focus' id='searchTextbox' ";
    t+=" onfocus=\"if(this.value=='14118种刊物')this.value='';\" ";
    t+=" onblur=\"if(this.value=='')this.value='14118种刊物'\" ";
    t+="";
    t+=">";
    //t+="<input type='submit' value='搜索'>";
    t+="<button type='submit' >搜索</button>";
    t+="</form>";
    return t;
}
var f_newtop = function() {
    var result = '';
    var l = arguments.length;
    var MagID = 0;
    if (l > 0) {
        result = '';
        if (11 == arguments[0]) {
            MagID = arguments[2];
        }
    }
    
    var t=f_catalog();
    t+="<div class='gtr-header2'>";
    t+="<div class='header-top'>";
    t+="<div class='new-logo'><a href='http://www.gotoread.com/'><img title='媒体资源整合服务提供商' src='http://cdn2.gotoread.com/images/logo/new-logo.png' width='221' height='25' /></a></div>";
    t+="<div class='q-menu'><div>";
    t+=f_UserInfo();
    t+="</div>";
    t+="<div class='arr'><a href='/' class='bg'>简体中文</a><a href='/' class='bg'>English</a></div>";
    t+="</div>";
    t+="</div>";
    t+="<div class='gtr-nav'><span class='nav-sideL'><a href='/'>首页</a><a href='/read/article.aspx'>看杂志</a>";
    t+="<a href='/order/'>订杂志</a><a href='/q/'>圈子(测试)</a></span><span class='nav-sideR'><a href='/media/'>投广告</a>";
    t+="<a href='/mag/manage/";    
    if ((MagID !="") && (MagID != 0)){
        t+="?MagID="+MagID;
    }
    t+="'>刊社管理</a>";
    t+="<a href='/catalog/initials.aspx'>A-Z检索</a></span>";
    t+="<div class='search-input'>";
    t+=f_search();
    t+="</div>";
    t+="</div>";
    t+="<div class='fl-box' >";
    t+="<a href='/catalog/more.aspx' onmouseover='f_CatalogShow();' onmouseout='f_CatalogHideDelay();'>杂志分类</a>";
    t+="<a href='/catalog/catalogmore.aspx' class='wide'>国家标准分类</a>";
    t+="</div>";
    t+="</div>";
    
    document.write(t);
    if (10 == arguments[0]) {
        document.write("<div id='id_top'></div>");
        for (var i = 0; i < l; i++) {
            if (0 == i) {
                result += ('a' + i + '=' + arguments[i]);
            } else {
                result += ('&a' + i + '=' + arguments[i]);
            }
        }
        
        var url = "/include/newtop.asp";        
        if (jsver == "1.11"){
            new Ajax(url+"?"+result, { method: 'get', update: $('id_top'), onComplete: function() { this.evalScripts(); } }).request();
        }else{
            new Request({url: url, method: 'get',onSuccess: function(responseText) {
                    $('id_top').set('html', responseText);
                }        
            }).send(result);
        }
        
    }
}

function f_btm(a,b,c,d){
	f_bottom();
}

var f_newbottom = function() {
    var t="<div class='clear_hei'></div>";
    t+="<div class='footer'>";
    t+="<div class='cright'>copyright&reg; 2009版权所有 | 京ICP证020027号 | 技术支持:北京网目图文信息技术有限公司</div>";
    t+="<div class='bottom'>";
    t+= "<a href='/info/about/'>关于浏览网</a> |";
    t+= " <a href='/info/law/'>免责与隐私</a>  |";
    t+= " <a href='/info/pagead/'>纸版广告代理</a> |";
    t+=  "<a href='/info/pagead/service.asp'>网站广告服务</a> |";
    t+= " <a href='/info/join/'>招聘信息</a> |";
    t+= " <a href='/info/contact/'>联系与汇款方式</a>  |";
    t+= " <a href='/info/link/'>合作伙伴</a> |";
    t+= " <a href='/info/integral/'>积分制度</a>";

    t+="</div>";
    t+="</div>";

    document.write(t);
    f_body_init();
}

function f_body_init(){
	var t;
	t='<div style="display:none;position:absolute;top:0px;left:0px;z-index:1000;background-color:#000;width:0px;height:0px" id="id_blackdiv"></div>';
	t+="<div id='id_middlediv' style='display:none;position:absolute;top:0px;left:0px;z-index:99998;background-color:white'>";
	t+="<table border='0' cellspacing='0' cellpadding='0' width='100%' border='0'><tr>";
	t+="<td align='middle' bgColor='#7691c7' height='30' >";
	t+="<table border='0' cellspacing='0' cellpadding='0' width='100%' border='0'><tr><td id='id_middlediv_title' style='font-weight:bold;font-size:14px'></td>";
	t+="<td width='22' valign='middle'><a href='javascript:f_middlediv_hide();'><img src='http://cdn2.gotoread.com/images/close2.gif' align='center'></a>&nbsp;</td></tr></table>";
	t+="</td></tr><tr><td align='middle' id='id_middlediv_body' style='font-size:12px'></td></tr></table>";
	t+="</div>";
	document.write(t);
}

function f_bottom(){
	f_newbottom();
}

function f_backdiv_show(){
	$("id_blackdiv").style.width=getScrollWidth()+"px";
	$("id_blackdiv").style.height=getScrollHeight() +"px";
	$("id_blackdiv").setOpacity(0);
	
	$("id_blackdiv").style.top = "0px";
	$("id_blackdiv").style.display='';
	
    if (jsver == "1.11"){
    var myFx = new Fx.Style('id_blackdiv', 'opacity').start(0,0.6);
    }else{
        $('id_blackdiv').fade(0.6); 
    }
}
function f_backdiv_hide(){
    if (jsver == "1.11"){
       var myFx = new Fx.Style('id_blackdiv', 'opacity').start(0.6,0); 
    }else{
        $('id_blackdiv').fade(0); 
    }
        
}
function f_middlediv_hide(){
	f_backdiv_hide();
	document.getElementById("id_middlediv").style.display="none";
}
function f_middlediv_hide_delay(delaytime){
	setTimeout("f_middlediv_hide();",delaytime);
}
function f_middlediv_show(){
	f_backdiv_show();
	document.getElementById("id_middlediv").style.display="";
}
function getQueryStr(str){
	var tmpArr,QueryString;
	var URL = document.location.toString().toUpperCase();
	str = str.toUpperCase();
	var ReturnStr="";
	if(URL.lastIndexOf("?")!=-1 && URL.lastIndexOf(str)!=-1){
		QueryString= URL.substring(URL.lastIndexOf("?")+1,URL.length);
		tmpArr=QueryString.split("&");		
		for (i=0;i<=tmpArr.length;i++){
			var tmp = tmpArr[i];
			if (tmp != undefined){
				if (tmp.lastIndexOf(str)!=-1){
					var tmpstr = tmpArr[i].split("=");	
					if (tmpstr[1] != undefined){
						ReturnStr=tmpstr[1];
					}
				}
			}
		}		
	}else{}
	return unescape(ReturnStr);
}

function f_top_old(x){
	var t ="";
	t+="<div id='logo' class='grayfont'>";
	t+="<a href='/' target='_self'>";
	t+="<img alt='浏览网 首页' border='0' src='http://cdn2.gotoread.com/images/logo.gif' width='280' height='35'></a>中文杂志平台&nbsp; ";
	t+="-&nbsp; 杂志订阅、在线阅读、广告投放</div>";
	t+="<div style='float:left;margin:35px 0px 0px 30px'>";
	t+="<a class='";
	t+=(x=="home"?"redbold12":"blackbold12");
	t+="' href='/' title='返回浏览网首页' target='_self'>";
	t+="浏览网首页</a> | ";
	t+="<a class='";
	t+=(x=="catalog"?"redbold12":"blackbold12");
	t+="' href='/catalog/' title='全部分类内容' target='_self' title='报刊分类'>";
	t+="分类</a> | ";
	t+="<a class='";
	t+=(x=="order"?"redbold12":"blackbold12");
	t+="' href='/order/' target='_self' title='订阅纸版杂志'>";
	t+="纸版杂志</a> | ";
	t+="<a class='";
	t+=(x=="o"?"redbold12":"blackbold12");
	t+="' href='/read/' target='_self' title='在线阅读原版杂志'>";
	t+="数字版杂志</a> | ";
	t+="<a class='";
	t+=(x=="as"?"redbold12":"blackbold12");
	t+="' href='/as/' target='_self' title='投放杂志广告'>";
	t+="投广告</a></div>";
		
	t+="<div id='search_bar_bg'>";
	t+="<form method='GET' action='/search/index.asp' name='SearchTop'>";
	t+="<div id='search_bar_beg'>";
	t+="</div>";
	t+="<div style='float:left;height:26px;padding-top:7px;padding-left:30px'>";
	t+="<select size='1' name='SearchID' class='font'>";
	t+="<option value='1'>---刊物搜索---</option>";
	t+="<option selected value='1'>刊物名称</option>";
	t+="<option value='2'>邮发代号</option>";
	t+="<option value='3'>国际刊号(ISSN)</option>";
	t+="<option value='4'>国内刊号(CN)</option>";
	t+="<option value='5'>浏览网刊号(MagID)</option>";
	t+="</select>";
	t+="<input type='text' name='SearchWord' size='40' class='font' maxlength='500' onfocus=\"if(this.value=='输入搜索关键字')this.value='';\" onblur=\"if(this.value=='')this.value='输入搜索关键字'\" value=\"\" />";
	t+="<input type='submit' value='搜索' name='search' class='button'></div>";
	t+="<div id='search_bar_end'>";
	t+="</div>";
	t+="</form>";
	t+="</div>";
	document.write (t);
}

function f_login(){
	f_middlediv_show();
	var i_Top = parseInt((window.getWidth() - 640)/2) + window.getScrollTop();
	$("id_middlediv").style.width ="400px";
	$("id_middlediv").style.top = i_Top+"px";
	$("id_middlediv").style.left ="200px";
	$("id_middlediv_title").innerHTML ="用户登录";	
	var url ="/customer/ajaxlogin.asp";	
    if (jsver == "1.11"){
        new Ajax(url+"?t="+Math.random(),{method: 'Post',
	    onComplete:function(request){
		    $('id_middlediv_body').setHTML(f_filter_script(request));
		    this.evalScripts();
	    },onFailure:function(){$("id_middlediv_body").setHTML("请求失败，请稍后再试。")}
	    }).request();
    }else{
        new Request({url: url, method: 'post',onSuccess: function(responseText) {
                $('id_middlediv_body').set('html', responseText);
            }        
        }).send(result);
    }		
}
function f_collection(url,title){
	f_middlediv_show();
	var i_Top = parseInt((window.getWidth() - 640)/2) + window.getScrollTop();
	$("id_middlediv").style.width ="450px";
	$("id_middlediv").style.top = i_Top+"px";
	$("id_middlediv").style.left ="200px";
	$("id_middlediv_title").innerHTML ="添加收藏";	
	var Ajax_url ="/customer/ajaxcollection.asp?url="+escape(url)+"&title="+escape(title)+"&t="+Math.random();
	new Ajax(Ajax_url,{method: 'Post',
	onComplete:function(request){
		$('id_middlediv_body').setHTML(f_filter_script(request));
		this.evalScripts();
	},onFailure:function(){$("id_middlediv_body").setHTML("请求失败，请稍后再试。")}
	}).request();
}
function f_commend(url,title){
	f_middlediv_show();
	var i_Top = parseInt((window.getWidth() - 640)/2) + window.getScrollTop();
	$("id_middlediv").style.width ="500px";
	$("id_middlediv").style.top = i_Top+"px";
	$("id_middlediv").style.left ="200px";
	$("id_middlediv_title").innerHTML ="推荐本文";
	var Ajax_url ="/article/recommend_ajax.asp?subject="+escape(title)+"&subjectlink="+escape(url)+"&t="+Math.random();
	new Ajax(Ajax_url,{method: 'Post',
	onComplete:function(request){
		$('id_middlediv_body').setHTML(f_filter_script(request));
		this.evalScripts();
	},onFailure:function(){$("id_middlediv_body").setHTML("请求失败，请稍后再试。")}
	}).request();
}
function f_citation(s){
	window.clipboardData.setData("Text",s);
	alert("网址复制成功,请直接粘贴到您的QQ/MSN上推荐给您的好友");
}
/////////////////cookie/////////////////////////////
function f_CookieEnable(){ //是否支持Cookie
		if(navigator.cookiesEnabled){return true;} 
		document.cookie = "testcookie=yes;"; 
		var cookieSet = document.cookie; 
		if (cookieSet.indexOf("testcookie=yes") > -1){
			document.cookie = ""; 
			return true;
		}else{return false;}
}
function f_SetCookie(sName,sValue,expDays){
	var d_exp = new Date();
	d_exp.setTime (d_exp.getTime() + expDays*24*60*60*1000);
	document.cookie = sName+" =" + sValue + ";"+" expires="+d_exp.toGMTString()+";path=/; "; 
}
function f_GetCookie(sName){
  var aCookie = document.cookie.split(";"+" ");
  for (i=0; i < aCookie.length; i++){
    var aCrumb = aCookie[i].split("=");
    if (sName == aCrumb[0]) 
      return unescape(aCrumb[1]);
  }
  return 1;
}
/////////////////end cookie/////////////////////////////
function pic_onerror(obj){
	obj.onerror = new Function("return false;");obj.src="http://cdn2.gotoread.com/images/picture/nocover70.jpg";obj.border = 1;	
}
function bigpic_onerror(obj){
	obj.onerror = new Function("return false;");obj.src="http://cdn2.gotoread.com/images/picture/nocover200.jpg";obj.border = 1;	
}
function midpic_onerror(obj){
	obj.onerror = new Function("return false;");obj.src="http://cdn2.gotoread.com/images/picture/nocover110.jpg";obj.border = 1;	
}

function logo_onerror(obj){	
	obj.onerror = new Function("return false;");obj.src="http://cdn2.gotoread.com/2002/images/logo.asp";obj.border = 0;
}
function f_filter_script(t){
	var regexp = /<script[^>]*>([\s\S]*?)<\/script>/gi;
    t=t.replace(regexp,''); 
    return t;
}
function  getObjectLeft(e){
  if (window.navigator.userAgent.indexOf("Firefox")>=1){return e.offsetLeft;}
  var l=e.offsetLeft;   
  while(e=e.offsetParent) l += e.offsetLeft;   
  return l;   
}   
function   getObjectTop(e){ 
  if (window.navigator.userAgent.indexOf("Firefox")>=1){return e.offsetTop;} 
  var t=e.offsetTop;   
  while(e=e.offsetParent) t += e.offsetTop;   
  return t;   
}

function GetCookie(sName){
    if (jsver == "0"){
          var aCookie = document.cookie.split(";"+" ");
          for (i=0; i < aCookie.length; i++){
            var aCrumb = aCookie[i].split("=");
            if (sName == aCrumb[0]){return unescape(aCrumb[1]);}
          }
          return "";
    }else if (jsver == "1.11"){
        return Cookie.get(sName);
    }else{
        var ck = Cookie.read(sName);
        if (null == ck){ck="";}
        return ck;
    }    
}
function f_GetHostName(){
    return window.location.host;
}
function SetCookie(sName,sValue){
    if (jsver == "0"){
        var d_exp = new Date();
        d_exp.setTime (d_exp.getTime() + 365*24*60*60*1000);
        document.cookie = sName+" =" + sValue + ";"+" expires="+d_exp.toGMTString()+";path=/; ";
    }else if (jsver == "1.11"){
        Cookie.set(sName,sValue);
    }else{
        var ip = f_GetHostName();
        if (ip != "192.168.0.210"){
            Cookie.write(sName,sValue,{domain: 'gotoread.com',path:'/'});
        }else{
            Cookie.write(sName,sValue);
        }
    }    
}
var b_history=0;
Temp="<div id='id_history_menu' onmouseover='f_history_over();' onmouseout='f_history_menu_out()' style='position:absolute;z-Index:6500;display:none;width:330px'>";
Temp+="<div class='popmenu'>";
Temp+="<div class='knob'><img src='http://cdn2.gotoread.com/images/knob.gif'></div>";
Temp+="<div id='id_history_menu_body' class='popmenu_c' style='margin-top:1px;padding:5px;background-color:white;overflow:auto;font-size:1.2em'></div>";
Temp+="</div>";
Temp+="</div>";
document.write (Temp);
function f_history_hide(){
	T_history_menu = setTimeout("f_history_menu_hide()",250);
}

function f_history_hide(){
	T_history_menu = setTimeout("f_history_menu_hide()",250);
}

function f_history_out(){f_history_hide();}
function f_history_over(){
	if (typeof T_history_menu!="undefined"){clearTimeout(T_history_menu);}
	document.getElementById("id_history_menu").style.display="";
}
function f_history_menu_out(){f_history_hide();}
function f_history_menu_hide(){
	document.getElementById("id_history_menu").style.display="none";
}


function f_GetVo_FromCookie(vo){//是否有此vo,-1不存在,>0存在，并且返回此vo
	var tmpcookie = GetCookie("emaghistory");
	if (tmpcookie =="undefined"||"" == tmpcookie){return -1;}
	var atmp=tmpcookie.split("!");
	var atmp_len=atmp.length;
	var itmp=-1;
	var vo_tmp;
	var atmp2;
	for (i=0;i<atmp_len;i++){
		atmp2 = atmp[i].split(",");
		if (atmp2[0] == vo){
			itmp = vo;
		}
	}
	return itmp;
}
function f_GetPage_FromCookie(vo){//返回Page,不存在返回封面1,
	var tmpcookie= GetCookie("emaghistory");
	if ( tmpcookie =="undefined"||"" == tmpcookie){return 1;}
	var atmp=tmpcookie.split("!");
	var atmp_len=atmp.length;
	var itmp=1;
	var vo_tmp;
	var atmp2;
	for (i=0;i<atmp_len;i++){
		atmp2 = atmp[i].split(",");
		if (atmp2[0] == vo){
			itmp = atmp2[1];
		}
	}
	return itmp;
}
function f_GetVos_FromCookie(){//返回Cookie中有几个vo
	var tmpcookie = GetCookie("emaghistory");
	if (tmpcookie =="undefined"||"" == tmpcookie){return 0;}
	var atmp=tmpcookie.split("!");
	var atmp_len=atmp.length;
	return atmp_len;
}


function f_history_show(){
	var temp_x,temp_y;
	var id_history=document.getElementById("id_history");	
	temp_x=(getObjectLeft(id_history)-20);
	temp_y=(getObjectTop(id_history)+15);	
	document.getElementById("id_history_menu").style.top=temp_y+"px";
	document.getElementById("id_history_menu").style.left=temp_x+"px";
	if (!b_history){
		var tmpstr=GetCookie("emaghistory");//123,12,111
		if ("undefined" == tmpstr){tmpstr="";}
		if ("" == tmpstr){
			$("id_history_menu_body").style.height="170px";
			document.getElementById("id_history_menu_body").innerHTML="<br/><br/><br/><br/><center>没有历史记录.</center>";
		}else{
			var atmp=tmpstr.split("!");
			var atmp2;
			var tmpvo="";
			var tmppage;
			tmpstr="<center><a href='javascript:f_DelAllVoHistory();' style='font-size:1.2em'>删除全部历史记录</a></center><br/>";
			tmpstr+="<table border='0' cellspacing='0' cellpadding='0'>";
			for (i=0;i<atmp.length;i++){
				atmp2=atmp[i].split(",");
				tmpvo=atmp2[0];
				tmppage=atmp2[1];
				if (1 == (i+1)%3 ){tmpstr+="<tr align='center'>";}
				tmpstr+="<td width='100'><div style='padding-top:3px'><a href='/s/e/?vo="+tmpvo+"&p="+tmppage+"' title='点击翻阅'><img src='/s/vo/"+tmpvo+"/7.jpg'></a></div><div style='padding:2px;text-align:center;width:100%'><a href='javascript:f_DelCookieByVo("+tmpvo+")' class='gray12'>删除</a></div></td>";
				if (0 == (i+1)%3 ){tmpstr+="</tr>";}	
			}
			if (0 != (i+1)%3){
				for (w=0;w<3 - (i+1)%3;w++){
					tmpstr+="<td> </td>";
				}tmpstr+="</tr>";
			}
			tmpstr+="</table>";
			if (i <=3){
				$("id_history_menu_body").style.height="170px";
			}else if (i<=6){
				$("id_history_menu_body").style.height="280px";
			}else{
				$("id_history_menu_body").style.height="400px";
			}
			$("id_history_menu_body").innerHTML=tmpstr;
			b_history=1;
		}
	}
	document.getElementById("id_history_menu").style.display='';
}

function f_GetVo_FromCookie(vo){//是否有此vo,-1不存在,>0存在，并且返回此vo
	var tmpcookie = GetCookie("emaghistory");
	if (tmpcookie =="undefined"||"" == tmpcookie){return -1;}
	var atmp=tmpcookie.split("!");
	var atmp_len=atmp.length;
	var itmp=-1;
	var vo_tmp;
	var atmp2;
	for (i=0;i<atmp_len;i++){
		atmp2 = atmp[i].split(",");
		if (atmp2[0] == vo){
			itmp = vo;
		}
	}
	return itmp;
}
function f_GetPage_FromCookie(vo){//返回Page,不存在返回封面1,
	var tmpcookie= GetCookie("emaghistory");
	if ( tmpcookie =="undefined"||"" == tmpcookie){return 1;}
	var atmp=tmpcookie.split("!");
	var atmp_len=atmp.length;
	var itmp=1;
	var vo_tmp;
	var atmp2;
	for (i=0;i<atmp_len;i++){
		atmp2 = atmp[i].split(",");
		if (atmp2[0] == vo){
			itmp = atmp2[1];
		}
	}
	return itmp;
}
function f_GetVos_FromCookie(){//返回Cookie中有几个vo
	var tmpcookie = GetCookie("emaghistory");
	if (tmpcookie =="undefined"||"" == tmpcookie){return 0;}
	var atmp=tmpcookie.split("!");
	var atmp_len=atmp.length;
	return atmp_len;
}

function f_DelCookieByVo(vo){
	f_history_menu_hide();
	var Temp=GetCookie("emaghistory");
	if ("undefined" == Temp){Temp="";}
	if (""==Temp){return;}	
	if (-1 == f_GetVo_FromCookie(vo) ){return;}
	//找到了
	var atmp=Temp.split("!");
	var str_tmp="";
	var atmp2;
	for (i=0;i<atmp.length;i++){
		atmp2=atmp[i].split(",");
		if (atmp2[0] != vo){
			str_tmp+=atmp[i]+"!";
		}
	}
	str_tmp=str_tmp.substr(0,str_tmp.length - 1);
	SetCookie("emaghistory",str_tmp);

	b_history = 0;//history初始化
	f_history_show();f_history_hide();
}
function f_DelAllVoHistory(){
	SetCookie("emaghistory","");
	f_ResetHistory();
}
function f_ResetHistory(){
	b_history = 0;//history初始化
	f_history_menu_hide();
	f_history_show();f_history_hide();
}
////////////////////////////////////////////////////////////


function isUser() {
     var s = "";
    try{
	    s = Cookie.read("Sid");
    }catch(e){
	    s = Cookie.get("Sid");
    }    
    
	if (null == s || false == s){
		return false;
    }
    
	return true;
}
function IsSuperAdmin(){
	if (-1 != CookieR.indexOf("GTR=A")){
		return true;
	}
	return false;
}
function isGroup_YeWu(){
	if (IsSuperAdmin() || -1 != CookieR.indexOf("GTR=E")){
		return true;
	}
	return false;
}
function isGroup_AD(){
	if (IsSuperAdmin() ||-1 != CookieR.indexOf("GTR=C")){
		return true;
	}
	return false;
}
function isGroup_Rg(){
	if (IsSuperAdmin() ||-1 != CookieR.indexOf("GTR=D")){
		return true;
	}
	return false;
}
function isGroup_Order(){
	if (IsSuperAdmin() ||-1 != CookieR.indexOf("GTR=B")){
		return true;
	}
	return false;
}
function isAdmin(){
	if ( IsSuperAdmin()|| isGroup_YeWu()||isGroup_AD()||isGroup_Rg()||isGroup_Order()){
		return true;
	}
	return false;
}
function isMagIDAdmin(MagID){
	if ("false" == CookieR){
		return false;
	}
	var idx = CookieR.indexOf("Mag=");
	if (-1 == idx){
		return false;
	}
	var str = CookieR.substring(idx+4,CookieR.length);
	var arr= str.split(",");
	for(i=0;i<arr.length;i++){
		if (arr[i] == MagID){
			return true;
		}
	}
	return false;
}
function f_GetEmail() {
    var str = "";
    try{
	    str = Cookie.read("User");
    }catch(e){
	    str = Cookie.get("User");
    }   
    
    if (null == str || false == str) {
        return "";
    }
    var arr = str.split("&");
    var s = "";
    for (var i = 0; i < arr.length; i++) {
        if (arr[i].indexOf("Email") > -1) {
            s = arr[i].substring(6,arr[i].length);
        }
    }
    return s;
}
function AddFavorite(title,url,desc){
     if ((typeof window.sidebar == 'object') && (typeof window.sidebar.addPanel == 'function'))
     {
         window.sidebar.addPanel(title,url,desc);
     }
     else//IE
     {
         window.external.AddFavorite(url,title);
     }
}
function f_logout(){
    var url =window.location.href;
    url = url.replace(/&/g,"&amp;");
    url = escape(url);
	window.location.href="/customer/logout.asp?realReturnURL="+url;
}
function f_hideAllSelect(){
	if (typeof g_selects != "undefined"){
		try{
			var arr = g_selects.split(",");		
			for (i=0;i<arr.length;i++){
				var t = arr[i];
				$(t).style.visibility="hidden";
			}
		}catch(e){}
	}
}
function f_showAllSelect(){
	if (typeof g_selects != "undefined"){
		try{
			var arr = g_selects.split(",");		
			for (i=0;i<arr.length;i++){
				var t = arr[i];
				$(t).style.visibility="visible";
			}
		}catch(e){}
	}
}

function f_CatalogShow(){
    if (typeof T_Catalog!="undefined"){clearTimeout(T_Catalog);}
    document.getElementById("id_g_catalog").style.display="";
}
function f_CatalogHide(){
    document.getElementById("id_g_catalog").style.display="none";
}
function f_CatalogHideDelay(){
	if (typeof T_Catalog!="undefined"){clearTimeout(T_Catalog);}
    T_Catalog = setTimeout("f_CatalogHide()",3000);
}
function f_CatalogHideDelay2(){
	if (typeof T_Catalog!="undefined"){clearTimeout(T_Catalog);}
    T_Catalog = setTimeout("f_CatalogHide()",500);
}


function f_TIAShow(TypeID,MagID,aids){
    var url="/customer/TiaMainWindow.asp?MagID="+MagID+"&TypeID="+TypeID+"&aids="+aids;
    window.location.href=url;
//	f_middlediv_show();
//	var i_Top = 5 + window.getScrollTop();
//	
//	$("id_middlediv").style.width ="720px";//宽高:700*600
//	$("id_middlediv").style.top = i_Top+"px";
//	$("id_middlediv").style.left ="152px";
//	$("id_middlediv").innerHTML ="<iframe  width='720' height='620' scrolling='no' src='/customer/TiaMainWindow.asp?MagID="+MagID+"&TypeID="+TypeID+"&aids="+aids+"' marginwidth='1' marginheight='1' name='f' border='0' frameborder='0' >浏览器不支持嵌入式框架，或被配置为不显示嵌入式框架。</iframe>";
}

function f_digit(magid,id,dig,func){//3投稿，2数字杂志，1精选文章，0杂志
    var url1 ="";
	var url2="";
	var sendstr="";
    if (func == 3){
        url1 ="/mag/dig/contributedig.asp";
        sendstr="magid="+magid+"&wid="+id+"&dig="+dig+"&t="+Math.random();
	    url2="/article/?MagID="+magid+"&wid="+id;
    }else if(func == 2){
        url1 ="/mag/dig/emagdig.asp";
        sendstr="vo="+id+"&dig="+dig+"&t="+Math.random();
	    url2="/mag/dig/emagdiglist.aspx?MagID="+magid+"&vo="+id;
    }else if (func == 1){
        url1 ="/mag/dig/articledig.asp";
        sendstr="id="+id+"&dig="+dig+"&t="+Math.random();
	    url2="/mag/"+magid+"/sarticle_"+id+".html";
    }else{
        url1 ="/mag/dig/magiddig.asp";
        sendstr="magid="+magid+"&dig="+dig+"&t="+Math.random();
	    url2="/mag/dig/diglist.aspx?MagID="+magid;
    }
    
    $('id_vote'+func+'_'+id).className="dugg-it";
    $('id_vote'+func+'_'+id).set('html',"<span>处理中</span>");
	$('id_poll'+func+'_'+id).set('html',"<img src='/images/loading.gif'>");
	
    new Request({url: url1, method: 'get',
        evalScripts:true,
        onSuccess: function(responseText) {
            $('id_vote'+func+'_'+id).set('html', "<a href='"+url2+"' class='orange'>查看</a>");
        },
        onFailure:function(){
        $('id_poll'+func+'_'+id).set('html',"<span>请求失败</span>")
        }       
    }).send(sendstr);
}

 function f_dig(magid,id,dig,godown,digtype,func){////func 3投稿，2数字杂志，1精选文章，0杂志
    var url1 ="";
    var sendstr="";
    if (func == 3){
        url1 ="/mag/dig/contributedig.asp";
        sendstr="magid="+magid+"&wid="+id+"&digtype="+digtype+"&t="+Math.random();
    }else if(func == 2){
        url1 ="/mag/dig/emagdig.asp";
        sendstr="vo="+id+"&dig="+dig+"&t="+Math.random();
    }else if (func == 1){
        url1 ="/mag/dig/articledig.asp";
        sendstr="magid="+magid+"&id="+id+"&digtype="+digtype+"&t="+Math.random();
    }else{
        url1 ="/mag/dig/magiddig.asp";
        sendstr="magid="+magid+"&dig="+dig+"&t="+Math.random();
    }
    
    if (digtype == 1){
        dig++;
    }else if(digtype ==2 ){
        godown++;
    }else{}      
    $('id_vote'+func+'_'+id).set('html',"&nbsp;处理中...");      
    
    var s = "<div class='item disabled'>您已投票";    
    s+=" <span class='ico__up'></span><span class='num'>";
    s+=dig;
    s+="</span><span class='ico__down'></span>";
    s+="<span class='num'>";
    s+=godown;
    s+="</span></div>";    
    new Request({url: url1, method: 'get',
        onSuccess: function(responseText) {
            if ("2" == responseText){
                s = s.replace("顶","投");
                s = s.replace("踩","投");
            }
            $('id_vote'+func+'_'+id).set('html', s);
        },
        onFailure:function(){
            $('id_vote'+func+'_'+id).set('html',"<span>请求失败</span>");
        }      
    }).send(sendstr);
    
    
}