NG.Shade=function(b,a,c){if(b==null){b=document.body}if(b.shade==null){if(a==null){a=b.offsetHeight}b.shade=document.createElement("div");NG.addClass(b.shade,"shade");b.shade.style.height=a+"px";b.shade.style.left="0";b.shade.style.position="absolute";b.shade.style.top="0";b.shade.style.width="100%"}this.disablescroll=(c==null||c);this.node=b;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(a){this.opacity=a;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(b){var a=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(b)){this.node.lastChild.innerHTML=b}else{this.node.lastChild.appendChild(b)}this.node.appendChild(document.createElement("div"));NG.addClass(this.node.lastChild,"close");this.node.lastChild.innerHTML="X";NG.addEventListener(this.node.lastChild,"click",function(){a.Close()});document.body.appendChild(this.node);setTimeout(function(){a.node.style.right=Math.max(0,Math.floor((document.body.clientWidth-a.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(e,c){var d=this;if(typeof this.dialog=="undefined"){var a=document.createElement("div");NG.addClass(a,"sendtofriends");if(typeof e=="undefined"){e=""}if(isStr(e)){a.innerHTML=e}else{a.appendChild(e)}var b=new NGUrl(window.location);b.addArgument("backboneop","sendtofriend",true);a.appendChild(document.createElement("form"));a.lastChild.action=b.toString();a.lastChild.method="post";a.lastChild.appendChild(document.createElement("div"));NG.addClass(a.lastChild.lastChild,"friends");a.lastChild.appendChild(document.createElement("a"));a.lastChild.lastChild.innerHTML="Add More Friends";a.lastChild.lastChild.href="#";NG.addEventListener(a.lastChild.lastChild,"click",function(){d.AddFriend()});a.lastChild.appendChild(document.createElement("div"));a.lastChild.lastChild.innerHTML='<input class="friend-send" type="submit" value="Send" />';this.root=a;this.dialog=new NG.Dialog(a);if(c){a.firstChild.firstChild.appendChild(document.createElement("div"));a.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 a=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['+a+'][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['+a+'][email]" type="text" class="textbox" />'};if(!Array.indexOf){Array.prototype.indexOf=function(b){for(var a=0;a<this.length;a++){if(this[a]==b){return a}}return -1}}if(!NG.getElementsByClassName){NG.getElementsByClassName=function(c,d){var b=[];if(NG.hasClass(c,d)){b[b.length]=c}for(var a=0;a<c.childNodes.length;a++){b=b.concat(NG.getElementsByClassName(c.childNodes[a],d))}return b}};