function show_review(button_id,hidden_content_id,open_content_id){
    if ($(hidden_content_id).style.display == "block")
    {
        $(hidden_content_id).style.display = "none";
        $(open_content_id).style.display = "block";
    }
    else
    {
        $(hidden_content_id).style.display = "block";
        $(open_content_id).style.display = "none";
    }
}

function getImg(star)
{
    return "/images/star"+star+".gif";
}

function checkTagForm(){
    var tag_length = window.document.tag_form.new_tag.value.length;
    var tag_content = window.document.tag_form.new_tag.value;
    if (tag_length > 30||checkspace(tag_content)) {
        $("tag_spinner_for_submit").hide();
        $("tag_submit_btn").enable();
        return false;
    }
    $("tag_spinner_for_submit").show();
    $("tag_submit_btn").disable();
    return true;
}

function checkForm(){
    var valid = new Validation('cause_form', {
        onSubmit:false
    });
    var result = valid.validate();
    if(!result)
    {
        return false;
    }else{
        $("spinner_for_submit").show();
        document.getElementById("submit_btn").disable();
        document.getElementById("btn").disable();
    }
}

function checkCommentForm()
{
    var valid = new Validation('comment_form', {
        onSubmit:false
    });
    var result = valid.validate();
    if(!result)
    {
        return false;
    }
    else
    {
        $("spinner_for_comment_submit").show();
        document.getElementById("submit_comment_btn").disable();
        return true;
    }
}

function checkspace(checkstr){
    var str = '';
    for(var i = 0; i < checkstr.length; i++) {
        str = str + ' ';
    }
    return (str == checkstr);
}


function send(id){
    var value = document.getElementById('user_tags').value;
    document.getElementById('tag_'+id).style.color = "red"
    var list = value.toString().split(" ");
    var i = 0
    for(;i<list.length;i++){
        if(document.getElementById('tag_'+id).title == list[i]){
            return false;
        }
    }
    if(value == ""){
        document.getElementById('user_tags').value = document.getElementById('tag_'+id).title;
    }else{
        document.getElementById('user_tags').value = value+" "+document.getElementById('tag_'+id).title;
    }
}