function navigateToURL(sel) {
	 if (sel.selectedIndex == -1 || sel.value == "dummy") return;
	 var opt = sel.options[sel.selectedIndex];
	 if (opt && opt.value)
			location.href = opt.value;
}

/**
* 折りたたみ式コンテンツを開く
*
* @param detailID
* オープンするコンテンツのID
* @param opener
* オープナーへの参照
*/
function openDetail(dID,opener){
	var img;
	
	document.getElementById(dID).style.display = "block";
	img = (dID == "works2009Detail" || dID == "works2005Detail") ? opener.firstChild.firstChild : opener;
	img.src = (img.src.match(/\/common\/img\/icon_plus.gif/)) ? "/common/img/icon_minus.gif" : "/common/img/icon_minus2.gif";
	img.alt = "詳細を隠す";
	opener.onclick = function(){
		closeDetail(dID,opener);
	};
}

function closeDetail(dID,opener){
	var img;
	
	document.getElementById(dID).style.display = "none";
	img = (dID == "works2009Detail" || dID == "works2005Detail") ? opener.firstChild.firstChild : opener;
	img.src = (img.src.match(/\/common\/img\/icon_minus.gif/)) ? "/common/img/icon_plus.gif" : "/common/img/icon_plus2.gif";
	img.alt = "詳細を表示";
	opener.onclick = function(){
		openDetail(dID,opener);
	};
}

function wo(target,w,h){
	window.open(String(target),"_blank","left=200,top=200,status,scrollbar,resizable,toolbar,menubar,location,width="+w+",height="+h);	
}

function openNicoVideoWindow	(videoId){
	var w = window.open("/_blank.html","_blank","left=200,top=200,status,scrollbar,resizable,toolbar,menubar,location,width="+485+",height="+385);	
	w.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"'
										+'"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> '
										+'<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" > '
										+'<head> '
										+'<style>*{margin:0; padding:0; color:#FFFFFF;}</style> '
										+'<title>'+videoId+'</title> '
										+'</head>' 
										+'<body> '
										+'<script type="text/javascript" src="http://ext.nicovideo.jp/thumb_watch/'+videoId+'"></script>'
										+'</body> '
										+'</html>');
}

function openYoutubeVideoWindow (videoId){
	var w = window.open("/_blank.html","_blank","left=200,top=200,status,scrollbar,resizable,toolbar,menubar,location,width="+425+",height="+344);	
	w.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"'
										+'"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> '
										+'<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" > '
										+'<head> '
										+'<style>*{margin:0; padding:0; color:#FFFFFF;}</style> '
										+'<title>'+videoId+'</title> '
										+'</head>' 
										+'<body>'
										+'<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/'+videoId+'"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/'+videoId+'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>',
										+'</body>'
										+'</html>');
}

//swfobjectラッパー関数
var outputSWF = (function(){
	var num = 1;
	
	return function (url,w,h){
		var flashvars = {};
		var params = {wmode: "opaque" , allowFullScreen: "true"};
		var attributes = {};
		var ver = "10.0.0";
		var color = "#FFFFFF";
		var prefix = "blogEntrySWF";
		document.write('<div class="swfContainer"><div id="'+prefix+num+'"></div></div>');
		swfobject.embedSWF(url, prefix+num, w, h, ver, color, flashvars ,params , attributes );
		
		num++;
	};
})();

//イベントリスナーラッパー
var addListener = (function() {
    if ( window.addEventListener ) {
        return function(el, type, fn) {
            el.addEventListener(type, fn, false);
        };
    } else if ( window.attachEvent ) {
        return function(el, type, fn) {
            var f = function() {
                fn.call(el, window.event);
            };
            el.attachEvent('on'+type, f);
        };
    } else {
        return function(el, type, fn) {
            el['on'+type] = fn;
        }
    }
})();


//サブコンテンツ部分のopenNewWindowIcon付きリンクの処理
function over(t){
	t.firstChild.style.textDecoration = "none";
}

function out(t){
	t.firstChild.style.textDecoration = "underline";
}

//IEのバージョンチェック
function getIEVersion(){
	var MSIE = "MSIE ";
	var UA = navigator.userAgent;
	
	if(UA.indexOf(MSIE) == -1) return 9999;
	
	var startPos = UA.indexOf(MSIE) + MSIE.length;
	var endPos = UA.indexOf(";",startPos);
	var version = Number(UA.slice(startPos,endPos));
	
	return version;
}
