function setYear(){
	var d_obj = new Date();
	document.write(d_obj.getFullYear());
}

function swf_object(SWF,WID,HEI){
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width='+ WID +' height='+ HEI +'>');
	document.write('<param name="allowScriptAccess" value="sameDomain" />');
	document.write('<param name="allowFullScreen" value="false" />');
	document.write('<param name="movie" value="./'+ SWF +'.swf" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="bgcolor" value="#000000" />');
	document.write('<param name="wmode" value="transparent" />');
	document.write('<embed src="./'+ SWF +'.swf" quality="high" wmode="transparent" bgcolor="#000000" width='+ WID +' height='+ HEI +' name="coverflow" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
}


function init() {
	smartRollover();
	border_none();
	blackwindow();
	photoChange();
	winClose();
	prepareGallery();
	prepareLinks();
	//commentLength();
	//topLength();
	//oshirase();
}
window.onload=init;


/*----------------------------------------------------------*/
//				お知らせここから				
/*----------------------------------------------------------*/
/*
function oshirase() {
	if(!document.getElementById("header")){
		return false;
	}
	var newsBox = document.createElement("p");
	newsBox.id= "newsbox";

	newsBox.style.position = "absolute";
	newsBox.style.top = "60px";
	newsBox.style.left = "380px";
	newsBox.style.fontWeight = "bold";
	newsBox.style.fontSize = "14px";
	newsBox.style.color = "#dd0000";
	newsBox.style.textAlign = "left";
	document.getElementById("header").appendChild(newsBox);
	newsBox.innerHTML = "年末年始の営業のお知らせ<br />12/30(水)～1/3(日)迄休業致します。<br />(年末は29日迄年始は4日からの営業となります)";
	
}
addLoadEvent(oshirase);
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	}
	else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}
*/

/*----------------------------------------------------------*/
//				お知らせここまで				
/*----------------------------------------------------------*/


//ロールオーバーイメージ
function smartRollover() {
	if(document.getElementsByTagName) {
		var images = document.getElementsByTagName("img");

		for(var i=0; i < images.length; i++) {
			if(images[i].getAttribute("src").match("_out."))
			{
				images[i].onmouseover = function() {
					this.setAttribute("src", this.getAttribute("src").replace("_out.", "_over."));
				}
				images[i].onmouseout = function() {
					this.setAttribute("src", this.getAttribute("src").replace("_over.", "_out."));
				}
			}
		}
	}
}



function border_none(){
	var all_link = document.links;
	for(i=0;i<all_link.length;i++){
		all_link[i].onfocus = function(){
			this.blur();
		}
	}
}

function commentLength(){
	if(!document.getElementById("comment")){
		return false;
	}
	commentElement = document.getElementById("comment");
	if(!document.getElementById("contents")){
		commentElement.style.height = "300px";
	}
}

function topLength(){
	if(!document.getElementById("special")){
		return false;
	}
	topElement = document.getElementById("special");
	if(!document.getElementById("pickup")){
		topElement.style.height = "355px";
	}
}

function blackwindow(){
	if(!document.getElementById("costume")){
		return false;
	}
	//divを作成しidをつけ、body直下に設置//
	var element = document.createElement("div");
	element.id = "black";
	document.body.insertBefore(element,document.body.firstChild);
	element.style.display = "none";
	//フレームを含む高さの振り分け//
	getwindowheight();
	//divを作成しidをつけ、最初に作ったdivの直下(bodyから2つ目)に設置//
	var iframe = document.createElement("div");
	iframe.id= "ifra";
	document.body.insertBefore(iframe,document.body.firstChild.nextSibling);
	iframe.style.display = "none";
	
	//Linkの長さ分、リンクを取りに行く//
	var ifra = document.getElementById("costume");
	var links = ifra.getElementsByTagName("a");
	for(var i=0; i<links.length; i++){
		links[i].onclick =function(linkName){
			var linkName = this.getAttribute("href");
			element.style.display = "inline";
			iframe.style.display = "inline";
			var iframeData = '<iframe src="'+ linkName +'" width="350px" height="500px" scrolling="no" frameborder="0" >この部分はインラインフレーム対応のブラウザで見てください。</iframe>';
			iframe.innerHTML = iframeData;
			
			//スクロールがでた際のifremeの表示の上余白設定//
			if(document.documentElement.scrollTop){
				newTop = document.documentElement.scrollTop;
			}else{
				newTop = document.body.scrollTop;
			}
			iframe.style.top = newTop + "px" ;
			
			//表示・非表示の実行//
			element.onclick = function(){
				element.style.display = "none";
				iframe.style.display = "none";
				iframe.firstChild.removeAttribute("src");
			}
			iframe.onclick = function(){
				element.style.display = "none";
				iframe.style.display = "none";
				iframe.firstChild.removeAttribute("src");
			}
			return false;
		}
	}
}

function getwindowheight(){
	var element = document.getElementById("black");
	
	if(document.all){
		theight = document.body.scrollHeight;
	}else{
		theight = document.documentElement.scrollHeight;
	}
	
	if(navigator.appVersion.indexOf("MSIE 6",0) != -1){
		nheight = document.body.clientHeight;
	}else if(navigator.userAgent.indexOf("Firefox",0) != -1){
		nheight = document.documentElement.clientHeight;
	}else{
		nheight =  document.body.scrollHeight;
	}
	
	if(nheight > theight){
		fHeight = nheight;
	}else{
		fHeight = theight;
	}
	element.style.height = fHeight+"px";
}


function photoChange(){
	if(document.getElementById("image")){
		var base = document.getElementById("image").getElementsByTagName("img")[0];
		base.style.display = "none";

		var imageList = new Array();
		for(i=0;i<3;i++){
			tmpImage = new Image();
			tmpImage.src = "pic0"+(i+1)+".jpg";
			imageList.push(tmpImage);
		}

		if(imageList[0].width > 300){
			base.style.marginTop = "50px";
		}
		base.style.display = "";

		var sumArray = document.getElementsByTagName("img");
		for(i=0;i<sumArray.length;i++){

			if(sumArray[i].className == "ladySum"){
			
				sumArray[i].onmouseover = function(){

					var targetImg = document.getElementById("image").getElementsByTagName("img")[0];
					
					var tmpSrc = this.src.split("thumb0");
					var tmpNumber = tmpSrc[1].split(".");
					var srcNumber = tmpNumber[0]-1;
					
					targetImg.src = imageList[srcNumber].src;
					
					if(imageList[srcNumber].height ==300){
						targetImg.style.marginTop = "50px";
					}else{
						targetImg.style.marginTop = "0";
					}
				}
			}
		}
	}
}
function winClose(){
	if(!document.getElementById("close")){
		return false;
	}
	var btnClose = document.getElementById("close").firstChild;
	btnClose.onclick = function(){
		if(parent.document.getElementById("black")){
		parent.document.getElementById("black").style.display = "none";
		parent.document.getElementById("ifra").style.display = "none";
		}else{
		window.close();
		}
	}
}

function showPic(whichpic) {
	var source = whichpic.getAttribute("href");
	var placeholder = document.getElementById("placeholder");
	placeholder.setAttribute("src",source);

}
function prepareGallery(){
	if(!document.getElementsByTagName) return false;	
	if(!document.getElementById) return false;
	if(!document.getElementById("imagegallery")) return false;	
	var gallery = document.getElementById("imagegallery");
	var links = gallery.getElementsByTagName("a");
	for(var i=0; i<links.length; i++){

		links[i].onclick =function(){
		showPic(this);
		return false;
		}
		links[i].onmouseover =function(){
		showPic(this);
		return false;
		}
	}
}


function prepareLinks() {
    if(!document.getElementsByTagName){
    	return false;
    }
    var links = document.getElementsByTagName("a");
    for (var i=0; i<links.length; i++) {
        if(links[i].getAttribute("className") == "popup" || links[i].getAttribute("class") == "popup") {
            links[i].onclick = function() {
                popUp(this.getAttribute("href"));
                return false;
            }
        }
    }
}
function popUp(winURL) {
	var winFocus;
    winFocus = window.open(winURL,"popup","width=850,height=550");
    winFocus.focus();
}
