$(document).ready(function() {	

	$('.show_news_body').click(function(){
		var id = $(this).attr('id');		
		$('#news_body_' + id).slideDown('slow');		
		$(this).hide();		
		$('.hide_news_body_' + id).show();			
	});

	$('.hide_news_body').click(function(){
		var id = $(this).attr('id');		
		$('#news_body_' + id).slideUp('slow');		
		$(this).hide();		
		$('.show_news_body_' + id).show();	
	});

	$('#gallery a').lightBox({fixedNavigation:true});
	
	$("#button").overlay({mask: '#000', closeOnClick: true, fixed: false});	
	
	$("#overlay_link").overlay({mask: '#000', closeOnClick: true, fixed: false});		
    
	$.fn.setCursorPosition = function(pos) {
		if ($(this).get(0).setSelectionRange) {
			$(this).get(0).setSelectionRange(pos, pos);
		} else if ($(this).get(0).createTextRange) {
		var range = $(this).get(0).createTextRange();
		range.collapse(true);
		range.moveEnd('character', pos);
		range.moveStart('character', pos);
		range.select();
		}
	}
    $("aside label").each(function (i) {
        $(this).next("input").attr("value",$(this).html()+"...");
        $(this).hide();
    });
    $("aside input").focus(function() {
        if($(this).prev("label").html()+"..." == this.value){$(this).addClass("focus").setCursorPosition(0);}
    });
    $("aside input").keypress(function() {
        if($(this).prev("label").html()+"..." == this.value){
            this.value = "";
            $(this).removeClass("focus").addClass("typing");
        }
    });
    $("aside input").blur(function() {
		$(this).removeClass("focus").removeClass("typing");
		if(this.value == ""){
		this.value = $(this).prev("label").html()+"...";
		}
    });
    
    $("#confirm-bid").hide();
    
    $('#place-bid-submit').click(function() {	
    
	var bid = $("#place-bid-value").val();
	
	$('#message').val(bid);		
	
	$('#your-bid').html(bid);			

    $("#place-bid").slideUp();

    $("#confirm-bid").slideDown();
    			
	return false;
		
	});		    

});
