
function reload(){
	parent.document.location.reload(true);
}
var ajaxRequest = initAjaxRequest();
function initAjaxRequest() {
    var request;
        if (window.ActiveXObject) {
                request = new ActiveXObject("Microsoft.XMLHTTP");
        } else {
                request = new XMLHttpRequest();
        }
    return request;
}

function leave_comment(url, parameters, container) {
	var blah = '&comment=' + document.getElementById('comment_on_daily').value;
	var param = parameters + blah;
        ajaxRequest.open('POST', url);
        ajaxRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        ajaxRequest.onreadystatechange = function() {
                if (ajaxRequest.readyState == 4 && ajaxRequest.status == 200) {
                       document.getElementById(container).innerHTML = ajaxRequest.responseText;
                }
        }
        ajaxRequest.send(param);

}


function ajaxPOST(url, parameters, container) {
        ajaxRequest.open('POST', url);
        ajaxRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        ajaxRequest.onreadystatechange = function() {
                if (ajaxRequest.readyState == 4 && ajaxRequest.status == 200) {
			
                        document.getElementById(container).innerHTML = ajaxRequest.responseText;
                }
        }
        ajaxRequest.send(parameters);

}



function fbs_click(link){
        if (link != ""){ u= link; }else{ u=location.href; }
        t=document.title;
window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');
        return false;
}

function toggle(name){
	var current = document.getElementById(name).style.display
	if(current == "block"){
		document.getElementById(name).style.display = "none";
	}else{
		document.getElementById(name).style.display = "block";
	}
}

function toggle_load(name){
        var current = document.getElementById(name).style.display
        if(current == "block"){
                document.getElementById(name).style.display = "none";
        }else{
                document.getElementById(name).style.display = "block";
		blah = name + ".php";
		ajaxPOST(blah,'load=y',name);
        }
}

function show_div(name){
document.getElementById(name).style.display = "block";
}

function close_div(name){
document.getElementById(name).style.display = "none";

}

function login(){
        show_div('login');
}

