

(function (){
var timeStamp = new Date().getTime().toString();
var tickerSwf = 'http://www.ettusais.co.jp/swf/blog_parts.swf';
 var ticker ='<div id=etTicker'+timeStamp+'>'
 ticker+='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="160" height="135" id="blog_parts_external" align="middle">';
 ticker+= '<param name="allowScriptAccess" value="always" />';
 ticker+= '<param name="movie" value="' + tickerSwf + '" />';
 ticker+= '<param name="FlashVars" value="lcid=' + timeStamp + '" />';
 ticker+= '<param name="wmode" value="transparent" />';
 ticker+= '<param name="quality" value="high" />';
 ticker+= '<param name="bgcolor" value="#ffffff" />';
 ticker+= '<embed src="' + tickerSwf + '" FlashVars="lcid='+timeStamp+'" quality="high" bgcolor="#ffffff" width="160" wmode="transparent" height="135" name="blog_parts_external" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
 ticker+='</object></div>';
 document.write(ticker);
})();






var gsFloatSwf_AN = 'http://www.ettusais.co.jp/swf/floating.swf';

var gsFloatId_AN = "Floating";
var gsFloatBgId_AN = "FloatingBg";
var gsTickerId_AN = "Ticker";

var giFloatLeft_AN = 0;

var gbShowFlg_AN = 0;
var giFloatNum_AN = 0;

bMacIeFlg_AN = CheckMacIe_AN();

function ShowPage(sMode,lcid){
	var oLayer;
	var sId;
	var iLayerTop;
	var iLayerWidth;
	var iLayerHeight;

	// 非表示モードの場合
	if(sMode != 1) {

		
		sId = gsFloatId_AN;
		oLayer = document.getElementById(sId);
		var oLayerParent = oLayer.parentNode;
		oLayerParent.removeChild(oLayer);
		

		sId = gsFloatBgId_AN;
		oLayer = document.getElementById(sId);
		var oLayerParent = oLayer.parentNode;
		oLayerParent.removeChild(oLayer);
		

		gbShowFlg_AN = 0;
		
		clearInterval(iIntervalId);
		clearInterval(iIntervalBgId);
		
		return;
	}
	
	
	if(gbShowFlg_AN == 1){

		return;
			
		
	} else {
		
		if(sMode == 1){

			oLayer = document.createElement('DIV');
			oLayer.id = gsFloatBgId_AN;

			oLayer.style.position = "absolute";
			oLayer.style.zIndex = 999;
			oLayer.style.display = "block";
			
			iLayerWidth = GetWindowSize_AN("width");
			iLayerHeight = GetWindowSize_AN("height");

			if(CheckBrowserModeForTicker_AN()){
				oLayer.style.width = iLayerWidth + "px";
				oLayer.style.height = iLayerHeight + "px";

			} else {
				oLayer.style.width = "100%";
				oLayer.style.height = "100%";
			}

			oLayer.style.top = GetScrollPosition_AN("top") + "px";
			oLayer.style.left = GetScrollPosition_AN("left") + "px";

			var sHtml = "&nbsp;";
			
			oLayer.innerHTML = sHtml;
			
			document.getElementsByTagName('body')[0].appendChild(oLayer);

			iIntervalBgId = setInterval("SetLayPosition_AN('" + gsFloatBgId_AN + "')", 100);


			oLayer = document.createElement('DIV');
			oLayer.id = gsFloatId_AN;

			oLayer.style.position = "absolute";
			oLayer.style.zIndex = 1000;
			oLayer.style.display = "block";
			
			iLayerWidth = GetWindowSize_AN("width");
			iLayerHeight = GetWindowSize_AN("height");

			if(CheckBrowserModeForTicker_AN()){
				oLayer.style.width = iLayerWidth + "px";
				oLayer.style.height = iLayerHeight + "px";

			} else {
				oLayer.style.width = "100%";
				oLayer.style.height = "100%";
			}

			oLayer.style.top = GetScrollPosition_AN("top") + "px";
			oLayer.style.left = GetScrollPosition_AN("left") + "px";

			var sHtml = "";

			sHtml += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="100%" height="100%" id="float_external" align="middle">';
			sHtml += '<param name="bgcolor" value="#ffffff" />';
			sHtml += '<param name="allowScriptAccess" value="always" />';
			sHtml += '<param name="movie" value="' + gsFloatSwf_AN + '" />';
			sHtml += '<param name="FlashVars" value="lcid=' + lcid + '" />';
			sHtml += '<param name="quality" value="high" />';
  			sHtml += '<param name="wmode" value="transparent" />';
			sHtml += '<param name="scale" value="noscale" />';
			sHtml += '<param name="salign" value="lt" />';
			sHtml += '<param name="SWLIVECONNECT" value="TRUE" />';
			sHtml += '<embed bgcolor="#333333" SWLIVECONNECT="TRUE" salign="lt" align="middle" scale="noscale" wmode="transparent" src="' + gsFloatSwf_AN + '" FlashVars="lcid='+lcid+'" name="float_external" quality="high" width="100%" height="100%" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
			sHtml += '</object>';
			
			
			
			document.getElementsByTagName('body')[0].appendChild(oLayer);
			document.getElementById(gsFloatId_AN).innerHTML = sHtml;
			iIntervalId = setInterval("SetLayPosition_AN('" + gsFloatId_AN + "')", 100);
						
			gbShowFlg_AN = 1;
		}
	}
	
	if(bMacIeFlg_AN == 1){
		window.scrollBy(0, 1);
	}
	
}

