﻿var scoreHandler = 'SetScore.aspx';
var oScoreSelects = document.getElementsByName('SelScore');
var oMsg = $('setScoreMsg');
var odisplay = 'spanTotalScore';
var scoreValue;
var myAjax;
function showErrorMsg(){ oMsg.style.display = "block"; oMsg.innerHTML = '<font color=red>您未能成功打分,请稍后再试</font>';   }
function showScoreMsg(){ oMsg.style.display = "block"; oMsg.innerHTML = '<font color=red>您已经打分成功.景点分数+'+ scoreValue +'</font>';   }
function hideScoreMsg(){ oMsg.style.display = "none"; }
function setScore(objId , objType) {
    for ( i=0; i<=oScoreSelects.length-1; i++) { if ( oScoreSelects[i].checked == true) { scoreValue = oScoreSelects[i].value;} }
    if ( scoreValue > 0) {                            
    var strParams = 'otype='+ objType +'&oid=' + objId + '&score=' + scoreValue;                                             
    myAjax = new Ajax.Updater(  
            {success: odisplay }, scoreHandler,  { 
                method: 'get',   parameters: strParams, 
                onFailure: function() { showErrorMsg(); setTimeout("hideScoreMsg()",3000); },
                onSuccess: function() { showScoreMsg(); setTimeout("hideScoreMsg()",3000); }
            } );       
    }    
}

var indexHandler;
var oIndexMsg = $('setIndexMsg');
var oIndexdisplay = 'spanIndex';
var indexValue1,indexValue2,indexValue3,indexValue4,indexValue5,indexValue6;
function showIndexErrorMsg(){ oIndexMsg.style.display = "block"; oIndexMsg.innerHTML = '<font color=red>您未能给指数打分,请稍后再试</font>';   }
function showIndexMsg(){ oIndexMsg.style.display = "block"; oIndexMsg.innerHTML = '<font color=red>您已经成功指数打分</font>';   }
function hideIndexMsg(){ oIndexMsg.style.display = "none";   }
function setSceneIndex( objId){
    indexHandler = 'SetSceneIndex.aspx';
    indexValue1 = $('sceneIndex1').value;
    indexValue2 = $('sceneIndex2').value;
    indexValue3 = $('sceneIndex3').value;
    indexValue4 = $('sceneIndex4').value;
    indexValue5 = $('sceneIndex5').value;
    indexValue6 = $('sceneIndex6').value;                           
    var strParams = 'id=' + objId + '&index1='+indexValue1+'&index2='+indexValue2+'&index3='+ indexValue3+'&index4='+indexValue4+'&index5='+indexValue5+'&index6='+indexValue6;                                             
    myAjax = new Ajax.Updater(  
            {success: oIndexdisplay }, indexHandler,  { 
                method: 'get',   parameters: strParams, 
                onFailure: function() { showIndexErrorMsg();setTimeout("hideIndexMsg()",3000);},
                onSuccess: function() { showIndexMsg();setTimeout("hideIndexMsg()",3000);}
            } );       
}
function setRouteIndex( objId){
    indexHandler = 'SetRouteIndex.aspx';
    indexValue1 = $('routeIndex1').value;
    indexValue2 = $('routeIndex2').value;
    indexValue3 = $('routeIndex3').value;                          
    var strParams = 'id=' + objId + '&index1='+indexValue1+'&index2='+indexValue2+'&index3='+ indexValue3;                                             
    myAjax = new Ajax.Updater(  
            {success: oIndexdisplay }, indexHandler,  { 
                method: 'get',   parameters: strParams, 
                onFailure: function() { showIndexErrorMsg();setTimeout("hideIndexMsg()",3000);},
                onSuccess: function() { showIndexMsg();setTimeout("hideIndexMsg()",3000);}
            } );       
}
