/**
 * @Name
 * @Desc    サイト全般に使用
 * @Author  inexio[ http://www.inexio.jp ]
 * @Date    2011/08/24 12:26
**/

function fontChange() {
  if(navigator.appVersion.indexOf("Mac") != -1) {
    document.body.style.fontFamily = 'Arial,san-serif,"ヒラギノ角ゴ Pro W3",Hiragino Kaku Gothic Pro,Osaka,verdana,palatino';
    //alert("Macintosh");
  }
}

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."));
        }
      }
    }
  }
}

function fancyBoxClass() {
  $("a.viewImg").fancybox({
    'titlePosition' : 'outside',
    'overlayColor' : '#000',
    'overlayOpacity' : 0.9
  });
  $("a[rel=example_group]").fancybox({
    'transitionIn' : 'none',
    'transitionOut' : 'none',
    'titlePosition' : 'over',
    'titleFormat' : function(title, currentArray, currentIndex, currentOpts) {
      return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
    }
  });
}


if(window.addEventListener)
{
  window.addEventListener("load", sourceReplace, false);
  window.addEventListener("load", fancyBoxClass, false);
  //window.addEventListener("load", fontChange, false);
}
else if(window.attachEvent)
{
  window.attachEvent("onload", sourceReplace);
  window.attachEvent("onload", fancyBoxClass);
  //window.attachEvent("onload", fontChange);
}


/*
function twitView() {
  new TWTR.Widget({
    version: 2,
    type: 'profile',
    rpp: 3,
    interval: 6000,
    width: 160,
    height: 300,
    theme: {
      shell: {
        background: '#333333',
        color: '#ffffff'
      },
      tweets: {
        background: '#FFFFFF',
        color: '#333333',
        links: '#336633'
      }
    },
    features: {
      scrollbar: true,
      loop: false,
      live: true,
      hashtags: true,
      timestamp: true,
      avatars: false,
      behavior: 'all'
    }
  }).render().setUser('MOKKO_LAND').start();
}
*/
function twitView() {
  document.write("<p class='indent01 par' style='color:#999999;font-size:85%;line-height:1.3;'>※エラー確認のため，開発時にはツイートの表示はOFFにしています。</p>");
}


/*
function socialLinks()
{
  document.write("<ul class=\"socialLinks\">");
  document.write("<li><a href=\"http://twitter.com/share/\" class=\"twitter-share-button\" data-count=\"horizontal\" data-via=\"MOKKO_LAND\" data-lang=\"ja\">Tweet</a><script type=\"text/javascript\" src=\"http://platform.twitter.com/widgets.js\"></script></li>");
  //document.write("<li><iframe src=\"http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.facebook-japan.com%2F&layout=button_count&show_faces=false&width=100&action=like&colorscheme=light&height=21\" scrolling=\"no\" frameborder=\"0\" style=\"border:none; overflow:hidden; width:100px; height:21px;\" allowTransparency=\"true\"></iframe></li>");
  document.write("<li><iframe src=\"http://www.facebook.com/plugins/like.php?app_id=111280098963132&amp;href=http%3A%2F%2Fwww.mland.gr.jp%2F&amp;send=false&amp;layout=button_count&amp;width=100&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=21\" scrolling=\"no\" frameborder=\"0\" style=\"border:none; overflow:hidden; width:100px; height:21px;\" allowTransparency=\"true\"></iframe></li>");
  //document.write("<li>" + document.URL + "</li>");
  //document.write("<li><div id=\"fb-root\"></div><script src=\"http://connect.facebook.net/jp_US/all.js#appId=111280098963132&amp;xfbml=1\">");
  //</script><fb:like href=\"" + document.URL + "\" send=\"false\" layout=\"button_count\" width=\"450\" show_faces=\"false\" font=\"\"></fb:like></li>");
  document.write("<li><a href=\"http://mixi.jp/share.pl\" class=\"mixi-check-button\"　data-key=\"mixi チェックキー\">Check</a><script type=\"text/javascript\" src=\"http://static.mixi.jp/js/share.js\"></script></li>");
  document.write("<li><g:plusone size=\"medium\" count=\"false\"></g:plusone></li>");
  document.write("</ul>");
}*/
function socialLinks() {
  document.write("<ul class=\"socialLinks\">");
  document.write("<li style='color:#666666;'>※エラー確認のため，開発時にはソーシャルリンクの機能はOFFにしています。</li>");
  document.write("</ul>");
}


function userSelectOn() {
  $("#userSelect").fadeIn(500);
  //userValue = 1;
}

