function simple_tooltip(target_items, name){
 $(target_items).each(function(i){
		$("body").append("<div class='"+name+"' id='"+name+i+"'><p>"+$(this).attr('title')+"</p></div>");
		var my_tooltip = $("#"+name+i);

		if($(this).attr("title") != "" && $(this).attr("title") != "undefined" ){

		$(this).removeAttr("title").mouseover(function(){
					my_tooltip.css({opacity:0.8, display:"none"}).fadeIn(400);
		}).mousemove(function(kmouse){
				var border_top = $(window).scrollTop();
				var border_right = $(window).width();
				var left_pos;
				var top_pos;
				var offset = 5;
				if(border_right - (offset *2) >= my_tooltip.width() + kmouse.pageX){
					left_pos = kmouse.pageX+offset;
					} else{
					left_pos = border_right-my_tooltip.width()-offset;
					}

				if(border_top + (offset *2)>= kmouse.pageY - my_tooltip.height()){
					top_pos = border_top +offset;
					} else{
					top_pos = kmouse.pageY-my_tooltip.height()-offset;
					}	

				my_tooltip.css({left:left_pos, top:top_pos});
		}).mouseout(function(){
				my_tooltip.css({left:"-9999px"});
		});

		}

	});
}


	 



$(document).ready(function(){
	/*
	 * Left menu according aeffect
	 *		
	 * $("div.subitems").not(':first').hide();
	 * $("div.mainMenu > a").click(function() {
	 * 	$("div.subitems:visible").slideUp("slow");
	 * 	$(this).next().not(':visible').slideDown("slow");				
	 * 	return false;
	 * });
	 */
	
	simple_tooltip("a.city","tooltip");
	
	var i;
	var selThis = "";
	var selNext = "";

//	for (i = 10; i < 17; i++) {
//		selThis = ".img"+i;
//		selNext = ".img"+(i+1);
//		
//		$(selThis).fadeOut(5000, function() {
//			if (this.complete) $(selNext).fadeIn(5000, function() {
//				if (this.complete) cycle = false;
//			});			
//		});
//				
//		
//		
//		$(selThis).fadeOut(5000);
//		$(selNext).fadeIn(5000);		
//		setTimeout(function() { $(selNext).fadeIn(5000) }, 5000);
//	}

		$(".img1").fadeOut(5000, function() {
			if (this.complete) $(".img2").fadeIn(5000, function() {
				if (this.complete) $(".img2").fadeOut(5000, function() {
					if (this.complete) $(".img3").fadeIn(5000, function() {
						if (this.complete) $(".img3").fadeOut(5000, function() {
							if (this.complete) $(".img4").fadeIn(5000, function() {
								if (this.complete) $(".img4").fadeOut(5000, function() {
									if (this.complete) $(".img5").fadeIn(5000, function() {
										if (this.complete) $(".img5").fadeOut(5000, function() {
											if (this.complete) $(".img6").fadeIn(5000, function() {
												if (this.complete) $(".img6").fadeOut(5000, function() {
													if (this.complete) $(".img7").fadeIn(5000, function() {
														if (this.complete) $(".img7").fadeOut(5000, function() {
															if (this.complete) $(".img8").fadeIn(5000, function() {
																if (this.complete) $(".img8").fadeOut(5000, function() {
																	if (this.complete) $(".img9").fadeIn(5000, function() {
																		if (this.complete) $(".img9").fadeOut(5000, function() {
																			if (this.complete) $(".img10").fadeIn(5000, function() {
																				if (this.complete) $(".img10").fadeOut(5000, function() {
																					if (this.complete) $(".img11").fadeIn(5000, function() {
																						if (this.complete) $(".img11").fadeOut(5000, function() {
																							if (this.complete) $(".img12").fadeIn(5000, function() {
																								if (this.complete) $(".img12").fadeOut(5000, function() {
																									if (this.complete) $(".img13").fadeIn(5000, function() {
																										if (this.complete) $(".img13").fadeOut(5000, function() {
																											if (this.complete) $(".img14").fadeIn(5000, function() {
																												if (this.complete) $(".img14").fadeOut(5000, function() {
																													if (this.complete) $(".img15").fadeIn(5000, function() {
																														if (this.complete) $(".img15").fadeOut(5000, function() {
																															if (this.complete) $(".img16").fadeIn(5000, function() {
																																if (this.complete) $(".img16").fadeOut(5000, function() {
																																	if (this.complete) $(".img17").fadeIn(5000, function() {
																																		if (this.complete) $(".img17").fadeOut(5000, function() {
																																			if (this.complete) $(".img18").fadeIn(5000, function() {
																																				if (this.complete) $(".img18").fadeOut(5000, function() {
																																					if (this.complete) $(".img19").fadeIn(5000);																																					
																																				});																									
																																			});
																																		});	
																																	});
																																});	
																															});
																														});	
																													});
																												});	
																											});
																										});	
																									});
																								});	
																							});
																						});	
																					});	
																				});																						
																			});
																		});	
																	});
																});	
															});
														});	
													});
												});	
											});
										});	
									});
								});	
							});
						});	
					});	
				});	
			});			
		});
	
});



