http_request = false; function ajax_connect() { if (window.XMLHttpRequest) { http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) http_request.overrideMimeType('text/plain'); } else if (window.ActiveXObject) { try { http_request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http_request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } } function ajax_check_status() { if (http_request.readyState == 4 && http_request.status == 200) return true; else return false; } function ajax_avatar_cut(hash, x1, x2, y1, y2) { ajax_connect(); http_request.onreadystatechange = function() { if (ajax_check_status()) if (http_request.responseText == 0) document.getElementById('avatar_preview').innerHTML = 'Wystapil blad podczas tworzenia avatara :('; else { avatar = document.getElementById('avatar_preview'); avatar.src = '/tmp/' + hash + '.jpg?' + Math.random(); } } http_request.open('GET', 'http://avatarek.pl/func/ajax.php?mode=avatar_cut&hash=' + hash + '&x1=' + x1 + '&x2=' + x2 + '&y1=' + y1 + '&y2=' + y2, true); http_request.send(null); } function ajax_vote(id, rating) { ajax_connect(); http_request.onreadystatechange = function() { if (ajax_check_status()) if (http_request.responseText == 0) document.getElementById('vote').innerHTML = 'Mozesz tylko raz oddac glos na avatar!'; else document.getElementById('vote').innerHTML = 'Glos zostal oddany prawidlowo!'; } http_request.open('GET', 'http://avatarek.pl/func/ajax.php?mode=avatar_vote&id=' + id + '&rating=' + rating, true); http_request.send(null); } function check_adult(check) { if(check != 1) { document.getElementById('container').innerHTML = '
'; } } function show_hide(id) { obj = document.getElementById(id); if (obj.style.display == 'none') obj.style.display = 'block'; else obj.style.display = 'none'; } function show (id) { document.getElementById(id).style.display = 'block'; return 1; } function hide (id) { document.getElementById(id).style.display = 'none'; return 1; }