//===200907 Toppage XML Load (use 'prototype.js')===//

function loadXMLFile()
{
var noticeXML = "notice.xml?query=" + "&cache=" + (new Date()).getTime();
	new Ajax.Request(noticeXML,{ 
		method: "post", 
		onSuccess: displayData,
		onFailure:function(httpObj){
			$("maintenanceInfo").innerHTML = "error";
}
		});
}

function displayData(httpObj){

var XML = httpObj.responseXML;
var noticeTag = XML.getElementsByTagName("notice");
var noticeTagLgt = noticeTag.length;

var urgentFlag = XML.getElementsByTagName("urgent")[0].getAttribute("viewflag");

if(urgentFlag=='1'){

contentAll = $("maincontentsarea");//===parentElement
already = $("topProducts");//===beforeElement

createInfo = document.createElement('div');//===createElement
createInfo.setAttribute('id', 'noticeInfo');//===set

contentAll.insertBefore(createInfo, already);//===insert


	for (i = 0; i < noticeTagLgt; i = i +1){
			var noticeDate = noticeTag[i].getAttribute("date");
			var noticeURL = noticeTag[i].getAttribute("link");
			var noticeTgt = noticeTag[i].getAttribute("target");
			var noticeTxt = noticeTag[i].firstChild.nodeValue;
			noticeP = '<p id=\"notice' +[i]+ '\"><\/p>';
			$("noticeInfo").innerHTML += noticeP;
			
	noticeTxt = noticeTxt.replace(/\[br\]/g,'<br \/>');
	noticeTxt = noticeTxt.replace(/\[b\]/g,'<strong>');
	noticeTxt = noticeTxt.replace(/\[\/b\]/g,'<\/strong>');
	noticeTxt = noticeTxt.replace(/\[small\]/g,'<span style=\"font-size:0.8em\">');
	noticeTxt = noticeTxt.replace(/\[\/small\]/g,'<\/span>');
	noticeTxt = noticeTxt.replace(/\[big\]/g,'<span style=\"font-size:1.2em\">');
	noticeTxt = noticeTxt.replace(/\[\/big\]/g,'<\/span>');

if(noticeTxt.indexOf('\[color')!=-1){
	noticeTxt = noticeTxt.replace(/\[color#(.*?)\]/g,'<span style=\"color:#$1\">');
	noticeTxt = noticeTxt.replace(/\[\/color\]/g,'<\/span>');

}
	
//	noticeTxt='<span class=\"noticeText\">'+ noticeTxt+ '<\/span>';
	
	if(noticeDate==null){
		noticeDate = '';
	}
	else{
		noticeDate ='<span class=\"noticeDate\">'+ noticeDate + '&nbsp;<\/span>';
	}

	if(noticeURL==null){
			noticeOne = noticeDate + noticeTxt;
			}
		
		else if(noticeTgt==null){
			noticeOne = noticeDate + '<a href=\"' +noticeURL+ '\">'+ noticeTxt +'<\/a>';
			}

		else if(noticeURL==null && noticeTgt==null){
			noticeOne = noticeDate + noticeTxt;
			}

		else{
			noticeOne = noticeDate + '<a href=\"' +noticeURL+ '\" target=\"'+noticeTgt+'\">'+ noticeTxt +'<\/a>';
			}
			$("notice"+[i]).innerHTML =noticeOne;

	}//====for noticeTagLgt~ end
	
}//=====if urgentFlag~ end;


}

//===200907 Toppage XML Load End===//



function top_fl_write(){
fl_w_tag1="<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' WIDTH='" + fl_src_width + "' HEIGHT='"+ fl_src_height +"'>";
fl_w_tag2="<PARAM NAME=movie VALUE='" +fl_src+ "'><param name=menu value=false /><PARAM NAME=quality VALUE=high><PARAM NAME=bgcolor VALUE='" +fl_src_bgcolor+ "'><PARAM NAME=wmode VALUE=transparent>";
fl_w_tag3="<EMBED src='"+fl_src+"' quality=high wmode='transparent' menu='false' bgcolor='"+fl_src_bgcolor+"'  WIDTH='"+fl_src_width+"' HEIGHT='"+fl_src_height+"' TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer'></EMBED></OBJECT>";

	document.write(fl_w_tag1 + fl_w_tag2 + fl_w_tag3);

}

function top_flcd_write(){
flcd_w_tag1="<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' WIDTH='" + flcd_src_width + "' HEIGHT='"+ flcd_src_height +"'>";
flcd_w_tag2="<PARAM NAME=movie VALUE='" +flcd_src+ "'><param name=menu value=false /><PARAM NAME=quality VALUE=high><PARAM NAME=bgcolor VALUE='" +flcd_src_bgcolor+ "'>";
flcd_w_tag3="<EMBED src='"+flcd_src+"' quality=high menu='false' bgcolor='"+flcd_src_bgcolor+"'  WIDTH='"+flcd_src_width+"' HEIGHT='"+flcd_src_height+"' TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer'></EMBED></OBJECT>";


	document.write(flcd_w_tag1 + flcd_w_tag2 + flcd_w_tag3);

}

function top_flcd2_write(){
flcd2_w_tag1="<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' id='countdown2' WIDTH='" + flcd2_src_width + "' HEIGHT='"+ flcd2_src_height +"'>";
flcd2_w_tag2="<PARAM NAME=movie VALUE='" +flcd2_src+ "'><param name=menu value=false /><PARAM NAME=quality VALUE=high><PARAM NAME=bgcolor VALUE='" +flcd2_src_bgcolor+ "'>";
flcd2_w_tag3="<EMBED src='"+flcd2_src+"' quality=high menu='false' bgcolor='"+flcd2_src_bgcolor+"' id='countdown2' WIDTH='"+flcd2_src_width+"' HEIGHT='"+flcd2_src_height+"' TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer'></EMBED></OBJECT>";


	document.write(flcd2_w_tag1 + flcd2_w_tag2 + flcd2_w_tag3);

}


function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function langChange(lse){
var jpnURL = "/index.html";
var engURL = "/english/index.html";
var cnURL = "/cn/index.html";
if(lse.options[lse.selectedIndex].value=="jp"){
	parent.location.href = jpnURL;
	}
if(lse.options[lse.selectedIndex].value=="en"){
	parent.location.href = engURL;
	}
if(lse.options[lse.selectedIndex].value=="cn"){
	parent.location.href = cnURL;
	}
}


function fig_open(figno,w,h){
	fignoURL = "zoom/" + figno + ".html";
	figWidth = w;
	figHeight =h;
	window.open(fignoURL,"figwin","width="+ figWidth +",height="+ figHeight +",toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes");
}


//======== side baner =========//

/*----------------
function bnCreate(){
var bnNumCn = 1;
var bnLinkCn = new Array;
bnLinkCn[1]= "<a href='/cn/special/gyro/index.html'><img src='/cn/images/gyro_bn.jpg' alt='Epson Toyocom的陀螺仪传感器的秘密' width='120' height='60'></a>";

if(document.getElementById('SpLinkBnCn')){
	var bnAll = document.getElementById('SpLinkBnCn');
	for (var i=1; i<=bnNumCn; i++){
		var bnItem = document.createElement('p');
		bnItem.setAttribute('id', 'linkBn' + i);
		bnAll.appendChild(bnItem);
		document.getElementById('linkBn' + i).innerHTML = bnLinkCn[i];
	}
}

}


if(window.addEventListener) {
	window.addEventListener("load", bnCreate, false);
}
else if(window.attachEvent) {
	window.attachEvent("onload", bnCreate);
}
---------------------*/
//======== Flash or gif write =========//

function a_fl_write(){
a_fl_y_tag1="<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' WIDTH='" + a_fl_y_width + "' HEIGHT='"+ a_fl_y_height +"'>";
a_fl_y_tag2="<PARAM NAME=movie VALUE='" +a_fl_y+ "'><PARAM NAME=quality VALUE=high><PARAM NAME=loop VALUE=false><PARAM NAME=wmode VALUE=transparent>";
a_fl_y_tag3="<EMBED src='"+a_fl_y+"' quality=high loop=false wmode=transparent bgcolor=#FFFFFF  WIDTH='"+a_fl_y_width+"' HEIGHT='"+a_fl_y_height+"' TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer'></EMBED></OBJECT>";

a_fl_n_tag="<IMG SRC='"+ a_fl_n +"' WIDTH='"+ a_fl_n_width +"' HEIGHT='"+ a_fl_n_height +"'>";

var flsh = 0;

for(i = 0; i < navigator.mimeTypes.length; i++) {

if(navigator.mimeTypes[i].type == "application/x-shockwave-flash"){
		flsh = 1;
		}
	}

if (flsh == 1) {
	document.write(a_fl_y_tag1 + a_fl_y_tag2 + a_fl_y_tag3);
	
	}
else if ( navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.indexOf("Win")!=-1){
	document.write(a_fl_y_tag1 + a_fl_y_tag2 + a_fl_y_tag3);
	}

else  {
	document.write(a_fl_n_tag);
	}
}


function topswfFork(){
		var flashVersion=false;
		var nn=(navigator.appName.charAt(0)=="N");
		var n6=(document.getElementById && nn) || false;
		var ie=(document.all && !nn) || false;
		var mac=(navigator.userAgent.indexOf("Mac")!=-1) || false;
		var ver=""+navigator.appVersion;
		var fno=ver.indexOf(" ");
		var macChecked=0;
		ver=eval(ver.substring(0,fno));
		
		if (ie && !mac)
		{
			var flashVersion=new ActiveXObject("ShockwaveFlash.ShockwaveFlash").FlashVersion();
        	flashVersion=Math.floor(flashVersion / 0x10000);
		}
		
		if (!flashVersion)
		{
			if (nn && !document.plugins) flashVersion=false;
			else if ((nn || n6) && navigator.plugins) flashVersion=navigator.plugins["Shockwave Flash"].description.charAt(16);
			else flashVersion=false;
		}
		
		if (ie && mac) window.onload=chkMac;
		
		function chkMac()
		{
			if (window["sample"]) flashVersion=((window["sample"].FlashVersion() & 0xffff0000) >> 16);
			macChecked=1;
			result();
		}
		function result()
		{
			if (mac && ie && macChecked==0) return;
			if (!flashVersion) location.replace("index_nf.html");
			else if (flashVersion<=4) location.replace("index_nf.html");
			else location.replace("index_nf.html");
		}
}

