// JavaScript Document

function over(a) {
	a.style.background = '#ccdd44';
}

function out(a) {
	a.style.background = '#eeeeee';
}

function overa(a) {
	a.style.background = '#ffcc00';
}

function outa(a) {
	a.style.background = '#fff';
}

function tagsOver(a) {
	var b = document.getElementById(a);
	b.style.display = 'block';
}

function tagsOut(a) {
	var b = document.getElementById(a);
	b.style.display = 'none';
}

function showShareBox(a){
    var b = document.getElementById(a);
    b.style.display = 'block';
}

function hideShareBox(a) {
    var b = document.getElementById(a);
    b.style.display = 'none';
}

var voted_array = [];

function sendPostRating(a, url, post_id){
    if (voted_array.indexOf(post_id) == -1) {
        var req = null;
        if (window.XMLHttpRequest) 
            req = new XMLHttpRequest();
        else 
            if (window.ActiveXObject) 
                req = new ActiveXObject(Microsoft.XMLHTTP);
        
        req.onreadystatechange = function(){
            if (req.readyState == 4) {
                if (req.status == 200) {
                    document.getElementById(a).innerHTML = req.responseText;
                }
                else {
                    document.getElementById(a).innerHTML = "";
                }
            }
        };
        req.open("POST", url, true);
        req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        req.send(null);
        voted_array.push(post_id);
    }
    
}

