// Top Ad / Detect iPad

function topAdImg(){
	var UA = navigator.userAgent;
	var target=/iPad/;
	if(UA.match(target)){
		document.write(
	'<ul id="topAdImgSlide">'+
	'<li><img src="/img_top/topMainVisual1.jpg" title="音楽学校メーザー・ハウス - MESAR HAUS" /></li>'+
	'<li><img src="/img_top/topMainVisual2.jpg" title="音楽学校メーザー・ハウス - MESAR HAUS" /></li>'+
	'<li><img src="/img_top/topMainVisual3.jpg" title="音楽学校メーザー・ハウス - MESAR HAUS" /></li>'+
	'<li><img src="/img_top/topMainVisual4.jpg" title="音楽学校メーザー・ハウス - MESAR HAUS" /></li>'+
	'<li><img src="/img_top/topMainVisual5.jpg" title="音楽学校メーザー・ハウス - MESAR HAUS" /></li>'+
	'</ul>'
		)
		$(document).ready(
			function(){
				$('#topAdImgSlide').innerfade({
					animationtype: 'fade',
					speed: 800,
					timeout: 6000,
					type: 'random',
					containerheight: '1em'
				});
			}
		);	
	}else{
		document.write(
'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="750" height="340" id="FlashID" title="MESAR HAUS - 音楽学校メーザー・ハウス">'+
'<param name="movie" value="/flash.swf" /><param name="quality" value="high" /><param name="wmode" value="opaque" /><param name="swfversion" value="6.0.65.0" /><param name="expressinstall" value="/js/expressInstall.swf" />'+
'<!--[if !IE]>--><object type="application/x-shockwave-flash" data="/flash.swf" width="750" height="340"><!--<![endif]-->'+
'<param name="quality" value="high" /><param name="wmode" value="opaque" /><param name="swfversion" value="6.0.65.0" /><param name="expressinstall" value="/js/expressInstall.swf" />'+
'<div>'+
'<ul id="topAdImgSlide">'+
'<li><img src="/img_top/topMainVisual1.jpg" title="音楽学校メーザー・ハウス - MESAR HAUS" /></li>'+
'<li><img src="/img_top/topMainVisual2.jpg" title="音楽学校メーザー・ハウス - MESAR HAUS" /></li>'+
'<li><img src="/img_top/topMainVisual3.jpg" title="音楽学校メーザー・ハウス - MESAR HAUS" /></li>'+
'<li><img src="/img_top/topMainVisual4.jpg" title="音楽学校メーザー・ハウス - MESAR HAUS" /></li>'+
'<li><img src="/img_top/topMainVisual5.jpg" title="音楽学校メーザー・ハウス - MESAR HAUS" /></li>'+
'</ul>'+
'</div>'+
'<!--[if !IE]>--></object><!--<![endif]-->'+
'</object>'
		)
		swfobject.registerObject("FlashID");
	}
}



// Event Date

function eventSchedule(){
	var nowdate = new Date();
	var mon  = nowdate.getMonth() + 1; 
	var date = nowdate.getDate(); 
	document.write(mon+'/'+date);
}



// Info Ticker

function infoTicker(){
	document.write(
'<ul class="infoTicker">'+
'<li><a href="/event_briefing/index.html" title="学校説明会">学校説明会は毎週土曜開催中！メーザーのこと詳しくお話します。</a></li>'+
'<li><a href="/event_opencampus/index.html" title="オープンキャンパス">オープンキャンパス平日開催中！いつものメーザーを見学できます。</a></li>'+
'<li><a href="/event_trial/index.html" title="体験レッスン">体験レッスン開催中。この１日でメーザーすべてを体感！</a></li>'+
'</ul>'
	)
}

$(document).ready(
	function(){
		$('.infoTicker').innerfade({
			animationtype: 'fade',
			speed: 400,
			timeout: 3000,
			type: 'random',
			containerheight: '1em'
		});
	}
);



// Scroll Pane

$(document).ready(function() {
$('.scroll-pane').jScrollPane();
});



// FAQ Link Switcher

function faqLink(FAQ){
	var faqID = FAQ;
	$(document).ready(function(){
		$(faqID).show("normal");
	});
}



