function $(e){if(typeof e=='string')e=document.getElementById(e);return e}; function collect(a,f){var n=[];for(var i=0;i
'; var img = new Image(); img.src = src; var leftPos = (screen.availWidth - img.width) / 2; var topPos = (screen.availHeight - img.height) / 2; popup=window.open('','image','toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=1,width=' + img.width + ',height=' + img.height + ',left=' + leftPos + ',top=' + topPos); popup.document.open(); popup.document.write(html); popup.document.body.focus(); popup.document.close(); }; //POPUPS function popImage(imageURL,imageTitle){ PositionX = 10; PositionY = 10; defaultWidth = 1; defaultHeight = 1; //kinda important var AutoClose = true; var imgWin = window.open('','_blank','scrollbars=no,resizable=1,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY); if( !imgWin ) { return true; } //popup blockers should not cause errors imgWin.document.write(''+imageTitle+'<\/title><script type="text\/javascript">\n'+ 'function resizeWinTo() {\n'+ 'if( !document.images.length ) { document.images[0] = document.layers[0].images[0]; }'+ 'var oH = document.images[0].height, oW = document.images[0].width;\n'+ 'if( !oH || window.doneAlready ) { return; }\n'+ //in case images are disabled 'window.doneAlready = true;\n'+ //for Safari and Opera 'var x = window; x.resizeTo( oW + 200, oH + 200 );\n'+ 'var myW = 0, myH = 0, d = x.document.documentElement, b = x.document.body;\n'+ 'if( x.innerWidth ) { myW = x.innerWidth; myH = x.innerHeight; }\n'+ 'else if( d && d.clientWidth ) { myW = d.clientWidth; myH = d.clientHeight; }\n'+ 'else if( b && b.clientWidth ) { myW = b.clientWidth; myH = b.clientHeight; }\n'+ 'if( window.opera && !document.childNodes ) { myW += 16; }\n'+ 'x.resizeTo( oW = oW + ( ( oW + 200 ) - myW ), oH = oH + ( (oH + 200 ) - myH ) );\n'+ 'var scW = screen.availWidth ? screen.availWidth : screen.width;\n'+ 'var scH = screen.availHeight ? screen.availHeight : screen.height;\n'+ 'if( !window.opera ) { x.moveTo(Math.round((scW-oW)/2),Math.round((scH-oH)/2)); }\n'+ '}\n'+ '<\/script>'+ '<\/head><body onload="resizeWinTo();"'+(AutoClose?' onblur="self.close();"':'')+'>'+ (document.layers?('<layer left="0" top="0">'):('<div style="position:absolute;left:0px;top:0px;display:table;">'))+ '<img src="'+imageURL+'" alt="Loading image ..." title="" onload="resizeWinTo();">'+ (document.layers?'<\/layer>':'<\/div>')+'<\/body><\/html>'); imgWin.document.close(); if( imgWin.focus ) { imgWin.focus(); } return false; } /* BBCODE */ function mail(user, domain){window.location = 'mailto:'+user+'@'+domain;} function flip( rid ) { document.getElementById(rid).style.display = document.getElementById(rid).style.display == 'none' ? 'block' : 'none' } function addText(elname, wrap1, wrap2) { if (document.selection) { // for IE var str = document.selection.createRange().text; document.forms[elname].elements[elname].focus(); var sel = document.selection.createRange(); sel.text = wrap1 + str + wrap2; return; } else if ((typeof document.forms[elname].elements[elname].selectionStart) != 'undefined') { // for Mozilla var txtarea = document.forms[elname].elements[elname]; var selLength = txtarea.textLength; var selStart = txtarea.selectionStart; var selEnd = txtarea.selectionEnd; var oldScrollTop = txtarea.scrollTop; //if (selEnd == 1 || selEnd == 2) //selEnd = selLength; var s1 = (txtarea.value).substring(0,selStart); var s2 = (txtarea.value).substring(selStart, selEnd) var s3 = (txtarea.value).substring(selEnd, selLength); txtarea.value = s1 + wrap1 + s2 + wrap2 + s3; txtarea.selectionStart = s1.length; txtarea.selectionEnd = s1.length + s2.length + wrap1.length + wrap2.length; txtarea.scrollTop = oldScrollTop; txtarea.focus(); return; } else { insertText(elname, wrap1 + wrap2); } } function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features); } function rodyk(id){ if (document.getElementById){ obj = document.getElementById(id); if (obj.style.display == "none"){ obj.style.display = ""; createCookie(id,0,1); } else { obj.style.display = "none"; createCookie(id,1,1); } } } function checkSearch() { if (document.getElementById && document.getElementById('mainsearch').value=="") { alert("First enter some words to search for, yo."); document.getElementById('mainsearch').focus(); return false; } else { return true; } } function faves() { if (document.all && navigator.userAgent.indexOf("Opera")==-1) { document.write("<a href=\"javascript:window.external.addfavorite('http://www.yourhtmlsource.com','HTMLSource: HTML Tutorials');\" class=\"nav\">Add HTMLSource to your favorites!</a><br />"); } else { document.write("Press Ctrl+D to add HTMLSource to your bookmarks!"); } } function createCookie(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else expires = ""; document.cookie = name+"="+value+expires+"; path=/"; } function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; }