jQuery(document).ready(function($){
	$("ul.menu li:last-child a").addClass('last');
	
	$('#contactform').submit(function(){
		var action = $(this).attr('action');
		var theme_path = $('#contactform #theme_path').val();
		$('#contactform #message').remove();
		$('#contactform #submit_btn').attr('disabled','disabled').after('<img src="'+theme_path+'/includes/contact-form/assets/ajax-loader.gif" class="loader" />');
		$.post(action, { 
				vardas: $('#vardas').val(),
				draugo_email: $('#draugo_email').val(),
				skelbimo_id: $('#skelbimo_id').val(),
				verify: $('#verify').val()
			},
			function(data){
				$('#contactform').prepend("<div id='message'></div>");
				$('#message').html(data);
				$('#message').slideDown('slow');
				$('#contactform img.loader').fadeOut('fast',function(){$(this).remove()});
				$('#submit_btn').removeAttr('disabled'); 
				if(data.match('success') != null){ 
					$('#ff').slideUp('slow');
				}
			}
		);
		return false; 
	});
});

function pop(url, name, w, h) {
	var new_win;
	if (h.toString().slice(-1) == '%') {
		h = h.slice(0,-1);
		if (!h) h = 75;
		if (screen.availHeight)
			h = parseInt(h)/100 * 2*screen.availHeight-screen.height;
		else
			h = parseInt(h)/100 * screen.height;
	}

	if (w.toString().slice(-1) == '%') {
		w = w.slice(0,-1);
		if (!w) w = 75;
		if (screen.availWidth)
			w = parseInt(w)/100 * 2*screen.availWidth-screen.width;
		else
			w = parseInt(w)/100 * screen.width;
	}
	var features = 'width='+w+',height='+h+',toolbar=0,status=0,menubar=0,directories=0,location=0,scrollbars=yes,copyhistory=0,resizable=yes';

	new_win = open(url, name, features);
	new_win.focus();
	return(false);
}
