var reltotarget = false; function $(v,o) { return( (typeof(o) == 'object' ? o : document).getElementById(v) ); } function $S(o) { return( (typeof(o) == 'object' ? o : $(o)).style); } function agent(v) { return( Math.max(navigator.userAgent.toLowerCase().indexOf(v), 0) ); } function abPos(o) { var o = (typeof(o) == 'object' ? o : $(o)), z = {X: 0, Y: 0}; while (o != null) { z.X += o.offsetLeft; z.Y += o.offsetTop; o = o.offsetParent; }; return(z); } /* Fetch window width and hide/show right side */ function liveWidth() { var x; if ($('right_column') != undefined) { x = window.innerWidth != null ? window.innerWidth : document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null; if (x < 1025) { $S('right_column').display = "none"; } else { $S('right_column').display = ""; } } } function hotKeys(evt) { alert(evt.keyCode); } /* fucking xhtml removed target="_blonk" from links and added a useless rel property. so...payback */ function externalLinks() { if (!reltotarget) { if (!document.getElementsByTagName) return; var anchors = document.getElementsByTagName("a"); for (var i = 0; i < anchors.length; i++) { var anchor = anchors[i]; if (anchor.getAttribute("href")) { if (anchor.getAttribute("rel") == "external") { anchor.target = "_blank"; } else if (anchor.getAttribute("rel") == "actions") { anchor.target = "actions"; } } } reltotarget = true; } } function buttons() { if (!document.getElementsByTagName) return; var buttons = document.getElementsByTagName("input"); for (var i = 0; i < buttons.length; i++) { var button = buttons[i]; if (button.className.indexOf("BTN") != -1) { button.onmouseover = function() { this.className = this.className.replace(/off$/,"on"); } button.onmouseout = function() { this.className = this.className.replace(/on$/,"off"); } } } } function openURL( url, target ) { try { var popup = window.open( url, target ); if ( popup == null ) return false; if (window.opera) if (!popup.opera) return false; } catch(err) { return false; } return true; } function close_comment() { $S('add_comment').display = 'none'; } function add_comment() { $S('add_comment').display = 'block'; if (document.forms.comment_form != null) document.forms.comment_form.comment.focus(); } function report_spam(id) { actions.location = '/report_' + id + '_spam.html'; } function change (type) { for (var i = 2; i < 4; i++) { $('type' + i).className = (type == i ? 'visible' : 'hidden'); } } function category_selected(element) { var value = element.options[element.selectedIndex].value.match(/(.*)-(.*)/); var id = value[2]; var type = value[1]; if (type == 4) type = 3; document.forms.upload_form.category.value = id; document.forms.upload_form.type.value = type; change(type); } function checkUploadForm(form) { var errors = 0; var message = 'Please see this errors before continuing'; if (form.select.options[form.select.selectedIndex].value == '0-0') { message += '\n- You must select a category'; errors++ } if (form.title.value == '') { message += '\n- You must enter a title'; errors++ } if (form.type.value == 2 && form.text.value == '') { message += '\n- You must add your content'; errors++ } else if (form.type.value == 3 && form.content.value == '') { message += '\n- You must add your content'; errors++ } else if (form.type.value == 1 && form.file.value == '') { message += '\n- You must select a file'; errors++ } if (form.type.value == 1 && form.file.value != '') { var extension = form.file.value.match(/(.*)\.(\w{3})$/); var extensions = new Array('jpg','jpeg','gif','png','JPG','GIF','JPEG','PNG'); if (!extension || extensions.indexOf(extension[2]) == -1) { message += '\n- Invalid extension (' + extension[2] +') must be: png, jpg, gif only'; errors++ } } if (form.keywords.value == '') { message += '\n- You must add at least a keyword'; errors++ } if (!form.agreement.checked) { message += '\n- You must agree with our terms'; errors++ } if (errors > 0) { alert(message); return false; } else return true; } function doEdit(div) { $S('content_' + div).display = 'none'; $S('form_' + div).display = 'block'; } function Comments(page, id) { actions.location = 'comments_page_' + page + '_' + id +'.html'; } function doSave(div, closeOnly) { $S('form_' + div).display = 'none'; $S('content_' + div).display = 'block'; var edit_action = ''; if (!closeOnly) { $('form_' + div).submit(); if (div == 'keys') { var edited = $('txt_' + div).value; var text = 'Tags: '; var words = edited.split((edited.indexOf(',',0) > -1) ? ',' : ' '); for (var i=0; i < words.length; i++) { text += ' ' + words[i] + ''; } $('content_' + div).innerHTML = text + '' + edit_action; } else { if (div == 'description' && $('txt_' + div).value == '') { $('content_' + div).innerHTML = 'Click here to add a description'; } else { $('content_' + div).innerHTML = (div == 'title' ? '

' : '') + $('txt_' + div).value + (div == 'title' ? '

' : ''); } } } else { $('form_' + div).reset(); } } function doAll(theElement) { var theForm = theElement.form; var i = 0; for (i; i < theForm.length; i++) { if (theForm[i].type == 'checkbox' && theForm[i].name != 'checkall') { theForm[i].checked = theElement.checked; } } } function jumptoindex() { document.location = '/'; } /* Atach to events */ window.onload = liveWidth; document.onload = liveWidth; window.onresize = liveWidth; document.onresize = liveWidth;