/*
 * Pines JavaScript Object
 *
 * Copyright (c) 2010-2011 Hunter Perrin
 *
 * Licensed under the GNU Affero GPL:
 *	  http://www.gnu.org/licenses/agpl.html
 */
if(!Array.prototype.indexOf)Array.prototype.indexOf=function(f,b){var d=this.length>>>0;b=Number(b)||0;b=b<0?Math.ceil(b):Math.floor(b);if(b<0)b+=d;for(;b<d;b++)if(b in this&&this[b]===f)return b;return-1};
window.pines||function(f,b){var d=function(a){d.ready(a)};d.full_location="";d.rela_location="";d.get=function(a,c,h){if(c){a+=a.indexOf("?")==-1?"?":"&";var g=[];for(var i in c)if(c.hasOwnProperty(i))encodeURIComponent?g.push(encodeURIComponent(i)+"="+encodeURIComponent(c[i])):g.push(escape(i)+"="+escape(c[i]));a+=g.join("&")}if(!h||h=="_self")f.location=a;else if(h=="_top")f.top.location=a;else if(h=="_parent")f.parent.location=a;else h=="_blank"?f.open(a):f.open(a,h)};d.post=function(a,c,h){var g=
b.createElement("form");g.action=a;g.method="POST";if(h)g.target=h;for(var i in c)if(c.hasOwnProperty(i)){a=b.createElement("input");a.type="hidden";a.name=i;a.value=c[i];g.appendChild(a)}b.body.appendChild(g);g.submit();b.body.removeChild(g)};d.paused=function(){return o};d.pause=function(){o=true};d.play=function(){o=false;if(p){p=false;m()}j&&k()};d.ready=function(a){l.push(a);j&&k()};d.load=function(a){e.push(a);e.length==1&&m()};d.loadjs=function(a,c){if(!(q.indexOf(a)>-1&&!c)){r=false;c=b.createElement("script");
c.setAttribute("type","text/javascript");c.setAttribute("src",a);e.push(c);e.length==1&&m();q[q.length]=a}};d.loadcss=function(a,c){if(!(s.indexOf(a)>-1&&!c)){c=b.createElement("link");c.setAttribute("type","text/css");c.setAttribute("rel","stylesheet");c.setAttribute("href",a);typeof c!="undefined"&&b.getElementsByTagName("head")[0].appendChild(c);s[s.length]=a}};d.notice=function(a,c){alert((c?c:"Notice")+"\n\n"+a)};d.error=function(a,c){alert((c?c:"Error")+"\n\n"+a)};var o=false,p=false,q=[],s=
[],e=[],l=[],j=false,r=false,k=function(){if(!(e&&!r||!j||o)){if(l)for(var a=l[0];a;){l=l.slice(1);a.call();a=l[0]}l=[]}},m=function(){if(o)p=true;else{var a=e[0];if(typeof a=="undefined"){r=true;k()}else if(typeof a=="function"){a.call();e=e.slice(1);m()}else{if(typeof a.readyState!="undefined")a.onreadystatechange=function(){if(a.readyState=="loaded"||a.readyState=="complete"){a.onreadystatechange=null;e=e.slice(1);m()}};else a.onload=function(){e=e.slice(1);m()};typeof a!="undefined"&&b.getElementsByTagName("head")[0].appendChild(a)}}},
n;if(b.addEventListener)n=function(){b.removeEventListener("DOMContentLoaded",n,false);j=true;k()};else if(b.attachEvent)n=function(){if(b.readyState==="complete"){b.detachEvent("onreadystatechange",n);j=true;k()}};var t=function(){if(!j){try{b.documentElement.doScroll("left")}catch(a){setTimeout(t,1);return}k()}};if(b.attachEvent){b.attachEvent("onreadystatechange",n);f.attachEvent("onload",function(){j=true;k()});var u=false;try{u=f.frameElement==null}catch(v){}b.documentElement.doScroll&&u&&t()}else if(b.addEventListener){b.addEventListener("DOMContentLoaded",
n,false);f.addEventListener("load",function(){j=true;k()},false)}f.pines=d}(window,window.document);

pines.full_location = "http://www.swarly.com/pines/"
pines.rela_location = "/pines/"
if(!this.JSON){pines.loadjs(pines.rela_location+"system/includes/json2.js");}

