var xmlHttp; function getXMLHTTP() { var A = null; try { A = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try { A = new ActiveXObject("Microsoft.XMLHTTP"); } catch(oc) { A = null; } } if (!A && typeof XMLHttpRequest != "undefined") { A = new XMLHttpRequest(); } return A; } function doQuery(e, queryString, senddata, suppressloading) { if (!suppressloading) Loading(e); searching = true; if (xmlHttp && xmlHttp.readyState != 0) { xmlHttp.abort() } xmlHttp=getXMLHTTP(); if (xmlHttp) { xmlHttp.open("POST", queryString, true); xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4 && xmlHttp.responseText && searching) { try { eval(xmlHttp.responseText); } catch(e) { errorWindow=window.open("", "", "height=500, width=600,toolbar=no,scrollbars=yes,menubar=no,resizable=yes"); errorWindow.document.write(xmlHttp.responseText); } searching = false; } } if (senddata) { senddata = senddata.split(' ') stub = ''; for (var i=0;i < senddata.length;i++) { var fld = senddata[i]; stub += fld + '=' + encodeURIComponent(document.getElementById(fld).value) + '&'; } xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); xmlHttp.send(stub); } else xmlHttp.send(null); } } function Loading(e) { if (e) { d = document.getElementById('loading'); x = findPosX(e)+15; y = findPosY(e)+5; d.style.left = x+'px'; d.style.top = y+'px'; d.style.visibility = 'visible'; d = document.getElementById('ajaxpop'); d.style.left = x+'px'; d.style.top = y+'px'; } else { if (parseInt(navigator.appVersion)>3) { if (navigator.appName=="Netscape") { winW = document.documentElement.clientWidth; winH = window.innerHeight; } if (navigator.appName.indexOf("Microsoft")!=-1) { winW = document.documentElement.clientWidth; winH = document.documentElement.clientHeight; } } d = document.getElementById('loading'); if (window.scrollY) scr = window.scrollY; else if (document.documentElement.scrollTop) scr = document.documentElement.scrollTop; else scr = 0; d.style.top = parseInt(scr+winH/2)-50+ 'px'; d.style.left = parseInt(winW/2)-50+ 'px'; d.style.visibility = 'visible'; } } function MoveAjax(e) { d = document.getElementById('ajaxpop'); x = findPosX(e)+15; y = findPosY(e)+5; d.style.left = x+'px'; d.style.top = y+'px'; } function findPosX(e) { var posx = 0; if (!e) var e = window.event; if (e.pageX) posx = e.pageX; else if (e.clientX) posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft; return posx; } function findPosY(e) { var posx = 0; if (!e) var e = window.event; if (e.pageY) posy = e.pageY; else if (e.clientY) posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop; return posy; } function Reposition() { if (parseInt(navigator.appVersion)>3) { if (navigator.appName=="Netscape") { winW = document.documentElement.clientWidth; winH = window.innerHeight; } if (navigator.appName.indexOf("Microsoft")!=-1) { winW = document.documentElement.clientWidth; winH = document.documentElement.clientHeight; } } d = document.getElementById('ajaxpop'); LI = d.getElementsByTagName('div'); maxwidth = 100; for(i=0; i < LI.length; i++) { w = parseFloat(LI[i].style.width); if (w > maxwidth) maxwidth = w; } h = document.getElementById('reposimg').offsetTop-10; if (h < 0) h = 50; d.style.width = maxwidth+'px'; d.style.height = h+'px'; d.style.left = parseInt((winW-maxwidth)/2) + 'px'; if (window.scrollY) scr = window.scrollY; else if (document.documentElement.scrollTop) scr = document.documentElement.scrollTop; else scr = 0; stub = parseInt((winH-h)/2+scr); d.style.top = stub + 'px'; d.onmousedown=right; d.onmouseup=right; } function findPosX(e) { var posx = 0; if (!e) var e = window.event; if (e.pageX) posx = e.pageX; else if (e.clientX) posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft; return posx; } function findPosY(e) { var posx = 0; if (!e) var e = window.event; if (e.pageY) posy = e.pageY; else if (e.clientY) posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop; return posy; } function URLencode(sStr) { return escape(sStr).replace(/\+/g, '%2B').replace(/\"/g,'%22').replace(/\'/g, '%27'); } whichDog = 0; function ddInit(e, divname) { whichDog = document.getElementById(divname); offsetx = findPosX(e); offsety = findPosY(e); nowX = parseInt(whichDog.style.left); nowY = parseInt(whichDog.style.top); ddEnabled=true; document.onmousemove = dd; } function dd(e) { if (!ddEnabled) return; whichDog.style.left = (nowX+findPosX(e)-offsetx)+'px'; whichDog.style.top = (nowY+findPosY(e)-offsety)+'px'; return false; } document.onmouseup = Function("ddEnabled=false"); function HideAjax() { document.getElementById('ajaxpop').style.visibility='hidden'; } function right(e) { return false; if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2)) return false; else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) { alert("Sorry, you do not have permission to right click."); return false; } return true; } function PhotoNav(e, dom, prev, next) { w = parseInt(document.getElementById('ajaxpop').style.width); onethird = parseInt(w/3); x = e.clientX-parseInt(document.getElementById('ajaxpop').style.left) if ((x < onethird) && prev) doQuery(0, dom+'/admin/index.php?s=ajax&a=popphoto&norepos&photoid='+prev, ''); if ((x > 2*onethird) && next) doQuery(0, dom+'/admin/index.php?s=ajax&a=popphoto&norepos&photoid='+next, ''); if ((x > onethird) && (x < 2*onethird)) HideAjax(); }