//# JavaScript Document
/*
	標準的なJavaScriptのライブラリ集
	XHTMLのコーディング規約上、JavaScript(js)と、style(css)は外部ファイルとして下さい。
*/

//# Access LOG
function access_log(log_id){
document.write('<a target="_blank" '
+'href="http://www.my-standard.co.jp/access_log/apricot.php?u='+ log_id +'"'
+'><img src="http://www.my-standard.co.jp/access_log/apricot.php'
+'?u='+ log_id +'&m=c&refr='+escape(top.document.referrer)
+'&scrn='+screen.width+'x'+screen.height+'x'+screen.colorDepth
+'&navi='+navigator.userAgent+'" style="width:0px;height:0px;border:0px;"'
+' /></a>');
}

//# Google Map
function create_google_map(pos_1, pos_2, html){

	google.load("maps", "2");

	function initialize(){

		var m_icon = new GIcon();
		m_icon.iconSize= new GSize(32, 32);
		m_icon.shadowSize= new GSize(32, 32);
		m_icon.iconAnchor= new GPoint(0, 32);
		m_icon.infoWindowAnchor= new GPoint(25, -5);
		m_icon.image = "http://www.my-standard.co.jp/img/icon_googlemap.png";

		var map = new GMap2(document.getElementById("map"));
		map.addControl(new GSmallMapControl());
		map.addControl(new GMapTypeControl());

		map.setCenter(new GLatLng(pos_1, pos_2), 18);

	  var point = new GLatLng(pos_1, pos_2);
	  var marker = createMarker(map, point, m_icon, html);
	}

	function createMarker(map, point, m_icon, html){
		var marker = new GMarker(point,{icon: m_icon});
		map.addOverlay(marker);
		marker.openInfoWindowHtml(html);
		GEvent.addListener(marker, "click", function(){
			marker.openInfoWindowHtml(html);
		});
  	return marker;
	}
	google.setOnLoadCallback(initialize);
}



//# flash, WindowsMedia, loadQuickTime 再生

function loadFlash(url,width,height){
	document.write('<object type="application/x-shockwave-flash" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+width+'" height="'+height+'">');
	document.write('<param name="movie" value="'+url+'">');
	document.write('<param name="quality" value="high">');
	document.write('<embed src="'+url+'" quality="high" pluginspage="http://www.macromedia.com/jp/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'">');
	document.write('</embed>');
	document.write('</object>');
}

function liadWindowsMedia(url,width,height){
	document.write('<object ID="MediaPlayer" width="'+width+'" height="'+height+'" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject">');
	document.write('<param name="ShowStatusBar" value="true">');
	document.write('<param name="Volume" value="false">');
	document.write('<param name="ShowDisplay" value="false">');
	document.write('<param name="ShowControls" value="false">');
	document.write('<param name="ShowAudioControls" value="false">');
	document.write('<param name="ShowPositionControls" value="false">');
	document.write('<param name="AutoStart" value="true">');
	document.write('<param name="FileName" value="'+url+'">');
	document.write('<embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/"');
	document.write('Name=MediaPlayer');
	document.write('ShowControls=0');
	document.write('ShowDisplay=0');
	document.write('ShowStatusBar=1');
	document.write('width='+width);
	document.write('height='+height);
	document.write('AutoStart=1');
	document.write('DisplaySize=0');
	document.write('ShowPositionControls=0');
	document.write('ShowVolumeControls=0');
	document.write('Src="'+url+'"');
	document.write('</embed>');
	document.write('</object>');
}

function loadQuickTime(url,width,height){
	document.write('<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" ');
	document.write('width="'+width+'" height="'+height+'" ');
	document.write('codebase="http://www.apple.com/qtactivex/qtplugin.cab">');
	document.write('<param name="src" value="'+url+'">');
	document.write('<param name="autoplay" value="true">');
	document.write('<param name="controller" value="true">');
	document.write('<param name="loop" value="false">');
	document.write('<embed src="'+url+'" type="video/quicktime" width="'+width+'" height="'+height+'" autoplay="true" controller="true" loop="false" pluginspage="http://www.apple.com/jp/quicktime/">');
	document.write('</embed>');
	document.write('</object>');
}
/*
function RollOver (obj,val) {
  obj.src = val;
}*/


/*--ロールオーバー
---------------------------------------*/
function initRollovers() {
	if (!document.getElementById) return
	
	var aPreLoad = new Array();
	var sTempSrc;
	var aImages = document.getElementsByTagName('img');

	for (var i = 0; i < aImages.length; i++) {		
		if (aImages[i].className == 'imgover') {
			var src = aImages[i].getAttribute('src');
			var ftype = src.substring(src.lastIndexOf('.'), src.length);
			var hsrc = src.replace(ftype, '_o'+ftype);

			aImages[i].setAttribute('hsrc', hsrc);
			
			aPreLoad[i] = new Image();
			aPreLoad[i].src = hsrc;
			
			aImages[i].onmouseover = function() {
				sTempSrc = this.getAttribute('src');
				this.setAttribute('src', this.getAttribute('hsrc'));
			}	
			
			aImages[i].onmouseout = function() {
				if (!sTempSrc) sTempSrc = this.getAttribute('src').replace('_o'+ftype, ftype);
				this.setAttribute('src', sTempSrc);
			}
		}
	}
}

window.onload = initRollovers;



/*ページトップへ移動*/
function backToTop() {
  var x1 = x2 = x3 = 0;
  var y1 = y2 = y3 = 0;
  if (document.documentElement) {
      x1 = document.documentElement.scrollLeft || 0;
      y1 = document.documentElement.scrollTop || 0;
  }
  if (document.body) {
      x2 = document.body.scrollLeft || 0;
      y2 = document.body.scrollTop || 0;
  }
  x3 = window.scrollX || 0;
  y3 = window.scrollY || 0;
  var x = Math.max(x1, Math.max(x2, x3));
  var y = Math.max(y1, Math.max(y2, y3));
  window.scrollTo(Math.floor(x / 2), Math.floor(y / 2));
  if (x > 0 || y > 0) {
      window.setTimeout("backToTop()", 33);
  }
}