if (self != top) {
	top.location.href = self.location.href;
}

$(function(){
	$('.share').click(function(){
		window.open(this.href,'share','width=600, height=350, resizable=yes, menubar=no, toolbar=no, scrollbars=no, status=no, resizable=no');
		return false;
	});
	$("input#check").click(function(){
		if($('input#contact_name').val() == '') {
			$('span#name_check').html('&nbsp;←必ずご入力下さい。');
		} else if(!mail_address($('input#contact_mail').val())) {
			$('span#name_check').html('');
			$('span#mail_check').html('&nbsp;←正しくご入力下さい。');
		} else if($('textarea#contact_desc').val() == '') {
			$('span#mail_check').html('');
			$('span#desc_ckeck').html('&nbsp;↑必ずご入力下さい。');
		} else {
			var input = document.createElement('input');
			input.setAttribute('type', 'hidden');
			input.setAttribute('name', 'func');
			input.setAttribute('value', 'check');
			this.form.appendChild(input);
			$(this.form).submit();
		}
	});
	$("input#post").click(function(){
		var input = document.createElement('input');
		input.setAttribute('type', 'hidden');
		input.setAttribute('name', 'func');
		input.setAttribute('value', 'send');
		this.form.appendChild(input);
		$(this.form).submit();
	});
	$('#maintable').fadeIn();
	resizeContainer();
	$(window).bind("resize", resizeContainer);
});

function resizeContainer() {
	var h = $(window).height() - 170;
	$('#contents').css('min-height', h+'px');
}

function mail_address(m) {
	if (m.match(/^[A-Za-z0-9]+[\w-]+@[\w\.-]+\.\w{2,}$/)){
		return true;
	} else {
		return false;
	}
}

function dispMap(div, area) {
	var myOptions = {zoom: 16, mapTypeId: google.maps.MapTypeId.ROADMAP};
	var marker = null;
	var geocoder = new google.maps.Geocoder();
	var map = new google.maps.Map(div, myOptions);
	geocoder.geocode({'address': area}, function(results, status) {
		map.setCenter(results[0].geometry.location);
		marker = new google.maps.Marker({map: map, position: results[0].geometry.location});
	});
	return false;
}