// util
function moveTo(elem, width, height, cheight) {
    var scr = {
        width  : document.body.clientWidth  || document.documentElement.clientWidth,
        height : document.documentElement.clientHeight || document.body.clientHeight,
        y : document.body.scrollTop || document.documentElement.scrollTop
    };
  elem.style.left = ((scr.width - width) / 2) + 'px';
  elem.style.top  = ((scr.height - height) / 2 + scr.y + cheight) + 'px';
}

// mouseover image
blogparts_button_img = new Array("/bp/fhh/img/btn01_off.jpg","/bp/fhh/img/btn01_on.jpg","/bp/fhh/img/btn02_off.jpg","/bp/fhh/img/btn02_on.jpg","/bp/fhh/img/btn03_off.jpg","/bp/fhh/img/btn03_on.jpg","/bp/fhh/img/btn04_off.jpg","/bp/fhh/img/btn04_on.jpg");
blogparts_button_preload = new Array();
for(i=0; i<blogparts_button_img.length; i++) {
  blogparts_button_preload[i] = new Image();
  blogparts_button_preload[i].src = 'http://www.amuse-s-e.co.jp/' + blogparts_button_img[i];
}

// gettag dialog
var dialog = '';
dialog += '<div id="bloomotion_fhh_blogparts_gettag"' +
          '     style="z-index:15000;display:none;font-size:83%;width:425px;background-color:#cccccc; border:1px solid #aaaaaa; position:absolute;">' +
          '<div style="padding:2px 5px 0 0;text-align:right;font-size:75% top:0px; left:0px;">' +
          '<a href="javascript:void(0)" onclick="document.getElementById(\'bloomotion_fhh_blogparts_gettag\').style.display = \'none\'">×閉じる</a></div>' +
          '<div style="padding:5px;background-color:#ffffff;border:2px solid #cccccc;">' +
          'このブログパーツをあなたのブログに貼り付けるには、下記のタグをコピーしてご使用ください。<br />' +
          '<form style="margin:0">' +
          '<textarea cols="40" rows="4" style="width:405px;" onfocus="this.select()">&lt;script type=&quot;text/javascript&quot; src=&quot;http://www.amuse-s-e.co.jp/bp/fhh/js/fhh.js&quot; charset=&quot;UTF-8&quot;&gt;&lt;/script&gt;</textarea>' +
          '</form>' +
          '<p>ご使用のブログによっては貼り付けることができない場合がございます。</p>' +
          '</div>' +
          '</div>';

function disp_gettag_dialog_fhh(event) {
    var dlg = document.getElementById('bloomotion_fhh_blogparts_gettag');
	document.body.appendChild(dlg);
    if ( dlg.style.display == 'block' ) return;
    moveTo(dlg, 425, 644, 370);
    dlg.style.display = 'block';
}

// video
var video = '<div id="blomoion_blogparts_video01"' +
          '     style="z-index:15000;display:none;font-size:83%;background-color:#cccccc; border:1px solid #aaaaaa; position:absolute;">' +
          '<div style="padding:2px 5px 0 0;text-align:right;font-size:75% top:0px; left:0px;">' +
		  '<a href="javascript:void(0)" onclick="blomotion_close_video01()">×閉じる</a></div>' +
          '<div id="blomotion_video_area"></div>' +
          '</div>';

function video_object(video_id) {
    function ce(tag,name){
        if (name && window.ActiveXObject){
            element = document.createElement('<'+tag+' name="'+name+'">');
        }else{
            element = document.createElement(tag);
            element.setAttribute('name',name);
        }
        return element;
    };

    var object1=document.createElement('object');
    object1.setAttribute('height','344');
    object1.setAttribute('width','425');
    var param1=ce('param','movie');
    param1.setAttribute('value','http://www.youtube.com/v/'+video_id+'&hl=ja&fs=1&autoplay=1');
    object1.appendChild(param1);
    var param2=ce('param','allowFullScreen');
    param2.setAttribute('value','true');
    object1.appendChild(param2);

    return object1;
}

function video_embed(video_id) {
    var embed1=document.createElement('embed');
    embed1.setAttribute('height','344');
    embed1.setAttribute('width','425');
    embed1.setAttribute('allowfullscreen','true');
    embed1.setAttribute('type','application/x-shockwave-flash');
    embed1.setAttribute('src','http://www.youtube.com/v/'+video_id+'&hl=ja&fs=1&autoplay=1');

    return embed1;
}

