window.onload = startup; function startup() { // Add the highlights to input form items addHighlights(); // Fix background PNG in IE6 if(document.body.style.filter!=undefined) { var thisBody = document.getElementsByTagName('body')[0]; thisBody.style.backgroundImage='none'; thisBody.style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src="/images/Body.png", sizingMethod="scale")'; var hhLogo = document.getElementById('hhLogo'); hhLogo.style.backgroundImage='none'; hhLogo.style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src="/images/hh2.png", sizingMethod="scale")'; } } /******* HIGHLIGHT INPUT FIELDS *******************************/ lastFocused = ''; function addHighlights() { var inputs = document.getElementsByTagName("input"); var textareas = document.getElementsByTagName("textarea"); var selects = document.getElementsByTagName("select"); var numInputs = inputs.length; var numTextAreas = textareas.length; var numSelects = selects.length; for ( i=0; i < numInputs; i++ ) { var currentInput = inputs[i]; currentInput.onfocus = onFocus; currentInput.onblur = onBlur; currentInput.onmouseover = onOver; currentInput.onmouseout = onOut; } for ( i=0; i < numTextAreas; i++ ) { var currentTextArea = textareas[i]; currentTextArea.onfocus = onFocus; currentTextArea.onblur = onBlur; currentTextArea.onmouseover = onOver; currentTextArea.onmouseout = onOut; } for ( i=0; i < numSelects; i++ ) { var currentSelect = selects[i]; currentSelect.onfocus = onFocus; currentSelect.onblur = onBlur; currentSelect.onmouseover = onOver; currentSelect.onmouseout = onOut; } } function onFocus() { lastFocused = this; this.style.background = '#FFFFFF'; this.style.border = '1px solid #FF9900'; this.style.color = '#FF9900'; } function onBlur() { this.style.background = '#ECECEC'; this.style.border = 'solid 1px #B0B0B0'; this.style.color = '#000000'; } function onOver() { if (this != lastFocused) { this.style.background = '#F8F8F8'; if (this.type == 'submit') this.style.cursor = 'pointer'; if (this.type == 'button') this.style.cursor = 'pointer'; } } function onOut() { if (this != lastFocused) { this.style.background = '#ECECEC'; this.style.border = 'solid 1px #B0B0B0'; this.style.color = '#000000'; } } // Insert links to specified elements/textboxes function insertLink(elementId) { var link = prompt("Please enter the link in the form of http://www.website.com/link.html", ""); while (link != null && link.substr(0,7).toLowerCase() != 'http://') { alert('Link must start with http:// using format: http://www.website.com/link.html'); var link = prompt("Please enter the link in the form of http://www.website.com/link.html", ""); } if (link != null) var title = prompt("Please enter what the link should read (i.e. Click Here!): ",""); if (link != null && title != null) { var textbox = document.getElementById(elementId); textbox.value += ' ' + title + ' '; } } function addEvent(elm, evType, fn, useCapture) // addEvent and removeEvent // cross-browser event handling for IE5+, NS6 and Mozilla // By Scott Andrew { if (elm.addEventListener){ elm.addEventListener(evType, fn, useCapture); return true; } else if (elm.attachEvent){ var r = elm.attachEvent("on"+evType, fn); return r; } else { alert("Handler could not be removed"); } } /**************************************************************************************************************/ // Create xmlhttp object based on browsertype function getHTTPObject() { if (window.XMLHttpRequest) { // If IE7, Mozilla, Safari, etc: Use native object var xmlHttp = new XMLHttpRequest(); } else { if (window.ActiveXObject) { // ...otherwise, use the ActiveX control for IE5.x and IE6 var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } /**************************************************************************************************************/ // Report media as spam/stolen/etc function deleteImage(id, obj) { var sure = confirm ("Are you sure you want to delete this image?"); if (sure) { obj.src = '/users/database/progress_circle.gif'; var url = 'delete.php?image_id=' + id; loadHttp = getHTTPObject(); loadHttp.open("GET", url, true); loadHttp.onreadystatechange = function() { if (loadHttp.readyState == 4) { if (loadHttp.responseText.indexOf('invalid') == -1) { obj.style.display="none"; } } }; loadHttp.send(null); } }