// タブ操作 //
function tabdis(array){
	for(var i=1;i<=5;i++){
	document.getElementById("tab"+i).style.display="none";
	}
	document.getElementById("tab"+array).style.display="block";
}
// tab : meeting package 2011.7.22 //
function mtabdis(array){
	for(var i=1;i<=4;i++){
	document.getElementById("tab"+i).style.display="none";
	}
	document.getElementById("tab"+array).style.display="block";
}

// イメージ操作 //
$(function(){
	  var imgsrcf = $("#imageSwich img").attr('src');
	  $(".thumnail a").hover(function () {
	  var imgsrc = $(this).attr('rel');
	  $("#imageSwich img").fadeOut(0);
	  $("#imageSwich img").attr("src",imgsrc);
	  $("#imageSwich img").fadeIn(0);
    },function(){
	$("#imageSwich img").fadeOut(0);
	  $("#imageSwich img").attr("src",imgsrcf);
	  $("#imageSwich img").fadeIn(0);
});
});


// ホテルリスト操作 //

$(function(){
$("#listbtn").click(function () {
  $('#sub-hotellist' ) . animate( { height: 'toggle', opacity: 'toggle' }, 'slow' );
});
});


$(function(){
	  $(".jCarouselLite img").hover(function () {
		  $(this).animate({width : 120, height : 80, marginTop: "-5px"},400);
		  $(this).dropShadow({  left : 1 ,top : 1 ,blur : 2,color : "#000"});
    },function(){
		  $(this).animate({width : 105, height : 70, marginTop: "0px"},200);
		  $(this).removeShadow();
	});
});

function getUrlVars()
{
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
    for(var i = 0; i < hashes.length; i++)
    {
        hash = hashes[i].split('=');
        vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }
    return vars;
}

$(function() {
	$('a.printwin').openwin({
		option  : {
		width   : 710,
		height  : 500,
		scrollbars  : "yes"
		},
		focus   : true
		});

});

$(function() {
	var byName = getUrlVars()["print"];
	if(byName=="1"){
		$("#jstyle").attr("media","all");
		};
});

(function($) {
	$.fn.openwin = function(settings) {
		settings = jQuery.extend({
			option		: {
				width		: false,
				height		: false,
				top			: false,
				left		: false,
				menubar		: "no",
				toolbar		: "no",
				location	: "no",
				status		: "no",
				resizable	: "no",
				scrollbars	: "yes",
				directories	: "no",
				titlebar	: "yes",
				fullscreen	: "no"
			},
			target		: "_blank",
			blur		: false,
			focus		: false
		}, settings);

		this.click(function() {
			var options = [];
			if($(this).attr("rel")) {
				var rel = $(this).attr("rel").split(",");
				var reloption = {};
				for(var i in rel) {
					var a = rel[i].split("=");
					reloption[a[0]] = a[1];
				}
			}
			for(var k in settings.option) {
				var v = settings.option[k];
				if(reloption) {
					if(reloption[k]) {
						v = reloption[k];
					}
				}
				if(v != false) {
					options.push(k + "=" + v);
				}
			}
			var target = settings.target;
			if(reloption) {
				if(reloption["target"]) {
					target = reloption["target"];
				}
			}
			var winurl = getUrlVars();
			var winurlp = winurl+"?print=1";
			var win = window.open(winurlp, target, options.join(","));
			if(settings.blur == true) {
				win.blur();
			}
			if(settings.focus == true) {
				win.focus();
			}
			return false;
		});
	}
})(jQuery);
