/*************************************************
* マリークヮントオンラインショップ ユーザ
* Seasonal Infomation
* 
* @author	K.ASAKURA <BrainWave>
* @version	2006.11.03
* @require	seasonal_infomation.js
*************************************************/

/*************************************************
  商品お知らせメール登録ウィンドウ表示
*************************************************/

function openInformsStock (url, itemCd) {
	var url   = url + '?informsItemCd=' + itemCd;
	var name  = 'informs_stock';
	var style = 'width=468, height=440';
	win = window.open(url, name, style);
}

/*************************************************
  ショッピングバッグに商品を追加
*************************************************/

function sendShoppingBag (formId) {
	if (formId != null) {
		document.forms[formId].submit();
	}
}

/*************************************************
  ショッピングバッグに商品を追加（商品、商品数分割）
*************************************************/
function sendShoppingBagSplit (formId) {
	if (formId != null) {
		var selectItemName  = document.forms[formId].itemCd.value;
		var selectItemValue = document.forms[formId].itemValue.value;
		var max = document.forms[formId].elements.length;
		var i;
		
		if (selectItemName == '') return false;
		for (i = 0; i < max; i++) {
			if (selectItemName == document.forms[formId].elements[i].name) {
				document.forms[formId].elements[i].value = selectItemValue;
			}
		}
		document.forms[formId].submit();
	}
}

/*************************************************
  商品詳細ページへ移動
*************************************************/

function moveDetail (url) {
	document.toolItemForm.action = url;
	document.toolItemForm.submit();
}

/*************************************************
  MARY'S POINTウィンドウ表示
*************************************************/
function openMarysPoint (url) {
	var name  = 'point';
	var style = 'scrollbars=yes,width=570,height=400';
	win = window.open(url, name, style);
}
/*************************************************
  毛成分ウィンドウ表示
*************************************************/

function openDispFur (url) {
    var url   = url
    var name  = 'seibun';
    var style = 'toolbar=no,location=no,menubar=no,scrollbars=yes,resizable=no,width=400,height=310';
    win = window.open(url, name, style);
}



/*************************************************
  HOW TO
*************************************************/

function openHowto01 (url) {
    var url   = url
    var name  = 'seibun';
    var style = 'toolbar=no,location=no,menubar=no,scrollbars=no,resizable=no,width=500,height=370';
    win = window.open(url, name, style);
}


/*************************************************
  プルダウン
*************************************************/
function shadow(obj) {
   if(!obj) return false;
   if(document.getElementById) {
      document.getElementById("shadow01").style.display = "none";
      document.getElementById("shadow02").style.display = "none";
      document.getElementById("shadow03").style.display = "none";
      document.getElementById("shadow04").style.display = "none";
      document.getElementById("shadow05").style.display = "none";
      document.getElementById("shadow06").style.display = "none";
      document.getElementById("shadow07").style.display = "none";
      document.getElementById(obj).style.display = "block";
   } else {
      return false;
   }
}

function mascara(obj) {
   if(!obj) return false;
   if(document.getElementById) {
      document.getElementById("mascara01").style.display = "none";
      document.getElementById("mascara02").style.display = "none";
      document.getElementById(obj).style.display = "block";
   } else {
      return false;
   }
}

function highlight(obj) {
   if(!obj) return false;
   if(document.getElementById) {
      document.getElementById("highlight01").style.display = "none";
      document.getElementById("highlight02").style.display = "none";
      document.getElementById("highlight03").style.display = "none";
      document.getElementById(obj).style.display = "block";
   } else {
      return false;
   }
}

function lipgross(obj) {
   if(!obj) return false;
   if(document.getElementById) {
      document.getElementById("lipgross01").style.display = "none";
      document.getElementById("lipgross02").style.display = "none";
      document.getElementById("lipgross03").style.display = "none";
      document.getElementById(obj).style.display = "block";
   } else {
      return false;
   }
}



/*************************************************
  jQuery
*************************************************/
$(function(){
  $('[href*=#]').click(function() {
    var $target=$(this.hash);
    var targetY=$target.offset().top;
    $($.browser.opera ? document.compatMode == 'BackCompat' ? 'body' : 'html' :'html,body').animate({scrollTop: targetY},500);return false;
  });
});











$(function(){

	window.onload = $(function(){

		var DC = "displayContent";
		var OverLay = "overLay";
		var closeBox = "closeBox";
		var closeImg = '<img src="../shopping/img/the_brushes/close.jpg" alt="CLOSE" />'
		var closeBoxElement = '<p id="'+closeBox+'"><a href="#">'+closeImg+'</a></p>';
		
		$("body").append("<div id='"+DC+"'></div><div id='"+OverLay+"'>"+closeBoxElement+"</div>");
		$("#"+DC).css({"opacity":0.8});
		$("#"+DC).hide();
		$("#"+OverLay).hide();
	
	
		$.fn.modalWindow = function(options){
			var op = $.extend($.fn.modalWindow.defaults,options);
			var $t = $(this);
			var id = $t.attr("href");
			$(id).hide();
			
			var Class = $t.attr("class");
	
			function clickEvent(){
				$t.click(function(){
					$("#"+closeBox).addClass("not_"+Class);
					var w = $(id).width();
					var h = $(id).height();
					$("#"+DC).fadeIn(300);
					$("#"+OverLay).fadeIn(300).append($(id)).css({marginTop:-h/2+"px",marginLeft:-w/2+"px"});
					$("#"+OverLay).children().not($(id+",#closeBox")).hide();
					$(id).show();
					$("select").hide();
					return false;
				 });
			 }
		
			$("#"+DC+",#"+closeBox+" a").click(function(){
				$("#"+closeBox).removeClass("not_"+Class);
				$("#"+DC).hide();
				$("#"+OverLay).hide();
				$("select").show();
				clickEvent();
				return false;
			});
			clickEvent();
			
			/*if($.browser.msie && $.browser.version<6){*/
				$(window).scroll(function(){
					$("#" + DC).css("top",$(document).scrollTop());
					$("#" + OverLay).css("top",($(document).scrollTop()+$(window).height()/2) +"px");
				});
			/*}*/
		};
	
		$.fn.modalWindow.defaults = {
			closeBtn:""
		}
	});

	$(".lightbox").each(function(){
		$(this).modalWindow();
	});
	$(".lightbox_close_true").each(function(){
		$(this).modalWindow();
	});

});