function userSelectOff() {
  $("#userSelect").fadeOut(500);
  //userValue = 0;
}

//if(userValue > 0) {
  //document.getElementById(userSelect).style.display="block";
//}







/*
function openNew(alertMsg)
{
  if(!confirm("「" + alertMsg + "」を新規ページで開きますか？")) {
    return false;
  }
}*/


function faqBlockTgr() {
/* エフェクト有り（重い!?様なのでとりあえず不使用）
  $(document).ready(function() {
    $('div.faqWrap:eq(0)> dl dd').hide();
    $('div.faqWrap:eq(0)> dl dt').click(function() {
      $(this).next().slideToggle('fast');
    });
  });
*/
  $(document).ready(function() {
    $("dl.faqBlock > dd").css("display", "none");
    $("dl.faqBlock > dt").each(function(i){
      $(this).click(function() {
        $("dl.faqBlock > dd").eq(i).toggle();
      });
    });
  });
}






function topImage()
{
	document.write("<script type=\"text/javascript\">");
	document.write("$(document).ready(");
	document.write("function(){");
	document.write("$('#topImage').innerfade({");
	document.write("animationtype: 'fade',");
	document.write("speed: 1500,"); //2000
	document.write("timeout: 3500,"); //2000
	document.write("timeoutLast: 3500,"); //8000
	document.write("type: 'sequence',");
	document.write("containerheight: '350px'");
	document.write("});");
	document.write("});");
	document.write("</script>");
	document.write("<h2 id=\"topImage\">");
	document.write("<img src=\"/images/top/img_topimage00.gif\" alt=\"number2 Co.,Lts.\" />");
	document.write("<img src=\"/images/top/img_topimage01.jpg\" alt=\"「8caf&eacute; marunouchi」アーバンなcafe styleの提案\" />");
	document.write("<img src=\"/images/top/img_topimage02.jpg\" alt=\"「8caf&eacute; kokubo」木と緑に囲まれた癒し空間\" />");
	document.write("<img src=\"/images/top/img_topimage03.jpg\" alt=\"「8caf&eacute; lazawalk」FOOD,DESSERT,DRINK...cafeの魅力を存分に\" />");
  document.write("<img src=\"/images/top/img_topimage04.jpg\" alt=\"「8caf&eacute; sweets」azayaka(あざやか)なスウィーツの彩り\" />");
  document.write("<img src=\"/images/top/img_topimage05.jpg\" alt=\"「THREE ARROWS」ワンランク上の珠玉のダイナー\" />");
  document.write("<img src=\"/images/top/img_topimage06.jpg\" alt=\"「Quattro Cafe」PUBLIC COMMUNITY SPACEの提案… \" />");
  document.write("<img src=\"/images/top/img_topimage07.jpg\" alt=\"「Dining六魯」選びぬかれた食材の数々\" />");
  document.write("<img src=\"/images/top/img_topimage08.jpg\" alt=\"「居酒家 かまどか」一食入魂　全てはお客様の笑顔の為に...\" />");
	document.write("</h2>");
}

function cafeImage()
{
	document.write("<script type=\"text/javascript\">");
	document.write("$(document).ready(");
	document.write("function(){");
	document.write("$('#cafeImage').innerfade({");
	document.write("animationtype: 'fade',");
	document.write("speed: 1500,");
	document.write("timeout: 4000,");
	document.write("timeoutLast: 4000,");
	document.write("type: 'sequence',");
	document.write("containerheight: '350px'");
	document.write("});");
	document.write("});");
	document.write("</script>");
	document.write("<h2 id=\"cafeImage\">");
	document.write("<img src=\"/images/brands/8cafe/img_cafeimage01.jpg\" alt=\"NO CAFE, NO LIFE\" />");
	document.write("<img src=\"/images/brands/8cafe/img_cafeimage02.jpg\" alt=\"NO CAFE, NO LIFE\" />");
	document.write("<img src=\"/images/brands/8cafe/img_cafeimage03.jpg\" alt=\"NO CAFE, NO LIFE\" />");
    document.write("<img src=\"/images/brands/8cafe/img_cafeimage04.jpg\" alt=\"NO CAFE, NO LIFE\" />");
	document.write("</h2>");
}

function setAddress(z1, z2, t1, t2, t3) {
	$.get('/api/getAddress.php', {zip01:z1, zip02:z2},
		function(data) {
			arr = eval('['+data+']');
			$("#"+t1).val(arr[0].pref);
			$("#"+t2).val(arr[0].addr01);
			$("#"+t3).val(arr[0].addr02);
			$("#"+t3).focus();
		}
	);
}

