﻿//设为首页
var sethomepage = function(url){
    if (document.all){  
        document.body.style.behavior="url(#default#homepage)";  
        document.body.setHomePage(window.location.href);  
    }else if (window.sidebar){  
        if(window.netscape){  
            try{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");}
            catch (e){alert("该操作被浏览器拒绝，如果想启用该功能，请在地址栏内输入 about:config,然后将项 signed.applets.codebase_principal_support 值该为true");}
        }
        var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components. interfaces.nsIPrefBranch);
        prefs.setCharPref("browser.startup.homepage",window.location.href);
    }else{alert("您的浏览器不支持自动设置首页, 请使用浏览器菜单手动设置!");}
}
//加入收藏
var addfav = function(){
    if (document.all){  
        try{window.external.addFavorite(window.location.href,document.title);}
        catch(e){alert("加入收藏失败，请使用Ctrl+D进行添加");}
    }else if (window.sidebar){
        window.sidebar.addPanel(document.title, window.location.href, "");
    }else{alert("加入收藏失败，请使用Ctrl+D进行添加");}
}
var loadExpData=function(fid,url){
var xmlhttp;
if(window.XMLHttpRequest)
    {xmlhttp=new XMLHttpRequest();}
else
    {xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}

xmlhttp.onreadystatechange=function(){
    if(xmlhttp.readyState==4 && xmlhttp.status==200)
    {
        document.getElementById(fid).innerHTML=xmlhttp.responseText;
    }
}
xmlhttp.open("GET",url,true);
xmlhttp.send();
}
//缩放超过规格图片
var imagesLoaded = function(myimg){
    var mywidth = 600;
    var myheight = 1000;
    var tmp_img = new Image();
    tmp_img.src = myimg.src;
    image_x = tmp_img.width;
    image_y = tmp_img.height;
    if (image_x > mywidth) {
        tmp_img.height = image_y * mywidth / image_x;
        tmp_img.width = mywidth;
        if (tmp_img.height > myheight) {
            tmp_img.width = tmp_img.width * myheight / tmp_img.height;
            tmp_img.height = myheight;
        }
    } else if (image_y > myheight) {
        tmp_img.width = image_x * myheight / image_y;
        tmp_img.height = myheight;
        if (tmp_img.width > mywidth) {
            tmp_img.height = tmp_img.height * mywidth / tmp_img.width;
            tmp_img.width = mywidth;
        }
    }
    myimg.width = tmp_img.width;
    myimg.height = tmp_img.height;
}

var showSearch=function(){
document.writeln("<form action=\"http://www.55126.cn/in.aspx\" method=\"post\" target=\"_blank\">");
document.writeln("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"margin-top:2px;font-size:13px;\">");
document.writeln("<tr>");
document.writeln("<td width=\"50\" height=\"23\" style=\"padding:0px 0px 0px 2px;\"><a href=\"http://www.55126.cn/in.aspx?userid=2\" target=\"_blank\"><img src=\"/images/logo_code_2.gif\" width=\"49\" height=\"23\" border=\"0\" align=\"absmiddle\" /></a></td>");
document.writeln("<td width=\"189\" style=\"padding:0px 0px 0px 3px;\"><input name=\"keyword\" type=\"text\" id=\"keyword\" style=\"padding:1px;font-size:13px;width:120px;\" />");
document.writeln("<input name=\"enter\" type=\"submit\" id=\"enter\" value=\"搜索\" style=\"background:#F0F0F0;border-top:1px solid #FEFEFE;border-right:1px solid #666666;border-bottom:1px solid #666666;border-left:1px solid #FEFEFE;padding-top:1px;width:40px;height:20px;font-size:12px;cursor:pointer;color:#004D94;\" />");
document.writeln("<input type=\"hidden\" name=\"searchtype\" value=\"1\" />");
document.writeln("<input type=\"hidden\" name=\"userid\" value=\"2\" /></td>");
document.writeln("<td width=\"170\" style=\"padding:4px 0px 0px 4px;\"> <a href=\"http://www.55126.cn/so.aspx?wd=%B2%D8%BB%FA%CD%BC&userid=2\" target=\"_blank\"  style=\"color:#0066FF;text-decoration:underline;\">藏机图</a> <a href=\"http://www.55126.cn/so.aspx?wd=%B2%BC%D2%C2&userid=2\" target=\"_blank\" style=\"color:#0066FF;text-decoration:underline;\">布衣</a> <a href=\"http://www.55126.cn/so.aspx?wd=%BD%E2%CC%AB%BA%FE\" target=\"_blank\" style=\"color:#ff0000;text-decoration:underline;\">解太湖</a> <a href=\"http://www.55126.cn/so.aspx?wd=%BB%E3%D7%DC\" target=\"_blank\" style=\"color:#0066FF;text-decoration:underline;\">汇总</a></td>");
document.writeln("</tr>");
document.writeln("</table>");
document.writeln("</form>");
}
