var nShadow={
	images:{
		t:{
			src:'t.png',
			width:1000,
			height:6
		},
		trl:{
			src:'trl.png',
			width:19,
			height:6
		},
		tr:{
			src:'tr.png',
			width:15,
			height:6
		},
		trb:{
			src:'trb.png',
			width:16,
			height:16
		},
		r:{
			src:'r.png',
			width:16,
			height:1000
		},
		brt:{
			src:'brt.png',
			width:16,
			height:16
		},
		br:{
			src:'br.png',
			width:16,
			height:18
		},
		brl:{
			src:'brl.png',
			width:19,
			height:18
		},
		b:{
			src:'b.png',
			width:1000,
			height:18
		},
		blr:{
			src:'blr.png',
			width:26,
			height:18
		},
		bl:{
			src:'bl.png',
			width:8,
			height:17
		},
		blt:{
			src:'blt.png',
			width:8,
			height:16
		},
		l:{
			src:'l.png',
			width:8,
			height:1000
		},
		tlb:{
			src:'tlb.png',
			width:8,
			height:16
		},
		tl:{
			src:'tl.png',
			width:7,
			height:5
		},
		tlr:{
			src:'tlr.png',
			width:26,
			height:6
		}
	},
	init:function(element){
		var isIE=(window.attachEvent && ! window.opera);
		//Path
		var path=nUtils.getScriptPath('nShadow.js');
		
		var mainDiv=element;
		if($(mainDiv)){
			mainDiv.style.border="none";
			mainDiv.nShadow={};
			var mainDivWidth=mainDiv.offsetWidth;
			var mainDivHeight=mainDiv.offsetHeight;

			this.images=nShadow.images;
			//Top
			var div=document.createElement('div');
			var divWidth=mainDivWidth-this.images.tlr.width-this.images.trl.width;
			if(divWidth < 0) divWidth=0;
			var img=this.images.t;
			var divHeight=img.height;
			with(div.style){
				position='absolute';
				top=-divHeight+"px";
				left=this.images.tlr.width+"px";
				width=divWidth+"px";
				height=divHeight+"px";
				if(isIE){
					filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+path+'/img/'+img.src+"', sizingMethod='crop')";
				}else{
					backgroundImage="url('"+path+'/img/'+img.src+"')";
				}
			}
			mainDiv.appendChild(div);
			mainDiv.nShadow['t']=div;
			
			//Top-Right-left
			div=document.createElement('div');
			img=this.images.trl;
			divWidth=img.width;
			divHeight=img.height;
			div.innerHTML='&nbsp;';
			with(div.style){
				position='absolute';
				top=-divHeight+"px";
				right="0px";
				width=divWidth+"px";
				height=divHeight+"px";
				if(isIE){
					filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+path+'/img/'+img.src+"', sizingMethod='crop')";
				}else{
					backgroundImage="url('"+path+'/img/'+img.src+"')";
				}
			}
			mainDiv.appendChild(div);
			mainDiv.nShadow['trl']=div;
			
			//Top-Right
			div=document.createElement('div');
			img=this.images.tr;
			divWidth=img.width;
			divHeight=img.height;
			div.innerHTML='&nbsp;';
			with(div.style){
				position='absolute';
				top=-divHeight+"px";
				right=(-divWidth)+"px";
				width=divWidth+"px";
				height=divHeight+"px";
				if(isIE){
					filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+path+'/img/'+img.src+"', sizingMethod='crop')";
				}else{
					backgroundImage="url('"+path+'/img/'+img.src+"')";
				}
			}
			mainDiv.appendChild(div);
			mainDiv.nShadow['tr']=div;
			
			//Top-Right-Bottom
			div=document.createElement('div');
			img=this.images.trb;
			divWidth=img.width;
			divHeight=img.height;
			div.innerHTML='&nbsp;';
			with(div.style){
				position='absolute';
				top="0px";
				right=(-divWidth)+"px";
				width=divWidth+"px";
				height=divHeight+"px";
				if(isIE){
					filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+path+'/img/'+img.src+"', sizingMethod='crop')";
				}else{
					backgroundImage="url('"+path+'/img/'+img.src+"')";
				}
			}
			mainDiv.appendChild(div);
			mainDiv.nShadow['trb']=div;
			
			//Right
			div=document.createElement('div');
			img=this.images.r;
			divWidth=img.width;
			divHeight=mainDivHeight-this.images.trb.height-this.images.brt.height;
			if(divHeight < 0) divHeight=0;
			div.innerHTML='&nbsp;';
			with(div.style){
				position='absolute';
				top=this.images.trb.height+"px";
				right=(-divWidth)+"px";
				width=divWidth+"px";
				height=divHeight+"px";
				if(isIE){
					filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+path+'/img/'+img.src+"', sizingMethod='crop')";
				}else{
					backgroundImage="url('"+path+'/img/'+img.src+"')";
				}
			}
			mainDiv.appendChild(div);
			mainDiv.nShadow['r']=div;
			
			//Bottom-Right-Top
			div=document.createElement('div');
			img=this.images.brt;
			divWidth=img.width;
			divHeight=img.height;
			div.innerHTML='&nbsp;';
			with(div.style){
				position='absolute';
				bottom="0px";
				right=(-divWidth)+"px";
				width=divWidth+"px";
				height=divHeight+"px";
				if(isIE){
					filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+path+'/img/'+img.src+"', sizingMethod='crop')";
				}else{
					backgroundImage="url('"+path+'/img/'+img.src+"')";
				}
			}
			mainDiv.appendChild(div);
			mainDiv.nShadow['brt']=div;
			
			//Bottom-Right
			div=document.createElement('div');
			img=this.images.br;
			divWidth=img.width;
			divHeight=img.height;
			div.innerHTML='&nbsp;';
			with(div.style){
				position='absolute';
				bottom=(-divHeight)+"px";
				right=(-divWidth)+"px";
				width=divWidth+"px";
				height=divHeight+"px";
				if(isIE){
					filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+path+'/img/'+img.src+"', sizingMethod='crop')";
				}else{
					backgroundImage="url('"+path+'/img/'+img.src+"')";
				}
			}
			mainDiv.appendChild(div);
			mainDiv.nShadow['br']=div;
			
			//Bottom-Right-Left
			div=document.createElement('div');
			img=this.images.brl;
			divWidth=img.width;
			divHeight=img.height;
			div.innerHTML='&nbsp;';
			with(div.style){
				position='absolute';
				bottom=(-divHeight)+"px";
				right="0px";
				width=divWidth+"px";
				height=divHeight+"px";
				if(isIE){
					filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+path+'/img/'+img.src+"', sizingMethod='crop')";
				}else{
					backgroundImage="url('"+path+'/img/'+img.src+"')";
				}
			}
			mainDiv.appendChild(div);
			mainDiv.nShadow['brl']=div;
			
			//Bottom
			div=document.createElement('div');
			img=this.images.b;
			divWidth=mainDivWidth-this.images.blr.width-this.images.brl.width;
			if(divWidth < 0) divWidth=0;
			divHeight=img.height;
			div.innerHTML='&nbsp;';
			with(div.style){
				position='absolute';
				bottom=(-divHeight)+"px";
				left=this.images.blr.width+"px";
				width=divWidth+"px";
				height=divHeight+"px";
				if(isIE){
					filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+path+'/img/'+img.src+"', sizingMethod='crop')";
				}else{
					backgroundImage="url('"+path+'/img/'+img.src+"')";
				}
			}
			mainDiv.appendChild(div);
			mainDiv.nShadow['b']=div;
			
			//Bottom-Left-Right
			div=document.createElement('div');
			img=this.images.blr;
			divWidth=img.width;
			divHeight=img.height;
			div.innerHTML='&nbsp;';
			with(div.style){
				position='absolute';
				bottom=(-divHeight)+"px";
				left="0px";
				width=divWidth+"px";
				height=divHeight+"px";
				if(isIE){
					filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+path+'/img/'+img.src+"', sizingMethod='crop')";
				}else{
					backgroundImage="url('"+path+'/img/'+img.src+"')";
				}
			}
			mainDiv.appendChild(div);
			mainDiv.nShadow['blr']=div;
			
			//Bottom-Left
			div=document.createElement('div');
			img=this.images.bl;
			divWidth=img.width;
			divHeight=img.height;
			div.innerHTML='&nbsp;';
			with(div.style){
				position='absolute';
				bottom=(-divHeight)+"px";
				left=-divWidth+"px";
				width=divWidth+"px";
				height=divHeight+"px";
				if(isIE){
					filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+path+'/img/'+img.src+"', sizingMethod='crop')";
				}else{
					backgroundImage="url('"+path+'/img/'+img.src+"')";
				}
			}
			mainDiv.appendChild(div);
			mainDiv.nShadow['bl']=div;
			
			//Bottom-Left-Top
			div=document.createElement('div');
			img=this.images.blt;
			divWidth=img.width;
			divHeight=img.height;
			div.innerHTML='&nbsp;';
			with(div.style){
				position='absolute';
				bottom="0px";
				left=-divWidth+"px";
				width=divWidth+"px";
				height=divHeight+"px";
				if(isIE){
					filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+path+'/img/'+img.src+"', sizingMethod='crop')";
				}else{
					backgroundImage="url('"+path+'/img/'+img.src+"')";
				}
			}
			mainDiv.appendChild(div);
			mainDiv.nShadow['blt']=div;
			
			//Left
			div=document.createElement('div');
			img=this.images.l;
			divWidth=img.width;
			divHeight=mainDivHeight-this.images.tlb.height-this.images.blt.height;
			if(divHeight < 0) divHeight=0;
			div.innerHTML='&nbsp;';
			with(div.style){
				position='absolute';
				top=this.images.tlb.height+"px";
				left=-divWidth+"px";
				width=divWidth+"px";
				height=divHeight+"px";
				if(isIE){
					filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+path+'/img/'+img.src+"', sizingMethod='crop')";
				}else{
					backgroundImage="url('"+path+'/img/'+img.src+"')";
				}
			}
			mainDiv.appendChild(div);
			mainDiv.nShadow['l']=div;
			
			//Top-Left-Bottom
			div=document.createElement('div');
			img=this.images.tlb;
			divWidth=img.width;
			divHeight=img.height;
			div.innerHTML='&nbsp;';
			with(div.style){
				position='absolute';
				top="0px";
				left=-divWidth+"px";
				width=divWidth+"px";
				height=divHeight+"px";
				if(isIE){
					filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+path+'/img/'+img.src+"', sizingMethod='crop')";
				}else{
					backgroundImage="url('"+path+'/img/'+img.src+"')";
				}
			}
			mainDiv.appendChild(div);
			mainDiv.nShadow['tlb']=div;
			
			//Top-Left
			div=document.createElement('div');
			img=this.images.tl;
			divWidth=img.width;
			divHeight=img.height;
			div.innerHTML='&nbsp;';
			with(div.style){
				position='absolute';
				top=-divHeight+"px";
				left=-divWidth+"px";
				width=divWidth+"px";
				height=divHeight+"px";
				if(isIE){
					filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+path+'/img/'+img.src+"', sizingMethod='crop')";
				}else{
					backgroundImage="url('"+path+'/img/'+img.src+"')";
				}
			}
			mainDiv.appendChild(div);
			mainDiv.nShadow['tl']=div;
			
			//Top-Left-Right
			div=document.createElement('div');
			img=this.images.tlr;
			divWidth=img.width;
			divHeight=img.height;
			div.innerHTML='&nbsp;';
			with(div.style){
				position='absolute';
				top=-divHeight+"px";
				left="0px";
				width=divWidth+"px";
				height=divHeight+"px";
				if(isIE){
					filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+path+'/img/'+img.src+"', sizingMethod='crop')";
				}else{
					backgroundImage="url('"+path+'/img/'+img.src+"')";
				}
			}
			mainDiv.appendChild(div);
			mainDiv.nShadow['tlr']=div;
		}
	},
	resize:function(element){
			if(!element.nShadow) return false;
			var newWidth=element.offsetWidth;
			var newHeight=element.offsetHeight;
			var newWidth=(newWidth-nShadow.images.tlr.width-nShadow.images.trl.width);
			if(newWidth < 0) newWidth=0;
			//alert(newWidth);
			var newHeight=(newHeight-nShadow.images.trb.height-nShadow.images.brt.height);
			if(newHeight < 0) newHeight=0;
			with(element.nShadow){
				t.style.width=b.style.width=(newWidth)+"px";
				l.style.height=r.style.height=(newHeight)+"px";
				t.innerHTML=trl.innerHTML=tr.innerHTML=trb.innerHTML=r.innerHTML=brt.innerHTML=br.innerHTML=brl.innerHTML=b.innerHTML=blr.innerHTML=bl.innerHTML=blt.innerHTML=l.innerHTML=tlb.innerHTML=tl.innerHTML=tlr.innerHTML='&nbsp;';
			}
			
	}
}