﻿var currentUserID       =       0;
var currentUserName     =       "";
var currentBlogUserID   =       0;
var currentBlogUserName =       "";
var baseDomain          =       "";
var baseUrl             =       "";
var baseResourceUrl     =       "";

/* 用户数据路径 */
var userHeadUrl         =   baseResourceUrl + "Image/Head/";
var userAlbumUrl        =   baseResourceUrl + "Image/Photo/";
var userVideoUrl        =   baseResourceUrl + "Video/User/";


/* 全局css名字定义 */
var css_lnk_hover = "lnkhoverstyle";
var css_lnk_unhover = "lnkkunhoverstyle";
var css_btn_hover = "btnhoverstyle";

var css_lnk = "jb_lnk";
var css_right_title = "right_content_title";
var css_small_btn = "jb_small_btn";


/* 大平台视频 */
var video_companyinfo = "pacompany.flv";
var video_companyinfozb = "zbcompany.flv";
var video_recommand = "parecommand.flv";
var video_recommandzb = "zbrecommand.flv";
var video_companyinfotk = "tkcompany.flv";
var video_recommandtk = "tkrecommand.flv";
//太平保险
var video_companyinfotp = "tpcompany.flv";
var video_recommandtp = "tprecommand.flv";
//太平洋保险
var video_companyinfotpy = "tpycompany.flv";
var video_recommandtpy = "tpyrecommand.flv";
// 保险通用
var video_companyinfoty = "tycompany.flv";
// 美国万通
var video_companyinfowt = "wtcompany.flv";
var video_recommandwt = "wtrecommand.flv";
// 新华保险
var video_companyinfoxh = "xhcompany.flv";
var video_recommandxh = "xhrecommand.flv";
// 友邦保险
var video_companyinfoyb = "ybcompany.flv";
var video_recommandyb = "ybrecommand.flv";

// 信诚保险
var video_recommandxc = "xcrecommand.flv";
// 加入我们
var video_joinus = "joinus.flv";
//阳光保险
var video_recommandyg = "yg.flv";

//合众保险
var video_hzrecommand = "hz_vdieo_822.flv";

// 平安热门推荐
var pa_video_769 = "pa_video_769.flv";
var pa_video_711 = "pa_video_711.flv";
//var pa_video_714 = "pa_video_714.flv";
var pa_video_491 = "pa_video_491.flv";
var pa_video_366 = "pa_video_366.flv";
var pa_video_110 = "pa_video_110.flv";
var pa_video_116 = "pa_video_116.flv";
var pa_video_122 = "pa_video_122.flv";
var pa_video_108 = "pa_video_108.flv";
var pa_video_494 = "pa_video_494.flv";
var al_video_744 = "al_video_744.flv"
var pa_video_727 = "pa_video_727.flv";

