var gal_root = '/Gallery'; var prev_get = ''; function comment(way, id) { switch(way) { case 'submit': with(document.getElementById('getCom')) { if (author.value =='Jméno') { alert('Žádné jméno???'); return false; } if (message.value =='') { alert('Žádný text???'); return false; } if (mail.value == 'Email') { mail.value = 'na'; } submit(); } break; case 'show': document.getElementById('showCom').style.display = 'none'; document.getElementById('getCom').style.display = ''; if (id != 0) { document.getElementById('getCom').aid.value = id; } document.getElementById('getCom').author.focus(); break; case 'cancel': document.getElementById('showCom').style.display = ''; document.getElementById('getCom').style.display = 'none'; break; case 'display': var element = document.getElementById('art' + id); if (!element) { return false; } req = request(); url = '/Blog/comment.php?cid=' + id ; req.onreadystatechange = function() { if (req.readyState == 4 && req.status == 200) { element.innerHTML = req.responseText; element.className = 'comment'; } } req.open('GET', url, true); req.send(null); break; } } function getOption(pid, target) { if ( !document.getElementById(target)) { return false; } if (prev_get != '') { el = document.getElementById(prev_get); label = prev_get + 's'; label = label.substr(0,1).toUpperCase() + label.substr(1); el.innerHTML = '' + label + ''; } req = request(); left = new Array(3); left['camera'] = 20; left['lense'] = 93; left['film'] = 156; url = gal_root + '/getoptions.php?get=' + target + '&left=' + left[target] + '&pid=' + pid ; req.onreadystatechange = function() { if (req.readyState == 4 && req.status == 200) { el = document.getElementById(target); el.innerHTML = req.responseText; } } prev_get = target; req.open('GET', url, true); req.send(null); } function go(where) { window.open(where.replace(/;/,'&'),'_self'); } function listComments(pid) { req = request(); url = doc_root + '/getoptions.php?set=comment&pid=' + pid + '&author=None'; req.onreadystatechange = function() { if (req.readyState == 4 && req.status == 200) { resp = document.getElementById('thisComments'); resp.innerHTML = req.responseText; } } req.open('GET', url, true); req.send(null); } function mail() { window.open('mailto:cujo@atlas.cz') } function pop(where) { popup = window.open(where.replace(/;/,'&'),'popup', 'toolbar=no,scrollbars=yes,status=yes,resize=yes,width=420,height=400,top=0,left=80'); } function really(where) { if(window.confirm('Opravdu???')) { window.open(where,'_self'); } } function request() { try { req = new XMLHttpRequest(); } catch(e) { try { req = new ActiveXObject('Msxml2.XMLHTTP'); } catch (e) { try { req = new ActiveXObject('Microsoft.XMLHTTP'); } catch (E) { req = false; } } } return req; } function setName(pid, set) { event.cancelBubble; if ( !document.getElementById(set)) { return false; } if (data = window.prompt('Desired ' + set + '?')) { setOption(pid, set, "'" + data + "'"); } else { return false; } } function setOption(pid, set, id) { event.cancelBubble; if ( !document.getElementById(set)) { return false; } req = request(); url = gal_root + '/getoptions.php?set=' + set + '&id=' + id + '&pid=' + pid + '&album=' + album; req.onreadystatechange = function() { if (req.readyState == 4 && req.status == 200) { el = document.getElementById(set); el.innerHTML = req.responseText; } } req.open('GET', url, true); req.send(null); }