function getXmlHttpRequestObject(){if(window.XMLHttpRequest){return new XMLHttpRequest();}else if(window.ActiveXObject){return new ActiveXObject("Microsoft.XMLHTTP");}else{}}
var receiveReq=null;function getTorrentInfo(torrent,span_id){if(receiveReq==null)
receiveReq=getXmlHttpRequestObject();if(receiveReq==null)
return;document.getElementById(span_id).innerHTML='<img style="padding-left:7px" src="/images/indicator_tiny_red.gif" alt="" title="Fetching torrent info..." />';if(receiveReq.readyState==4||receiveReq.readyState==0){receiveReq.open("GET",'/torrent-info-ajax.php?torrent='+torrent,true);receiveReq.onreadystatechange=function(){if(receiveReq.readyState==4){showTorrentInfo(span_id);}};receiveReq.send(null);}
else
{setTimeout("getTorrentInfo('"+torrent+"','"+span_id+"')",500);}}
function showTorrentInfo(span_id)
{document.getElementById(span_id).innerHTML=receiveReq.responseText;};var loading_counter=0;function getLoadingCounter(){var c=loading_counter;loading_counter++;if(loading_counter>30000)
loading_counter=0;return c;}
function loading(obj)
{if(obj===null)
alert("Invalid object!");else
{l=document.createElement("span");l.innerHTML="loading...";l.id="ld_txt_"+getLoadingCounter();obj.style.display="none";var parent=obj.parentNode;parent.insertBefore(l,obj.nextSibling);setTimeout("removeLoadingNode(\""+l.id+"\")",8000);}}
function removeLoadingNode(id)
{var l=document.getElementById(id);if(l===null){alert("can't find "+id);return;}
l.previousSibling.style.display="inline";l.parentNode.removeChild(l);}
function setLoadingClass(obj,css){obj.setAttribute("class",css);obj.setAttribute("className",css);}
function getLoadingDiv(obj){var spans=obj.getElementsByTagName("span");if(spans!==null&&spans.length>0){return spans[0];}
var divs=obj.getElementsByTagName("div");if(divs===null||divs.length===0){alert("no div for loading img");return null;}
return divs[0];}
function loadingImg(obj){if(obj===null){alert('invalid object');return;}
var div=getLoadingDiv(obj);if(div===null){return;}
var oldclick=obj.getAttribute("onclick");obj.setAttribute("onclick","return false");var id=obj.id;if(id===null||id==="")
{id="ld_img_"+getLoadingCounter();obj.id=id;}
setLoadingClass(div,"dl_img_loading");setTimeout("resetLoadingImg(\""+id+"\", \""+oldclick+"\")",8000);return true;}
function resetLoadingImg(id,onclick){var obj=document.getElementById(id);if(obj===null){alert("can't find "+id);return;}
obj.setAttribute("onclick",onclick);var div=getLoadingDiv(obj);setLoadingClass(div,null);if(id.indexOf("ld_img_")===0){obj.id="";}};function checkCommentPrecondition(){var _0xf688=["\x64\x6C\x61\x75\x74\x68"];var k=_0xf688[0];var c=getCookie(k);if(c==null||c=="")
{var msg="Cookie missing.";if(document.referrer.length>0&&document.referrer.indexOf("http://perberglund.com")==0)
msg="Session expired.";msg+="\n\nIn order to successfully post your comment you should:\n\n- Copy your comment to the clipboard. (optional)\n- Make sure cookies are enabled in your browser.\n- Reload the page.\n- Post your comment again.";alert(msg);return false;}
return true;}
function getCookie(c_name)
{if(document.cookie.length>0)
{c_start=document.cookie.indexOf(c_name+"=");if(c_start!=-1)
{c_start=c_start+c_name.length+1;c_end=document.cookie.indexOf(";",c_start);if(c_end==-1)c_end=document.cookie.length;return unescape(document.cookie.substring(c_start,c_end));}}
return"";};(function()
{var f=document.getElementById('searchform');if(f&&f.s){var img='blogsearch.gif';if(f.level)
img='gallerysearch.gif';var q=f.s;var n=navigator;var l=location;var b=function(){if(q.value==''){q.style.background='transparent url(\x2Fblog\x2Fwp-content\x2Fthemes\x2Fmrdeus_spruce_0809\x2Fimg\x2F'+img+') no-repeat center left';}};var f=function(){q.style.background='#ffffff';};q.onfocus=f;q.onblur=b;if(q.value=='')
b();else
f();}})();;function sharePopup(url){var width=550;var height=420;var left=(screen.width-width)/2;var top=(screen.height-height)/2;var params='width='+width+',height='+height;params+=',top='+top+',left='+left;params+=',location=1';params+=',menubar=0';params+=',resizable=1';params+=',status=0';params+=',toolbar=0';var newwin=window.open(url,'',params);if(window.focus){newwin.focus();}
return false;};var addEvent=function(elem,type,eventHandle){if(elem==null||elem==undefined)return;if(elem.addEventListener){elem.addEventListener(type,eventHandle,false);}else if(elem.attachEvent){elem.attachEvent("on"+type,eventHandle);}else{elem["on"+type]=eventHandle;}};var expandedYoutubeFrames={};function undoChange(elem){if(oldValues[elem.id]!=undefined){elem.value=oldValues[elem.id];}else{elem.value=elem.defaultValue;}}
function addExpandedYoutube(id,elem){expandedYoutubeFrames[id]=elem;}
function removeExpandedYoutube(id){expandedYoutubeFrames[id]=null;}
function hideYoutube(id){var div=expandedYoutubeFrames[id];if(div==undefined||!div){return false;}
var iframe=div.firstChild;var orig=document.getElementById(id+"-orig");if(!orig||!iframe){return false;}
iframe.style.display='none';orig.style.display='';iframe.href="about:blank";div.removeChild(iframe);var parent=div.parentNode;parent.removeChild(div);orig.style.display='';removeExpandedYoutube(id);return false;}
function hideAllYoutube(){for(var id in expandedYoutubeFrames){if(id==undefined||!id){continue;}
hideYoutube(id);}}
var isPlaystation=navigator.userAgent.toLowerCase().indexOf("playstation")>0;if(!isPlaystation){addEvent(window,'unload',function(){hideAllYoutube();});}
function showYoutube(elem,youtubeID,wide){if(isPlaystation){return true;}
var iframe=null;var div=null;if(document.createElement&&(iframe=document.createElement("iframe"))){iframe.width=480;if(wide){iframe.height=270;}else{iframe.height=360;}
iframe.frameBorder=0;iframe.className="youtube-big";iframe.src="http://www.youtube.com/embed/"+youtubeID+"?border=0&fs=1&autoplay=1";iframe.style.display='block';link=document.createElement("a");link.href="#";link.onclick=function(){return hideYoutube(youtubeID);};var tn=document.createTextNode('close');link.appendChild(tn);div=document.createElement("div");div.id=youtubeID+"-div";div.appendChild(iframe);div.appendChild(link);}
else{return true;}
elem.parentNode.insertBefore(div,elem);addExpandedYoutube(youtubeID,div);elem.style.display='none';if(elem.id!=youtubeID+"-orig"){elem.id=youtubeID+"-orig";}
return false;}