// Studio Index Description Switch

function studioIndexDescriptionSwitch(STU){
	var stuID = STU;
	document.getElementById('studioIndexDescription1').style.display="none";
	document.getElementById('studioIndexDescription2').style.display="none";
	document.getElementById('studioIndexDescription3').style.display="none";
	document.getElementById('studioIndexDescription4').style.display="none";
	$(document).ready(function(){
		$('#studioIndexDescription2').hide();
		$('#studioIndexDescription2').hide();
		$('#studioIndexDescription3').hide();
		$('#studioIndexDescription4').hide();
		$(stuID).fadeIn("slow");
	});
}



// Course Requirement Tab Switch - Unused

function courseRequirementSwitch(REQ){
	var reqID = REQ;
	document.getElementById('courseRequirement1').style.display="none";
	document.getElementById('courseRequirement2').style.display="none";
	document.getElementById('courseRequirement3').style.display="none";
	document.getElementById('courseRequirement4').style.display="none";
	$(document).ready(function(){
		$('#courseRequirement1').hide();
		$('#courseRequirement2').hide();
		$('#courseRequirement3').hide();
		$('#courseRequirement4').hide();
		$(reqID).fadeIn("slow");
	});
}



// Course Requirement Tab Switch2 - Unused

function courseRequirementSwitch2(REQ){
	var reqID = REQ;
	document.getElementById('courseRequirement1').style.display="none";
	document.getElementById('courseRequirement2').style.display="none";
	document.getElementById('courseRequirement3').style.display="none";
	document.getElementById('courseRequirement4').style.display="none";
	document.getElementById('courseRequirement5').style.display="none";
	$(document).ready(function(){
		$('#courseRequirement1').hide();
		$('#courseRequirement2').hide();
		$('#courseRequirement3').hide();
		$('#courseRequirement4').hide();
		$('#courseRequirement5').hide();
		$(reqID).fadeIn("slow");
	});
}



// Popup Window

function popup(URL,SIZE){
	popup = window.open(URL,'MESAR HAUS',SIZE+'scrollbars=yes,status=no,toolbar=no,location=no,menubar=no,directories=no,resizable=no');
}



// Twitter

function relative_time(time_value) {
  time_values = time_value.split(" ");
  time_value = time_values[1]+" "+time_values[2]+", "+time_values[5]+" "+time_values[3];
  var parsed_date = Date.parse(time_value);
  var relative_to = (arguments.length > 1) ? arguments[1] : new Date();
  var delta = parseInt((relative_to.getTime() - parsed_date) / 1000);
  delta = delta + (relative_to.getTimezoneOffset()*60);
  var dt = new Date();
  dt.setTime(dt.getTime() - (delta*1000));
  yy = dt.getYear();
  mm = dt.getMonth() + 1;
  dd = dt.getDate();
  dy = dt.getDay();
  hh = dt.getHours();
  mi = dt.getMinutes();
  ss = dt.getSeconds();
  if (yy < 2000) { yy += 1900; }
  if (mm < 10) { mm = "0" + mm; }
  if (dd < 10) { dd = "0" + dd; }
  dy = new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sst")[dy];
  if (hh < 10) { hh = "0" + hh; }
  if (mi < 10) { mi = "0" + mi; }
  if (ss < 10) { ss = "0" + ss; }

  return yy+"/"+mm+"/"+dd+"("+dy+") "+hh+":"+mi+":"+ss;

}

function twitterCallback(obj) {
  var t = document.getElementById('topTwitterInside');
  for ( i=0; i<obj.length; i++) {
    t.innerHTML += '<ul>';
    for ( i=0; i<obj.length; i++) {
        t.innerHTML += '<li class="clearfix">'+'<a href="http://twitter.com/#!/mesarhaus" target="_blank"><img src="http://img.tweetimag.es/i/mesarhaus_m" /></a>'+obj[i].text+'</li>';
    }
    t.innerHTML += '</ul>';
    t_mdl = document.createElement("div");
    t_mdl.setAttribute("class","twitter_middle");
    t_time = document.createElement("span");
    t_time.setAttribute("class","twitter_time");
    t_text = document.createElement("span");
    t_text.setAttribute("class","twitter_text");
    t_mdl.appendChild(t_time);
    t_mdl.appendChild(t_text);
    t.appendChild(t_mdl);
  }
}

