var aSlider = {    
	animation: "slide",
	slideFrom:"right",
	unfoldFrom: "left",
	height:100,
	width:100,
	fheight:"100px",
	fwidth:"100px",
	location:"top",
	align:"opposite",
	delay: 500,
	duration:500,
	fadeOut: false,
	fadeDuration:500,
	fadeTimeout:2000,
	div:document.createElement("div"),
	iframe:document.createElement("iframe"),	
	closeable:true,
	closeButton:null,
	defaultCloseButton: "<input type=\"button\" value=\"X\">",
	oncomplete:null,
	ani:{},

	init:function(options){
		try{
			if(document.doctype && document.doctype == null){
				var newDoctype = document.implementation.createDocumentType(
				'html',
				'-//W3C//DTD XHTML 1.0 Transitional//EN',
				'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'
				);
				document.doctype.parentNode.replaceChild(newDoctype, document.doctype);
			}
		}catch(e){}
		this.iframe.allowTransparency = true;
		var jdiv = $mowpop(this.div);
		var jiframe = $mowpop(this.iframe);
		
		jdiv.css({overflow:"hidden",position:"fixed",allowTransparency:"true",display:"none",zIndex:2147483647});
		jiframe.css({width:"0px",height:"0px",overflow:"hidden",border:"0px"});

		this.iframe.src = options.url;
		this.iframe.scrolling = "no";
		this.iframe.frameBorder = 0;
		document.body.appendChild(this.iframe);
		
		for(var x in options){if(typeof(this[x]) != "undefined"){this[x] = options[x];}}
		
		if(!isNaN(this.height) || (this.height.search(/px/i) == -1 && this.height.search(/em/i) == -1 && this.height.search(/%/i) == -1)){this.fheight = this.height + "px";}
		else{this.fheight = this.height;}
		
		if(!isNaN(this.width) || (this.width.search(/px/i) == -1 && this.width.search(/em/i) == -1 && this.width.search(/%/i) == -1)){this.fwidth = this.width + "px";}
		else{this.fwidth = this.width;}
		
		var hCenter = ($mowpop(window).width() / 2) - (this.width / 2);
		var vCenter = ($mowpop(window).height() / 2) - (this.height / 2);
		
		var eStyle = {};
		if(this.animation == "slide"){
			switch(this.location){
				case "top":
				case "bottom":
					if(this.location == "top"){eStyle = {top:"0px",height:"0px",width:this.fwidth};}
					else{eStyle = {bottom:"0px",height:"0px",width:this.fwidth};}
					if(this.align == "center"){eStyle.left = hCenter + "px";}
					else if(this.align == "opposite"){eStyle.right = "0px";}
					else{eStyle.left = "0px";}			
					this.ani = {height:this.fheight};
					break;
				
				case "right":
				case "left":
					if(this.location == "right"){eStyle = {right:"0px",width:"0px",height:this.fheight};}
					else{eStyle = {left:"0px",width:"0px",height:this.fheight};}
					
					if(this.align == "center"){eStyle.top = vCenter + "px";}
					else if(this.align == "opposite"){eStyle.bottom = "0px";}
					else{eStyle.top = "0px";}			
					this.ani = {width:this.fwidth};
					break;
				case "center":
					eStyle = {width:this.fwidth,height:this.fheight};
					
					if(this.slideFrom == "top" || this.slideFrom == "bottom"){
						eStyle.left = hCenter + "px";
						if(this.slideFrom == "top"){
							eStyle.top = "-" + this.fheight;
							this.ani = {top:vCenter + "px"};
						}
						else{
							eStyle.bottom = "-" + this.fheight;
							this.ani = {bottom:vCenter + "px"};
						}
					}
					else if(this.slideFrom == "left" || this.slideFrom == "right"){
						eStyle.top = vCenter + "px";
						if(this.slideFrom == "left"){
							eStyle.left = "-" + this.fwidth;
							this.ani = {left:hCenter + "px"};
						}
						else{
							eStyle.right = "-" + this.fwidth;
							this.ani = {right:hCenter + "px"};
						}
					}
					
					break;
			}
		}
		else if(this.animation == "unfold"){
			eStyle = {};
			
			switch(this.unfoldFrom){
				case "left":
					eStyle = {top:vCenter+"px",left:hCenter+"px",width:"0px",height:this.fheight};
					this.ani = {width:this.fwidth};
					break;
				case "right":
					eStyle = {top:vCenter+"px",right:hCenter+"px",width:"0px",height:this.fheight};
					this.ani = {width:this.fwidth};
					break;
				case "top":
					eStyle = {top:vCenter+"px",left:hCenter+"px",height:"0px",width:this.fwidth};
					this.ani = {height:this.fheight};
					break;
				case "bottom":
					eStyle = {bottom:vCenter+"px",left:hCenter+"px",height:"0px",width:this.fwidth};
					this.ani = {height:this.fheight};
					break;
				
			}
			
			
		}
		
		
		jdiv.css(eStyle);
		
		document.body.appendChild(this.div);
		var obj = this;

		$mowpop(this.iframe).css({width:"100%",height:"100%"});
		document.body.removeChild(this.iframe);
		this.div.appendChild(this.iframe);

		setTimeout(function(){obj.animate(obj);},this.delay); 


	},
	close:function(obj){$mowpop(obj.div).fadeOut(obj.fadeDuration);},
	animate:function(obj){			    
	    obj.div.style.display = "block";
	    var div = $mowpop(obj.div);
	    div.animate(obj.ani,obj.duration,function(){				    
		if(obj.oncomplete && obj.oncomplete != null){
			obj.oncomplete();
		}
		if(obj.closeable){
			if(obj.closeButton != null){
				var b = $mowpop(obj.iframe).contents().find(obj.closeButton);
				if(b.length > 0){
					b.css("cursor","pointer");
					b.click(function(){obj.close(obj);});
				}
				else{obj.closeButton = null;}
			}

			if(obj.closeButton == null){
				obj.closeButton = $mowpop(document.createElement("div"));
				obj.closeButton.css({position:"absolute",top:"0px",right:"0px"});
				obj.closeButton.html(obj.defaultCloseButton);
				obj.closeButton.children().first().click(function(){obj.close(obj);});
				obj.div.appendChild(obj.closeButton.get(0));
			}
		}
		if(obj.fadeOut == true){setTimeout(function(){obj.close(obj);},obj.fadeTimeout);}
	    });
	}
} 

