﻿// JScript 文件
var _url="";
function _rStyleW(div)
{
    return div.style.width.substring(0,div.style.width.length-2)
}
function _rStyleH(div)
{
    return div.style.height.substring(0,div.style.height.length-2)
}
function ShowLiuyan()
{                    

    var div=_re("DivLiuyan");                    
   
    div.style.position="absolute";
    div.style.width=350;
    div.style.height=200;
    div.style.zIndex=2;
    
    var bWidth=parseInt(document.body.scrollWidth);
    var dWidth=parseInt(_rStyleW(div));
    div.style.left=((bWidth-dWidth)/2).toString();
    div.style.top=parseInt(document.body.scrollTop)+(parseInt(document.body.clientHeight)-parseInt(_rStyleH(div)))/2;                
    
    var cover=_re("divCover");                   
    cover.style.width=document.body.scrollWidth;
    cover.style.height=document.body.scrollHeight;                  
    high(cover);
    return;
}            

var highlighting;
var lowlighting;               
function high(image){
    image.style.display="block";
    if(lowlighting!=null)
        clearInterval(lowlighting);
    theobject=image;
    highlighting=setInterval("highlightit(theobject)",100);
}
function low(image){
    if(highlighting!=null)
        clearInterval(highlighting);                  
   theobject=image;
   lowlighting=setInterval("lowlightit(theobject)",100);                  
}
function lowlightit(cur2)
{                   
    _re("DivLiuyan").style.display="none";
    if (cur2.filters.alpha.opacity>1)
        cur2.filters.alpha.opacity-=8;
    else if(window.lowlighting)
    {
        clearInterval(lowlighting);
        cur2.style.display="none";                        
    }
}
function highlightit(cur2){
    if (cur2.filters.alpha.opacity<60)
        cur2.filters.alpha.opacity+=8;
    else if(window.highlighting)
    {
        clearInterval(highlighting);
        _re("DivLiuyan").style.display="block";
    }
}

//留言
function liuyan(banID,url)
{
    try
    {  
        _url=url;
        if(_re("LyStyle").value.trim()=="")
        {
            alert("联系方式不可以空！");
            return;
        }
        var LyStyle=escape(_re("LyStyle").value);
        var name=escape(_re("LyName").value);        
        var content=escape(_re("LyContent").value);
        if(_re("LyContent").value.trim()=="")
        {
            alert("留言内容不可以空！");
            return;
        } 
        _re("btnAdd").disabled=true;     
        service.useService("../liuyan/liuyan.asmx?WSDL","uLiuyan");       
        service.uLiuyan.callService(Insert_Liuyan,"AddLiuyan",banID,name,content,LyStyle,0);
    }
    catch(e)
    {
        alert(e.message);
    }
}
function Insert_Liuyan(result)
{
    if(!result.error)
    {
        if(result.value==true)
        { 
           alert("留言提交成功！");
           //winreload(_url);
         }   
        else
            alert("留言失败！");
            
        low(_re('divCover'));
    }
    _re("btnAdd").disabled=false;     
}