function twitterTL(){
document.write(
 '<scr'+'ipt '
+'type="text/javascript" '
+'src="http://www.twitter.com/statuses/user_timeline/mesarhaus.json?callback=twitterCallback&count=5">'
+'</scr'+'ipt>'
);
}



// Seminar Menu

function seminarMenu (){
	document.write(
'<select id="seminarMenu" onChange="location = options[this.selectedIndex].value">'+
'<option value="" selected="selected">過去のイベント</option>'+
'<option value="/seminar/index.html">ProToolsセミナー</option>'+
'<option value="/seminar/spark7.html">Spark7 バンド・クリニック</option>'+
'<option value="/seminar/protools9.html">ProTools9 セミナー</option>'+
'<option value="/seminar/protoolslogicpro1day.html">ProTools / Logic Pro 1Day セミナー (2010年)</option>'+
'<option value="/seminar/oznoy.html">オズ・ノイ - OZ NOY - スペシャル・クリニック開催！</option>'+
'<option value="/seminar/billyseahan.html">ビリー・シーン スペシャル・クリニック開催！</option>'+
'<option value="/seminar/andytimmons.html">AndyTimmons ギター・クリニック開催！</option>'+
'<option value="/seminar/tripleworkshop.html">ギター×ベース×ドラム - Triple Workshop </option>'+
'<option value="/seminar/watusi.html">Watusiのサウンドプロデュースセミナー開催！</option>'+
'<option value="/seminar/allenhinds.html">アレン・ハインズ ギタークリニック</option>'+
'<option value="/seminar/mimi.html">mimi ヴォーカル・スペシャル・セミナー</option>'+
'<option value="/seminar/boo.html">ソウルラップシンガーBooのスペシャルセミナー</option>'+
'<option value="/seminar/synthefesta06.html">SYNTHE SIZER FESTA 06</option>'+
'<option value="/seminar/drumsday06.html">MESAR DRUMS DAY 06</option>'+
'<option value="/seminar/eguchitakahito.html">江口貴勅の作曲アレンジセミナー</option>'+
'<option value="/seminar/gibson.html">Gibson Jazz Guitar Contest 2006本選会 バンド部門でメーザー生２冠達成！</option>'+
'<option value="/seminar/totalexperience.html">Total Experience Gospel Choir ゴスペル・セミナー</option>'+
'<option value="/seminar/rhythmlab.html">RHYTHM LAB.特別セミナー開催！</option>'+
'<option value="/seminar/lincolngoins.html">リンカーン・ゴーインズ ベース・セミナー</option>'+
'<option value="/seminar/creatorsworld2006.html">CREATOR\'S WORLD 2006</option>'+
'<option value="/seminar/filomachado.html">ラテン・ミュージックの神髄を聴け！FILO MACHADO ＆ 櫻井哲夫セミナー開催。</option>'+
'<option value="/seminar/lloydspiegel.html">ロイド・スピーゲル ライブ＆ギター・クリニック開催！</option>'+
'<option value="/seminar/djd.html">ドミニク"DJD"ドーソンDJ&リミックス・セミナー</option>'+
'<option value="/seminar/kawadayoshihiko.html">河田嘉彦ディジュリドゥ＆即興セミナー</option>'+
'<option value="/seminar/garrisondavis.html">Garrison Davisゴスペルセミナー</option>'+
'<option value="/seminar/mikestern.html">MIKE STERN JAZZ MASTER CLASS</option>'+
'<option value="/seminar/pattoby.html">パット・トービー（ex.MR.BIG）ドラムス・セミナー</option>'+
'<option value="/seminar/hyramblock.html">ハイラム・ブロック・ギタークリニック</option>'+
'<option value="/seminar/drumsday05.html">メーザー・ドラムス・デイ2005</option>'+
'<option value="/seminar/allknowledge.html">全知識セミナー</option>'+
'<option value="/seminar/masterkey.html">DJ MASTERKEY x DJ HIRAKATSU最強のDJセミナー</option>'+
'</select>'
	);
}