window.__flash__removeCallback=function(instance,name){try{if(instance)instance[name]=null}catch(flashEx){}};function DisplayFlv(video_name,ele_id,width,height,nomenu){var s1;if(video_name.split(".")[1]=="flv"){s1=new SWFObject(baseResourceUrl+"Video/player.swf","ply",""+width,""+height,"9","#FFFFFF");s1.addParam("autostart","true");if(nomenu){s1.addParam("scale","noscale");s1.addParam("menu","false");s1.addParam("loop","true");s1.addParam("autoplay","true");s1.addParam("allowfullscreen","true");s1.addParam("allowscriptaccess","always")}else{s1.addParam("autoplay","true");s1.addParam("allowfullscreen","true");s1.addParam("allowscriptaccess","always")}s1.addParam("flashvars","file="+baseResourceUrl+"Video/"+video_name);s1.write(ele_id)}else if(video_name.split(".")[1]=="swf"){s1=new SWFObject(baseResourceUrl+"Video/"+video_name,"ply",""+width,""+height,"9","#FFFFFF");if(nomenu){s1.addParam("scale","noscale");s1.addParam("menu","false");s1.addParam("loop","true");s1.addParam("autoplay","true")}else{s1.addParam("allowfullscreen","true");s1.addParam("allowscriptaccess","always")}s1.write(ele_id)}}function AddFavorite(sURL,sTitle){try{window.external.addFavorite(sURL,sTitle)}catch(e){try{window.sidebar.addPanel(sTitle,sURL,"")}catch(e){alert("加入收藏失败，请使用Ctrl+D进行添加")}}};function SetHome(obj,vrl){try{obj.style.behavior='url(#default#homepage)';obj.setHomePage(vrl)}catch(e){if(window.netscape){try{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect")}catch(e){alert(" 此操作被浏览器拒绝！\n请在浏览器地址栏输入“about:config”并回车\n然后将 [signed.applets.codebase_principal_support]的值设置为'true',双击即可。")}var prefs=Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);prefs.setCharPref('browser.startup.homepage',vrl)}}};function getiev(){var userAgent=window.navigator.userAgent.toLowerCase();$.browser.msie8=$.browser.msie&&/msie 8\.0/i.test(userAgent);$.browser.msie7=$.browser.msie&&/msie 7\.0/i.test(userAgent);$.browser.msie6=!$.browser.msie8&&!$.browser.msie7&&$.browser.msie&&/msie 6\.0/i.test(userAgent);var v;if($.browser.msie8){v=8}else if($.browser.msie7){v=7}else if($.browser.msie6){v=6}else{v=-1}return v};function JuBao_PageInit(){$(".LoginButton").bind("click",function(){location.href="Login.aspx";return false});$(".ExitButton").bind("click",function(){location.href="LogOut.aspx";return false});if(currentUserID>0){$("#BackToPage").bind("click",function(){location.href=baseUrl+"Pages/AdminUser.aspx";return false}).show();$(".LoginButton").hide();$(".ExitButton").show();$("#AdminUserCenter").show();$("#AdminUserDesign").show();$(".adminope").show()}else{$(".LoginButton").show().css("left","900px");$(".ExitButton").hide();$("#AdminUserCenter").hide();$("#AdminUserDesign").hide();$(".adminope").hide();$("#BackToPage").hide()}$(".jb_lnk").hover(function(){$(this).addClass(css_lnk_hover)},function(){$(this).removeClass(css_lnk_hover)});$(".jb_small_btn").hover(function(){$(this).addClass(css_btn_hover)},function(){$(this).removeClass(css_btn_hover)});$(".jb_input_numonly").keyup(function(){var tmptxt=$(this).val();$(this).val(tmptxt.replace(/\D/g,''))}).bind("contextmenu",function(){return false});$("textarea").keypress(function(e){if(e.which==13){var inputstr=$(this).text();$(this).text(inputstr+"<br>");return false}});currentBlogUserID=$("#hidden_bloguserid").text();var v=getiev();if(v>0){$(document.body).addClass("ie ie"+v)}};function SetUserSession(uid,name){currentUserID=uid;currentUserName=name};function SetBaseDomain(_domain){baseDomain=_domain;baseUrl="http://"+baseDomain+"/JuBao/";baseResourceUrl="http://180.235.64.229/";userHeadUrl=baseResourceUrl+"Image/Head/";userAlbumUrl=baseResourceUrl+"Image/Photo/";userVideoUrl=baseResourceUrl+"Video/User/"};function SetBlogUserID(id,name){currentBlogUserID=id;currentBlogUserName=name};function OpenModelWindow(url,option){var fun;try{if(parent!=null&&parent.$!=null&&parent.$.ShowIfrmDailog!=undefined){fun=parent.$.ShowIfrmDailog}else{fun=$.ShowIfrmDailog}}catch(e){fun=$.ShowIfrmDailog}fun(url,option)};function CloseModelWindow(callback,dooptioncallback){parent.$.closeIfrm(callback,dooptioncallback)};function StrFormat(temp,dataarry){return temp.replace(/\{([\d]+)\}/g,function(s1,s2){var s=dataarry[s2];if(typeof(s)!="undefined"){if(s instanceof(Date)){return s.getTimezoneOffset()}else{return encodeURIComponent(s)}}else{return""}})};function StrFormatNoEncode(temp,dataarry){return temp.replace(/\{([\d]+)\}/g,function(s1,s2){var s=dataarry[s2];if(typeof(s)!="undefined"){if(s instanceof(Date)){return s.getTimezoneOffset()}else{return(s)}}else{return""}})};function FixImageSize(ele,width,height){var left_offset=0;var path=ele.attr("src");var mw=width;var mh=height;img=new Image();img.src=path;w=img.width;h=img.height;if(w==0||h==0)w=h=0;else{h=h*mw/w;w=mw;if(h>mh){var tmp=w*mh/h;left_offset=(w-tmp)/2;w=tmp;h=mh}}ele.attr("width",w).attr("height",h).css("padding-left",left_offset)};var popUpWin=0;function PopUpWindow(URLStr,left,top,width,height,newWin,scrollbars){if(typeof(newWin)=="undefined")newWin=false;if(typeof(left)=="undefined")left=100;if(typeof(top)=="undefined")top=0;if(typeof(width)=="undefined")width=800;if(typeof(height)=="undefined")height=760;if(newWin){open(URLStr,'','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars='+scrollbars+',resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');return}if(typeof(scrollbars)=="undefined"){scrollbars=0}if(popUpWin){if(!popUpWin.closed)popUpWin.close()}popUpWin=open(URLStr,'popUpWin','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars='+scrollbars+',resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');popUpWin.focus()}function Check(event,regex){e=window.event||event;var k=e.keyCode||e.which;　　var objRegex=regex;　　if(String.fromCharCode(k).match(objRegex)==null)　　{　　　　if(window.event){event.returnValue=false}else{e.preventDefault()}return false;　　}};function valClip(ev,regex,control){var content=clipboardData.getData("Text");if(content!=null){try{var test=parseInt(content);var str=""+test;if(content.match(regex)==null){clipboardData.setData("Text","")}}catch(e){alert("粘贴出现错误!")}}doPaste(control)}function doPaste(control){maxLength=control.attributes["maxLength"].value;value=control.value;if(maxLength){event.returnValue=false;maxLength=parseInt(maxLength);var oTR=control.document.selection.createRange();var iInsertLength=maxLength-value.length+oTR.text.length;var sData=window.clipboardData.getData("Text").substr(0,iInsertLength);oTR.text=sData}};function loadPage(){if($(".leftpart")!=undefined){if($(".leftpart").length>0){var leftHeight=$(".leftpart")[0].offsetHeight}else{var leftHeight=0}}else{var leftHeight=0}if($(".page_content")!=undefined){if($(".page_content").length>0){var bodyHeight=$(".page_content")[0].offsetHeight}else{var bodyHeight=0}}else{var bodyHeight=0}if($(".rightpart")!=undefined){if($(".rightpart").length>0){var rightHeight=$(".rightpart")[0].offsetHeight}else{var rightHeight=0}}else{var rightHeight=0}if($(".head")!=undefined){if($(".head").length>0){var headHeight=$(".head")[0].offsetHeight}else{var headHeight=0}}else{var headHeight=0}if($(".header")!=undefined){if($(".header").length>0){var headerHeight=$(".header")[0].offsetHeight}else{var headerHeight=0}}else{var headerHeight=0}if($(".menu")!=undefined){if($(".menu").length>0){var menuHeight=$(".menu")[0].offsetHeight}else{var menuHeight=0}}else{var menuHeight=0}var height=0;if(leftHeight>=bodyHeight&&leftHeight>=rightHeight){height=leftHeight}if(bodyHeight>=leftHeight&&bodyHeight>=rightHeight){height=bodyHeight}if(rightHeight>=bodyHeight&&rightHeight>=leftHeight){height=rightHeight}$(".pagebody")[0].style.height=height+headHeight+menuHeight+headerHeight+30};

//用户使用协议
function ReadMe()
{
    if($("#ReadMeCheckBox").attr("checked")==false)
    {
        alert("必须同意保保网用户使用协议！");
        return false;
    }
    return true;
}

//执行键盘按键命令
function KeyDown(e,btnloginID)
{ 
var keycode = "0";
//IE浏览器
if(CheckBrowserIsIE())
{
keycode = event.keyCode;
}
else
{
//火狐浏览器
keycode = e.which;
}
if (keycode == "13")  //回车键是13
{
document.getElementById(btnloginID).focus();
//document.getElementById(btnloginID).click();
return;
}
}

//判断访问者的浏览器是否是IE
function CheckBrowserIsIE()
{
var result = false;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer")
{
result = true;
}
return result;
}


//首页顶部大公告栏
$(document).ready(function(){
    $(".flip").click(function(){
        $(".panel").slideToggle("slow");
        if ($("#expand")[0].className == "flip show")
        {
            $("#expand").removeClass("show");
            $("#expand").addClass("hide");
            $("#marqueeshow").css("display","none"); 
            document.getElementById("expand").innerText = "点此收起";
        }
        else
        {
            $("#expand").removeClass("hide");
            $("#expand").addClass("show");
            $("#marqueeshow").css("display",""); 
            document.getElementById("expand").innerText = "点此展开";
        }
      });
      
      $(".forblog").click(function(){
        $(".panel").slideToggle("slow");
        if ($("#expand")[0].className == "notice-right show")
        {
            $("#expand").removeClass("show");
            $("#expand").addClass("hide");
            $("#marqueeshow").css("display","none"); 
            document.getElementById("expand").innerText = "点此收起";
        }
        else
        {
            $("#expand").removeClass("hide");
            $("#expand").addClass("show");
            $("#marqueeshow").css("display",""); 
            document.getElementById("expand").innerText = "点此展开";
        }
      });
      //招聘公告栏
      $(".forjob").click(function(){
        $(".panel1").slideToggle("slow");
        if ($("#expandjob")[0].className == "notice-right show forjob")
        {
            $("#expandjob").removeClass("show");
            $("#expandjob").addClass("hide");
            $("#marqueeshowjob").css("display","none"); 
            document.getElementById("expandjob").innerText = "点此收起";
        }
        else
        {
            $("#expandjob").removeClass("hide");
            $("#expandjob").addClass("show");
            $("#marqueeshowjob").css("display",""); 
            document.getElementById("expandjob").innerText = "点此展开";
        }
      });
    });
    

    
function AddToFavorite(url, title) {   //加入收藏夹
    var url = location.href;
    if  (document.all) {
        window.external.addFavorite(url, title);
    }
     else   if  (window.sidebar) {
    window.sidebar.addPanel(title, url,  "" );
    }   
}

//验证留言
function CheckMessage()
{
    var name = $("#ctl00_ctl00_MainContent_txtMessageName").val().trim();
    //var content = $("#ctl00_ctl00_MainContent_txtMessageContent").text().trim();
    var content = document.getElementById("ctl00_ctl00_MainContent_txtMessageContent").value.trim();
    if (name == "")
    {
        alert("姓名不能为空！");
        $("#ctl00_ctl00_MainContent_txtMessageName").focus();
        return false;
    }
    if (content == "")
    {
        alert("内容不能为空！");
        $("#ctl00_ctl00_MainContent_txtMessageContent").focus();
        return false;
    }
    return true;
}

//查询输入字数
function CountWords(param)
{
    var maxLength = 500;
    //var words = $.trim($("#"+param.id).text());
    //var words = document.getElementById(param.id).value.trim();
    var words = document.getElementById("ctl00_ctl00_MainContent_txtMessageContent").value.trim();
    var length = words.length;
    
    if (length > maxLength)
    {
        alert("对不起，您的留言字数超过规定值！");
        words = $.trim(words.substr(0,maxLength));
        length = words.length;
        $("#"+param.id).text(words);
        document.getElementById(param.id).value = words;
    }
    
    $("#wordCount")[0].innerHTML = length;
}


function resizeHeadImg(ImgD,iwidth,iheight) { 
     var image=new Image(); 
     image.src=ImgD.src;
     if(image.width>=iwidth || image.height>=iheight){ 
        ImgD.width = iwidth;
        ImgD.height = iheight;
    } 
    else {
        ImgD.width = "141";
        ImgD.height = "200";
    }
}

function resizeimg(ImgD,iwidth,iheight) { 
     var image=new Image(); 
     image.src=ImgD.src; 
     if(image.width>0 && image.height>0){ 
        if(image.width/image.height>= iwidth/iheight){ 
           if(image.width>iwidth){ 
               ImgD.width=iwidth; 
               ImgD.height=(image.height*iwidth)/image.width; 
           }else{ 
                  ImgD.width=image.width; 
                  ImgD.height=image.height; 
                } 
               ImgD.alt=image.width+"×"+image.height; 
        } 
        else{ 
                if(image.height>iheight){ 
                       ImgD.height=iheight; 
                       ImgD.width=(image.width*iheight)/image.height; 
                }else{ 
                        ImgD.width=image.width; 
                        ImgD.height=image.height; 
                     } 
            } 
    } 
}
