document.write('<div id="header">');
document.write('<div id="logo"><a href="http://www.kongfz.com/"><img src="http://book.kongfz.com/images/logo.gif" alt="孔夫子旧书网" /></a></div>');
document.write('<div id="topRight">');
document.write('<div id="memberLoginArea" style="text-align:right;"> <a href="http://pm.kongfz.com/member/member.php" target="_blank">个人中心</a> <a href="http://shop.kongfz.com/shopping_cart/shopping_cart.php?act=shoppingCartList" target="_blank"> <img src="http://book.kongfz.com/images/shopping_car01.gif" alt="购物车" align="absmiddle" /></a> <a href="http://pm.kongfz.com/member/register.php" target="_blank">注册</a> <a href="http://shop.kongfz.com/apply_shop.php?act=apply" target="_blank">我要开店</a> <a href="http://help.kongfz.com/" target="_blank">新手指南</a> </div>');
document.write('<div id="topmenu">');
document.write('<ul>');
document.write('<li><a href="http://www.kongfz.com/">首页</a></li>');
document.write('<li id="current"><a href="http://shop.kongfz.com/">书店联盟</a></li>');
document.write('<li><a href="http://pm.kongfz.com/">在线拍卖</a></li>');
document.write('<li><a href="http://www.kongfz.com/trade/index.php">旧书广场</a></li>');
document.write('<li><a href="http://pmgs.kongfz.com/">拍卖联盟</a></li>');
document.write('<li><a href="http://www.kongfz.com/trade/index1.php">夫子社区</a></li>');
document.write('<li><a href="http://www.kongfz.com/trade/gujiu.php">古旧书院</a></li>');
document.write('</ul>');
document.write('<div class="clear"></div>');
document.write('</div>');
document.write('</div>');
document.write('<div class="clear"></div>');
document.write('</div>');
document.write('<div id="subMenu2"></div>');
document.write('<div id="search">');
document.write('<table align="center" style="margin:auto">');
document.write('<tr>');
document.write('<td><img src="http://book.kongfz.com/images/icon_search_result.gif" alt="搜索" align="absmiddle" /> </td>');
document.write('<td>图书搜索：');
document.write('</td>');
document.write('<td><span id="shopPanelConent" style="display:block">');
document.write('<form id="frmSearchShop" name="frmSearchShop" method="get" action="http://search.kongfz.com/book.jsp">');
document.write('<input type="text" id="query" name="query"  style="width:280px;"  /> ');
document.write('<select name="sale" id="sale">');
document.write('<option value="0" selected="selected">未售</option>');
document.write('<option value="1" >已售</option>');
document.write('</select> ');
document.write('<label><img onclick="searchSubmit()" style="cursor:pointer;" src="http://book.kongfz.com/images/bt_search_result.gif" alt="搜索" align="absmiddle" /> <a href="http://search.kongfz.com/book_adv.html" target="_blank" class="font12">高级搜索</a> <a href="http://search.kongfz.com/" target="_blank" class="font12">搜索首页</a></label>');
document.write('<input type="hidden" name="act" value="newSys" />');
document.write('</form>');
document.write('</span>'); 
document.write('</td>');
document.write('</tr>');
document.write('</table>');
document.write('</div>');

function $(id){return document.getElementById(id);}

//搜索
function searchSubmit()
{
	$('frmSearchShop').submit();
}

function processLiMouseOver(obj,indexId,normalImgUrl)
{
	var elts=document.getElementsByTagName('li');
    var count=0;
    var elements=[];
    for(var i=0;i<elts.length;i++)
    {
         if(elts[i].getAttribute("name")=="bookPicList")
         {
                  elements[count]=elts[i];
            elements[count++].className = "";
               }
    } 
	document.getElementById('bookBigPic').src =  normalImgUrl;	  		
	obj.className="on";
}

function processLiMouseOver(obj,indexId,normalImgUrl)
{
	var elts=document.getElementsByTagName('li');
    var count=0;
    var elements=[];
    for(var i=0;i<elts.length;i++)
    {
         if(elts[i].getAttribute("name")=="bookPicList")
         {
                  elements[count]=elts[i];
            elements[count++].className = "";
               }
    } 
	document.getElementById('bookBigPic').src =  normalImgUrl;	  		
	obj.className="on";
}


