$(document).ready(function() 
{
	var $h2 = $('h2');
	if ($h2.size() == 0)
		$('#feedback').insertAfter('h1').css('display', 'block');
	else
		$('#feedback').insertAfter($h2).css('display', 'block');
	
	$('a#addNavi').click(function()
	{		
		var $html = '<tr><td>Navigaatiolinkki</td><td><input type="text" value="" name="navi[]"/></td><td><a class="removeNavi" href="javascript:;">Poista</a></td></tr>';
		
		$(this).parent('td').parent('tr').before($html);
		return false;
	});
	
	$('a.removeNavi').livequery('click',function() 
	{
		$(this).parent().parent().remove();	
	
	});
	
	$('a.removeSeller').click(function()
	{
		return confirm("Oletko varma että haluat poistaa tämän myyjän?");
	});
	
	$('a.removeProject').click(function()
	{
		return confirm("Oletko varma että haluat poistaa tämän sivuston?");
	});
	$('.sortable-item').click(function(){
		// alert('asd');
		
	});




	if(!$('input#reopen').attr('checked')) 
		$('input#reopen').siblings('input').attr('disabled', true);
	
	$('input#reopen').click(function(){
		if(this.checked)
			$(this).siblings('input').attr('disabled', false).datepicker('enable');
		else
			$(this).siblings('input').attr('disabled', true).datepicker('disable');
	
	});

});
