<!-- 
var _title_comment_array=false;
var _current_language_id=0;
var _comment_showVerifyTime=false;
function getCommentRidSrc(){
    _comment_showVerifyTime=new Date();
    return '/CustomAction/CheckCodeImage.aspx?rid=' + _comment_showVerifyTime.getTime();
}
function checkCommentVerifyCodeImage(){
   var nowtime=new Date();
   var timeS=(60-10)*1000; //一分钟间隔，10秒减免
   if(!_comment_showVerifyTime || nowtime.getTime()-_comment_showVerifyTime.getTime()>timeS){
        var objImage=docEle('comment_verifyCodeImage');
        if(objImage){
            objImage.src=getCommentRidSrc();                    
        }
    }
}   
function ajaxSendFormQuery(form,button)
{
    if(form!=null && form.action!=''){
        if(!DoAjax(form.action,'POST',getFormQueryString(form),setFormQueryResponse,form,button))
        {          
            _comment_showVerifyTime=false; 
            return true;
        }else if(button!=null){
            _comment_showVerifyTime=false;
            button.disabled=true;
        }
    }  
    return false;
}
function setFormQueryResponse(xmlHttp,form,button)
{
    var timeLeft=10;
    if(!(xmlHttp||false)){
        timeLeft=3;
    } else {
        var xmlDoc=xmlHttp.responseXML || xmlHttp.responseXML.documentElement;    
        if(xmlDoc!=null)
        {          
            var results=xmlDoc.getElementsByTagName("JResults");  
            if(results!=null && results.length==1)
            {
                alert(getNodeValue(xmlDoc,"Message"));
                if(getNodeValue(xmlDoc,"Result").toLowerCase()=='true'){     
                    if(form!=null){           
                        form.focus();
                        var objSubject=docEle('comment_subject');
                        if(objSubject && !objSubject.readOnly){                        
                            objSubject.value='';
                        }
                        if(docEle('comment_content')){
                            docEle('comment_content').value='';
                        }
                        if(docEle('comment_checkcode')){
                            docEle('comment_checkcode').value='';
                        }                    
                    }     
                    if(getNodeValue(xmlDoc,"CommentCountID")!='' && getNodeValue(xmlDoc,"CommentCount")>=0){
                        var objCommentCount=docEle(getNodeValue(xmlDoc,"CommentCountID"));
                        if(objCommentCount){
                            objCommentCount.innerHTML=getNodeValue(xmlDoc,"CommentCount");
                        }
                    }             
                    if(getNodeValue(xmlDoc,"Refresh").toLowerCase()=='true'){                              
                        resetAllCommentLabels();
                        GetLabelValues('dynamic',null);
                    }
                }else{
                    timeLeft=3;
                    if(form!=null){          
                        form.focus();
                    }
                }
            }
        }
    }
    if(button!=null)
    {
        var btnValue=button.value;       
        var intTime=self.setInterval(function(){
            timeLeft--;
            if(timeLeft>=0){
                button.value=btnValue+'('+timeLeft+')';                
            }else{
                button.disabled=false;
                button.value=btnValue;
                intTime=window.clearInterval(intTime);
            }
        },1000);
    }
}
function resetAllCommentControls()
{
    if(docEle('comment_name')){
        docEle('comment_name').value='';
    }
    if(docEle('comment_subject')){
        docEle('comment_subject').value='';
    }
    if(docEle('comment_content')){
        docEle('comment_content').value='';
    }
    if(docEle('comment_email')){
        docEle('comment_email').value='';
    }
    if(docEle('comment_address')){
        docEle('comment_address').value='';
    }
    if(docEle('comment_website')){
        docEle('comment_website').value='';
    }
    if(docEle('comment_phone')){
        docEle('comment_phone').value='';
    }
    if(docEle('comment_chat')){
        docEle('comment_chat').value='';
    }
    if(docEle('comment_checkcode')){
        docEle('comment_checkcode').value='';
    }  
}
function resetAllCommentLabels()
{
    var labels=document.getElementsByTagName('div');  
    if(labels!=null && labels.length>0)
    {           
        for(var index=0; index<labels.length; index++)
        {            
            var isLabel=labels[index].getAttribute('isLabel')||'';           
            if(isLabel.toLowerCase()=='true'){         
                var type    = (labels[index].getAttribute('displayType')||'').toLowerCase();
                var objType = labels[index].getAttribute('objectType')||'';
                if(type=='pageslider' || (type=='dynamic' && objType!='')){
                    labels[index].setAttribute('hasLoaded','false');                   
                }
            }            
        }        
    }       
}
//得到一个表单里的全部信息
function getFormQueryString(objForm)
{ 
    if(objForm==null){
        return '';
    }
    var i,queryString = "", and = "";
    var item; 
    var itemValue;
    for( i=0;i<objForm.length;i++ ) {
        item = objForm[i];
        if (item.name!=null && item.name!='' && (item.name.indexOf('&')<0 && item.name.indexOf('=')<0)) {
            if ( item.type == 'select-one' && item.selectedIndex>-1) {
                itemValue = item.options[item.selectedIndex].value;
            } else if ( item.type=='checkbox' || item.type=='radio') {
                if ( item.checked == false ){
                       continue;    
                }
                itemValue = item.value;
            } else if ( item.type == 'button' || item.type == 'submit' || item.type == 'reset' || item.type == 'image'){
                continue;
            } else {
                itemValue = item.value;
            }
            if(itemValue!=null && itemValue!=''){
                queryString += and + item.name + '=' + encodeURIComponent(itemValue);
                and="&";
            }            
        }
    } 
    queryString += and + 'comment_ajax=true';
    return queryString;
}
function initCommentForm(commentTitleArray,lanId,groupId,groupType,objectId){
    if(commentTitleArray!=null){
        _title_comment_array=commentTitleArray;        
    }else{
        _title_comment_array={};
    }   
    if(lanId!=null && lanId>0){
        _current_language_id=lanId;
    }
    if(docEle('comment_groupid')){
        docEle('comment_groupid').value=groupId||'0';
    }     
    if(docEle('comment_objectid')){
        docEle('comment_objectid').value=objectId||'0';
    }
    if(docEle('button_comment_submit') && _title_comment_array['comment_submit']!=null){
        docEle('button_comment_submit').value=_title_comment_array['comment_submit'];
    }
    if(docEle('button_comment_reset') && _title_comment_array['comment_reset']!=null){
        docEle('button_comment_reset').value=_title_comment_array['comment_reset'];
    } 
    if(docEle('comment_verifyCodeImage') && _title_comment_array['checkcode_refresh']!=null){
        docEle('comment_verifyCodeImage').title=_title_comment_array['checkcode_refresh'];
    } 
    DoAjax('/CustomAction/LoadComment.aspx?load_action=init&load_lang='+(_current_language_id||0),'GET',null,function(xmlHttp){
        var xmlDoc=xmlHttp.responseXML || xmlHttp.responseXML.documentElement;           
        if(xmlDoc!=null)
        {  
            if(getNodeValue(xmlDoc,"Result").toLowerCase()=='true'){    
                var cookie=getCookie('comment_member'); 
                setCommentControlValue('comment_name',getNodeValue(xmlDoc,'MemberName')||getCookieValue(cookie,'comment_name'));
                setCommentControlValue('comment_email',getNodeValue(xmlDoc,'MemberEmail')||getCookieValue(cookie,'comment_email'));  
                setCommentControlValue('comment_address',getNodeValue(xmlDoc,'MemberAddress')||getCookieValue(cookie,'comment_address'));   
                setCommentControlValue('comment_phone',getNodeValue(xmlDoc,'MemberPhone')||getCookieValue(cookie,'comment_phone')); 
                setCommentControlValue('comment_website',getNodeValue(xmlDoc,'MemberWebsite')||getCookieValue(cookie,'comment_website')); 
                setCommentControlValue('comment_chat',getNodeValue(xmlDoc,'MemberChat')||getCookieValue(cookie,'comment_chat'));
                                       
                var faces=xmlDoc.getElementsByTagName("Face");                
                if(faces!=null && faces.length>0){
                    var objFace=docEle('view_comment_face');
                    if(objFace){
                        objFace.innerHTML='';
                        for(var i=0;i<faces.length;i++){           
                            var image=document.createElement("img"); 
                            image.title=faces[i].getAttribute('Name');
                            image.alt=image.title;
                            image.src=faces[i].getAttribute('Image');
                            image.setAttribute('Key',faces[i].getAttribute('Key'));
                            image.style.cursor='pointer';
                            image.onclick=function(){
                                InsertFace('comment_content',this.getAttribute('Key'));                                                       
                            };
                            objFace.appendChild(image);
                        } 
                    }
                }
            }
        }
    });
    
    loadCommentControlSetting(groupType,objectId,groupId);        
}
function scrollToCommentArea(){
    window.location.hash='#a_comment_start';    
    var obj=docEle('view_comment_form');
    if(obj){            
       obj.scrollIntoView();
    }
}
function setCommentControlTitle(id,tName)
{
    if(docEle(id) && _title_comment_array[tName]!=null){
        docEle(id).innerHTML=_title_comment_array[tName];
    }
}
function setCommentControlValue(id,value)
{
    if(docEle(id) && value!=null){
        docEle(id).value=value;
    }
}
function setCommentControlDisplay(id,isDisplay)
{
    if(docEle(id)){
        docEle(id).style.display=(isDisplay!=null && (isDisplay==true||isDisplay.toLowerCase()=='true'))?'':'none';
    }
}
function loadCommentControlSetting(groupType,objectId,groupId)
{   
    if(docEle('comment_action')){
        docEle('comment_action').value='comment';
    }   
    if(docEle('view_comment_message')){
        docEle('view_comment_message').style.display='none';        
    } 
    var objSubject=docEle('comment_subject');
    if(objSubject){
        objSubject.value='';
        objSubject.readOnly=false;
    }  
    setCommentControlTitle('title_comment_grouptype','comment_grouptype');
    setCommentControlTitle('title_comment_name','comment_name');
    setCommentControlTitle('title_comment_subject','comment_subject');
    setCommentControlTitle('title_comment_content','comment_content');
    setCommentControlTitle('title_comment_email','comment_email');
    setCommentControlTitle('title_comment_address','comment_address');
    setCommentControlTitle('title_comment_website','comment_website');
    setCommentControlTitle('title_comment_phone','comment_phone');
    setCommentControlTitle('title_comment_chat','comment_chat');      
    setCommentControlTitle('title_comment_checkcode','comment_checkcode');     
    
    DoAjax('/CustomAction/LoadComment.aspx?load_action=comment&load_lang='+(_current_language_id||0)+'&load_type='+(groupType||'')+'&load_group='+(groupId||0)+'&load_object='+(objectId||0),'GET',null,function(xmlHttp){
        var xmlDoc=xmlHttp.responseXML || xmlHttp.responseXML.documentElement;
        if(xmlDoc!=null)
        {  
            if(getNodeValue(xmlDoc,"Result").toLowerCase()=='true'){                
                var groups=xmlDoc.getElementsByTagName("CommentGroup");                
                if(groups!=null && groups.length>0){
                    var objSelect=docEle('comment_grouptype');
                    if(objSelect && objSelect.type=='select-one'){
                        while(objSelect.options.length>0)
                        {
                            objSelect.removeChild(objSelect.options[0]);
                        }
                        for(var i=0;i<groups.length;i++){                           
                            var option = new Option(groups[i].getAttribute('Name'),groups[i].getAttribute('Type'));
                            option.setAttribute('GroupId',groups[i].getAttribute('ID'));
                            option.setAttribute('IsCheckCode',groups[i].getAttribute('IsCheckCode'));
                            option.setAttribute('IsNameNotNull',groups[i].getAttribute('IsNameNotNull'));
                            option.setAttribute('IsSubjectNotNull',groups[i].getAttribute('IsSubjectNotNull'));
                            option.setAttribute('IsContentNotNull',groups[i].getAttribute('IsContentNotNull'));
                            option.setAttribute('IsEmailNotNull',groups[i].getAttribute('IsEmailNotNull'));
                            option.setAttribute('IsAddressNotNull',groups[i].getAttribute('IsAddressNotNull'));
                            option.setAttribute('IsWebsiteNotNull',groups[i].getAttribute('IsWebsiteNotNull'));
                            option.setAttribute('IsPhoneNotNull',groups[i].getAttribute('IsPhoneNotNull'));
                            option.setAttribute('IsChatNotNull',groups[i].getAttribute('IsChatNotNull'));                            
                            objSelect.options.add(option);
                        }                        
                        if(docEle('view_comment_grouptype')){                                 
                            docEle('view_comment_grouptype').style.display=objSelect.options.length<=1 ? 'none' : '';                                
                        }
                        if(objSelect.options.length>0){                                                                    
                            objSelect.onchange=function(){      
                                changeCommentGroupOption(this.options[this.selectedIndex]);                                                      
                            };                            
                            changeCommentGroupOption(objSelect.options[objSelect.selectedIndex]);         
                        }                         
                    }
                }
            }else{            
                if(docEle('view_comment_form')){
                    docEle('view_comment_form').style.display='none';
                }
                if(docEle('id_comment_form')){
                    docEle('id_comment_form').style.display='none';
                }
                var objMessage=docEle('view_comment_message');
                if(objMessage){             
                    objMessage.style.display='';
                    objMessage.innerHTML=getNodeValue(xmlDoc,"Message");
                }
                return;
            }
        }        
        if(docEle('view_comment_form')){
            docEle('view_comment_form').style.display='';
        }
    });
}
function changeCommentGroupOption(option)
{
    if(option!=null){
        setCommentControlDisplay('view_comment_name',option.getAttribute('IsNameNotNull'));
        setCommentControlDisplay('view_comment_subject',option.getAttribute('IsSubjectNotNull'));
        setCommentControlDisplay('view_comment_content',option.getAttribute('IsContentNotNull'));
        setCommentControlDisplay('view_comment_email',option.getAttribute('IsEmailNotNull'));
        setCommentControlDisplay('view_comment_address',option.getAttribute('IsAddressNotNull'));
        setCommentControlDisplay('view_comment_website',option.getAttribute('IsWebsiteNotNull'));
        setCommentControlDisplay('view_comment_phone',option.getAttribute('IsPhoneNotNull'));
        setCommentControlDisplay('view_comment_chat',option.getAttribute('IsChatNotNull'));    
        if(docEle('comment_groupid')){
            docEle('comment_groupid').value=option.getAttribute('GroupID')||'0';
        } 
        if(docEle('view_comment_form')){
            docEle('view_comment_form').style.display='';
        }
        if(docEle('id_comment_form')){
            docEle('id_comment_form').style.display='';
        }
        var objCheckCode=docEle('view_comment_checkcode');
        var isCheckCode=option.getAttribute('IsCheckCode')||'';
        isCheckCode=isCheckCode!=null && (isCheckCode==true||isCheckCode.toLowerCase()=='true');
        if(isCheckCode){
            if(objCheckCode){
                objCheckCode.style.display='';
            }
            if(docEle('comment_verifyCodeImage')){
                docEle('comment_verifyCodeImage').src=getCommentRidSrc();
            }
        }else if(objCheckCode){
            objCheckCode.style.display='none';            
        }
    }
}
function loadReplyControlSetting(commentId)
{    
//    var objSubject=docEle('comment_subject');
//    if(objSubject){
//        var commentSubject=docEle('comment_subject_of_'+commentId);
//        if(commentSubject){            
//            objSubject.value=commentSubject.innerHTML;
//        }else{
//            objSubject.value='';
//        }
//        objSubject.readOnly=true;
//    }
    if(docEle('view_comment_message')){
        docEle('view_comment_message').style.display='none';        
    } 
    if(docEle('comment_action')){
        docEle('comment_action').value='reply';
    }    
    if(docEle('comment_commentid')){
        docEle('comment_commentid').value=commentId||'0';
    }    
    setCommentControlTitle('title_comment_name','reply_name');
    setCommentControlTitle('title_comment_subject','reply_subject');
    setCommentControlTitle('title_comment_content','reply_content');
    setCommentControlTitle('title_comment_email','reply_email');
    setCommentControlTitle('title_comment_address','reply_address');
    setCommentControlTitle('title_comment_website','reply_website');
    setCommentControlTitle('title_comment_phone','reply_phone');
    setCommentControlTitle('title_comment_chat','reply_chat');      
    setCommentControlTitle('title_comment_checkcode','comment_checkcode');
    if(docEle('view_comment_grouptype')){                                 
        docEle('view_comment_grouptype').style.display='none';                                
    }
    DoAjax('/CustomAction/LoadComment.aspx?load_action=reply&load_lang='+(_current_language_id||0)+'&load_comment='+(commentId||0),'GET',null,function(xmlHttp){
        var xmlDoc=xmlHttp.responseXML || xmlHttp.responseXML.documentElement;
        if(xmlDoc!=null)
        {  
            if(getNodeValue(xmlDoc,"Result").toLowerCase()=='true'){                
                var groups=xmlDoc.getElementsByTagName("CommentGroup");                
                if(groups!=null && groups.length==1){  
                    var option = new Option(groups[0].getAttribute('Name'),groups[0].getAttribute('Type'));
                    option.setAttribute('GroupId',groups[0].getAttribute('ID'));
                    option.setAttribute('IsCheckCode',groups[0].getAttribute('IsCheckCode'));
                    option.setAttribute('IsNameNotNull',groups[0].getAttribute('IsNameNotNull'));
                    option.setAttribute('IsSubjectNotNull',groups[0].getAttribute('IsSubjectNotNull'));
                    option.setAttribute('IsContentNotNull',groups[0].getAttribute('IsContentNotNull'));
                    option.setAttribute('IsEmailNotNull',groups[0].getAttribute('IsEmailNotNull'));
                    option.setAttribute('IsAddressNotNull',groups[0].getAttribute('IsAddressNotNull'));
                    option.setAttribute('IsWebsiteNotNull',groups[0].getAttribute('IsWebsiteNotNull'));
                    option.setAttribute('IsPhoneNotNull',groups[0].getAttribute('IsPhoneNotNull'));
                    option.setAttribute('IsChatNotNull',groups[0].getAttribute('IsChatNotNull'));                            
                    changeCommentGroupOption(option); 
                    var objSubject=docEle('comment_subject');
                    if(objSubject){
                        objSubject.value=groups[0].getAttribute('Subject')||'';
                        objSubject.readOnly=true;
                    }
                }
            }else{                      
                if(docEle('view_comment_form')){
                    docEle('view_comment_form').style.display='none';
                }
                if(docEle('id_comment_form')){
                    docEle('id_comment_form').style.display='none';
                }
                var objMessage=docEle('view_comment_message');
                if(objMessage){
                    objMessage.style.display='';
                    objMessage.innerHTML=getNodeValue(xmlDoc,"Message");
                }
                return;
            }
        }        
        if(docEle('view_comment_form')){
            docEle('view_comment_form').style.display='';
        }
    });
}
-->