function disp_video_fhh(event) {
    var v = document.getElementById('blomoion_blogparts_video01');
    moveTo(v, 425, 644, 0);
    var span = document.createElement("span");
    span.appendChild(video_embed('4GjtpcsPm_E'));
    var area = document.getElementById("blomotion_video_area");
    area.innerHTML = '';
    var object = video_object('4GjtpcsPm_E');
    area.appendChild(object);
    area.replaceChild(span, object);
 document.body.appendChild(v);
    v.style.display = 'block';
}

function blomotion_close_video01() {
 document.getElementById('blomoion_blogparts_video01').style.display = 'none';
document.getElementById("blomotion_video_area").innerHTML = '';
}

document.write(dialog);
document.write(video);
document.write('<div style="width:160px;background-color:#ffffff;">');
document.write('<div style="text-align:center;"><img src="http://www.amuse-s-e.co.jp/bp/fhh/img/img01.gif" alt="Freeway High High 「君の好きな歌」" width="160" height="66" style="border:none" /></div>');
document.write('<div><a href="javascript:void(0)" onclick="javascript:disp_video_fhh(event)"><img src="http://www.amuse-s-e.co.jp/bp/fhh/img/btn01_off.jpg" alt="PVを視聴する" width="160" height="134" onmouseover="this.src=\'http://www.amuse-s-e.co.jp/bp/fhh/img/btn01_on.jpg\'" onmouseout="this.src=\'http://www.amuse-s-e.co.jp/bp/fhh/img/btn01_off.jpg\'" style="border:none;" /></a></div>');
document.write('<div style="text-align:center;"><img src="http://www.amuse-s-e.co.jp/bp/fhh/img/img02.gif" alt="着うたダウンロードはこちら" width="160" height="121" style="border:none" /></div>');
document.write('<div style="text-align:center;"><a href="http://www.freewayhigh2.com/" target="_blank"><img src="http://www.amuse-s-e.co.jp/bp/fhh/img/btn02_off.jpg" alt="Official Site" width="160" height="27" onmouseover="this.src=\'http://www.amuse-s-e.co.jp/bp/fhh/img/btn02_on.jpg\'" onmouseout="this.src=\'http://www.amuse-s-e.co.jp/bp/fhh/img/btn02_off.jpg\'" style="border:none;" /></a></div>');
document.write('<div style="text-align:center;"><img src="http://www.amuse-s-e.co.jp/bp/fhh/img/img03.jpg" alt="" width="160" height="5" style="border:none" /></div>');
document.write('<div style="text-align:center;"><a href="http://www.shinseido.co.jp/cgi-bin/WebObjects/Catalog.woa/wa/detail?r=ASCM-6084" target="_blank"><img src="http://www.amuse-s-e.co.jp/bp/fhh/img/btn03_off.jpg" alt="CDを購入する" width="160" height="27" onmouseover="this.src=\'http://www.amuse-s-e.co.jp/bp/fhh/img/btn03_on.jpg\'" onmouseout="this.src=\'http://www.amuse-s-e.co.jp/bp/fhh/img/btn03_off.jpg\'" style="border:none;" /></a></div>');
document.write('<div style="text-align:center;"><img src="http://www.amuse-s-e.co.jp/bp/fhh/img/img04.jpg" alt="" width="160" height="5" style="border:none" /></div>');
document.write('<div style="text-align:"><a href="javascript:void(0)" onclick="javascript:disp_gettag_dialog_fhh(event)"><img src="http://www.amuse-s-e.co.jp/bp/fhh/img/btn04_off.jpg" alt="このブログパーツをもらう" width="160" height="27" onmouseover="this.src=\'http://www.amuse-s-e.co.jp/bp/fhh/img/btn04_on.jpg\'" onmouseout="this.src=\'http://www.amuse-s-e.co.jp/bp/fhh/img/btn04_off.jpg\'" style="border:none;" /></a></div>');
document.write('<div style="text-align:center;"><img src="http://www.amuse-s-e.co.jp/bp/fhh/img/img05.jpg" alt="" width="160" height="6" style="border:none" /></div>');
document.write('</div>');
