//改变字体大小
function changeFont(_A, _B, _C, _D, _E){
    var A = document.getElementById(_A);
    var B = document.getElementById(_B);
    var C = document.getElementById(_C);
    var E = document.getElementById(_E);
    if(!A || !B || !C || !E) return false;
    var nowSize = _D;
    if(dojo.cookie('dayoo_fontsize')){ nowSize = parseInt(dojo.cookie('dayoo_fontsize')) }
    C.style.fontSize = nowSize + 'px';
    A.onclick = function(){
        nowSize += 2;
        if(nowSize > 20){
            nowSize = 20;
            return false;
        }else{
            C.style.fontSize = nowSize + 'px';
            dojo.cookie('dayoo_fontsize', nowSize, 360);
        }
        return false;
    };
    B.onclick = function(){
        nowSize -= 2;
        if(nowSize < 10){
            nowSize = 10;
            return false;
        }else{
            C.style.fontSize = nowSize + 'px';
            dojo.cookie('dayoo_fontsize', nowSize, 360);
        }
        return false;
    }
    E.onclick = function(){
        nowSize = _D;
        C.style.fontSize = nowSize + 'px';
        dojo.cookie('dayoo_fontsize', nowSize, 360);
        return false;
    }
}

//提示框
function changeBoard(_A, _B){
    var A = [], B = [];
    for(var i=0; i<_A.length; i++){
        if(document.getElementById(_A[i]) && document.getElementById(_B[i])){
            var t1 = document.getElementById(_A[i]);
            var t2 = document.getElementById(_B[i]);
            A.push(t1); B.push(t2);
            t1.value = i;
            t2.$left = t2.style.left;
            t2.$top = t2.style.top;
        }else{ return false; }
    }
    function reSize(elem){
        elem.style.display = 'none';
        elem.style.left = elem.$left;
        elem.style.top = elem.$top;
    }
    var is_show = false;
    function show(elem){
        if(is_show){ 
            return false;
        }else{
            is_show = true;
            elem.style.display = 'block';
			dojo.style(elem, "opacity", 0);
			dojo.fadeIn({ node:elem.id,delay:300}).play();
        }
    }
    for(var i=0; i<_A.length; i++){
        A[i].onmouseover = function(e){
            var t = this.value;
            show(B[t]);
            is_show = true;
        }
        A[i].onmouseout = function(){
            var t = this.value;
            reSize(B[t]);
            is_show = false;
        }
    }
}

/* 
评论提交检查
*/
function checkFormComment(object)
{
    if (object.anonymous.checked == false) {               
			  
	    if (object.username.value == '') {
              alert('请填写你的用户名!');
              object.username.select();
              return false;
        }

        if (object.password.value == '') {
              alert('请填写你的密码!');
              object.password.select();
              return false;
        }
    }

    if (object.wltitle.value == '' || object.wltitle.value=='请填写标题') {
          alert('请填写标题!');
          object.wltitle.select();
          return false;
    }


    if (object.content.value == '') {
          alert('请填写评论内容!');
          object.content.select();
          return false;
    }
} 

dojo.addOnLoad(function(){
    changeFont('i2', 'i3', 'text_content', 14, 'itext');
    changeBoard(new Array('i1','i2','i3','i4','itext'), new Array('i1_text','i2_text','i3_text','i4_text','i5_text'));
});