function SetLayPosition_AN(sId){
	var oTarget = document.getElementById(sId);

	if(CheckBrowserModeForTicker_AN()){
		oTarget.style.width = GetWindowSize_AN("width") + "px";
		oTarget.style.height = GetWindowSize_AN("height") + "px";
	}
	
	oTarget.style.top = GetScrollPosition_AN("top") + "px";
	oTarget.style.left = GetScrollPosition_AN("left") + "px";
}


function GetMiddlePosition_AN(sMode){
	
	var iWindowWidth, iWindowHeight;
	iWindowWidth = GetWindowSize_AN('width');
	iWindowHeight = GetWindowSize_AN('height');
	
	var iScrollTop, iScrollLeft;
	iScrollTop = GetScrollPosition_AN('top');
	iScrollLeft = GetScrollPosition_AN('left');
	
	var iMiddleTop = iWindowHeight / 2 + iScrollTop;
	var iMiddleLeft = iWindowWidth / 2 + iScrollLeft;
	
	if(sMode == "top"){
		return iMiddleTop;
	} else {
		return iMiddleLeft;
	}
	
}


function GetScrollPosition_AN(sMode){

	var iScrollPosition;

	if(sMode == "left"){
		if(self.pageXOffset){
			iScrollPosition = self.pageXOffset;
		// Explorer 6 Strict
		}else if(document.documentElement && document.documentElement.scrollLeft){
			iScrollPosition = document.documentElement.scrollLeft;
		// all other Explorers
		}else if(document.body){
			iScrollPosition = document.body.scrollLeft;
		}
	} else {

		if(self.pageYOffset){
			iScrollPosition = self.pageYOffset;
		// Explorer 6 Strict
		}else if(document.documentElement && document.documentElement.scrollTop){
			iScrollPosition = document.documentElement.scrollTop;
		// all other Explorers
		}else if(document.body){
			iScrollPosition = document.body.scrollTop;
		}
	}
	
	return iScrollPosition;
}


function GetWindowSize_AN(sMode){
	var iWindowWidth, iWindowHeight;
	
	// all except Explorer
	if(self.innerHeight){
		iWindowWidth = self.innerWidth;
		iWindowHeight = self.innerHeight;
	// Explorer 6 Strict Mode
	}else if(document.documentElement && document.documentElement.clientHeight){
		iWindowWidth = document.documentElement.clientWidth;
		iWindowHeight = document.documentElement.clientHeight;
	// other Explorers
	}else if(document.body){
		iWindowWidth = document.body.clientWidth;
		iWindowHeight = document.body.clientHeight;
	}
	
	if(sMode == "width"){
		return (iWindowWidth);
	} else {
		return (iWindowHeight);
	}
}


function getElementOffset(lcid) {

	if(navigator.userAgent.indexOf('Firefox') > -1 ){
		var elem = document.getElementById('etTicker'+lcid).getElementsByTagName('embed')[0];
	}else{
		var elem = document.getElementById('etTicker'+lcid).getElementsByTagName('object')[0];
	}
	
	var left = 0, top = 0, offsetParent = null;
	if ( elem.getBoundingClientRect ) {
		var box = elem.getBoundingClientRect();
		left = box.left + Math.max( document.documentElement.scrollLeft, document.body.scrollLeft ) - (document.documentElement.clientLeft || document.body.clientLeft);
		top  = box.top  + Math.max( document.documentElement.scrollTop,  document.body.scrollTop )  - (document.documentElement.clientLeft || document.body.clientLeft);
		
	} else {
		left = elem.offsetLeft, top  = elem.offsetTop, offsetParent = elem.offsetParent;
		while ( offsetParent ) {
			left += offsetParent.offsetLeft;
			top  += offsetParent.offsetTop;
			offsetParent = offsetParent.offsetParent;
		}
		 if(navigator.userAgent.indexOf('Firefox') > -1){
			var bodyStyle = document.defaultView.getComputedStyle(document.body, '');
			left += Number(bodyStyle.marginLeft.slice(0, -2));
			top += Number(bodyStyle.marginTop.slice(0, -2));
		}
	}
	return { x:left-GetScrollPosition_AN("left"), y:top-GetScrollPosition_AN("height")};
}

	


function CheckMacIe_AN(){
	var sOs = GetOsName_AN();
	var sNavigator = GetNavigatorName_AN();
	
	if((sOs == "MacOSX" || sOs == "MacOS") && sNavigator == "Explorer"){
		return true;
	} else {
		return false;
	}
}



function CheckBrowserModeForTicker_AN(){
	var sOs = GetOsName_AN();
	var sBrowser = GetNavigatorName_AN();

	if(sOs == "Windows" && sBrowser == "Explorer"){
		return true;
	}
	return false;
}



function GetOsName_AN(){
	var uAgent  = navigator.userAgent.toUpperCase();
	if (uAgent.indexOf("MAC OS X") >= 0) return "MacOSX";
	if (uAgent.indexOf("MAC") >= 0) return "MacOS";
	if (uAgent.indexOf("WIN") >= 0) return "Windows";
	if (uAgent.indexOf("X11") >= 0) return "UNIX";
	return "";
}



function GetNavigatorName_AN(){
	if(navigator.IBM_HPR) return "HomepageReader";
	
	aName  = navigator.userAgent.toUpperCase();
	if (aName.indexOf("SAFARI") >= 0) return "Safari";
	if (aName.indexOf("CHIMERA") >= 0) return "Camino";
	if (aName.indexOf("OPERA") >= 0) return "Opera";
	
	aName = navigator.appName.toUpperCase();
	if (aName.indexOf("NETSCAPE") >= 0)  return "Netscape";
	if (aName.indexOf("MICROSOFT") >= 0) return "Explorer";
	return "";
}

