(function(win, doc){
	var settings, body,  head;
    var DOMAIN="http://www.isharemybitch.com/";
   
	if(doc.getElementsByTagName){ head = doc.getElementsByTagName('head')[0] || doc.documentElement; }
	else{ head = doc.documentElement; }
	
	var _$ = typeof(jQuery) === "undefined" ? false : jQuery;
	if(!_$){
		var jQscript=doc.createElement('script');
	    // use the latest version of the jQuery core library
	    jQscript.src='http://code.jquery.com/jquery-latest.min.js';
	    // append the new script element to the DOM
		
		
	   jQscript.onreadystatechange = function(){	
		   
			if (jQscript.readyState == 'loaded' || jQscript.readyState=="complete") {
				_$ = jQuery;
				init();
			};
	   }
	   
		jQscript.onreadystatechange();
		jQscript.onload=function(){
			_$ = jQuery;
			init();
		};
	    head.appendChild(jQscript);
	    
	   
	}else{
		init();
	}
	 
	

	function loadFiles(){
		
		var style = doc.createElement("link");
		style.setAttribute("href",DOMAIN+"gallery-widget/css/white/style.css");
		style.setAttribute("media","screen");
		style.setAttribute("title","white");
		style.setAttribute("rel","stylesheet");
		style.setAttribute("type","text/css");
		head.appendChild(style);
		
		style = doc.createElement("link");
		style.setAttribute("href",DOMAIN+"gallery-widget/css/modual_css.css");
		style.setAttribute("media","screen");
	
		style.setAttribute("rel","stylesheet");
		style.setAttribute("type","text/css");
		
		head.appendChild(style);
		
		var script = doc.createElement("script");
		script.src=DOMAIN+"gallery-widget/piroBox.1_2_min.js";
		head.appendChild(script);	
		
	}
	var modalWindow = {
			parent:"body",
			windowId:null,
			content:null,
			width:null,
			height:null,
			close:function()
			{
				_$(".modal-window").remove();
				_$(".modal-overlay").remove();
			},
			open:function()
			{
				var modal = "";
				modal += "<div class=\"modal-overlay\"></div>";
				modal += "<div id=\"" + this.windowId + "\" class=\"modal-window\" style=\"width:" + this.width + "px; height:" + this.height + "px; margin-top:-" + (this.height / 2) + "px; margin-left:-" + (this.width / 2) + "px;\">";
				modal += this.content;
				modal += "</div>";	

				_$(this.parent).append(modal);

				_$(".modal-window").append("<a class=\"close-window\"></a>");
				_$(".close-window").click(function(){modalWindow.close();});
				_$(".modal-overlay").click(function(){modalWindow.close();});
			}
		};
	
	var gallery=function(options){
		var _images=[];		
		
		this.add=function(thumb,large,hidden,title){
			_images.push({thumb:thumb,large:hidden ? thumb : large,hidden:hidden,rel:hidden ? large : null,title:title});
		}
			
		this.create=function(div){
			var d=_$(div);
			var str="";
			for(var idx in _images){
				str+=_t(options.name,_images[idx]);
			}
			
			// create embed screen
			
			str+="<div id='isharemybitch-embed' style='clear:both'>" +
			"<strong>Embed Code for this gallery:</strong>  <br/>" +
			"Width : <input style='width: 50px;' value='"+options.width+"' id=\"txtEmbedWidth\"><br/>" +
			"<input type=\"button\" value=\"Generate Embed Code\"></div>";
			d.html(str);
			_$("#isharemybitch-embed :button",d).click(function(){
				var width=_$("#txtEmbedWidth",d).val();
				modalWindow.windowId = "myModal";  
				modalWindow.width = 310;  
				modalWindow.height = 200;  
				modalWindow.content = "<textarea style='width:300px;height:180px'>"+_embed(options.id,width)+"</textarea>";  
				modalWindow.open();  
				
			});
			
		}
		
	};
	
	
	function _embed(id,width){
		return "<div id=\"isharemybitch-gallery-"+id+"\" style=\"width:"+width+"px;\"></div>" +
				"<script type=\"text/javascript\" src=\""+DOMAIN+"gallery-widget/widget.php?id="+id+"&width="+width+"\"></script>"; 
			
	}
	
	function _t(name,img){
		var style=img.hidden ? " style='display:none'" :"";
		var href = "href='"+img.large+"'";
		href+=img.hidden ? " aff='"+img.rel+"'" : "";
		var title = " title='"+img.title+"' ";
		return "<div class='isharemybitch-gallery-item-container' "+style+">" +
				"<a "+href+" class='pirobox_gall_"+name+"'"+title+"><img src='"+img.thumb+"'/></a></div>";
	}
	function initGallery(){
		
		var check=setInterval(function(){
			if(typeof(jQuery().piroBox) === "undefined") return;
			clearInterval(check);
		jQuery().piroBox({
		      my_speed: 300, // animation speed
		      bg_alpha: 0.5, // background opacity
		      radius: 4, // caption rounded corner
		      scrollImage : false, // true == image follows the page _|_
									// false == image remains in the same
									// open position
		                           // in some cases of very large images or
									// long description could be useful.
		      slideShow : 'slideshow', // true == slideshow on, false ==
									// slideshow off
		      slideSpeed : 3, // slideshow
		      pirobox_next : 'piro_next', // Nav buttons -> piro_next ==
											// inside piroBox ,
											// piro_next_out == outside
											// piroBox
		      pirobox_prev : 'piro_prev', // Nav buttons -> piro_prev ==
											// inside piroBox ,
											// piro_prev_out == outside
											// piroBox
		      close_all : '.piro_close' // add class .piro_overlay(with
										// comma)if you want overlay click
										// close piroBox
		      });	
		},10)
	}
	 function init(){
		 if(typeof(window.IShareMyBitch) === "undefined"){
			
		    	loadFiles();    	
		   }
		
		 if(typeof(window.IShareMyBitch) ==="undefined" ){
				window.IShareMyBitch={
						createNewGallery:function(options){	
							return new gallery(options);
							},
					initGallerySettings:initGallery,
					Loaded:true
				};
				
			}
	 }

})(window,document);

