/**
 * @Name     
 * @Desc    サイト全般に使用
 * @Author  Y.Okuyama[inexio]
 * @Date    2010/05/14 11:07
**/

function agentCheck()
{
    var userAgent = navigator.userAgent;
    var strProtocol = location.protocol;
    if( userAgent.search(/iPhone/) != -1 )
    {
        if( strProtocol.indexOf( "https" ) == -1 )
        {
        	document.write("<link rel=\"stylesheet\" href=\"/css/iphone.css\" type=\"text/css\" media=\"screen\" />");
        }
        else
        {
        	document.write("<link rel=\"stylesheet\" href=\"/awabi-nigai.com/css/iphone.css\" type=\"text/css\" media=\"screen\" />");
        }
        document.write("<meta name=\"format-detection\" content=\"telephone=no\" />");
    }
}

function sourceReplace()
{  
  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", sourceReplace, false);
}
else if(window.attachEvent)
{
  window.attachEvent("onload", sourceReplace);
}




