/************************************************
  
    Site Name: 弥生株式会社
	Description: common script
	Version: 
	Author: 
	Last Modified :

************************************************/
function smartRollover() {
	if(document.getElementsByTagName) {
		var images = document.getElementsByTagName("img");

		for(var i=0; i < images.length; i++) {
			if(images[i].getAttribute("src").match("_off."))
			{
				images[i].onmouseover = function() {
					this.setAttribute("src", this.getAttribute("src").replace("_off.", "_on."));
				}
				images[i].onmouseout = function() {
					this.setAttribute("src", this.getAttribute("src").replace("_on.", "_off."));
				}
			}
		}
	}
}

if(window.addEventListener) {
	window.addEventListener("load", smartRollover, false);
}
else if(window.attachEvent) {
	window.attachEvent("onload", smartRollover);
}

function changeTag(){
	var tabs=document.getElementById("n-tabs");
	for(var i in tabs.childNodes){
		var childObj=tabs.childNodes[i];
		if(childObj.tagName=="LI"){
			if(childObj.className="ui-tabs-selected"){
				alert("OK");
			}
		}
	}
}


//以下 旧common.css--------------------------------------------------------------------------------------------

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_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_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 doPost(command) {
  document.form.command.value = command;
  document.form.submit();
}

function select(mediumId) {
  var form = document.form;
  form.command.value = "list";
  form.mediumId.value = mediumId;
  form.action = "/icare/faq/contents.do";
  form.submit();
}

function w_open1(){
	window.open("/icare/regist/update.do","windowopen1","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes width=700,height=800,") }

function w_open2(){
        window.open("/icare/onlinesupport/olnList.do","windowopen2","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes width=800, height=700,") }
        
function w_open3(){
  window.open("/icare/store/supply/aboutsupportproduct.html","windowopen3","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes width=640,height=600,") }

function w_open4(){
  window.open("/icare/regist/update/info.do","windowopen4","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes width=800, height=700,") }

function newwin1(str) {
    if (str != "") {
        if (navigator.appVersion.substring(0,1) >= "3") {
           popup1=window.open(str,'popup1','width=680,height=560,resizable=yes,scrollbars=1,left=10,top=10');
            popup1.location.href=str;
            popup1.focus();
       } else {
            popup1=window.open(str,'popup1','width=680,height=560,resizable=yes,scrollbars=1,left=10,top=10');
            window.open(str,'popup1','width=680,height=560,resize=yes,scrollbars=1,left=10,top=10');
            popup1.location.href=str;
        }
    }
}

function newwin2(str) {
    if (str != "") {
        if (navigator.appVersion.substring(0,1) >= "3") {
           popup2=window.open(str,'popup2','width=770,height=640,resizable=yes,scrollbars=1,left=30,top=30');
            popup2.location.href=str;
            popup2.focus();
       } else {
            popup2=window.open(str,'popup2','width=770,height=640,resizable=yes,scrollbars=1,left=30,top=30');
            window.open(str,'popup2','width=770,height=640,resize=yes,scrollbars=1,left=30,top=30');
            popup2.location.href=str;
        }
    }
}


//20080627追加--------------------------------------------------------------------------------------------

function printPage(){
	if(document.getElementById || document.layers){
		window.print();	
	}
}


function window1(win1) { 
      win=window.open(win1,"new","toolbar=1,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=641,height=600");
} 


//新規ウィンドウ表示
function papWin1(url) {
	window.open(url,'papWin1','width=680,height=500,menubar=no,toolbar=no,resizable=yes,scrollbars=yes');
}
function papWin2(url){
	window.open(url,'papWin2','width=680,height=750,menubar=no,toolbar=no,resizable=yes,scrollbars=yes');
}
function papWin3(url){
	window.open(url,'papWin3','width=700,height=800,menubar=no,toolbar=no,resizable=yes,scrollbars=yes');
}

//印刷用PDFダウンロード
function kakunin() {
	if (window.confirm("印刷用PDFファイルをダウンロードしますか？")) { return true;} else { return false;}
}

//ポップアップ用
function popWidth(w) { 
      document.getElementById("popWrap").style.width = (w + 28) + "px";
	  document.getElementById("popContainer").style.width = (w + 18) + "px";
	  document.getElementById("popCorpHeader").style.width = w + "px";
	  document.getElementById("popCorpFooter").style.width = w + "px";
	  document.getElementById("popContents").style.width = w + "px";
	  document.getElementById("popContMain").style.width = w + "px";
} 

function CloseWin(){
    window.close();
}
