// javascriptの保存はUTF-8！
//=============================================


//=============================================
// header
//=============================================
function header(){
var bgimg = new Array();
for($i=0;$i<18;$i++){//画像の枚数分だけ数値を指定する
  bgimg.push($i);
}

var idNum = Math.floor(Math.random()*bgimg.length);
//alert(bgcss[idNum]);
//document.write('<img src="http://www.regreen.jp/common/img/header'+bgimg[idNum]+'.jpg" title="'+bgimg[idNum]+'" />');//Debug用
document.write('<img src="http://www.regreen.jp/common/img/header'+bgimg[idNum]+'.jpg" alt="" />');

}


//=============================================
// footer
//=============================================
function footer(){
document.write("&copy; 2009 RegreenBase Inc.");

}

//=============================================
// Global Menu (Living)
//=============================================
function livingMenu(){
document.write('<li class="masuho"><a href="/living/masuhocho.html" class="menu32">増穂町プロジェクト</a></li>');
document.write('<li class="mizukuchi"><a href="/living/mizukuchi.html" class="menu34">山梨市 水口周辺エリア</a></li>');
document.write('<li class="oshino"><a href="/living/oshino.html" class="menu35">忍野エリア</a></li>');
//document.write('<li class="project"><a href="/living/index.html" class="menu33">その他物件紹介</a></li>');
}

//=============================================
// Workshop 「参加希望者受付中アイコン」
//=============================================
function banner(word){
	if (word == "sanka"){ //参加タグが入っていたら画像表示
		document.write('<img src="http://www.regreen.jp/img/culture/icon_sanka.gif" alt="参加希望者受付中" />');
	}
}

//=============================================
// popup [concept] 未使用
//=============================================
function openWindow() { //v2.0
theURL = 'concept.html';
winName = 'コンセプト';
features ='width=930,height=680';
window.open(theURL,winName,features);
}


//=============================================
// rollover
//=============================================

function initRollovers() {
	if (!document.getElementById) return
	
	var aPreLoad = new Array();
	var sTempSrc;
	var aImages = document.getElementsByTagName('img');

	for (var i = 0; i < aImages.length; i++) {		
		if (aImages[i].className == 'over') {
			var src = aImages[i].getAttribute('src');
			var ftype = src.substring(src.lastIndexOf('.'), src.length);
			var hsrc = src.replace(ftype, '_on'+ftype);

			aImages[i].setAttribute('hsrc', hsrc);
			
			aPreLoad[i] = new Image();
			aPreLoad[i].src = hsrc;
			
			aImages[i].onmouseover = function() {
				sTempSrc = this.getAttribute('src');
				this.setAttribute('src', this.getAttribute('hsrc'));
			}	
			
			aImages[i].onmouseout = function() {
				if (!sTempSrc) sTempSrc = this.getAttribute('src').replace('_on'+ftype, ftype);
				this.setAttribute('src', sTempSrc);
			}
		}
	}
}

//window.onload = initRollovers;

//=============================================
// Swap URL to new contact form
//=============================================

function chgURL(){
	var aTag = document.getElementsByTagName('a');
	for(i=0; i<aTag.length; i++){
		var aTagMatch = document.getElementsByTagName('a')[i];
		if(aTagMatch=="https://f.msgs.jp/webapp/form/12305_hfs_3/index.do"){//お問い合わせ
			aTagMatch.href = "http://www.regreen.jp/contact/index.php?id=2"
		}else if(aTagMatch=="https://f.msgs.jp/webapp/form/12305_hfs_4/index.do"){//イベント参加
			aTagMatch.href = "http://www.regreen.jp/contact/index.php?id=0"
		}else if(aTagMatch=="https://f.msgs.jp/webapp/form/12305_hfs_5/index.do"){//ギャラリー|撮影スタジオ
			aTagMatch.href = "http://www.regreen.jp/contact/index.php?id=1"
		}else if(aTagMatch=="https://f.msgs.jp/webapp/form/12305_hfs_6/index.do"){//不動産
			aTagMatch.href = "http://www.regreen.jp/contact/index.php?id=3"
		}
	}
}

//window.onload = chgURL;

function loadEvent(){
	initRollovers();
	chgURL();
}

window.onload = loadEvent;
