
(function($){

	

	$(document).ready(function(){
		$('#front-ad').nivoSlider({
			 effect: 'fade',
			 animSpeed:1500, 
			 pauseTime:4000,
			 directionNav:false,
			 controlNav:false,
			 pauseOnHover:false,
			 slices:1
		});
		
		if($('table.search_results tr').length > 0){
			$('table.search_results tr').each(function(){							   
				$(this).mouseover(function(){
					$(this).addClass('hover').find('.go').show();
				}).mouseout(function(){
					$(this).removeClass('hover').find('.go').hide();
				}).click(function(e){
					e.preventDefault();
					var href = $(this).removeClass('hover').find('a').attr('href');
					window.location.href = href;
				});
			});
		}
		
		$('#billinginfo').change(function(){
			if($(this).is(':checked')) {
				$('#billingdata').show();
			} else {
				$('#billingdata').hide();	
			}
		});
        
        $('.inline-label[id]').each(function() {
	    	var label = $('label[for=' + $(this).attr('id') + ']');
	    	if (label.length == 1) {
	    		var inlineText = label.text();
	    		label.hide();
	    		$(this).focus(function() {
					if(inlineText == $(this).val()) {
						$(this).val('');
					}
	    		}).blur(function() {
					if($.trim($(this).val()) == '') {
						$(this).val(inlineText);
					}
	    		}).blur();
	    	}
	    });
	
	});
})(jQuery);
	
function view(el,id) {
	hide = (id == 'info-1') ? 'info-2' : 'info-1';
	$(el).addClass('selected');
	$('#' +id).show();
	$('#' + hide).hide();
	$('#' + hide + '-a').removeClass('selected');
}

function searchfield(t){
	if(t == 1){
		if($('#searchinput').val() == 'Sisesta otsingusõna'){
			$('#searchinput').val('');
		}
	} else {
		if($('#searchinput').val() == ''){
			$('#searchinput').val('Sisesta otsingusõna');
		}
	}
}
