
var loginWindowOpen = false;

function openPlans()
{
	window.open('/plans.php','plans_full','menubar=no,toolbar=no,location=no,directories=no,fullscreen=no,titlebar=no,hotkeys=no,status=no,scrollbars=no,resizable=no,width=1010,height=625');
	plans_full.focus();
}

jQuery(document).ready(function()
{
	// login button
	jQuery('#loginbutton')
		.click(function()
		{
			//alert('here');
			if ( jQuery("div#optionsmenulogin").is(":visible"))
			{
				jQuery("div#optionsmenulogin").slideUp("fast");
			}
			else
			{
				jQuery("div#optionsmenulogin").slideDown("fast");
			}
			//jQuery('#optionsmenulogin').toggle();
		});
		
		
	// competition banner
	jQuery(document)
		.ready(function()
		{
			//alert('here');
			if ( jQuery("div#banner_compet").is(":visible"))
			{
			}
			else
			{
        setTimeout(
				jQuery("div#banner_compet").slideDown(1000), 500);
			}
			//jQuery('#banner_compet').toggle();
		});
		

	// competition banner in shops
	jQuery(document)
		.ready(function()
		{
			//alert('here');
			if ( jQuery("div#banner_compet2").is(":visible"))
			{
			}
			else
			{
        setTimeout(
				jQuery("div#banner_compet2").slideDown(1000), 3000);
			}
		});
		
	// basic menu
	jQuery('#cm_plans, #cm_about, #cm_magazine, #cm_tenants, #cm_offices, #cm_parking, #cm_contact')
		.css( {backgroundPosition: "0 72px"} )
		.mouseover(function()
		{
			jQuery(this).stop().animate({backgroundPosition:"(0 0px)"}, {duration:150})
			if (jQuery("div#shopSelector").is(":visible"))
      		{
      			jQuery("div#shopSelector").slideUp("fast");
      		}
			if (jQuery("div#restaurantSelector").is(":visible"))
      		{
      			jQuery("div#restaurantSelector").slideUp("fast");
      		}

		})
		.mouseout(function()
		{
			jQuery(this).stop().animate({backgroundPosition:"(0 72px)"}, {duration:100})
		});

 	// shops
 	jQuery('#cm_shops')
		.css( {backgroundPosition: "0 72px"} )
		.mouseover(function()
		{
			if (jQuery("div#restaurantSelector").is(":visible"))
      		{
      			jQuery("div#restaurantSelector").slideUp("fast");
      		}
			jQuery('#cm_shops').stop().animate({backgroundPosition:"(0 0px)"}, {duration:150})
			
			//jQuery("div#shopSelector").stop().animate({height:seth},"50");
			jQuery("div#shopSelector").height(50).slideDown("fast");
			
			jQuery("div.shopSelectorPanes > div").hide();
			//jQuery("div#shopSelectorPanes").slideUp("fast");
		})
		.mouseout(function()
		{
			jQuery('#cm_shops').stop().animate({backgroundPosition:"(0 72px)"}, {duration:100})
		});
		
		
		
	// shop selector
	jQuery("div#shopSelector").hover( 
		function() {},
		function() { jQuery("div#shopSelector").slideUp("fast");}
		);
		
				
	// setup tooltips for tabs
	jQuery.tools.addTipEffect("slidedown",
		function()
     	{
			var opacity = this.getConf().opacity; 
			this.getTip().css({opacity:0}).animate({top: '+=15', opacity:opacity}, 300).show(); 
		},
     	function()
     	{ 
			this.getTip().animate({top: '+=15', opacity:0}, 300, function()
			{  
				jQuery(this).hide().animate({top: '+=30'}, 0); 
			}); 

    	} );

          //pro IE
  //        div.style.height = "auto";


		
		// tooltips for shop selector
		jQuery("#trigger_bankomaty, #trigger_bryle, #trigger_domactnost, #trigger_hracky, #trigger_klenoty, #trigger_moda, #trigger_modnidoplnky, #trigger_multimedia, #trigger_obuv, #trigger_potraviny, #trigger_sluzby, #trigger_sport, #trigger_galanterie, #trigger_zdravikrasa").tooltip({effect: 'slidedown'});
		
    var count_show = 0;
 		
		// setup tabs
		jQuery("ul.shopSelectorTabs").tabs("div.shopSelectorPanes > div",
			{
		 		onClick: function(i)
		 		{ 
  				var pane = this.getPanes().eq(i);
					var seth = pane.height() + 50;

          //prvni spusteni nebo volani prvniho polozky      
          if (seth == 50) {
              //prvni spusteni scriptu
              if (!count_show) {
                  pane.height(0);
              }
              else {
                pane.height(37);
                seth = 87;              
              }
          }
          //opakovane spusteni
          if (seth != 50) {
            jQuery('#shopSelector').stop().animate({height:seth},"50");
          }

          count_show++;

    			} 

			});
		
		
	// restaurants
 	jQuery('#cm_restaurants')
		.css( {backgroundPosition: "0 72px"} )
		.mouseover(function()
		{
			if (jQuery("div#shopSelector").is(":visible"))
      		{
      			jQuery("div#shopSelector").slideUp("fast");
      		}
      		
			jQuery('#cm_restaurants').stop().animate({backgroundPosition:"(0 0px)"}, {duration:150})
			jQuery("div#restaurantSelector").slideDown("fast");
		})
		.mouseout(function()
		{
			jQuery('#cm_restaurants').stop().animate({backgroundPosition:"(0 72px)"}, {duration:100})
		});
		
		
	// restaurants selector
	jQuery("div#restaurantSelector").hover( 
		function() {},
		function() { jQuery("div#restaurantSelector").slideUp("fast");}
		);

		// news ticker			
		jQuery('#tickernews').innerfade({
				animationtype: 'slide',
				speed: 750,
				timeout: 5000,
				type: 'sequence',
				containerheight: '2em'
			});
		jQuery('#tickernews').css('visibility','visible');
  		
});