/*
 * IE PNG Fix v1.4
 *
 * Copyright (c) 2006 Takashi Aida http://www.isella.com/aod2/
 *
 */
// IE5.5+ PNG Alpha Fix v1.0RC4
// (c) 2004-2005 Angus Turnbull http://www.twinhelix.com

// This is licensed under the CC-GNU LGPL, version 2.1 or later.
// For details, see: http://creativecommons.org/licenses/LGPL/2.1/

if (typeof IEPNGFIX == 'undefined') {
//--============================================================================

var IEPNGFIX = {
	blank:  'http://www.isella.com/aod2/images/blank.gif',
	filter: 'DXImageTransform.Microsoft.AlphaImageLoader',
	fixit: function (elem, src, method) {
		if (elem.filters[this.filter]) {
			var filter = elem.filters[this.filter];
			filter.enabled = true;
			filter.src = src;
			filter.sizingMethod = method;
		}
		else {
			elem.style.filter = 'progid:' + this.filter +
				'(src="' + src + '",sizingMethod="' + method + '")';
		}
	},

	fixwidth: function(elem) {
		if (elem.currentStyle.width == 'auto' &&
			elem.currentStyle.height == 'auto') {
			elem.style.width = elem.offsetWidth + 'px';
		}
	},

	fixchild: function(elem, recursive) {
		if (!/MSIE (5\.5|6\.|7\.)/.test(navigator.userAgent)) return;

		for (var i = 0, n = elem.childNodes.length; i < n; i++) {
			var childNode = elem.childNodes[i];
			if (childNode.style) {
				if (childNode.style.position) {
					childNode.style.position = childNode.style.position;
				}
				else {
					childNode.style.position = 'relative';
				}
			}
			if (recursive && childNode.hasChildNodes()) {
				this.fixchild(childNode, recursive);
			}
		}
	},

	fix: function(elem) {
		if (!/MSIE (5\.5|6\.|7\.)/.test(navigator.userAgent)) return;

		var bgImg =
			elem.currentStyle.backgroundImage || elem.style.backgroundImage;

		if (elem.tagName == 'IMG') {
			if ((/\.png$/i).test(elem.src)) {
				this.fixwidth(elem);
				this.fixit(elem, elem.src, 'image');
				elem.src = this.blank;
				elem.runtimeStyle.behavior = 'none';
			}
		}
		else if (bgImg && bgImg != 'none') {
			if (bgImg.match(/^url[("']+(.*\.png)[)"']+$/i)) {
				var s = RegExp.$1;
				this.fixwidth(elem);
				elem.style.backgroundImage = 'none';
				this.fixit(elem, s, 'crop'); // crop | image | scale

				if (elem.tagName == 'A' && elem.style) {
					if (!elem.style.cursor) {
						elem.style.cursor = 'pointer';
					}
				}

				this.fixchild(elem);
				elem.runtimeStyle.behavior = 'none';
			}
		}
	},

	hover: function(elem, hvImg) {
		var bgImg = elem.style.backgroundImage;

		if (!bgImg && elem.currentStyle) bgImg = elem.currentStyle.backgroundImage;

		if (elem.tagName == 'IMG' && hvImg) {
			var image = elem.src;
			elem.onmouseover = function() {
				elem.src = hvImg;
				IEPNGFIX.fix(elem);
			};
			elem.onmouseout = function() {
				elem.src = image;
				IEPNGFIX.fix(elem);
			};
		}
		else if (bgImg && bgImg != 'none' && hvImg) {
			elem.onmouseover = function() {
				elem.style.backgroundImage = 'url(' + hvImg + ')';
				IEPNGFIX.fix(elem);
			};
			elem.onmouseout = function() {
				elem.style.backgroundImage = bgImg;
				IEPNGFIX.fix(elem);
			};
		}

		IEPNGFIX.fix(elem);
	}
};

//--============================================================================
} // end if (typeof IEPNGFIX == 'undefined')

// var bccks_widget_box = document.createElement('div');
// bccks_widget_box.id = time();
var bcckTitle='旅するバナナ';
// var widgetBoxId = 'bccks_widget_';

var with_title = '';
var bg_image = 'url("http://bccks.jp/images/widget/blogPartsBg02.gif")';
var published_on = '2008-07-10 17:01:34.429622';
var author = 'ryoooooz';

var widget = document.createElement('div');
var bcck = document.createElement('div');
bcck.id = 'bcck_15333';
bcck.title = bcckTitle;
//bcck.style.cursor = 'pointer';
bcck.style.width = '130px';
bcck.style.height = '130px';
bcck.style.margin = '0';
bcck.style.padding = '0';
bcck.style.textAlign = 'center';

if (bg_image){
  bcck.style.backgroundImage = bg_image;
  bcck.style.backgroundRepeat = 'no-repeat';
}
bcck.style.backgroundColor = '#ddeeff';

bcckImgDiv = document.createElement('div');
bcckImgDiv.style.width = '130px';
bcckImgDiv.style.height = '130px';
bcckImgDiv.style.textAlign = 'center';
bcckImgDiv.style.backgroundImage = "url(http://bccks.jp/images/shadow/tn/12x6_shadow.png)";

bcckImgDiv.style.backgroundPositionX = '50%';
bcckImgDiv.style.backgroundPositionY = '50%';

if(typeof bcckImgDiv.style.backgroundPosition != 'undefined') bcckImgDiv.style.backgroundPosition = '50% 50%';

//bcckImgDiv.style.borderWidth = '1px';
//bcckImgDiv.style.borderStyle = 'solid';
//bcckImgDiv.style.borderColor = 'black';

// bcckLink = document.createElement('a');
/*  bcckLink.href = 'http://bccks.jp/bcck/15333?blog' */
// bcckLink.href = 'http://bccks.jp/viewer/15333/1/A/VIEW?blog';
// bcckLink.href = 'javascript:void(0);';
// bcckLink.onclick = "launchViewerFromBlogParts";
// bcckLink.onmouseover = "testfunc";

// bcckImg = document.createElement('img');
// bcckImg.className='bcck_image';
// bcckImg.src='http://bccks.jp/tn/00/00/01/53/33/15333.jpg';
// bcckImg.style.border = 'none';
// bcckImg.style.marginTop = '35px';

//bcckLink.appendChild(bcckImg);
//bcckImgDiv.appendChild(bcckLink);
//bcckImgDiv.appendChild(bcckImg);

bcckImgDiv.innerHTML = '<a href="http://bccks.jp/#B15333,P0?blog" target="bccks"><img src="http://bccks.jp/tn/00/00/01/53/33/15333.jpg" border="0" style="margin:35px;border:0;" class="bcck_image"></a>';
bcck.appendChild(bcckImgDiv);

if (with_title){
  var bcckTitleDiv=document.createElement('div');
  bcckTitleDiv.className='bcck_title';
  bcckTitleDiv.appendChild(document.createTextNode(bcckTitle));
  bcck.appendChild(bcckTitleDiv);
  if (published_on){
    bcckDistOn = document.createElement('div');
    bcckDistOn.appendChild(document.createTextNode(published_on));
    bcckDistOn.style.color = '#000055';
    bcckDistOn.style.fontSize = 'small';
    bcck.appendChild(bcckDistOn);
  }
  if (author){
    bcckAuthorDiv = document.createElement('div');
    bcckAuthorDiv.appendChild(document.createTextNode(author));
    bcckAuthorDiv.style.color = '#888888';
    bcckAuthorDiv.style.textAlign = 'center';
    bcck.appendChild(bcckAuthorDiv);
  }
}
widget.appendChild(bcck);
IEPNGFIX.fix(bcckImgDiv);
document.write(widget.innerHTML);

function launchViewerFromBlogParts(href, target, w, h)
{
    win = window.open(href, target, 'width='+w+',height='+h+',scrollbars=yes,resizable=yes,left=0,top=0');
    win.focus();
}