﻿var url="http://www.e-uparts.com/" 
var title="■ユニオンパーツ - 機械部品CADデータ■"
function favorites(Url,Title)
{
  if (Url=="") Url=url
  if (Title=="") Title=title
  if (document.all)
    window.external.AddFavorite(Url,Title)
}

function setTitle(TDID,BGIMGID,FGColor)
{
 return setTitleSub("",TDID,BGIMGID,FGColor)
}


function setTitleSub(BasePath,TDID,BGIMGID,FGColor)
{
  setBGIMG(TDID+"1",BasePath+"img/logo/menu01"+BGIMGID+".gif")
  setBGIMG(TDID+"2",BasePath+"img/logo/menu02"+BGIMGID+".gif")
  setBGIMG(TDID+"3",BasePath+"img/logo/menu03"+BGIMGID+".gif")
  // setFGCOLOR(TDID+"F1",'red')
  //setFGCOLOR(TDID+"F1",'white')
}


function setFGCOLOR(LayName,Color)
{ 
  if (document.getElementById) //N6,Moz,IE5,IE6用
     document.getElementById(LayName).style.color=Color
  else if (document.all)//IE4用
     document.all(LayName).style.color=Color
}

function setBGIMG(layName,image)
{
  if (document.getElementById)     
    { document.getElementById(layName).style.backgroundImage = (image=="")?"":"url("+image+")"}
  else if (document.layers)
    { // ネスケ用
     document.layers[layName].background.src=image
    }
  else if (document.all)//IE4用
    {
     document.all(layName).style.backgroundImage="url("+image+")"
    }
}

function newwin5(str)
{
 newwin(str,'popup5','width=640,height=450,resizable=yes,scrollbars=1,left=340,top=108')
}

function OpenNewWin(str)
{
 newwin(str,'_blank','width=640,height=450,resizable=yes,scrollbars=1,left=340,top=108')
}

function newwin(str,windowname,windowoption)
 {
    if (str != "")
      {
       popupwin=window.open(str,windowname,windowoption);
       //popupwin.location.href=str;
       if (navigator.appVersion.substring(0,1) >= "3") popupwin.focus();
      }
}

function checkData(data,CheckStr)
{
  var thisChar;
  var Count=data.length;
  var i=0; 
  if (Count<=0) return false;
  if (CheckStr.lgth<=0) return true;
  for(i=0;i<Count;i++)
     {
      thisChar = data.substring(i,i+1);
      if (CheckStr.indexOf(thisChar)==-1)
         return false;
     }
  return true;
}

function IsNum(data)
{
  return checkData(data,"0123456789");
}

function IsAlpha(data)
{
  return checkData(data,"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
}

function IsNumAndAlpha(data)
{
  return checkData(data,"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
}

function IsTelText(data)
{
  return checkData(data,"0123456789-()<>{}[]_");
}
function IsZipCodeText(data)
{
  return checkData(data,"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-()<>{}[]#$%&'+@\\|_*");
}