// 画像プレロード
function preloadImg(imgName) {
 for (var i = 0; i < imgName.length; i++) {
  if (document.images) (new Image()).src = imgName[i];
 }
}
var mnImages = new Array(
'/shop/item/scshop/design/img01/bg_last_on.gif',
'/shop/item/scshop/design/img01/bg_next_on.gif',
'/shop/item/scshop/design/img01/bg_prev_on.gif',
'/shop/item/scshop/design/img01/bg_first_on.gif',
'/shop/item/scshop/design/img04/header_login_on01.gif',
'/shop/item/scshop/design/img04/header_login_on02.gif',
'/shop/item/scshop/design/img04/header_login_on03.gif',
'/shop/item/scshop/design/img04/shopmenu_faq.gif',
'/shop/item/scshop/design/img04/shopmenu_guide.gif',
'/shop/item/scshop/design/img04/shopmenu_shoplist.gif',
'/shop/item/scshop/design/img04/shopmenu_size.gif',
'/shop/item/scshop/design/img04/shopmenu_toiawase.gif',
'/shop/item/scshop/design/img04/shopmenu_top.gif',
'/shop/item/scshop/design/img04/111201xmasgift_gift01_on1.jpg',
'/shop/item/scshop/design/img04/111201xmasgift_gift01_on2.jpg',
'/shop/item/scshop/design/img04/111201xmasgift_gift02_on1.jpg',
'/shop/item/scshop/design/img04/111201xmasgift_gift02_on2.jpg',
'/shop/item/scshop/design/img04/111201xmasgift_gift02_on2.jpg',
'/shop/item/scshop/design/img04/111201xmasgift_gift03_on1.jpg',
'/shop/item/scshop/design/img04/111201xmasgift_gift03_on2.jpg',
'/shop/item/scshop/design/img04/111201xmasgift_gift04_on1.jpg',
'/shop/item/scshop/design/img04/111201xmasgift_gift04_on2.jpg');
preloadImg(mnImages);


/* ポップアップウィンドウ */
function MM_openBrWindow(theURL,winName,features) { 
  window.open(theURL,winName,features);
}

/* ポップアップ・家具のサイズ詳細 */
function kagusize(theURL) {
  window.open(theURL,'kagusize','menubar=no,scrollbars=yes,resizable=yes,width=660,height=600');
    return;
}

/*ポップアップ・コンフォートスタイル */
function w_style() {
  window.open('http://www.studio-clip.co.jp/style/','style','toolbar=no,menubar=no,scrollbars=yes,resizable=yes,width=1000,height=940').focus();
    return;
}

/*ポップアップ・ニュースレター登録 */
function w_newsletter() {
window.open('http://www.studio-clip.co.jp/newsletter/','windowname','scrollbars=yes,resizable=yes,status=yes,width=600,height=600').focus();
return;
}

/*ポップアップ・コーディネート */
function w_coordinate(theURL) {
  window.open(theURL,'coordinate','menubar=no,scrollbars=yes,resizable=yes,width=500,height=850').focus();
    return;
}

/* イベント詳細 */
function w_event(theURL) {
  window.open(theURL,'event','menubar=no,scrollbars=yes,resizable=yes,width=600,height=600').focus();
    return;
}
// サブウィンドウから親ウィンドウのURLを変更する（過去ログ用／今後はver.2の方を使うこと）
function w_dtlURL(theURL) {
window.opener.focus();
window.opener.location.href=theURL;
}
/* サブウィンドウから親ウィンドウのURLを変更する--ver.2
　HTMLファイルの('')内にURLコード書き込むだけで商品ページにリンクされます。*/
function w_dtlURL_ver2(URLcode) {
theURL='http://www.studio-clip.co.jp/fs/scshop/' + URLcode;
window.opener.focus();
window.opener.location.href=theURL;
}


/* 折りたたみ */
function expand(URI,SUB,EXP){
  if(document.getElementById) {
    if(document.getElementById(SUB).style.display) {
      if(URI != 0) {
        document.getElementById(SUB).style.display = "block";
        document.getElementById(EXP).style.display = "none";
      } else {
        document.getElementById(SUB).style.display = "none";
        document.getElementById(EXP).style.display = "block";
      }
    } else {
      location.href = URI;
      return true;
    }
  } else {
    location.href = URI;
    return true;
  }
}


// ニュースレター（店舗セレクトメニュー）
         function makeSublist(parent,child,isSubselectOptional,childVal){
            $("body").append("<select style='display:none' id='"+parent+child+"'></select>");
            $('#'+parent+child).html($("#"+child+" option"));
            var parentValue = $('#'+parent).attr('value');
            $('#'+child).html($("#"+parent+child+" .sub_"+parentValue).clone());
            childVal = (typeof childVal == "undefined")? "" : childVal ;
            $("#"+child+' option[@value="'+ childVal +'"]').attr('selected','selected');
            $('#'+parent).change( 
               function(){
                  var parentValue = $('#'+parent).attr('value');
                  $('#'+child).html($("#"+parent+child+" .sub_"+parentValue).clone());
                  if(isSubselectOptional) $('#'+child).prepend("<option value='none'> -- Select -- </option>");
                  $('#'+child).trigger("change");
                                 $('#'+child).focus();
               }
            );
         }
         $(function(){
            makeSublist('child', true, '');   
            makeSublist('parent','child', false, '1');   
         });

