 var show_img = "<img src='http://pat.design-grafixx.com/images/loader.gif' alt='Loading'>";
 
function get_Content(wo, url){

    var xmlHttp = null;
    // Mozilla, Opera, Safari sowie Internet Explorer 7
    if (typeof XMLHttpRequest != 'undefined') {
        xmlHttp = new XMLHttpRequest();
    }
    if (!xmlHttp) {
        // Internet Explorer 6 und älter
        try {
            xmlHttp  = new ActiveXObject("Msxml2.XMLHTTP");
        } catch(e) {
            try {
                xmlHttp  = new ActiveXObject("Microsoft.XMLHTTP");
            } catch(e) {
                xmlHttp  = null;
            }
        }
    }
    if (xmlHttp) {
        xmlHttp.open('GET', url, true);

        xmlHttp.onreadystatechange = function () {
            if (xmlHttp.readyState == 4) {
                myContent = xmlHttp.responseText;
                document.getElementById(wo).innerHTML = myContent;
            }
        };
        xmlHttp.send(null);
    }
}

function change(img){
	document.getElementById('hg').style.backgroundImage='url(pat/'+img+')';
	
    var url = "grafixx.php?action=prev&id="+img;
    
    get_Content('footer',url);
}

function vote(id,vote){
    
	var wo = "rating_"+id;  
	
    document.getElementById(wo).innerHTML = show_img;

    var url = "grafixx.php?action=vote&id="+id+"&vote="+vote;
    
    get_Content(wo, url);
}

$("a#ToogleSidebar").click().toggle(function() {
	$('#sidebar').animate({
		width: 'show',
		opacity: 'show'
	}, 'slow');
}, function() {
	$('#sidebar').animate({
		width: 'hide',
		opacity: 'hide'
	}, 'slow');
});

