$(window).bind("resize",function(){
  resizeDisplay();
});

$(document).ready(function(){
  onloadDisplay();
});

var pageSize1 = 1312;
var pageSize2 = 1594;

function resizeDisplay(){
  if($("html").width() <= pageSize1){
    $('#bottom li:gt(4)').fadeOut('fast');
  }else if($("html").width() <= pageSize2){
    if($('#bottom li:eq(5)').css('display') == 'none'){
      $('#bottom li:eq(5)').fadeIn('fast');
    }
    $('#bottom li:eq(6)').fadeOut('fast');
  }else if($("html").width() > pageSize2){
    if($('#bottom li:eq(5)').css('display') == 'none'){
      $('#bottom li:eq(5)').fadeIn('fast');
    }
    if($('#bottom li:eq(6)').css('display') == 'none'){
      $('#bottom li:eq(6)').fadeIn('fast');
    }
  }
}

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 Wopen_mail() {
window.open("https://g.ab0.jp/client/1100_p.php/1UuenX","_blank","toolbar=0,scrollbars=1,resizable=0,width=600,height=590");
return false ;
}


function randomKrrBnnr() {
  m = 0, x = 0, y = 0;
  ad  = new Array();
  adv = new Array();
  hit = new Array();

  hit[0] = 1; adv[0] = 'http://www.dfsokinawa.com/img/banner_kurara01.jpg';
  hit[1] = 1; adv[1] = 'http://www.dfsokinawa.com/img/banner_kurara02.jpg';
  hit[2] = 1; adv[2] = 'http://www.dfsokinawa.com/img/banner_kurara03.jpg';
  hit[3] = 1; adv[3] = 'http://www.dfsokinawa.com/img/banner_kurara04.jpg';

  for(i=0; i<=hit.length - 1; i++) {
    m += hit[i];
  }
  n = Math.floor(Math.random() * m);
  n++;
  for(i=0; i<=hit.length - 1; i++) {
    x = y;
    y += hit[i];
    if(x<n && n<=y) ad = adv[i];
  }
  document.write("<img src='"+ad+"' width=\"304\" height=\"196\" alt=\"くららクラクラ　詳しくはこちら\" >");
}





function showAs(obj) {
var id = new Array('as1_1','as1_2','as1_3','as1_4','as1_5');
if(!obj) return false;
if(document.getElementById) {

if(document.getElementById(obj).style.display == "block") {//added
document.getElementById(obj).style.display = "none";//added
} else {//added

var disp = (obj=="all") ? "block" : "none";
for(i = 0; i < id.length; i++)
document.getElementById(id[i]).style.display = disp;
if(obj!="all") document.getElementById(obj).style.display = "block";

}//added

} else {
return false;
}
}

function showAs2(obj) {
var id = new 
Array('as2_1','as2_2','as2_3','as2_4','as2_5','as2_6','as2_7','as2_8');
if(!obj) return false;
if(document.getElementById) {

if(document.getElementById(obj).style.display == "block") {//added
document.getElementById(obj).style.display = "none";//added
} else {//added

var disp = (obj=="all") ? "block" : "none";
for(i = 0; i < id.length; i++)
document.getElementById(id[i]).style.display = disp;
if(obj!="all") document.getElementById(obj).style.display = "block";

}//added

} else {
return false;
}
}


function showAs3(obj) {

var id = new Array('as3_1','as3_2','as3_3','as3_4');
if(!obj) return false;
if(document.getElementById) {

if(document.getElementById(obj).style.display == "block") {//added
document.getElementById(obj).style.display = "none";//added
} else {//added

var disp = (obj=="all") ? "block" : "none";
for(i = 0; i < id.length; i++)
document.getElementById(id[i]).style.display = disp;
if(obj!="all") document.getElementById(obj).style.display = "block";

}//added

} else {
return false;
}
}



function Wopen_attchdmap() {//QA用
window.open("http://www.dfsokinawa.com/qa/parkingmap.html","_blank","toolbar=0,scrollbars=1,resizable=0,width=780,height=600");
return false ;
}

function Wopen_mapaccess01() {//Access用
window.open("http://www.dfsokinawa.com/access/address.html","_blank","toolbar=0,scrollbars=1,resizable=0,width=800,height=320");
return false ;
}
function Wopen_mapaccess02() {//Access用
window.open("http://www.dfsokinawa.com/access/attachedmap.html","_blank","toolbar=0,scrollbars=1,resizable=0,width=860,height=600");
return false ;
}
