

window.onload = function() {

	longDiv();
	
	titling();
	
	
	$('#bayan').accordion({
	    header: ".title",
		autoHeight: false,
		navigation: true,
		alwaysOpen: false
	});



a = $('#bayan .current');
b = a.parent().get(0);
b = $(b).prev();
b.addClass('lolwut');


$('#bayan').accordion('activate', '.lolwut');

    
}




function longDiv() {
//( Longdiv is looooooooooooooooooooooooong! :] 
	if ($('.longdiv').length>0) {
		h = $('.longdiv').parent().height();
		h = h.toString() + 'px';
		$('.longdiv').css({height: h});
	}
}





function drops() {
	$('.drops > div').hover(
		function() {
			$('div', this).show();
		},
		function() {
			$('div', this).hide();
		}
	);
}


function orly_init() {
	links = $('.confirm');
	links.click(function(e){
		if (!confirm('ORLY?')) {
			e.preventDefault();
		}
	})
}





function titling() {
 	imgs = $('img[title]');
 	imgs.each(function(){
		src = this.src;
		text = this.title;
		w = 2 + 2 * parseInt($(this).css('marginLeft')) + 2 * parseInt($(this).css('paddingLeft'));
		w = (w + $(this).width()).toString() + 'px;';
		
		//f = ($(this).css('float').toString());
		f = $(this).css('float');
		style = 'text-align: center;' + 'width:' + w  + 'float:' + f;
	 
		div = '<div class="titled" style="' + style + '"><img src="' + src +'" alt=""/>'+ text + '</div>';
		
	 	$(this).replaceWith(div);
 	})
 
 }

$(document).ready(function($) {
	$('.show a.item').click(
		function() {
			$('.show img#big_image').attr('src', $(this).attr('href'));
			return false;
		}
	);
});
