$('document').ready(function () {

	var post_fimg = $('#home_right img:first')
	if(post_fimg.size() > 0) {
		$('#home_left').append(post_fimg)
	}
	
	var about_fimg = $('#about_right img:first')
	if(about_fimg.size() > 0) {
		$('#about_left').append(about_fimg)
	}
	
	if($('.single_right').size() > 0) {
		$('.single_right').each(function (i) {
			var single_fimg = $(this).find('img:first')
			if(single_fimg.size() > 0) {
				$(this).parent().children('.single_left').append(single_fimg)
			}
		})
	}
	
	if($('.archives_right .storycontent').size() > 0) {
		$('.archives_right .storycontent').each(function (i) {
			var img = $(this).find('img:first')
			$(this).parent().parent().children('.left_img').html(img)
		})
	}
	
	// initialize scrollable
	$("div.scrollable").scrollable();
	
	    // select items under the second scrollable and do something when they are clicked 
    $("div.scrollable div.items div").click(function() { 
 
        // perform the effect 
        //$(this).fadeOut().fadeIn();
 
    });
    
    $('.add-comment').click(function () {
    	$(this).parent().children('.subscribe2').slideUp(1000)
    	$(this).parent().children('.send_to_friend').slideUp(1000)
    	$(this).parent().children('.leave_a_comment').toggle(1000)
    	
    	return false;
    })
    
    /*
    $('.subscribe').click(function () {
    	$(this).parent().children('.leave_a_comment').slideUp(1000)
    	$(this).parent().children('.send_to_friend').slideUp(1000)
    	$(this).parent().children('.subscribe2').toggle(1000)
    	
    	return false;
    })
    */
    
    $('.send-to-friend').click(function () {
    	$(this).parent().children('.leave_a_comment').slideUp(1000)
    	$(this).parent().children('.subscribe2').slideUp(1000)
    	$(this).parent().children('.send_to_friend').toggle(1000)
    	
    	return false;
    })
    
    $("#accordion").accordion({ autoHeight: false,
    							event: 'mouseover'});
})

function textOnFocus(element) {
	if(element.value == element.defaultValue) {
		element.value = "";
	}
}

function textOnBlur(element) {
	if(element.value == "") {
		element.value = element.defaultValue;
	}
}

function popitup(url) {
	newwindow=window.open(url,'name','height=800,width=900');
	if (window.focus) {newwindow.focus()}
	return false;
}
