﻿function addFlash(m_width,m_height,m_style,m_src,m_flashvars)
{
    document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' width="+m_width+" height="+m_height+" style=\"margin:0px;"+m_style+"\">");
    document.write("<param name='movie' value='"+m_src+"' />");
    document.write("<param name='quality' value='high' />");
    document.write("<param name='menu' value='false' />");
    document.write("<param name='wmode' value='transparent' /> ");
    document.write("<param name='flashvars' value='"+m_flashvars+"' /> ");    
    document.write("</object>");
}

//收藏
function mark(){
	bookmark(window.location,document.title);
}
function bookmark(sURL, sTitle)
{
    try {    
        window.external.AddFavorite(sURL, sTitle);
    }
    catch (e){
        try {
            window.sidebar.addPanel(sTitle, sURL, "");
        }
        catch (e) {
            alert("加入收藏失败，请使用Ctrl+D进行添加");
        }
    }
}
//设为首页
function setHome(This){
    This.style.behavior='url(#default#homepage)';
    This.setHomePage(window.location);
}


function flashNew(width,height,pics,titles,links){
    //csdn:addFlash(width,height,"background:#000000","/res/pic.swf","pic_width="+width+"&pic_height="+height+"&pics="+pics+"&links="+links+"&texts="+titles+"&show_text=0&txtcolor=000000&bgcolor=666666&button_pos=4&stop_time=3000&border=0");
    if (titles.length > 6) {
        addFlash(width, height, "background:#eeeeee","/res/pixviewer.swf",
            "borderwidth=" + width + "&borderheight=" + (height - 18) + "&pics=" + pics + "&links=" + links + "&texts=" 
            + titles + "&textheight=18&curhref=http://www.sina.com.cn");
    } else {
        addFlash(width, height, "background:#eeeeee", "/res/pixviewer.swf",
            "borderwidth=" + width + "&borderheight=" + height + "&pics=" + pics + "&links=" + links + "&texts=" 
            + titles + "&textheight=0&curhref=http://www.sina.com.cn");
    }
  //pics=&links=&texts=&borderwidth=306&borderheight=169&textheight=0&curhref=
}


//BannerShow
function BannerShow() {
    this.mID = null;
    this.timer = null;
    this.mHtml = "";
    this.Img = new Array();
    this.Title = new Array();
    this.Address = new Array();
    this.index = -1;
    //添加图片
    this.AddImage = function(img, title, address) {
        this.Img[this.Img.length] = img;
        this.Title[this.Title.length] = title;
        this.Address[this.Address.length] = address;
    }
    //开始播放
    this.playNext = function() {

        this.index++;
        if (this.index >= this.Img.length) this.index = 0;
        for (var i = 0; i < this.Img.length; i++) {
            if (i == this.index) {
                document.getElementById(this.mID + "img" + i).filters.blendTrans.apply();
                document.getElementById(this.mID + "img" + i).style.visibility = "visible";
                document.getElementById(this.mID + "img" + i).filters.blendTrans.play();
            } else {
                document.getElementById(this.mID + "img" + i).filters.blendTrans.apply();
                document.getElementById(this.mID + "img" + i).style.visibility = "hidden";
                document.getElementById(this.mID + "img" + i).filters.blendTrans.play();
            }
        }
    }
    //开始构建
    this.create = function(id, width, height) {
        this.mID = id;
        this.mHtml = "<div id='" + id + "' style='width:" + width + "px;height:" + height + "px;position:relative;overflow:hidden;'>";
        for (var i = 0; i < this.Img.length; i++) {
            this.mHtml = this.mHtml + "<a href='" + this.Address[i] + "' title='" + this.Title[i] + "' target='_blank'><img alt='" + this.Title[i] + "' id='" + id + "img" + i + "' src='" + this.Img[i] + "' style='width:100%;height:100%;position:absolute;top:0px;left:0px;margin:0px;FILTER: blendTrans(duration=1);border:0px;"
            if (i != 0) this.mHtml = this.mHtml + "visibility:hidden;"; //将第一个设为可见
            this.mHtml = this.mHtml + "' /></a>";
        }
        this.mHtml = this.mHtml + "</div>";
        document.write(this.mHtml);
    }
    //播放
    this.play = function() {
        if (this.timer == null) {
            var self = this;
            this.timer = setInterval(function() { self.playNext(); }, 5000);
        }
    }
    //停止
    this.stop = function() {
        clearInterval(this.timer);
        this.timer = null;
    }
    //调用构建


}


///***********************************************************
//在线客服
function hideKF() {
    document.getElementById("kfdiv").style.display = "none";
}
function KF(qq, info) {
    var _self = this;
    //飘动    
    this.move = function() {
        var img = document.getElementById("kfdiv").style.top = 80 + document.documentElement.scrollTop; //80+document.body.scrollTop;
    }

    //输出对象
    var html = "<div id='kfdiv' style='top:80px;cursor:hand;position:absolute;width:100px;height:198px;right:3px; background:url(\"/res/user_kf.gif\") no-repeat;' >\r\n";
    html += ("<a href='tencent://message?uin=" + qq + "' style='display:block;height:120px;border:0px solid red;'>&nbsp;</a><div style='cursor:hand;position:absolute;width:90px;height:70px;border:0px solid red;left:5px;top:115px;overflow:hidden;'>" + info + "</div>");
    html += ("<img title='点击此处关闭' src='/res/close.gif' onclick='hideKF()' style='color:blue;position:absolute;bottom:1px;left:2px;' />");
    html += ("</div>\r\n");
    document.write(html);
    //设置事件
    window.onscroll = function() { _self.move(); }
    window.onresize = function() { _self.move(); }

}

//专汽之都客服
function ZycKf() {
    this.add = function(qq, title) {
        document.getElementById("kfcontent").innerHTML += ("<a style=\"background:url(/res/kf_button.gif);font-family:宋体;width:89px;height:24px; display:block;margin-top:3px; text-align:left;color:White; text-indent:30px;\" href=\"tencent://message?uin=" + qq + "\" >" + title + "</a>");
    }
    this.move = function() {
        document.getElementById("zyc1kfdiv").style.top = 30 + document.documentElement.scrollTop; //80+document.body.scrollTop;
    }
    this.show = function() {
        var html = ("<div id=zyc1kfdiv style='width:95px;height:121px; position:absolute;  right:2px;top:2px; background:url(/res/kf.gif); text-align:center;line-height:24px;'></div>");
        var elc = document.createElement(html);
        document.body.appendChild(elc);
        document.getElementById("zyc1kfdiv").innerHTML = "<center><div id='kfcontent' style='border:2px solid #000000;border-top:0px;padding-bottom:3px;margin-top:30px;background:#C6C4C4;'></div></center>";
        var _self = this;
        window.onscroll = function() { _self.move(); }
        window.onresize = function() { _self.move(); }
    }
    this.show();
}


//===================禁止选择网页内容，屏蔽右键==========
//调用方式：<script>DeSelect();</script>
function DeSelect() {
    this.__szft_empty=function() {
        document.selection.empty();
    }
    this.__szft_return_false = function() {
        return false;
    }
	this.__EventsBind=function(){
		try{
			document.body.oncontextmenu = this.__szft_return_false;
			document.body.ondragstart = this.__szft_return_false;
			document.body.onselectstart = this.__szft_return_false;
			document.body.onselect = this.__szft_empty;
			document.body.oncopy = this.__szft_empty;
			document.body.onbeforecopy = this.__szft_return_false;
			document.body.onmouseup = this.__szft_empty;
		}
		catch(e){
			//屏蔽失败
		}
	}
	this.__EventsBind();
}