<br />
<b>Warning</b>:  scandir(/home/domains/isharemybitch.com/public_html/media/galleries/4b78868abafac) [<a href='function.scandir'>function.scandir</a>]: failed to open dir: No such file or directory in <b>/home/domains/isharemybitch.com/public_html/gallery-widget/widget.php</b> on line <b>61</b><br />
<br />
<b>Warning</b>:  scandir() [<a href='function.scandir'>function.scandir</a>]: (errno 2): No such file or directory in <b>/home/domains/isharemybitch.com/public_html/gallery-widget/widget.php</b> on line <b>61</b><br />
<br />
<b>Warning</b>:  Invalid argument supplied for foreach() in <b>/home/domains/isharemybitch.com/public_html/gallery-widget/widget.php</b> on line <b>64</b><br />
 /* for Mozilla */
   if (document.addEventListener) {
       document.addEventListener("DOMContentLoaded", init_gallery, false);
   }

   /* for Internet Explorer */
   /*@cc_on @*/
   /*@if (@_win32)
       document.write("<script defer >init_gallery();<"+"/script>");
   /*@end @*/

   /* for other browsers */
   window.onload = init_gallery;



function init_gallery(){
	window["bitch_pending"] = this;
	if(arguments.callee.done) return;
	
	var c=arguments.callee;
	
	var _timer = setInterval(function() {
	var bitch = window["IShareMyBitch"];
	if (typeof bitch === "undefined") return;
	if(c.done){ clearInterval(_timer); return;}
	c.done = true;
	clearInterval(_timer)
	var gallery = bitch.createNewGallery({name:"4b78868abafac",width:588,id:1128});
				gallery.create("#isharemybitch-gallery-1128");
		bitch.initGallerySettings();

	},10);
}
