function DropShadowInterface(color,xOffset,yOffset,blur,opacity,xShrink,yShrink){this.dropShadowId=null;this.elemId=null;this.color=null;this.xOffset=null;this.yOffset=null;this.xShrink=null;this.yShrink=null;this.blur=null;this.opacity=null;this.shadowStyle=null;this.images=new Array;this.draw=DropShadowInterface_Draw;this.erase=DropShadowInterface_Erase;this.init=DropShadowInterface_Init;this.setBlur=DropShadowInterface_SetBlur;this.alignElement=DropShadowInterface_AlignElement;return this;}
DropShadowInterface.prototype=new Interface;DropShadowInterface.prototype.constructor=DropShadowInterface;DropShadowInterface.superclass=Interface.prototype;DropShadowInterface.styles={DefaultMenu:{color:'rgb(0,0,0)',xOffset:10,yOffset:15,blur:{iRadius:12,iSigma:20},opacity:.2,xShrink:16,yShrink:20},Default:{color:'rgb(0,0,0)',xOffset:17,yOffset:17,blur:{iRadius:20,iSigma:20},opacity:.2,xShrink:29,yShrink:24},IEDefault:{color:'rgb(0,0,0)',xOffset:7,yOffset:10,blur:{iRadius:10,iSigma:20},opacity:.2,xShrink:9,yShrink:10},CheckAll:{color:'rgb(0,0,0)',xOffset:7,yOffset:7,blur:{iRadius:10,iSigma:10},opacity:.2,xShrink:9,yShrink:4},oldIe:{color:'rgb(0,0,0)',xOffset:7,yOffset:10,blur:{iRadius:10,iSigma:20},opacity:.2,xShrink:9,yShrink:10}};DropShadowInterface.engineUrl='/gfx/gradient.php';DropShadowInterface.imgIds={top:0,left:1,bottom:2,right:3,topLeft:4,bottomLeft:5,bottomRight:6,topRight:7};function DropShadowInterface_Init(color,xOffset,yOffset,blur,opacity,xShrink,yShrink){if(!this.shadowStyle&&DomUtils.browser.isIE())this.shadowStyle='IEDefault';else if(!this.shadowStyle)this.shadowStyle='Default';var shadowStyle=DropShadowInterface.styles[this.shadowStyle];this.color=(color)?color:shadowStyle.color;this.xOffset=!isNaN(xOffset)?xOffset:shadowStyle.xOffset;this.yOffset=!isNaN(yOffset)?yOffset:shadowStyle.yOffset;this.blur=isString(blur)?blur:shadowStyle.blur;this.opacity=isFloat(opacity)?opacity:shadowStyle.opacity;this.xShrink=!isNaN(xShrink)?xShrink:shadowStyle.xShrink;this.yShrink=!isNaN(yShrink)?yShrink:shadowStyle.yShrink;this.hexColor='';this.rgbColor='';var rgbRegex=/^rgb\(\s?([0-9]{1,3})\s?\,\s?([0-9]{1,3})\s?\,\s?([0-9]{1,3})\s?\)/;var hexRegex=/^\#?[0-9A-Fa-f]{3}$|\#[0-9A-Fa-f]{6}$/;if(hexRegex.test(this.color)){var triplets=new Array;if(this.color.length>4){this.hexColor=this.color;for(var start=1;start+2<=this.color.length;start+=2)triplets[triplets.length]=this.color.substr(start,2);for(var i=0;i<triplets.length;i++)triplets[i]=parseInt(triplets[i],16);this.rgbColor=triplets.join(',');}else if(this.color.length==4){for(var start=1;start+1<=this.color.length;start++)triplets[triplets.length]=this.color.substr(start,1)+this.color.substr(start,1);this.hexColor='#'+triplets.join('');for(var i=0;i<triplets.length;i++)triplets[i]=parseInt(triplets[i],16);this.rgbColor=triplets.join(',');}else throw new Error('No valid color setting defined! color: '+this.color);}else{var matches=this.color.match(rgbRegex);if(matches&&matches.length>1){matches.shift();for(var i=0;i<matches.length;i++){if(parseInt(matches[i])>255)throw new Error('Invalid RGB color specified: '+this.color);}
this.rgbColor=matches.join(',');}else throw new Error('No valid color setting defined! color: '+this.color);}
if(isString(this.blur)){var radius=parseInt(this.blur);var sigma=0;if(this.blur.indexOf('x')>0)sigma=parseInt(this.blur.split('x')[1]);this.setBlur(radius,sigma);}
this.images=new Array;this.images[DropShadowInterface.imgIds.top]=DropShadowInterface.engineUrl+'?grad=linear&dir=btt&height='+this.blur.iRadius+
'&width='+this.blur.iRadius+'&color='+this.rgbColor+'&gaussian='+this.blur.iRadius+'x'+this.blur.iSigma+'&opacity='+this.opacity;this.images[DropShadowInterface.imgIds.bottom]=DropShadowInterface.engineUrl+'?grad=linear&dir=ttb&height='+this.blur.iRadius+
'&width='+this.blur.iRadius+'&color='+this.rgbColor+'&gaussian='+this.blur.iRadius+'x'+this.blur.iSigma+'&opacity='+this.opacity;this.images[DropShadowInterface.imgIds.left]=DropShadowInterface.engineUrl+'?grad=linear&dir=rtl&height='+this.blur.iRadius+
'&width='+this.blur.iRadius+'&color='+this.rgbColor+'&gaussian='+this.blur.iRadius+'x'+this.blur.iSigma+'&opacity='+this.opacity;this.images[DropShadowInterface.imgIds.right]=DropShadowInterface.engineUrl+'?grad=linear&dir=ltr&height='+this.blur.iRadius+
'&width='+this.blur.iRadius+'&color='+this.rgbColor+'&gaussian='+this.blur.iRadius+'x'+this.blur.iSigma+'&opacity='+this.opacity;this.images[DropShadowInterface.imgIds.bottomRight]=DropShadowInterface.engineUrl+'?grad=radial&radius='+(this.blur.iRadius*2)+
'&height='+this.blur.iRadius+'&width='+this.blur.iRadius+'&opacity='+this.opacity+
'&x=0&y=0'+'&color='+this.rgbColor+'&gaussian='+this.blur.iRadius+'x'+this.blur.iSigma;this.images[DropShadowInterface.imgIds.topRight]=DropShadowInterface.engineUrl+'?grad=radial&radius='+(this.blur.iRadius*2)+
'&height='+this.blur.iRadius+'&width='+this.blur.iRadius+'&opacity='+this.opacity+
'&x=0&y='+(this.blur.iRadius+1)+'&color='+this.rgbColor+'&gaussian='+this.blur.iRadius+'x'+this.blur.iSigma;this.images[DropShadowInterface.imgIds.bottomLeft]=DropShadowInterface.engineUrl+'?grad=radial&radius='+(this.blur.iRadius*2)+
'&height='+this.blur.iRadius+'&width='+this.blur.iRadius+'&opacity='+this.opacity+
'&x='+(this.blur.iRadius+1)+'&y=0'+'&color='+this.rgbColor+'&gaussian='+this.blur.iRadius+'x'+this.blur.iSigma;this.images[DropShadowInterface.imgIds.topLeft]=DropShadowInterface.engineUrl+'?grad=radial&radius='+(this.blur.iRadius*2)+
'&height='+this.blur.iRadius+'&width='+this.blur.iRadius+'&opacity='+this.opacity+
'&x='+(this.blur.iRadius+1)+'&y='+(this.blur.iRadius+1)+'&color='+this.rgbColor+'&gaussian='+this.blur.iRadius+'x'+this.blur.iSigma;if(typeof(window.preloadImage)=='function'){for(i=0;i<this.images.length;i++){util.resourceManager.get(this.images[i]);}}
}
function DropShadowInterface_Draw(){var opacity=this.opacity;var dropShadow=document.getElementById(this.dropShadowId);if(dropShadow){DomUtils.removeElement(dropShadow);dropShadow=null;}
var elem=document.getElementById(this.elemId);if(elem){var zIndex=parseInt(DomUtils.getZIndex(elem))-2;this.dropShadowId=this.id+'_DropShadow';var dropShadow=elem.cloneNode(false);dropShadow.id=this.dropShadowId;dropShadow.style.visibility='hidden';dropShadow.style.zIndex=zIndex;dropShadow.className='';dropShadow.style.position='absolute';dropShadow.style.backgroundColor='transparent';dropShadow.style.border='none';dropShadow.style.left=parseInt(DomUtils.getElementLeft(elem))+'px';dropShadow.style.top=parseInt(DomUtils.getElementTop(elem))+'px';dropShadow.xOffset=parseInt(this.xOffset);dropShadow.yOffset=parseInt(this.yOffset);dropShadow.overflow='visible !important';document.getElementsByTagName('body')[0].appendChild(dropShadow);if(this.xShrink){dropShadow.style.width=parseInt(parseInt(DomUtils.getElementWidth(elem))+(parseInt(this.xShrink)/2))+'px';}
if(this.yShrink){dropShadow.style.height=parseInt(parseInt(DomUtils.getElementHeight(elem))+(parseInt(this.yShrink)/2))+'px';}
if(DomUtils.browser.isIE()){var eStyle=DomUtils.getCurrentStyle(elem);pLeft=parseInt(eStyle.paddingLeft);pRight=parseInt(eStyle.paddingRight);pTop=parseInt(eStyle.paddingTop);pBottom=parseInt(eStyle.paddingBottom);pWidth=parseInt((!isNaN(pLeft)?pLeft:0)+(!isNaN(pRight)?pRight:0));pHeight=parseInt((!isNaN(pTop)?pTop:0)+(!isNaN(pBottom)?pBottom:0));}else{pHeight=0;pWidth=0;}
var img;var shadow=document.createElement('div');shadow.id=this.id+'_DropShadow_Main';shadow.style.position='absolute';shadow.style.width=parseInt(parseInt(DomUtils.getElementWidth(elem))-parseInt(this.xShrink))+'px';shadow.style.height=parseInt(parseInt(DomUtils.getElementHeight(elem))-parseInt(this.yShrink))+'px';shadow.style.left=parseInt(this.xOffset)+'px';shadow.style.top=parseInt(this.yOffset)+'px';shadow.style.border='none';shadow.style.backgroundColor='rgb('+this.rgbColor+')';shadow.style.zIndex=zIndex;if(DomUtils.browser.isIE())shadow.style.filter+='progid:DXImageTransform.Microsoft.Alpha(opacity='+(this.opacity*100)+')';else shadow.style.MozOpacity=this.opacity;dropShadow.appendChild(shadow);var bottomEdge=document.createElement('div');bottomEdge.id=this.id+'_DropShadow_Bottom';bottomEdge.className='shadow';bottomEdge.style.position='absolute';bottomEdge.style.top=parseInt(parseInt(DomUtils.getElementHeight(shadow))+parseInt(this.yOffset))+'px';bottomEdge.style.left=parseInt(this.xOffset)+'px';bottomEdge.style.height=parseInt(this.blur.iRadius)+'px';bottomEdge.style.width=parseInt(DomUtils.getElementWidth(shadow))+'px';bottomEdge.style.zIndex=zIndex;img=document.createElement('img');img.src=util.resourceManager.get(this.images[DropShadowInterface.imgIds.bottom]);img.height=parseInt(this.blur.iRadius);img.width=parseInt(DomUtils.getElementWidth(shadow));img.style.position='absolute';img.style.left='0px';img.style.top='0px';DropShadowInterface_FixPNG(img);bottomEdge.appendChild(img);dropShadow.appendChild(bottomEdge);var rightEdge=document.createElement('div');rightEdge.id=this.id+'_DropShadow_Right';rightEdge.className='shadow';rightEdge.style.position='absolute';rightEdge.style.left=parseInt(parseInt(DomUtils.getElementWidth(shadow))+parseInt(this.xOffset))+'px';rightEdge.style.top=parseInt(this.yOffset)+'px';rightEdge.style.height=parseInt(DomUtils.getElementHeight(shadow))+'px';rightEdge.style.width=parseInt(this.blur.iRadius)+'px';rightEdge.style.zIndex=zIndex;img=document.createElement('img');img.src=util.resourceManager.get(this.images[DropShadowInterface.imgIds.right]);img.height=parseInt(DomUtils.getElementHeight(shadow));img.width=parseInt(this.blur.iRadius);img.style.position='absolute';img.style.left='0px';img.style.top='0px';DropShadowInterface_FixPNG(img);rightEdge.appendChild(img);dropShadow.appendChild(rightEdge);var leftEdge=document.createElement('div');leftEdge.id=this.id+'_DropShadow_Left';leftEdge.className='shadow';leftEdge.style.position='absolute';leftEdge.style.left=parseInt(parseInt(this.xOffset)-parseInt(this.blur.iRadius))+'px';leftEdge.style.top=parseInt(this.yOffset)+'px';leftEdge.style.height=parseInt(DomUtils.getElementHeight(shadow))+'px';leftEdge.style.width=parseInt(this.blur.iRadius)+'px';leftEdge.style.zIndex=zIndex;img=document.createElement('img');img.src=util.resourceManager.get(this.images[DropShadowInterface.imgIds.left]);img.height=parseInt(DomUtils.getElementHeight(shadow));img.width=parseInt(this.blur.iRadius);img.style.position='absolute';img.style.left='0px';img.style.top='0px';DropShadowInterface_FixPNG(img);leftEdge.appendChild(img);dropShadow.appendChild(leftEdge);var topEdge=document.createElement('div');topEdge.id=this.id+'_DropShadow_Top';topEdge.className='shadow';topEdge.style.position='absolute';topEdge.style.left=parseInt(this.xOffset)+'px';topEdge.style.top=parseInt(parseInt(this.yOffset)-parseInt(this.blur.iRadius))+'px';topEdge.style.height=parseInt(this.blur.iRadius)+'px';topEdge.style.width=parseInt(DomUtils.getElementWidth(shadow))+'px';topEdge.style.zIndex=zIndex;img=document.createElement('img');img.src=util.resourceManager.get(this.images[DropShadowInterface.imgIds.top]);img.height=parseInt(this.blur.iRadius);img.width=parseInt(DomUtils.getElementWidth(shadow));img.style.position='absolute';img.style.left='0px';img.style.top='0px';DropShadowInterface_FixPNG(img);topEdge.appendChild(img);dropShadow.appendChild(topEdge);var brCorner=document.createElement('div');brCorner.id=this.id+'_DropShadow_BottomRightCorner';brCorner.className='shadow';brCorner.style.position='absolute';brCorner.style.top=parseInt(parseInt(DomUtils.getElementHeight(shadow))+parseInt(this.yOffset))+'px';brCorner.style.left=parseInt(parseInt(DomUtils.getElementWidth(shadow))+parseInt(this.xOffset))+'px';brCorner.style.height=parseInt(this.blur.iRadius)+'px';brCorner.style.width=parseInt(this.blur.iRadius)+'px';brCorner.style.zIndex=zIndex;img=document.createElement('img');img.src=util.resourceManager.get(this.images[DropShadowInterface.imgIds.bottomRight]);img.height=parseInt(this.blur.iRadius);img.width=parseInt(this.blur.iRadius);img.style.position='absolute';img.style.left='0px';img.style.top='0px';DropShadowInterface_FixPNG(img);brCorner.appendChild(img);dropShadow.appendChild(brCorner);var trCorner=document.createElement('div');trCorner.id=this.id+'_DropShadow_TopRightCorner';trCorner.className='shadow';trCorner.style.position='absolute';trCorner.style.left=parseInt(parseInt(DomUtils.getElementWidth(shadow))+parseInt(this.xOffset))+'px';trCorner.style.top=parseInt(parseInt(this.yOffset)-parseInt(this.blur.iRadius))+'px';trCorner.style.height=parseInt(this.blur.iRadius)+'px';trCorner.style.width=parseInt(this.blur.iRadius)+'px';trCorner.style.zIndex=zIndex;img=document.createElement('img');img.src=util.resourceManager.get(this.images[DropShadowInterface.imgIds.topRight]);img.height=parseInt(this.blur.iRadius);img.width=parseInt(this.blur.iRadius);img.style.position='absolute';img.style.left='0px';img.style.top='0px';DropShadowInterface_FixPNG(img);trCorner.appendChild(img);dropShadow.appendChild(trCorner);var blCorner=document.createElement('div');blCorner.id=this.id+'_DropShadow_BottomLeftCorner';blCorner.className='shadow';blCorner.style.position='absolute';blCorner.style.left=parseInt(parseInt(this.xOffset)-parseInt(this.blur.iRadius))+'px';blCorner.style.top=parseInt(parseInt(DomUtils.getElementHeight(shadow))+parseInt(this.yOffset))+'px';blCorner.style.height=parseInt(this.blur.iRadius)+'px';blCorner.style.width=parseInt(this.blur.iRadius)+'px';blCorner.style.zIndex=zIndex;img=document.createElement('img');img.src=util.resourceManager.get(this.images[DropShadowInterface.imgIds.bottomLeft]);img.height=parseInt(this.blur.iRadius);img.width=parseInt(this.blur.iRadius);img.style.position='absolute';img.style.left='0px';img.style.top='0px';DropShadowInterface_FixPNG(img);blCorner.appendChild(img);dropShadow.appendChild(blCorner);var tlCorner=document.createElement('div');tlCorner.id=this.id+'_DropShadow_TopLeftCorner';tlCorner.className='shadow';tlCorner.style.position='absolute';tlCorner.style.left=parseInt(parseInt(this.xOffset)-parseInt(this.blur.iRadius))+'px';tlCorner.style.top=parseInt(parseInt(this.yOffset)-parseInt(this.blur.iRadius))+'px';tlCorner.style.height=parseInt(this.blur.iRadius)+'px';tlCorner.style.width=parseInt(this.blur.iRadius)+'px';tlCorner.style.zIndex=zIndex;img=document.createElement('img');img.src=util.resourceManager.get(this.images[DropShadowInterface.imgIds.topLeft]);img.height=parseInt(this.blur.iRadius);img.width=parseInt(this.blur.iRadius);img.style.position='absolute';img.style.left='0px';img.style.top='0px';DropShadowInterface_FixPNG(img);tlCorner.appendChild(img);dropShadow.appendChild(tlCorner);dropShadow.style.visibility=DomUtils.getCurrentStyle(elem).visibility;}else{throw new Error('unable to find content element');}
}
function DropShadowInterface_Erase(){var dropShadow=document.getElementById(this.dropShadowId);if(dropShadow)DomUtils.removeElement(dropShadow);dropShadow=null;}
function DropShadowInterface_AlignElement(pos){var elem=document.getElementById(this.elemId);if(!elem)throw new Error('Unable to find element: '+this.elemId);var dropShadow=document.getElementById(this.dropShadowId);if(!dropShadow)throw new Error('Unable to find drop shadow element: '+this.dropShadowId);dropShadow.style.position='absolute';dropShadow.style.left=DomUtils.getElementLeft(elem)+'px';dropShadow.style.top=DomUtils.getElementTop(elem)+'px';dropShadow=null;elem=null;}
function DropShadowInterface_SetBlur(radius,sigma){this.blur={iRadius:radius,iSigma:sigma};}
function DropShadowInterface_FixPNG(img){if(DomUtils.browser.isIE()){var arVersion=navigator.appVersion.split("MSIE");var version=0.0;if(arVersion&&arVersion.length>1)version=parseFloat(arVersion[1]);if((version>=5.5)&&(version<7)&&(document.body.filters)){var imgID=(img.id)?"id='"+img.id+"' ":"";var imgClass=(img.className)?"class='"+img.className+"' ":"";var imgTitle=(img.title)?"title='"+img.title+"' ":"title='"+img.alt+"' ";var imgStyle="display:inline-block;";if(img&&img.style){imgStyle+=img.style.cssText||'';img.style.cssText="display: none";}
var strNewHTML="<span "+imgID+imgClass+imgTitle
+" style=\""+"width:"+img.width
+"px; height:"+img.height
+"px;"+imgStyle+";"
+"filter: progid:DXImageTransform.Microsoft.AlphaImageLoader"
+"(src=\'"+img.src+"\', sizingMethod='scale');\"></span>";img.src="";img.outerHTML=strNewHTML;}}}

