window.onresize = baiduResizeDiv;
window.onerror = function(){}
var divTop,divLeft,divWidth,divHeight,docHeight,docWidth,objTimer,i = 0;
String.prototype.Trim = function(){return this.replace(/^\s+|\s+$/g,"");}



function baiduMsg()
{
   try{
    divTop = parseInt(document.getElementById("eMeng").style.top,10);
    divLeft = parseInt(document.getElementById("eMeng").style.left,10);
    divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10);
    divWidth = parseInt(document.getElementById("eMeng").offsetWidth,10);
    docWidth = document.documentElement.clientWidth;
    docHeight = document.documentElement.clientHeight;
    document.getElementById("eMeng").style.top = parseInt(document.documentElement.scrollTop,10) + docHeight + 10;// divHeight
    document.getElementById("eMeng").style.left = parseInt(document.documentElement.scrollLeft,10) + docWidth - divWidth;
    document.getElementById("eMeng").style.visibility="visible";
    objTimer = window.setInterval("baidu_move_div()",10);
   }catch(e){}
} 

function baiduResizeDiv()
{
   i+=1;
   try{
    divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10);
    divWidth = parseInt(document.getElementById("eMeng").offsetWidth,10);
    docWidth = document.documentElement.clientWidth;
    docHeight = document.documentElement.clientHeight;
    document.getElementById("eMeng").style.top = docHeight - divHeight + parseInt(document.documentElement.scrollTop,10);
    document.getElementById("eMeng").style.left = docWidth - divWidth + parseInt(document.documentElement.scrollLeft,10);
   }catch(e){}
}

function baidu_move_div()
{
   try{
    if(parseInt(document.getElementById("eMeng").style.top,10) <= (docHeight - divHeight + parseInt(document.documentElement.scrollTop,10)))
    {
     window.clearInterval(objTimer);objTimer = window.setInterval("baiduResizeDiv()",1);
    }
    divTop = parseInt(document.getElementById("eMeng").style.top,10);
    document.getElementById("eMeng").style.top = divTop - 1;
   }catch(e){}
}
function ooc(){
	if(document.getElementById("ooc").innerHTML=="□打开"){
	    document.getElementById("ooc").innerHTML="×关闭";
		document.getElementById("child2").style.display="";
	}
	else{
		document.getElementById("ooc").innerHTML="□打开";
		document.getElementById("child2").style.display="none";
	}
	baiduResizeDiv();
}

function valid_message()
{
   objMess = lea_mess.message;
   objContact = lea_mess.contact;
  
   objMess.value = objMess.value.Trim();
   objContact.value = objContact.value.Trim();
  
   strMess = objMess.value;
   strContact = objContact.value;
	
   if (strMess.length > 200)
   {
    alert('您的留言过长，请减少至200字内，谢谢！');
    return false;
   }
   if (strContact.length > 50)
   {
    alert('您的联系方式过长，请减少至50字内，谢谢！');
    return false;
   }
   if ((strMess.length < 1 || strMess==objMess.defaultValue) && strContact.length>0)
   {
    alert('您还没有填写留言内容，请在留言内容框内填写完提交，谢谢！');
    return false;
   }
   if ((strContact.length < 1 || strContact==objContact.defaultValue) && strMess.length>0)
   {
    alert('您还没有填写联系方式，请在联系方式框内填写完提交，谢谢！');
    return false;
   }
   if ((strContact.length < 1 && strMess.length<1) || (strMess==objMess.defaultValue && strContact==objContact.defaultValue))
   {
    alert('您好，留言不能为空，谢谢！');
    return false;
   }
   if(!confirm('您确定发送留言吗?')) 
   {
    return false;
   }
  
   lea_mess.submit();
   msee_init();
}

function msee_init () {
   lea_mess.message.value = lea_mess.message.defaultValue;
   lea_mess.contact.value = lea_mess.contact.defaultValue;
   lea_mess.lycoding.value = lea_mess.lycoding.defaultValue;
}

function baiduMessbox(shape,color,userid){
   if(shape>1) window.onload = baiduMsg;
   else {styles='';copic=''}
   var s;
   s = '<link href="http://kehu.jinshengxi.net/css.css" rel="stylesheet" type="text/css" />'
		+ '<div class="Mess'+ color +'" id=eMeng style="Z-INDEX:99999;LEFT:0px;POSITION:absolute;TOP:0px;VISIBILITY:hidden;">'
		+ '<div id="title" onclick="ooc();">&nbsp;<span style="width:200px;">恒宇机械设备欢迎您留言</span><span id="ooc">×关闭</span></div>'
		+ '<div id="child2">'
		+ '<div style="line-height:25px; text-align:left;">&nbsp;<span class="telT">全国免费电话：</span><span class="tel">400 711 6103</span></div>'
		+ '<form id="form2" name="lea_mess" method="post" action="http://kehu.jinshengxi.net/getMess.php" style="padding:0; margin:0;" target=baidu_msg_frm>'
		+ '<div style="margin-bottom:2px;"><iframe src=\'\' name=baidu_msg_frm style=\'display:none;\'></iframe><textarea name="message" class="context" onfocus="if (this.value == this.defaultValue) this.value=\'\';" onblur="this.value=this.value.Trim(); if (this.value==\'\') this.value=this.defaultValue;">您好，感谢关注本网站！&#13;如果您对本站的产品或服务感兴趣，请点击此处留言，谢谢！</textarea></div>'
		+ '<div><textarea name="contact" class="lxtext" onfocus="if (this.value == this.defaultValue) this.value=\'\';" onblur="this.value=this.value.Trim(); if (this.value==\'\') this.value=this.defaultValue;">请留下您的联系方式，&#13;本站会尽快与您联系。</textarea></div>'
		+ '<table width="240" border="0" cellspacing="0" cellpadding="0" style="padding:5px 0 5px 0;"><tr>'
		+ '<td width="70" align="left"><input name="lycoding" type="hidden" id="lycoding" value="'+ userid +'" /><img src="http://kehu.jinshengxi.net/images/fs_'+ color +'.jpg" style="cursor:hand;" onclick="valid_message();" border="0" /></td>'
		+ '<td align="right"><a href="http://kehu.jinshengxi.net/m/login.html" target="_blank" style="color:#999999;">查看留言■</span></td>'
		+ '</tr></table>'
		+ '</form>'
		+ '</div></div>';
   document.writeln(s);
}
baiduMessbox(2, 1, "tk8kU92");










