
/* tooltips for .sponsored-ads */
$(document).ready(function() {
	var root = $(".search-details .sponsored-ads .sub");
	$(root).find('dl.item').each(function(){
		//var position = $(this).position();
		var content = $(this).find(".po-tooltip").html();
		if (content){
			/*
			$(this).simpletip({
				fixed: true,
				position: [0, 76],
				showEffect: 'fade',
				showTime: '300',
				hideEffect: 'fade',
				content: content
			});*/
			$(this).simpletip({
				fixed: true,
				position: [0, 76],
				content: content,
				showEffect: 'custom',
				 showCustom: function(){
					$(this).css({
						opacity:'0.1',
						display: 'block',
						zIndex: '100000'
					})
				.animate({
					opacity:'1'
					}, 0);
				} 
				
			});
			/*
			$(function() {
				var zIndexNumber = 1000;
				$('div').each(function() {
					$(this).css('zIndex', zIndexNumber);
					zIndexNumber += 10;
				});
			});
			*/
		}
		
	});
});

$(document).ready(function() {
	//$(".search-details tr.sponsored-ads").prev().addClass("sponsored-ads-prev");
})
/* menu */
$(document).ready(function(){	
	// menu
	$('ul.sf-menu').superfish(); 
	
});
/* live search */
$(document).ready(function(){
	var input = $('.top-search input.text');
	$(input).attr('autocomplete', 'off');

	var liveSearch = $('.live-search');
	$(liveSearch).css('z-index', '100000');
		
	input.keyup(function() {
		if(this.value.length > 1 && this.value != this.lastValue) {
			liveSearch.slideDown(200);
		}
		else {
			liveSearch.slideUp(200);
		}
		this.lastValue = this.value;
	});
	
});
$(document.body).click(function(event) {
	if(!$(event.target).parents('.live-search').length) {
		$('.live-search').slideUp(200);
	}
});

$(document).ready(function(){
	var input = $('.top-search1 input.text');
	$(input).attr('autocomplete', 'off');

	var liveSearch = $('.live-search-1');
	$(liveSearch).css('z-index', '100000');
		
	input.keyup(function() {
		if(this.value.length > 1 && this.value != this.lastValue) {
			liveSearch.slideDown(200);
		}
		else {
			liveSearch.slideUp(200);
		}
		this.lastValue = this.value;
	});
	
});


$(document.body).click(function(event) {
	if(!$(event.target).parents('.live-search-1').length) {
		$('.live-search-1').slideUp(200);
	}
});