﻿var ScrWin={};ScrWin.Scr=new Class.create();ScrWin.Scr.prototype={initialize:function(b){this.options={element:'',x:0,y:0,scrtime:30,DragDrop:null,ctrl:''};Object.extend(this.options,b||{});this.element=$(this.options.element);this.ctrl=$(this.options.ctrl);this.space=this.options.space;this.x=this.options.x;this.y_copy=this.y=this.options.y;this.scrtime=this.options.scrtime;this.element.style.top=this.y+"px";this.element.style.left=this.x+"px";this.ScrollTop=document.documentElement.scrollTop;this.onscr();if(this.options.DragDrop){var c=new DragDrop.Drop(this.options.DragDrop);c.MouseUpEvent=function(){var a=Position.cumulativeOffset(this.element);this.y=a[1]-document.documentElement.scrollTop}.bind(this)}},onscr:function(s){onscroll=function(){this.ScrollTop=document.documentElement.scrollTop;this.followFloat()}.bind(this)},getNewPostionY:function(a){return this.y+this.ScrollTop},followFloat:function(){this.newPostionY=this.getNewPostionY();if(this.FlowTime)clearInterval(this.FlowTime);this.scrSpace=this.newPostionY-parseInt(this.element.style.top);this.space=Math.abs(this.scrSpace)/this.scrtime;if(this.space<1)this.space=1;this.FlowTime=setInterval(function(){this.followingY()}.bind(this),1)},followingY:function(){var a=parseInt(this.element.style.top);var b=this.newPostionY-a;var c=this.space;if(Math.abs(b)<this.scrSpace/5){this.space=Math.round(Math.abs(b/5));if(this.space>c)this.space=c;if(this.space<1)this.space=1}if(b>0){if(b>=this.space){this.element.style.top=a+this.space+"px"}else{this.element.style.top=a+b+"px";clearInterval(this.FlowTime)}}else{if((-b)>=this.space){this.element.style.top=a-this.space+"px"}else{this.element.style.top=a+b+"px";clearInterval(this.FlowTime)}}},getBottomRight:function(){var a=document.documentElement.clientWidth;var b=document.documentElement.clientHeight+this.ScrollTop;return{x:a,y:b}},toMinorMax:function(a){if(this.ismin)this.toMax(a);else this.toMin(a);if(a.action)a.action()},toMin:function(a){this.ismin=true;this.ctrlHeight=this.ctrl.scrollHeight-a.y;$(a.box).hide();this.ctrl.addClassName('toMin');var b=this.getBottomRight();var c={x:b.x-this.element.scrollWidth,y:b.y-this.ctrl.scrollHeight};this.element.style.left=c.x+a.x+"px";this.element.style.top=c.y+a.y+"px";this.y=c.y+a.y-this.ScrollTop;if(this.options.toMinEvt)this.options.toMinEvt()},toMax:function(a){this.ismin=false;this.y=this.y_copy;$(a.box).show();this.ctrl.removeClassName('toMin');var b=this.getBottomRight();var c={x:b.x-this.element.scrollWidth,y:b.y-this.element.scrollHeight};this.element.style.top=c.y+a.y+"px";if(this.options.toMaxEvt)this.options.toMaxEvt()},re_scr:function(){setTimeout(function(){var a=document.getElementById("ECS").scrollHeight;var b=Position.cumulativeOffset(this.element);this.y=b[1]-document.documentElement.scrollTop+d_h-document.getElementById("ECS").scrollHeight;d_h=a;this.ScrollTop=document.documentElement.scrollTop;this.followFloat()}.bind(this),10)},center:function(){if(this.ismin)this.toMax({y:0,x:0,box:'ECScontent'});var a=(document.documentElement.clientWidth-this.element.scrollWidth)/2;var b=document.documentElement.scrollTop+((document.documentElement.clientHeight-this.element.scrollHeight)/2);this.element.style.left=a+"px";this.element.style.top=b+"px";this.y=b-document.documentElement.scrollTop}};var toMinEvt=function(){$('ECSLink').removeClassName('EToMin').addClassName('EToMax').title='最大化留言板'};var toMaxEvt=function(){$('ECSLink').removeClassName('EToMax').addClassName('EToMin').title='最小化留言板'};formOptions.otherSuccess=function(){};function focusMsg(){if($F('msg_content')=='您好，如果您对我公司产品感兴趣，请点此留言，谢谢！（限100个汉字）')$('msg_content').addClassName('ontext').value=''}function blurMsg(){if($F('msg_content')==''){$('msg_content').removeClassName('ontext').value='您好，如果您对我公司产品感兴趣，请点此留言，谢谢！（限100个汉字）'}}var scr,c_w,c_h,d_h;function LoadMsg(t){MsgBox(t);if(!myid){myid=0;$('linkbox').show();popVali(['msg_name','msg_email','msg_mobile','msg_content','msg_btn'])}else{popVali(['msg_content','msg_btn'])}c_w=document.documentElement.clientWidth;c_h=document.documentElement.clientHeight;d_h=document.getElementById("ECS").scrollHeight;scr=new ScrWin.Scr({element:'ECS',ctrl:'ECStitle',x:c_w-201,y:c_h-d_h,toMinEvt:toMinEvt,toMaxEvt:toMaxEvt,DragDrop:{element:'ECS',handle:'ECStitle'}})}function MsgBox(t){var a=t;if(!t)t='您好，如果您对我公司产品感兴趣，请点此留言，谢谢！（限100个汉字）';else t='我对您的“'+t+'”很感兴趣，请报价？ \n';document.write('<DIV class=ECS id=ECS style="top:0; left:0;">');document.write('<DIV class=ECStitle id=ECStitle>');document.write('<UL><LI class=ELeft><SPAN class=titleA>买卖留言板</SPAN> </LI>');document.write('<LI class=ERight><A class=EToMin id=ECSLink title=最小化留言板 onClick="scr.toMinorMax({y:0,x:0,box:\'ECScontent\'});this.blur()" href="javascript:void(0)"></A> ');document.write('</LI></UL></DIV>');document.write('<DIV class=ECScontent id=ECScontent>');document.write('<DIV class=EMiddle><UL>');document.write('<LI><TEXTAREA id=msg_content class="required'+(!a?'':' ontext')+'" onBlur="scr.re_scr();blurMsg()" onFocus="focusMsg()">'+t+'</TEXTAREA><p class=con_p></p></LI>');document.write('<span id="linkbox" style="display:none">');document.write('<LI class=dis>请留下联系方式,我们会尽快联系您 </LI>  ');document.write('<LI class=name><SPAN>姓&nbsp;名&nbsp;</SPAN><INPUT class="required inputName" id=msg_name onBlur="scr.re_scr()"><p></p></LI>');document.write('<LI class=name><SPAN>QQ/MSN</SPAN><INPUT class="required inputName" id=msg_email onBlur="scr.re_scr()"><p></p></LI>');document.write('<LI class=name><SPAN>电&nbsp;话&nbsp;</SPAN><INPUT class="inputName" id=msg_mobile><p></p></LI></span>');document.write('<LI class=submit><span id="sucesss" style="display:none">发送留言成功!</span>');document.write('<span id="submitDiv2" style="display:none"><IMG src="/images/web/send2.gif" align=absMiddle></span><span id="submitDiv">');document.write('<IMG src="/images/web/send.gif" align=absMiddle id="msg_btn" style="cursor:pointer" onClick="scr.re_scr()"></span>');document.write('</LI></UL></DIV>');document.write('<DIV class=EBottom></DIV></DIV>');document.write('</DIV>')}function askPart(t){$('msg_content').addClassName('ontext').value='我对您的“'+t+'”很感兴趣，请报价？ \n';scr.center()}var ask_type=1;function ask(){if($F('msg_content')=='您好，如果您对我公司产品感兴趣，请点此留言，谢谢！（限100个汉字）'){$('msg_content').addClassName('ontext').value='';alert('请填写留言内容!');return}var b=(window.location.href+'').replace(/\&/gi,'##');var c='type=3&content='+$F('msg_content')+'&myid='+myid+'&userid='+companyid;if(myid)c+='&source={type:'+ask_type+',url:\''+b+'\'}';else{c+='&source={type:'+ask_type+',url:\''+b+'\',name:\''+$F('msg_name').replace(/\'/gi,"\\'")+'\',email:\''+$F('msg_email')+'\',mobile:\''+$F('msg_mobile')+'\'}'}$('submitDiv2').show();$('submitDiv').hide();var d={method:'post',postBody:c,onComplete:function(a){$('msg_name').value='';$('msg_email').value='';$('msg_mobile').value='';$('msg_content').value='';$('msg_name')._true=undefined;$('msg_email')._true=undefined;$('msg_mobile')._true=undefined;$('msg_content')._true=undefined;$('sucesss').show();$('submitDiv2').hide();$('submitDiv').show()}};new Ajax.Request('/Services/Sns.asmx/Feed_Pro_Sub',d)}