/*
 * common.js
 * スパム対策、ページスクロール
*/

/*スパム対策*/
<!--
function vspam(im,domain) {
	maddress = "mailto:" + im + "@" + domain;
	window.location.href = maddress;
}
// -->

$(function(){
	/* ウィンク効果 */
	$("a img.wink").hover(function(){
		$(this).css("opacity", "0.2");
		$(this).css("filter", "alpha(opacity=20)");
		$(this).fadeTo("slow", 1.0);
	});
	
});

$(document).ready(function() {
						   
	/*高さ揃える*/
	$('#footer-Info .box').flatHeights();

	/*無理やり中央揃えにしる*/
	var center1  = Math.floor($("#pMark").height() / 2);
	var center2  = Math.floor($("#pMark .text").height() / 2);
	$("#pMark .right").css("position", "relative");
	$("#pMark .text").css({
      position : 'absolute',
      top : center1 - center2 -10
    });
	
	var center3  = Math.floor($("#secom").height() / 2);
	var center4  = Math.floor($("#secom .text").height() / 2);
	$("#secom .text").css("position", "relative");
	$("#secom p").css({
      position : 'absolute',
      top : center3 - center4 -10
    });

	var center5  = Math.floor($("#about").height() / 2);
	var center6  = Math.floor($("#about .inner").height() / 2);
	$("#about").css("position", "relative");
	$("#about .inner").css({
      position : 'absolute',
      top : center5 - center6 - 10
    });
	
	/*お問い合わせボタン*/
	$('#formInquiry a')
    .css({  'backgroundPosition': '0 0' })
    .hover(
      function(){
        $(this)
          .stop()
          .animate({
            'opacity': 0
          }, 250);
      },
      function(){
        $(this)
          .stop()
          .animate({
            'opacity': 2
          }, 250);
      }
    );
	
	function mycarousel_initCallback(carousel){
    	// Disable autoscrolling if the user clicks the prev or next button.
    	carousel.buttonNext.bind('click', function() {
        	carousel.startAuto(0);
    	});

    	carousel.buttonPrev.bind('click', function() {
        	carousel.startAuto(0);
    	});

    	// Pause autoscrolling if the user moves with the cursor over the clip.
    	carousel.clip.hover(function() {
        carousel.stopAuto();
    	}, function() {
        	carousel.startAuto();
    	});
	};

    $('#bannerArea').jcarousel({
		scroll:1,							
        auto: 3,
		wrap: 'last',
        initCallback: mycarousel_initCallback
    });
	
});


/* ポップアップ */
function vRoom()
{
   adWindow=window.open('http://www.guide-niigata.gr.jp/living_panorama/','newWin','width=820,height=800,scrollbars=yes,resizable=yes,toolbar=yes,directories=yes,location=yes,menubar=yes,status=yes,left=0,top=0');
}

function newLife()
{
   adWindow=window.open('http://www.living-gallery.com/newlife.html','newWin','width=800,height=800,scrollbars=yes,resizable=yes,toolbar=yes,directories=yes,location=yes,menubar=yes,status=yes,left=0,top=0');
}

function outlet()
{
   adWindow=window.open('http://www.living-gallery.com/outlet.html','newWin','width=850,height=1200,scrollbars=yes,resizable=yes,toolbar=yes,directories=yes,location=yes,menubar=yes,status=yes,left=0,top=0');
}


function caravan()
{
   adWindow=window.open('http://www.living-gallery.com/extra/caravan.html','newWin','width=850,height=800,scrollbars=yes,resizable=yes,toolbar=yes,directories=yes,location=yes,menubar=yes,status=yes,left=0,top=0');
}

function natsutoku()
{
   adWindow=window.open('http://www.living-gallery.com/natsutoku.html','newWin','width=850,height=800,scrollbars=yes,resizable=yes,toolbar=yes,directories=yes,location=yes,menubar=yes,status=yes,left=0,top=0');
}


/*賃貸まつり*/
function lg_fes(){
	var st = "scrollbars=yes,resizable=yes,toolbar=yes,directories=yes,location=yes,menubar=yes,status=yes";
	var wx = 880;
	var wy = 700;
	var x = (screen.width  - wx) / 2;
	var y = ((screen.height - wy) / 2) - 30;
	var newwin = window.open("http://www.living-gallery-koriyama.com/extra/lg_festival.html","newWin","left="+x+",top="+y+",width="+wx+",height="+wy+","+st);
	newwin.focus();
}
