$(document).ready(function() {
    $('a.iframe', '#gallery').iframe();
});

if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPad/i))) {
	if (document.cookie.indexOf("iphone_redirect=false") == -1) {
		window.location = "apple/";
	}

	else{ (document.cookie.indexOf("ipad_redirect=false") == -1)
		window.location = "apple/";
	}
}

$(document).ready(function() {

	jQuery.event.add(window, "load", backgroundResize);
	jQuery.event.add(window, "resize", backgroundResize);

	function backgroundResize() {

		var s_h = $(window).height();
		var s_w = $(window).width();
		var top_h = $(window).height();
		var dd_h = $("#disc-information").height();
		var tr_h = $("#track-list").height();
		var ga_h = $("#gallery").height();
		var ma_h = $("#making").height();
		var wa_h = $("#wallpaper").height();
		var sl_h = $("#staff-list").height();
		var ba_h = $("#banner").height();

		$("#background div").css("width", s_w);
		$("#dotmask").css("width", s_w);
		$("#dotmask").css("height", s_h);

		$("#top").css("height", top_h);
		$("#bg01").css("height", top_h);
		$("#bg02").css("height", dd_h + 768);
		$("#bg03").css("height", tr_h + 768);
		$("#bg04").css("height", ga_h + 768);
		$("#bg05").css("height", ma_h + 768);
		$("#bg06").css("height", wa_h + 768);
		$("#bg07").css("height", sl_h + 768);
		$("#bg08").css("height", ba_h + 768);
		$("#bg09").css("height", top_h + 20);

		$("#banner").css("margin-bottom", top_h);

		if (s_h < 720) {
			$("#top h2").css({"background-position":"left -300px","height":"365px"});
		}
		else {
			$("#top h2").css({"background-position":"left bottom","height":"768px"}); 
		}

	}

});

$(document).ready(function() {
	$("#track-list table tr td:nth-child(1)").css({"width":"25px","padding":"0"});
	$("#track-list table tr td:nth-child(2)").css({"color":"#ffffff","font-weight":"bold"});
	$("#track-list .disc_b tr td:nth-child(3)").css({"font-style":"italic","text-align":"right","padding":"0"});
	$("#track-list table tr td:nth-child(4)").css({"font-style":"italic","text-align":"right","padding":"0"});
	$("#track-list table tr:nth-child(15)").css({"border":"0px"});
});

$(document).ready(function() {
	$('a[href^="#"]').click(function(){
		$($(this).attr("href")).ScrollTo(1000, 'easeout');
		return false;
	});
});
