/**/ /* CSS3 Dropshadow for IE version: 20100804.031039 * (c) 2009-2010 martin. http://p2b.jp * This is licensed under the MIT License. */ if(/*@cc_on!@*/false){ // IE only var CSS3Shadow = { init : function(){ var d = document, relpath, scripts = d.getElementsByTagName('script'); for(var i = 0, l = scripts.length; i < l; i++){ relpath = scripts[i].getAttribute('src'); if(relpath && relpath.indexOf('css3shadow.htc') !== -1){ CSS3Shadow.path = relpath; d.documentElement.addBehavior(relpath); } } }, play : function(o){ var d = document; if(o.nodeName=='HTML'){ var sheets = d.styleSheets, sheet, selector, csstext, mt, mb; var TXT_SHADOW = /text\-shadow\s*?:\s*?([^;]+)?/i; var BOX_SHADOW = /box\-shadow\s*?:\s*?([^;]+)?/i; for(var i = 0, l = sheets.length; i < l; i++){ sheet = sheets[i]; if(sheet.media == 'all' || sheet.media == 'screen' || !sheet.media){ for(var j = 0, k = sheet.rules.length; j < k; j++){ selector = sheet.rules[j].selectorText; csstext = sheet.rules[j].style.cssText; if((mt = TXT_SHADOW.exec(csstext))){ sheet.addRule(selector, 'behavior: url('+CSS3Shadow.path+'); text-shadow:'+ mt[1].replace(/^\s+|\s*$/, '')+';'); } if((mb = BOX_SHADOW.exec(csstext))){ sheet.addRule(selector, 'behavior: url('+CSS3Shadow.path+'); box-shadow:'+ mb[1].replace(/^\s+|\s*$/, '')+';'); } } } } } else { if(o.dropShadowApplied){ o.style.behavior = 0; return; } o.dropShadowApplied = true; var imgNode = false; if(o.nodeName != 'IMG'){ o.innerHTML = ('' + o.innerHTML + ''); } else { imgNode = true; } if(o.currentStyle['text-shadow']){ var prop = CSS3Shadow.parse(o.currentStyle['text-shadow'], o); if(typeof prop[0][1] == 'undefined'){ var _prop = prop; prop = []; prop[0] = _prop; } var shadowtxt, css, size = prop.length, x, y, radius, color, alpha; var ol = o.lastChild, c, cn, cl; for (var j = 0; j < size; j++){ x = prop[j][0], y = prop[j][1], radius = prop[j][2], color = prop[j][3], alpha = prop[j][4]; shadowtxt = ol.cloneNode(true); css = shadowtxt.style; css.position = 'absolute'; css.width = ol.offsetWidth + 'px'; css.marginLeft = (x - radius * .5) + 'px'; css.marginTop = (y - (y > 0 ? 1 : 0) - radius * .5) + 'px'; css.color = color; css.zIndex = (ol.style.zIndex - 1); if(/center|right/.test(o.currentStyle.textAlign)){ if(!d.documentMode || d.documentMode == 7){ var pl = CSS3Shadow.toPixel(o.currentStyle.paddingLeft, o); var ml = CSS3Shadow.toPixel(o.currentStyle.marginLeft, o); shadowtxt.runtimeStyle.left = pl + ml + radius + 'px'; } } for (c = 0, cn = shadowtxt.childNodes, cl = cn.length; c < cl; c++){ if(cn[c].nodeType == 1) cn[c].style.color = color; } if(radius > 0){ css.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity="+(alpha * 80)+")"; css.filter += "progid:DXImageTransform.Microsoft.blur(pixelradius='"+(radius > 1 ? radius * .5 : radius)+"', makeShadow=false)"; } o.insertBefore(shadowtxt, o.firstChild); }//for } if(o.currentStyle['box-shadow']){ var prop = CSS3Shadow.parse(o.currentStyle['box-shadow'], o); if(typeof prop[0][1] == 'undefined'){ var _prop = prop; prop = []; prop[0] = _prop; } var shadow, css, size = prop.length, x, y, radius, color, alpha, inset; var pl = CSS3Shadow.toPixel(o.currentStyle.paddingLeft, o), pt = CSS3Shadow.toPixel(o.currentStyle.paddingTop, o); var ml = CSS3Shadow.toPixel(o.currentStyle.marginLeft, o), mt = CSS3Shadow.toPixel(o.currentStyle.marginTop, o); var w = o.offsetWidth, h = o.offsetHeight, os = o.style; for (var j = 0; j < size; j++){ x = prop[j][0], y = prop[j][1], radius = prop[j][2], color = prop[j][3], alpha = prop[j][4], inset = prop[j][5]; if(inset){ shadow = d.createElement('div'), css = shadow.style; css.zIndex = 1; css.position = 'absolute'; css.marginLeft = (x - 1.2 * radius - pl) + 'px'; css.marginTop = (y - 1.2 * radius - pt) + 'px'; css.width = (o.clientWidth + .2 * radius) + 'px'; css.height = (o.clientHeight + .2 * radius) + 'px'; css.backgroundColor = o.currentStyle.backgroundColor; // Trick os.backgroundColor = color; os.position = o.currentStyle.position == 'static' ? 'relative' : o.currentStyle.position; os.overflow = 'hidden'; if(radius > 0){ css.filter += "progid:DXImageTransform.Microsoft.blur(pixelradius='"+(radius * .5)+"', makeShadow=false)"; css.filter += "progid:DXImageTransform.Microsoft.blur(pixelradius='"+(radius * .5)+"', makeShadow=false)"; } o.insertBefore(shadow, o.firstChild); } else { shadow = d.createElement('div'), css = shadow.style; css.zIndex = -1; css.position = 'absolute'; if(imgNode){ css.marginLeft = (x - radius + ml) + 'px'; css.marginTop = (y - radius + mt) + 'px'; } else { css.marginLeft = (x - 2 * radius) + 'px'; css.marginTop = (y - 2 * radius) + 'px'; } css.width = w + 'px'; css.height = h + 'px'; css.backgroundColor = color; if(radius > 0){ css.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity="+(alpha * 90)+")"; css.filter += "progid:DXImageTransform.Microsoft.blur(pixelradius='"+(radius * .5)+"', makeShadow=false)"; css.filter += "progid:DXImageTransform.Microsoft.blur(pixelradius='"+(radius * .5)+"', makeShadow=false)"; } if(imgNode){ o.parentNode.insertBefore(shadow, o); } else { o.insertBefore(shadow, o.firstChild); } } }//for }//box-shadow } }, parse : function(prop, o){ var PROPS = [], m, x = 0, y = 0, radius = 0, color = '#999', alpha = 1, inset = 0, props; var SHADOW_PROP = /(rgba?\([^\)]+\)|(?:[a-z]+?|#[0-9a-f]{3,6})+?|)\s*?((?:[\d.-]+?)(?:px|em|pt|))\s+?((?:[\d.-]+?)(?:px|em|pt|))\s+?((?:[\d.-]+?)(?:px|em|pt)|)\s*?((?:[\d.-]+?)(?:px|em|pt)|)\s*?(rgba?\([^\)]+\)|(?:[a-z]+?|#[0-9a-f]{3,6})+?|)$/i; if(prop.indexOf(',') !== -1){ prop = prop.replace(/rgba?\(([^)]+)\)/, function(a){ return a.replace(/([0-9%]),\s*/g, '$1 ');}); } if(prop.indexOf(',') !== -1){ var props = prop.split(','), l = props.length; for (var i = 0; i < l; i++) PROPS[i] = CSS3Shadow.parse(props[i], o); return PROPS; } if(prop.indexOf('inset') !== -1){ prop = prop.replace(/\s*?inset\s*?/, ''); inset = 1; } if((m = SHADOW_PROP.exec(prop))){ x = CSS3Shadow.toPixel(m[2], o), y = CSS3Shadow.toPixel(m[3], o), radius = CSS3Shadow.toPixel(m[4], o); color = m[1] != '' ? m[1] : m[6]; if(color.indexOf('rgba(') !== -1){ m = /rgba\(([^ ]+ [^ ]+ [^ ]+) ?([^)]+)?\)/i.exec(color); color = 'rgb(' + m[1] + ')'; alpha = m[2] != '' ? m[2] : alpha; } } return [x, y, radius, color, alpha, inset]; }, toPixel : function(c, o){ if(/^[0-9-]/.test(c)){ if(c.indexOf('em') > 0){ var fs = o.currentStyle.fontSize; if(fs == 'medium' || fs == '100%') fs = 16; else if(fs.indexOf('pt') > 0) fs = Math.round(fs.replace('pt', '') / 72 * 96); else if(fs.indexOf('em') > 0) fs = Math.round(fs.replace('em', '') * 16); else fs = fs.replace('px', ''); return Number(c.replace('em', '') * fs); } else if(c.indexOf('pt') > 0) return Math.round(c.replace('pt', '') / 72 * 96); else return Number(c.replace('px', '')); } else { if(c == 'auto' || c == null || c == 'undefined') return 0; if(c == 'medium') return 4; alert("Size Not Specified 1:" + c); } alert("Size Not Specified 2:" + c); } } if(!CSS3Shadow.path) CSS3Shadow.init(); window.attachEvent('onresize', function(){location.reload()}); }