(function(d){if(typeof STK=="undefined"){STK=new Object()}if(typeof Config=="undefined"){Config=new Object()}var c=new Object();var b=new Object();var a=new Object();a.urlMenuMap={};d.extend(d,{offHeight:function(){if(d.browser.msie){return document.documentElement.clientHeight}else{return window.innerHeight}},stopBubble:function(f){if(f&&f.stopPropagation){f.stopPropagation()}else{window.event.cancelBubble=true}},stopDefault:function(f){if(f&&f.preventDefault){f.preventDefault()}else{window.event.returnValue=false}return false},setCookie:function(h){var g=d.extend({key:"",value:"",path:"/",domain:"",expireDay:-1,today:false,secure:false},h);if(g.key!=""){var f=new Array();f.push(g.key);f.push("=");f.push(encodeURIComponent(g.value));f.push("; path=");f.push(g.path);if(g.domain!=""){f.push("; domain=");f.push(g.domain)}if(g.expireDay>0){var e=new Date();if(g.today){e.setHours(0,0,0,0)}e.setTime(e.getTime()+g.expireDay*24*60*60*1000);f.push("; expires=");f.push(e.toGMTString())}else{if(g.expireDay==0){var e=new Date();e.setTime(e.getTime()-1);f.push("; expires=");f.push(e.toGMTString())}}if(g.secure){f.push("; secure")}document.cookie=f.join("")}},getCookie:function(e){var f=document.cookie.match("(?:^|;)\\s*"+e.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1")+"=([^;]*)");return f?decodeURIComponent(f[1]):false},delCookie:function(e){d.setCookie({key:e,expireDay:0})}});d.extend(d.fn,{autoFloatFixed:function(n){var g=d.extend({speed:"slow",top:false,bottom:false,beforeSlideDo:null,afterSlideDo:null},n);var j=d(this);var h=true;var l=false;j.css({position:"absolute"});if((typeof g.top=="number"||typeof g.top=="string")&&/^[0-9]+%?$/.test(g.top)){l=true;if(/^[0-9]+%$/.test(g.top)){h=false;g.top=parseFloat(g.top.replace("%",""));j.css({bottom:"auto",top:g.top+"%"})}else{j.css({bottom:"auto",top:g.top+"px"})}}else{if((typeof g.bottom=="number"||typeof g.bottom=="string")&&/^[0-9]+%?$/.test(g.bottom)){if(/^[0-9]+%$/.test(g.bottom)){h=false;g.bottom=parseFloat(g.bottom.replace("%",""));j.css({bottom:g.bottom+"%",top:"auto"})}else{j.css({bottom:g.bottom+"px",top:"auto"})}}else{return}}if(g.speed===0&&!(d.browser.msie&&d.browser.version=="6.0")){j.css({position:"fixed"});return}var e=0;var f=0;var o;var i;d(window).scroll(function(){j.stop(true);k()});function k(){m();if(g.beforeSlideDo){g.beforeSlideDo()}if(g.speed===0){j.css(i)}else{j.animate(i,g.speed,function(){if(g.afterSlideDo){g.afterSlideDo(f)}})}}function m(){if(d.browser.msie){e=document.documentElement.clientHeight;if(d.browser.version=="6.0"){d("body").find("select").css("visibility","hidden")}}else{e=window.innerHeight}if(typeof window.pageYOffset!="undefined"){f=window.pageYOffset}else{if(typeof document.compatMode!="undefined"&&document.compatMode!="BackCompat"){f=document.documentElement.scrollTop}else{if(typeof document.body!="undefined"){f=document.body.scrollTop}}}if(l){if(h){o=(f+g.top)+"px"}else{o=(f+g.top*e/100)+"px"}i={top:o}}else{if(h){o=(f+g.bottom)+"px"}else{o=(((f+e)-(1-g.bottom)*e/100))+"px"}i={bottom:o}}}}});d.extend(c,{init:function(g){for(var f=0;f<STK_Css[g.css].common.length;f++){document.write('<link type="text/css" rel="stylesheet" href="'+STK_Setting.urlPath+STK_Css[g.css].common[f]+'"/>')}Config.setCurCss(g.css);var e=STK_Lng[g.language];d(function(){a.ajaxLoading=d('<div class="Ajax-loading" style="display:block">'+e.loading+"</div>");a.ajaxLoading.appendTo("body");c.changeLng(g.language);Config.setCurLanguage(g.language);d("#J_main_menu").show();c.initMainDiv();STK.go(g.defaultUrl);a.curMenuName=g.defaultMenu;d("#J_common-iframe").load(function(){a.ajaxLoading.hide();var i=window.frames["J_common-iframe"].window.location.href;if(i){var h=i.split("?")[0];a.urlMenuMap[h]=a.curMenuName}c.changeMenuSelectByUrl(i)});d("#J_common_floatmenubar").autoFloatFixed({speed:0,top:0,left:0});d("#J_common_expopt").autoFloatFixed({speed:0,top:"50%",left:155});d("#J_common_expopt").click(function(){if(d(this).hasClass("common-nav-opt-close")){d(this).removeClass("common-nav-opt-close").addClass("common-nav-opt-open");d("#J_common_aside").addClass("common-aside-contract");d("#J_common_floatmenubar").hide();d("#J_common_main_frame").addClass("main-frame-contract")}else{d(this).removeClass("common-nav-opt-open").addClass("common-nav-opt-close");d("#J_common_aside").removeClass("common-aside-contract");d("#J_common_floatmenubar").show();d("#J_common_main_frame").removeClass("main-frame-contract")}})});STK.resize(c.initMainDiv)},changeLng:function(e){d("#J_main_menu").children("li").children("a").each(function(){var g=d(this).attr("id");if(typeof g!="string"){return}var f=g.split("_")[2];if(STK_Lng[e].menu[f]){d(this).children("span").html(STK_Lng[e].menu[f])}});a.ajaxLoading.html(STK_Lng[e].loading)},changeMenuSelectByUrl:function(e){for(var f in STK_Setting.menuUrlHiglight){if(e.indexOf(f)>=0){STK.switchMenu(STK_Setting.menuUrlHiglight[f]);return}}},initMainDiv:function(){var e=d.offHeight();d("#J_common_main_frame").css({height:e+"px"})},JsonToQueryString:function(f){var e=[];for(var g in f){e.push(g+"="+f[g])}return e.join("&")}});d.extend(Config,{getBrokerId:function(){return b.brokerId},setBrokerId:function(e){b.brokerId=e},getStkCode:function(){return b.stkCode},setStkCode:function(e){b.stkCode=e},getAnalystId:function(){return b.analystId},setAnalystId:function(e){b.analystId=e},getCurCss:function(){return b.curCss},setCurCss:function(e){b.curCss=e},getCurLanguage:function(){return b.curLanguage},setCurLanguage:function(e){b.curLanguage=e}});d.extend(STK,{init:function(l){if(typeof STK_Lng=="undefined"){alert("\u914d\u7f6e\u6587\u4ef6\u52a0\u8f7d\u5931\u8d25\uff0c\u8bf7\u91cd\u65b0\u5c1d\u8bd5!");return}var k=d.getCookie("stk_css");var j=d.getCookie("stk_language");if(typeof k!="string"||typeof STK_Css[k]=="undefined"){d.delCookie("stk_css")}else{if(typeof STK_Css[l.css]!="undefined"){d.delCookie("stk_css")}else{l.css=k}}if(typeof j!="string"||typeof STK_Lng[j]=="undefined"){d.delCookie("stk_language")}else{if(typeof STK_Lng[l.language]!="undefined"){d.delCookie("stk_language")}else{l.language=j}}var h=d.extend({language:"zh_cn",css:"s1",urlPath:"",cssVersion:"",defaultUrl:"iframe/stock01.jsp",defaultMenu:"stock"},l);STK_Setting.urlPath=h.urlPath;if(typeof h.cssVersion!=undefined&&d.trim(h.cssVersion.toString()).length>0){for(var n in STK_Css){for(var f=0;f<STK_Css[n].common.length;f++){var k=STK_Css[n].common[f];if(k.indexOf("?")>0){k+="&v="+d.trim(h.cssVersion.toString())}else{k+="?v="+d.trim(h.cssVersion.toString())}STK_Css[n].common[f]=k}}}var e={};for(var n in STK_Setting.menuUrlHiglight){for(var g=0;g<STK_Setting.menuUrlHiglight[n].length;g++){e[STK_Setting.menuUrlHiglight[n][g]]=n}}STK_Setting.menuUrlHiglight=e;c.init(h);d(function(){d("#J_main_menu li a").each(function(){d(this).click(function(t){d.stopDefault(t);var s=d(this).attr("id");var r=d(this).attr("href");if(typeof s!="string"){return}var o=s.split("_")[2];var p=STK_Setting.menuDefaultParam[o];var m=["__="+new Date().getTime()];for(var q=0;q<p.length;q++){if(typeof b[p[q]]!="undefined"){m.push(p[q]+"="+b[p[q]])}}if(m.length>0){if(r.indexOf("?")<0){r=r+"?"+m.join("&")}else{r=r+"&"+m.join("&")}}STK.switchMenu(o);d("#J_main_menu .selected").removeClass("selected");d(this).addClass("selected");STK.go(r)})})})},resize:function(e){if(typeof e=="function"){d(window).resize(function(){e()})}},scroll:function(e){if(typeof e=="function"){d(window).scroll(function(){e()})}},go:function(e,f){if(typeof e=="string"){a.ajaxLoading.show();d("#J_common-iframe").get(0).src=e}return},formGo:function(i,h){var g=d.extend({menuChange:true},h);if(typeof i!="undefined"){var f=d("#J_common-iframe").contents().find("#"+i);if(f&&f.is("form")){a.ajaxLoading.show();var e=f.attr("action");f.submit()}}else{a.ajaxLoading.show()}},switchMenu:function(e,f){if(f==="url"){var g=e.split("?")[0];if(typeof a.urlMenuMap[g]!="undefined"){STK.switchMenu(a.urlMenuMap[g])}else{c.changeMenuSelectByUrl(g)}}else{d("#J_main_menu .selected").removeClass("selected");d("#J_m_"+e).addClass("selected");a.curMenuName=e}},changeLng:function(e){if(Config.getCurLanguage()==e){return false}if(STK_Lng[e]&&STK_Lng[e].menu){d.setCookie({key:"stk_language",value:e,expireDay:5*365});c.changeLng(e);Config.setCurLanguage(e);STK.go(d("#J_common-iframe").attr("src"))}},changeCss:function(j){if(Config.getCurCss()==j){return false}if(STK_Css[j]){d.setCookie({key:"stk_css",value:j,expireDay:5*365});if(typeof Config.getCurCss()!="undefined"){var e=Config.getCurCss();if(typeof STK_Css[e]!="undefined"){if(d("link").length>0){d("link").each(function(){var l=d(this).attr("href");for(var k=0;k<STK_Css[e].common.length;k++){if(l==STK_Css[e].common[k]){d(this).remove()}break}})}d("#J_common-iframe").contents().find("link").each(function(){var l=d(this).attr("href");for(var k=0;k<STK_Css[e].frame.length;k++){if(l==STK_Css[e].frame[k]){d(this).remove()}break}})}}var g=document.getElementsByTagName("head")[0];for(var f=0;f<STK_Css[j].common.length;f++){var h=document.createElement("link");h.href=STK_Css[j].common[f];h.rel="stylesheet";h.type="text/css";g.appendChild(h)}var g=d("#J_common-iframe").contents().find("head").get(0);for(var f=0;f<STK_Css[j].frame.length;f++){var h=document.createElement("link");h.href=STK_Css[j].frame[f];h.rel="stylesheet";h.type="text/css";g.appendChild(h)}Config.setCurCss(j)}}})})(jQuery);

