// JavaScript Document by Anissa Hart

$(document).ready(function(e) {
   var ua = navigator.userAgent;
   var url = "http://ohbijou.com/mnews.html";
   if (ua.indexOf("BlackBerry") >= 0)
   {
      if (ua.indexOf("WebKit") >= 0)
      {
         window.location = url;
      }
   }
});



$(document).ready(function(){

	if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))  || 
	(navigator.userAgent.match(/blackberry/i)) || (navigator.userAgent.match(/android/i)) || (navigator.userAgent.match(/opera mini/i)) || (navigator.userAgent.match(/(pre\/|palm os|palm|hiptop|avantgo|plucker|xiino|blazer|elaine)/i)) || (navigator.userAgent.match(/(iris|3g_t|windows ce|opera mobi|windows ce; smartphone;|windows ce; iemobile)/i)) || (navigator.userAgent.match(/(mini 9.5|vx1000|lge |m800|e860|u940|ux840|compal|wireless| mobi|ahong|lg380|lgku|lgu900|lg210|lg47|lg920|lg840|lg370|sam-r|mg50|s55|g83|t66|vx400|mk99|d615|d763|el370|sl900|mp500|samu3|samu4|vx10|xda_|samu5|samu6|samu7|samu9|a615|b832|m881|s920|n210|s700|c-810|_h797|mob-x|sk16d|848b|mowser|s580|r800|471x|v120|rim8|c500foma:|160x|x160|480x|x640|t503|w839|i250|sprint|w398samr810|m5252|c7100|mt126|x225|s5330|s820|htil-g1|fly v71|s302|-x113|novarra|k610i|-three|8325rc|8352rc|sanyo|vx54|c888|nx250|n120|mtk |c5588|s710|t880|c5005|i;458x|p404i|s210|c5100|teleca|s940|c500|s590|foma|samsu|vx8|vx9|a1000|_mms|myx|a700|gu1100|bc831|e300|ems100|me701|me702m-three|sd588|s800|8325rc|ac831|mw200|brew |d88|htc\/|htc_touch|355x|m50|km100|d736|p-9521|telco|sl74|ktouch|m4u\/|me702|8325rc|kddi|phone|lg |sonyericsson|samsung|240x|x320|vx10|nokia|sony cmd|motorola|up.browser|up.link|mmp|symbian|smartphone|midp|wap|vodafone|o2|pocket|kindle|mobile|psp|treo)/i))) {

		//$("#buttons").css({"bottom":"-146px"});
		location.replace("http://ohbijou.com/mnews.html");

	} else {

		$("#buttons div").mouseover(function(){

			var box = $(this);

			$(this).stop().animate({"queue":"false", "top":"-19px"}, 250).animate({"queue":"false", "top":"-14px"}, 120, "linear").animate({"queue":"false", "top":"-19px"}, 190, "linear");

		});

		$("#buttons div").mouseout(function(){

			var box = $(this);

			$(this).stop().animate({"queue":"false", "top":"0px"}, 250);

		});

		$(window).bind("load",function(){

			$("#buttons").animate({"bottom":"-146px"});

		});

	}

});	

$(document).ready(function() {
	$(".iconlink").click(function(event){
		  	window.open($(event.target).find("a").attr("href"), "_blank");
	   })
});

$(document).ready(function(){
     if($(".tweet").length > 0) {
	    $(".tweet").tweet({
            username: "ohbijou",
            join_text: "auto",
            avatar_size: 32,
            count: 4,
            auto_join_text_default: "", 
            auto_join_text_ed: "",
            auto_join_text_ing: "",
            auto_join_text_reply: "",
            auto_join_text_url: "",
            loading_text: "loading tweets..."
        });
	 }
});

$(document).ready(function() {
		if ($(".scroll-pane").length > 0)
		{
			jQuery.event.add(window, "load", resizeFrame);
			jQuery.event.add(window, "resize", resizeFrame);
		}
});


function resizeFrame() 
{
	var h = $(window).height();
	if (h < 650)
	{
		$('#biobox, .scroll-pane').css('height', '350px');
		$(function()
		{
			$('.scroll-pane').jScrollPane();
		});
	}
	else
	{
		$('#biobox, .scroll-pane').css('height', '450px');
		$(function()
		{
			$('.scroll-pane').jScrollPane();
		});
		
	}
	
}

$(document).ready(function() {
    moveBgAround();
});

