/**
 * @Name     
 * @Desc    サイト全般に使用
 * @Author  inexio[ http://www.inexio.jp/ ]
 * @Date    2011/03/16 16:45
**/

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(location.pathname == "/" || location.pathname == "/index.html")
{
    $(document).ready(function ()
    {
        var scrollSpeed = 10;
        var targetWidth = 1806;
        var targetX = 0;
        setInterval(function()
        {
            if (targetX >= targetWidth) targetX= 0;
            targetX += scrollSpeed;
            $('h1').css("background-position",targetX+"px 0px");
        }, 1);
    })
}



function sortDesign()
{
	$('#sortDesign').change(function()
    {
		if(this.value == "all")
        {
		    location.href = "./";
		}
        else
        {
		    location.href = "./?sort=" + this.value;
        }
	});
}



if(window.addEventListener)
{
  window.addEventListener("load", sourceReplace, false);
  window.addEventListener("load", sortDesign, false);
  window.addEventListener("load", setupZoom, false);
}
else if(window.attachEvent)
{
  window.attachEvent("onload", sourceReplace);
  window.attachEvent("onload", sortDesign);
  window.attachEvent("onload", setupZoom);
}



function viewChange(image)
{
    document.getElementById("salonImg").src = image;
}



