
 $(document).ready(function(){	
		popup();
                if($(".rotator").length) {
	          rotate_show($(".rotator #q1"));
        	 }
		curtains();
	});
	
  $(window).resize(function(){	

	}); 
  
  function curtains(){
	  	fl=0;
	  	$(".curtb_tit").hover(function(){
			   if(fl==0) {
					//$(this).find(".bubble").css("display","block");
					fl=1;
					if($(this).attr("class").replace("curtb_tit","")!=' act') 
						$(this).find(".bubble").fadeIn(100);
				   }
			},function(){
				//$(this).find(".bubble").css("display","none");
				if($(this).attr("class").replace("curtb_tit","")!=' act')  {
					//$(this).find(".bubble").fadeOut(100,function(){fl=0;});
					$(this).find(".bubble").css("display","none");
					fl=0;
					}
			});
		$(".curtb_tit").click(function(){				
				if($(this).attr("class").replace("curtb_tit","")!=' act')  {
					$(".curtb_tit .bubble").css("display","none");
					cls = $(this).find("span").attr("class");
					$(".curt_block.act").slideUp('slow',function(){$(".curt_block.act").removeClass("act");$(".curtb_tit.act").removeClass("act");});
					$(".curt_block."+cls).slideDown('slow',function(){$(this).toggleClass("act"); $(".curtb_tit span."+cls).parents(".curtb_tit").toggleClass("act");});
				}
			});
	  }
  
  function popup(){
	    $(".twocols .mapprev").click(function(){
				t = ($(window).height()-$(".flashmap").height())/2;
				w = $(window).width();
				st = $(window).scrollTop();
				t=t+st;
				
				l = (w-$(".flashmap").width())/2;				
				if(t<0) t = 0;
				
				if(w<$(".main").width()) w = $(".main").width();
				$(".flashmap").css("margin-top",t+"px");
				$(".flashmap").css("margin-left",l+"px");
				$(".flashmap").css("display","block");								  
			});
		$(".flashmap .close a").click(function(){
				$(this).parents(".flashmap").css("display","none");								  
			});
	  }



function rotate_next(obj){	
		ids = $(obj).attr("id");
		ids = ids.replace("q","")*1;
		//alert(ids);
		if(ids<$(".rotator img").length) {
			idn = ids+1;
			rotate_show(".rotator #q"+idn);
			}
		else rotate_show(".rotator #q1");
	}
	
	function rotate_close(obj){	
		setTimeout(function() { $(obj).fadeOut(700, function(){rotate_next(obj);} ); }, 4000);
		}
	function rotate_show(obj){		
		$(obj).fadeIn(700,rotate_close(obj));		
		}