// JavaScript Document


//if (typeof document.documentElement.style.maxHeight == "undefined") {
//	var clear="../img/share/clear.gif"
//	pngfix=function(){var els=document.getElementsByTagName('*');var ip=/\.png/i;var i=els.length;while(i-- >0){var el=els[i];var es=el.style;if(el.src&&el.src.match(ip)&&!es.filter){es.height=el.height;es.width=el.width;es.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+el.src+"',sizingMethod='crop')";el.src=clear;}else{var elb=el.currentStyle.backgroundImage;if(elb.match(ip)){var path=elb.split('"');var rep=(el.currentStyle.backgroundRepeat=='no-repeat')?'crop':'scale';es.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+path[1]+"',sizingMethod='"+rep+"')";es.height=el.clientHeight+'px';es.backgroundImage='none';var elkids=el.getElementsByTagName('*');if (elkids){var j=elkids.length;if(el.currentStyle.position!="absolute")es.position='static';while (j-- >0)if(!elkids[j].style.position)elkids[j].style.position="relative";}}}}}
//	window.attachEvent('onload',pngfix);
//}

$(function(){
	
	//alert('test');
	
	//pngファイルのIE対応
	$("img[@src$=png]").pngfix();
	$("img[@src$=png],.iepngfix").pngfix();
	$("img[@src$=png],.zoomup").pngfix();
	$("img[@src$=png],.closebox").pngfix();
	$("#home #special #msg_special").pngfix();

	//写真リストのマウスオーバー
	$('ul.list_s_5 li').hover(function(){
		$(' .caption a',$(this)).css({'text-decoration':'underline','color':'#b33a26'});
	},function(){
		$(' .caption a',$(this)).css({'text-decoration':'none','color':'#280000'});
	});
	
	$('#author_list li').hover(function(){
		$('a:last',$(this)).css({'text-decoration':'underline','color':'#b33a26'});
	},function(){
		$('a:last',$(this)).css({'text-decoration':'none','color':'#280000'});
	});
	
	//商品の拡大写真
	var dTime = 200;
	$('.zoom').click(function(){
		thisID = $(this).attr('id');
		
		if(jQuery.browser.msie){
			win_y = document.body.scrollTop || document.documentElement.scrollTop;
			browser_y = document.documentElement.clientHeight || document.body.clientHeight || document.body.scrollHeight;
		} else {
			win_y = window.scrollY;//スクロール量を取得
			browser_y = window.innerHeight;//ブラウザの高さを取得
		}
		
		//alert(browser_y);
		//alert(win_y);
		
		if(browser_y < 800 && browser_y >= 700) {
			win_y = win_y - 40;	
		} else if(browser_y < 700 && browser_y >= 600) {
			win_y = win_y - 80;	
		} else if(browser_y < 600) {
			win_y = win_y - 130;
		} else {
			win_y = win_y
		}
		
		$('+div.zoomup',$(this)).css({'top':win_y+'px'});
		$('.zoomup').css({'display':'none'});
		
		//IEのバージョンを取得
		var appver = window.navigator.appVersion;
		var p = appver.indexOf("MSIE",0);
		var p2 = appver.indexOf(";",p);
		var iever = appver.substring(p + 5, p2);
		//alert(iever);
		
		if(iever >= 8 ){
			$('div.zoomup').css({'background':'url(http://www2.barbara-studio.com/parts/img/share/bg_zoom.png) no-repeat'});
		}
		
		if(jQuery.browser.msie){
			$('+div.zoomup',$(this)).show();
		} else {
			
			$('div.zoomup').css({'background':'none'});
			
			$('+div.zoomup',$(this)).show();
			$('+div.zoomup',$(this)).animate(
				{'opacity':'1'},
				dTime,
				"linear"
			);
			
			timerID = setTimeout('addZoomBg()',dTime);
			
		}
		
	});
	
	$('.zoomup').click(function(){
		//$(this).fadeOut();
		$('.closebox').hide();
		if(jQuery.browser.msie){
			$(this).hide();
			
		} else {
			$('div.zoomup').css({'background':'none'});
			$(this).animate(
				{'opacity':'0'},
				dTime,
				"linear",
				function(){
					$(this).hide();	
				}
			);
			
			//$(this).hide();
		}
	});
	
	$('.zoomup').hover(function(){
		$(this).append('<div class="closebox"><img src="../../../parts/img/share/closebox.png" /></div>');
		$('.closebox').show();
	},function(){
		$('.closebox').hide();
		//$('.closebox').remove();
	});
	
	//1点限り
	var hmtl_one = '<div class="only_one" style="position:absolute;left:76px;top:100px;"><img src="http://www2.barbara-studio.com/parts/img/share/icon_one.png" alt="1点限り" width="41" height="17" /></div>';
	$('.one').prepend(hmtl_one);
	
	//ただいま製作中
	//var uc_comment = '<h3 style="margin-top:30px;">当サイトは現在制作中です。ご注文は今しばらくお待ちください。</h3>';
	//$('#payment').html(uc_comment);
	
	//alphaバージョン
	//var alpha = '<div style="font-size:11px;position:absolute;left:32px;top:76px;">alpha version 0.96</div>';
	//$('#wrapper').prepend(alpha);
	
	
	//カレンダーの切り替え
	$('#link_next').click(function(){
		$('#this_month').animate(
			{"left":"-200px"},
			200,
			"linear"		 
		);		
		$('#next_month').animate(
			{"left":"0px"},
			200,
			"linear"		 
		);
	});
	
	$('#link_this').click(function(){
		$('#next_month').animate(
			{"left":"200px"},
			200,
			"linear"		 
		);
		$('#this_month').animate(
			{"left":"0px"},
			200,
			"linear"		 
		);
	});
	
	$('#link_next').hover(function(){
		$(this).css({'color':'#b33a26'});
	},function(){
		$(this).css({'color':'#796068'});
	});
	
	$('#link_this').hover(function(){
		$(this).css({'color':'#b33a26'});
	},function(){
		$(this).css({'color':'#796068'});
	});
	
	//注文フォームを開く
	$('.openOrder').click(function(){
		var win = window.open("http://www2.barbara-studio.com/ajaxmail/ajaxmail/order.html","",",width=700,height=700,toolbar=no,scrollbars=yes,resizable=yes");
		win.focus();
	});
	
	//注文ボタンのhover
	$('.openOrder').hover(function(){
		$(this).css('background-position','0 -26px');
	},function(){
		$(this).css('background-position','0 0');
	});
	
	
});

function addZoomBg(){
	$('div.zoomup').css({'background':'url(http://www2.barbara-studio.com/parts/img/share/bg_zoom.png) no-repeat'});

}

function openOrder(){
	var win = window.open("./ajaxmail/ajaxmail/order.html","",",width=700,height=700,toolbar=no,scrollbars=yes,resizable=yes");
	win.focus();
}