NG.Shade=function(e,f,d){if(e==null){e=document.body}if(e.shade==null){if(f==null){f=e.offsetHeight}e.shade=document.createElement("div");NG.addClass(e.shade,"shade");e.shade.style.height=f+"px";e.shade.style.left="0";e.shade.style.position="absolute";e.shade.style.top="0";e.shade.style.width="100%"}this.disablescroll=(d==null||d);this.node=e;this.setOpacity(75);this.show()};NG.Shade.prototype.show=function(){this.oldOverflow=this.node.style.overflow;if(this.disablescroll){this.node.style.overflow="hidden";scroll(0,0)}this.node.appendChild(this.node.shade)};NG.Shade.prototype.close=function(){this.node.style.overflow=this.oldOverflow;if(this.node.shade!=null){this.node.removeChild(this.node.shade)}};NG.Shade.prototype.setOpacity=function(b){this.opacity=b;this.node.shade.style.filter="alpha(opacity="+(this.opacity)+")";this.node.shade.style.mozOpacity=this.opacity/100;this.node.shade.style.khtmlOpacity=this.opacity/100;this.node.shade.style.opacity=this.opacity/100};NG.Dialog=function(c){var d=this;this.shade=new NG.Shade();this.node=document.createElement("div");NG.addClass(this.node,"dialog");this.node.appendChild(document.createElement("div"));NG.addClass(this.node.lastChild,"inner");if(isStr(c)){this.node.lastChild.innerHTML=c}else{this.node.lastChild.appendChild(c)}this.node.appendChild(document.createElement("div"));NG.addClass(this.node.lastChild,"close");this.node.lastChild.innerHTML="X";NG.addEventListener(this.node.lastChild,"click",function(){d.Close()});document.body.appendChild(this.node);setTimeout(function(){d.node.style.right=Math.max(0,Math.floor((document.body.clientWidth-d.node.clientWidth)/2))+"px"},10)};NG.Dialog.prototype.Close=function(){document.body.removeChild(this.node);this.shade.close()};NG.Dialog.prototype.Show=function(){this.shade.show();document.body.appendChild(this.node)};NG.SendToFriends=function(j,g){var f=this;if(typeof this.dialog=="undefined"){var i=document.createElement("div");NG.addClass(i,"sendtofriends");if(typeof j=="undefined"){j=""}if(isStr(j)){i.innerHTML=j}else{i.appendChild(j)}var h=new NGUrl(window.location);h.addArgument("backboneop","sendtofriend",true);i.appendChild(document.createElement("form"));i.lastChild.action=h.toString();i.lastChild.method="post";i.lastChild.appendChild(document.createElement("div"));NG.addClass(i.lastChild.lastChild,"friends");i.lastChild.appendChild(document.createElement("a"));i.lastChild.lastChild.innerHTML="Add More Friends";i.lastChild.lastChild.href="#";NG.addEventListener(i.lastChild.lastChild,"click",function(){f.AddFriend()});i.lastChild.appendChild(document.createElement("div"));i.lastChild.lastChild.innerHTML='<input class="friend-send" type="submit" value="Send" />';this.root=i;this.dialog=new NG.Dialog(i);if(g){i.firstChild.firstChild.appendChild(document.createElement("div"));i.firstChild.firstChild.lastChild.innerHTML='<label class="current_user">Your Name: <input name="from" type="text" class="textbox" /></label><label class="current_user">Your Email: <input name="from_email" type="text" class="textbox" /></label>'}this.AddFriend()}else{this.dialog.Show()}};NG.SendToFriends.prototype.AddFriend=function(){var b=this.root.firstChild.firstChild.getElementsByTagName("div").length;this.root.firstChild.firstChild.appendChild(document.createElement("div"));this.root.firstChild.firstChild.lastChild.appendChild(document.createElement("label"));this.root.firstChild.firstChild.lastChild.lastChild.innerHTML='Name: <input name="friend['+b+'][name]" type="text" class="textbox" />';this.root.firstChild.firstChild.lastChild.appendChild(document.createElement("label"));this.root.firstChild.firstChild.lastChild.lastChild.innerHTML='Email: <input name="friend['+b+'][email]" type="text" class="textbox" />'};if(!Array.indexOf){Array.prototype.indexOf=function(c){for(var d=0;d<this.length;d++){if(this[d]==c){return d}}return -1}}if(!NG.getElementsByClassName){NG.getElementsByClassName=function(h,g){var e=[];if(NG.hasClass(h,g)){e[e.length]=h}for(var f=0;f<h.childNodes.length;f++){e=e.concat(NG.getElementsByClassName(h.childNodes[f],g))}return e}};