function moveBgAround() {
	//give a random value from 0 to 400 for the X axis and Y axis
	var x = Math.floor(Math.random()*631);
	var y = Math.floor(Math.random()*451);
	//random generated time it take to move
	var time = Math.floor(Math.random()*1001) + 7000;
	//make the background image move!
	$('.scrollbg').animate({
		backgroundPosition: '(' + (x * -1) + 'px ' + (y * -1) + 'px)'
	}, time, "easeInOutQuad", function (){
		moveBgAround();
	});
	
}







$(document).ready(function() {
	if ($('#gigs').length > 0) {
		//jQuery.event.add(window, "load", resizeFrame);
		//jQuery.event.add(window, "resize", resizeFrame);
		
	
		var h = $(window).height();
		if (h < 700)
		{
			$('#gigs').css('height', '350px');
			
			
			$("table#curgigs").createScrollableTable({
			width:'650px',
			height:'290px'
			});
			$("table#pastgigs").createScrollableTable({
				width:'650px',
				height:'290px'
			});
			
			
		}
		else
		{
			
			$('#gigs').css('height', '450px');
			
			$("table#curgigs").createScrollableTable({
			width:'650px',
			height:'390px'
			});
			$("table#pastgigs").createScrollableTable({
				width:'650px',
				height:'390px'
			});
			
		}
		
	
		
		
		
	}
});


$(document).ready(function(){
	$("#upcoming").show();
	$("#past").hide();
	$('#uc').addClass('selected');
	$("#uc").click(function(event){
		event.preventDefault();
		$('#uc').addClass('selected');
		if($('#pc').hasClass('selected'))
			$('#pc').removeClass('selected');
		$("#upcoming").show();
		$("#past").hide();
	});
	$("#pc").click(function(event){
		event.preventDefault();
		$('#pc').addClass('selected');
		if($('#uc').hasClass('selected'))
			$('#uc').removeClass('selected');
		$("#upcoming").hide();
		$("#past").show();
	});
});



$(document).ready(function() {
    if($("#gallery").length > 0) {
 		
		var h = $(window).height();
		if (h < 670)
		{
		   
		   $('#photog').css('height', '350px');
		   Galleria.loadTheme('galleria/themes/classic/galleria.classic.min.js');
					$("#gallery").galleria({
						width: 800,
						height: 350
					});
		}
		else
		{
			$('#photog').css('height', '500px');
			 Galleria.loadTheme('galleria/themes/classic/galleria.classic.min.js');
					$("#gallery").galleria({
						width: 800,
						height: 450
					});
		}
	}
}); 


$(document).ready(function() {
    if($("#promofact").length > 0) {
		jQuery.event.add(window, "resize", moveLogo);
		var w = $(window).width();
		if (w < 1157)
			$("#promofact").css('bottom', '75px');
		else
			$("#promofact").css('bottom', '5px');
	}
});

function moveLogo() 
{
	var w = $(window).width();
	if (w < 1157)
	{
		$("#promofact").css('bottom', '75px');
	}
	else
	{
		$("#promofact").css('bottom', '5px');
		
	}
	
}

$(document).ready(function(){
	$("#beacons").hide();
	$("#sfftt").hide();
	$("#metalmeets").show();
	$('.albumlink1 a').addClass('selected');
	$(".albumlink1").click(function(event){
		event.preventDefault();
		$('.albumlink1 a').addClass('selected');
		if($('.albumlink2 a').hasClass('selected') || $('.albumlink3 a').hasClass('selected'))
		{
			$('.albumlink2 a').removeClass('selected');
			$('.albumlink3 a').removeClass('selected');
		}
		$("#metalmeets").show();
		$("#beacons").hide();
		$("#sfftt").hide();
	});
	$(".albumlink2").click(function(event){
		event.preventDefault();
		$('.albumlink2 a').addClass('selected');
		if($('.albumlink1 a').hasClass('selected') || $('.albumlink3 a').hasClass('selected'))
		{
			$('.albumlink1 a').removeClass('selected');
			$('.albumlink3 a').removeClass('selected');
			
		}
		$("#metalmeets").hide();
		$('#sfftt').hide();
		$("#beacons").show();
	});
	$(".albumlink3").click(function(event){
		event.preventDefault();
		$('.albumlink3 a').addClass('selected');
		if($('.albumlink1 a').hasClass('selected') || $('.albumlink2 a').hasClass('selected'))
		{
			$('.albumlink1 a').removeClass('selected');
			$('.albumlink2 a').removeClass('selected');
			
		}
		$("#metalmeets").hide();
		$('#sfftt').show();
		$("#beacons").hide();
	});
});


 