//联系店主
function contactWindow(siteMember, siteBook, shopId,shopName,userId,nickName,realName,phoneNum,mobile,areaName,address)
{
    var g_shopId = shopId;
    var g_shopName = shopName;
    var g_userId = userId;
    var g_nickName = nickName;
    var g_realName = realName;
    var g_phoneNum = phoneNum;
    var g_mobile = mobile;
    var g_areaName = areaName;
    var g_address = address;
    var g_sendMsg = '(<a href="'+ siteMember +'member/send_message.php?friendId='+userId+'" target="_blank">发消息</a>)';
    
    myForeWindow= new ForeWindow('contactDiv');
    document.getElementById("shopNameDiv").innerHTML = '<a href="'+ siteBook + shopId +'/" target="_blank">'+ g_shopName + '</a>';
    document.getElementById("realNameDiv").innerHTML = '<a href="'+ siteMember +'member/view_member_info.php?memberId='+userId+'" target="_blank">'+ g_realName + '</a>';
    document.getElementById("nickNameDiv").innerHTML = '<a href="'+ siteMember +'member/view_member_info.php?memberId='+userId+'" target="_blank">'+ g_nickName + '</a>';
    document.getElementById("phoneNum").innerHTML = g_phoneNum;
    document.getElementById("mobile").innerHTML = g_mobile;
    document.getElementById("areaName").innerHTML = g_areaName;
    document.getElementById("address").innerHTML = g_address;
    document.getElementById("sendMsgDiv").innerHTML = g_sendMsg;
    
    if(phoneNum != "")
    {
        document.getElementById("phoneNumDiv").style.display = "";
        document.getElementById("phoneNum").innerHTML = phoneNum;
    }

    if(mobile != "")
    {
        document.getElementById("mobileDiv").style.display = "";
        document.getElementById("mobile").innerHTML = mobile;
    }

    myForeWindow.show();
}

//显示店主相关信息的层
document.write('<div class="foreWindow" id="contactDiv" style="width:400px;">');
document.write('<div class="winTitlebar">店主相关信息：</div>');
document.write('<div class="winContent">');
document.write('<div >书店名称：<span  id="shopNameDiv"></span></div>');
document.write('<div >店主昵称：');
document.write('<span id="nickNameDiv" ></span>');
document.write('&nbsp;<span id="sendMsgDiv"></span>');
document.write('</div>');

document.write('<div >店主姓名：');
document.write('<span id="realNameDiv" ></span>');
document.write('</div>');

document.write('<div id="phoneNumDiv" style="display:none;">联系电话：');
document.write('<span id="phoneNum"></span>');
document.write('</div>');

document.write('<div id="mobileDiv" style="display:none;">手机：');
document.write('<span id="mobile"></span>');
document.write('</div>');

document.write('<div id="addressDiv">地址：');
document.write('<span id="areaName"></span>&nbsp;&nbsp;');
document.write('<span id="address"></span>');
document.write('</div>');

document.write('<input type="button" value="关 闭" onclick="myForeWindow.hide();"/>');

document.write('</div>');
document.write('</div>');


//加入购物车js
function addToShoppingCart(bookId,shopId,carDomain)
{
    var url = null;
    var random=Math.random();
    try
    {
        if(carDomain == null)
        {
            carDomain = "http://shop.kongfz.com/";
        }
    
        bookId = parseInt(bookId);
        shopId = parseInt(shopId);

        if(shopId > 0 && bookId > 0)
        {
            url = carDomain + "shopping_cart/shopping_cart.php?act=addBook&bookId="+bookId+"&shopId="+shopId+"&random="+random;
        }
        else
        {
            url = carDomain + "shopping_cart/shopping_cart.php?act=shoppingCartList"+"&random="+random;
        }
        var popup=window.open(url,"shoppingCartWindow");
        popup.focus();
    }
    catch (e)
    {

    }
}



var footerHtmlStr = '<a href="http://www.kongfz.com/help/aboutus.php" target="_blank">关于孔夫子</a> - <a href="http://help.kongfz.com/" target="_blank">网站帮助</a> -<a href="http://www.kongfz.com/help/guanggao.php" target="_blank"> 广告业务</a> -<a href="http://www.kongfz.com/help/zhaopin.php" target="_blank"> 诚聘英才</a> -<a href="http://www.kongfz.com/help/lianxi.html" target="_blank"> 联系我们</a> -<a href="http://www.kongfz.com/help/copyright.php" target="_blank"> 版权隐私</a> -<a href="http://shop.kongfz.com/advice.php?act=add" target="_blank"> 意见建议</a><br />'
 + '版权所有<span style="font-family:Arial;">©</span>2002-2010 孔夫子旧书网（<a href="http://www.kongfz.com/" target="_blank">www.kongfz.com</a>）<br />'
 + 'Copyright<span style="font-family:Arial;">©</span>All rights reserved 京ICP 041501&nbsp;&nbsp;客服电话：010-64755951';


window.onload = function()
{
    //默认第一个图片为当前状态显示
    if(document.getElementById("bookPicList0"))
    {
        document.getElementById("bookPicList0").className = 'on';
    }  
    
    document.getElementById("footer").innerHTML = footerHtmlStr;  
}

