﻿// JScript 文件

function addBookmark(title,url) {
    if (window.sidebar) { window.sidebar.addPanel(title, url,""); } 
    else if( document.all ) {window.external.AddFavorite( url, title);} 
    else if( window.opera && window.print ) {return true;}
}

function encome(tar){
    tar.href = encodeURI(tar.href);
}

function autoResize(){ 
    document.all["iframe2"].style.height=test.document.body.scrollHeight 
}

function turnHeight(iframe)
{
    var frm = document.getElementById(iframe);
    var subWeb = document.frames ? document.frames[iframe].document : frm.contentDocument;
    if(frm != null && subWeb != null)
    { frm.height = subWeb.body.scrollHeight + 20;}
}

//JS版的Server.UrlEncode编码函数
String.prototype.UrlEncode = function()
{
    var str = this;
    str = str.replace(/./g,function(sHex)
    {
        window.EnCodeStr = "";
        window.sHex = sHex;
        window.execScript('window.EnCodeStr=Hex(Asc(window.sHex))',"vbscript");
        return window.EnCodeStr.replace(/../g,"%$&");
    });
    return str;
}

function resize(){
    $(".newsTextContainer p img").each(function(){
        if(this.style) this.style.cssText = "margin:2px auto;";
        picResizeV2(this,600,900);
    });
}

$(document).ready(resize);
$(window).load(resize);

//三级域名分析
function getTitle(name,sex,domain)
{
    var result = "";
    var title = "";
    var url = "http://" + domain.toLowerCase() + ".ren.csfqw.com";
    if(sex == "男") title = "先生";
    if(sex == "女") title = "女士";
    if(domain != null && domain.length > 0)
    {
        result = name + title + "在本站的网址：" + url;
        result += " &nbsp; <a href=\"#\" onclick=\"javascript:addBookmark('" + name + title + "资料大全','" + url + "');return false;\">收藏</a>";
        result += ",<a href=\"#\" onclick=\"javascript:clipboardData.setData('Text','" + url + name + title + "资料大全');return false;\">复制</a>";
    }
    return result;
}