/*
	Site Name: Bungalows Design
	Description: style import
	Version: 1.00
	Author: Bungalows Design
*/


//RollOver ++++++++++++++++++++++++++++++++++++++++++//
function initRollOverImages() {
	var image_cache = new Object();
	$("img.swap").each(function(i) {
		var imgsrc = this.src;
		var dot = this.src.lastIndexOf('.');
		var imgsrc_on = this.src.substr(0, dot) + '_on' + this.src.substr(dot, 4);
		image_cache[this.src] = new Image();
		image_cache[this.src].src = imgsrc_on;
		$(this).hover(
			function() { this.src = imgsrc_on;},
			function() { this.src = imgsrc;});
	});
}
$(document).ready(initRollOverImages);


//SmoothScroll ++++++++++++++++++++++++++++++++++++++++++//
$(document).ready(function(){
	$('a[href*=#]').click(function() {
	if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
		var $target = $(this.hash);
		$target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
		if ($target.length) {
			var sclpos = 43;
			var targetOffset = $target.offset().top - sclpos;
			$('html,body').animate({scrollTop: targetOffset}, 600);
			return false;
		}
	}
	});
});

//External Links ++++++++++++++++++++++++++++++++++++++++++//
window.onload = function() {
	var node_a = document.getElementsByTagName('a');
	for (var i in node_a) {
		if (node_a[i].className == 'external') {
			node_a[i].onclick = function() {
			window.open(this.href, '', '');
			return false;
			};
		}
	}
};

//Duplicate HTML ++++++++++++++++++++++++++++++++++++++++++//
function DuplicateMaplink() {
	document.write(''
		 + '<a href="http://maps.google.co.jp/maps?sourceid=navclient&hl=ja&q=%E7%A5%9E%E5%A5%88%E5%B7%9D%E7%9C%8C%E9%80%97%E5%AD%90%E5%B8%82%E5%B1%B1%E3%81%AE%E6%A0%B93-5-24&ie=UTF8&split=0&gl=jp&ei=lhEUSrmbB4SUkAWiuOWDDw&z=16&iwloc=A" class="external">地図（Google Map）</a></span><br />'
	);
}

function DuplicateContact() {
	var s=";8FEJP;80KzP;80KKP;80K{PU;80KGP;80LJP;80KzP;8FEHPv;80KxP;80K{P/;80LHP"+";8IKP;80KvP;80LEP",r="";
	for(i=0;i<s.length;i++)r+=String.fromCharCode((s.charCodeAt(i)+39)%93+33);
	document.write(''
		 + '<p class="adress">MAIL：<a href="mailto:'+r+'?subject=%82%a8%96%e2%82%a2%8d%87%82%ed%82%b9"><strong>info@bungalows.jp</strong></a><br />'
	);
}

