/*********************************
 * menu functions
 ********************************/


jQuery(document).ready(function() {
 
	jQuery('div.welcomeMenu0 ul ul').css('display', 'none');
	   
	  jQuery('div.welcomeMenu0>ul>li').mouseover(function(){
		    //jQuery(this).children('ul').fadeIn('slow');
		     jQuery(this).children('ul').css('display', 'block');
		  });
		  jQuery('div.welcomeMenu0>ul>li').mouseleave(function(){
		    //jQuery(this).children('ul').fadeOut('slow');
			  jQuery(this).children('ul').css('display', 'none');
		  });
		  jQuery('div.welcomeMenu0>ul>li>ul>li').mouseover(function(){
		    //jQuery(this).children('ul').fadeIn('slow');
			  jQuery(this).children('ul').css('display', 'block');
		  });
		  jQuery('div.welcomeMenu0>ul>li>ul>li').mouseleave(function(){
		    //jQuery(this).children('ul').fadeOut('slow');
			  jQuery(this).children('ul').css('display', 'none');
		  });
	
});

/*********************************
 * common functions
 ********************************/

jQuery(document).ready(function() {
/* 
  jQuery('#not_logged_in_content input[type=text]').focus(function(){
	    var val = jQuery(this).attr('value');
	    jQuery(this).attr('name',val).attr('value','');    
	  });
		  
	  jQuery('#not_logged_in_content input[type=text]').blur(function(){
	    if(jQuery(this).attr('value') == '')
	    {
	      var val = jQuery(this).attr('name');
	      jQuery(this).attr('value',val).attr('name','');  
	    }
	  });  
  */
  jQuery('div.standort_text').css('display', 'none');
  
  
  jQuery('div.standort_item').click(function(){
	if(jQuery(this).hasClass('open') == false)
	{
      jQuery(this).children('div').css('display', 'block');
      jQuery(this).addClass('open');
	}
	else
	{
      jQuery(this).children('div').css('display', 'none');
      jQuery(this).removeClass('open');
	}
  });
  
  jQuery('#not_logged_in_content a#close').removeAttr('href');
  
  jQuery('#not_logged_in_content a#close').click(function(){
    jQuery('#not_logged_in').fadeOut('slow');
    jQuery('#not_logged_in_opacity').css('display', 'none');
    
  });
  
  /* show img button */
    jQuery('a#active_show_img').removeAttr('href');
    jQuery('a#inactive_show_img').removeAttr('href');
    
      jQuery('a#active_show_img').click(function(){
  	    /*jQuery('head').append('<link rel="stylesheet" href="../css/show_image.css" type="text/css" />');*/
  	    jQuery('#search_box').fadeOut('slow');
  	    jQuery('#lang_switch').fadeOut('slow');
  	    jQuery('#head').fadeOut('slow', function(){jQuery('#img_head').css('height', '190px'); jQuery('#inactive_show_img').fadeIn('fast'); });
  	    jQuery('#img_head img').fadeOut('slow');
  	    jQuery('#img_head a#active_show_img').fadeOut('slow');
  	    jQuery('#img_head a#show_worldmap').fadeOut('slow');
  	    jQuery('#content *').fadeOut('slow');
   	    jQuery('#panel').fadeOut('slow');
   	    jQuery('#footer_bottom').fadeOut('slow');
   	    jQuery('#world').fadeOut('slow');
   	    jQuery('.op').fadeOut('slow');
   	    jQuery('#start_content').fadeOut('slow');
   	    jQuery('#active_show_img').fadeOut('slow');
   	    jQuery('#show_vid').fadeOut('slow');
   	    jQuery('#tr_bg').css('border', 'none');
  	    jQuery('#img_head').css('border', 'none');
  	    jQuery('#logged_in_box').fadeOut('slow');
  	    jQuery('#inactive_show_img').css('position', 'absolute');
  	    jQuery('#inactive_show_img').css('bottom', '0px');
  	    
  	    jQuery('body.page1 #inactive_show_img').css('top', '60px');
      });
  
      jQuery('a#inactive_show_img').click(function(){
    	jQuery('#inactive_show_img').fadeOut('slow', function(){
    		jQuery('#img_head').css('height', '130px'); 
    		jQuery('#search_box').fadeIn('slow');
      	    jQuery('#lang_switch').fadeIn('slow');
      	    jQuery('#head').fadeIn('slow');
      	    jQuery('#img_head img').fadeIn('slow');
      	    jQuery('#img_head a#active_show_img').fadeIn('slow');
      	    jQuery('#img_head a#show_worldmap').fadeIn('slow');
      	    jQuery('#content *').fadeIn('slow');
      	    jQuery('#img_head').css('border-bottom', '5px solid #00569B');	
      	    jQuery('#tr_bg').css('border-top', '4px solid #00569B');	
      	    jQuery('.op').fadeIn('slow');
      	    jQuery('#start_content').fadeIn('slow'); 
      	    jQuery('#active_show_img').fadeIn('slow');
      	    jQuery('#show_vid').fadeIn('slow');
      	    jQuery('#panel').fadeIn('slow');
      	    jQuery('#world').fadeIn('slow');
      	    jQuery('#footer_bottom').fadeIn('slow');
      	  jQuery('#logged_in_box').fadeIn('slow');
    	});
       });
	  
  /* for coloring the table.color */
  jQuery('table.color').css('border-collapse', 'collapse');
  jQuery('table.color').css('border-color', 'white');
  
  jQuery('table.color tr:even').css('background', '#f0f1f1');
  
  jQuery('table.color tr:first-child').css('height', '27px');
  jQuery('table.color tr td h3').css('margin','0px');	  
  
  jQuery('table.color tr td').css('padding','5px');
  jQuery('table.color tr td:first-child').css('color','#00569B');
  
  
  /* startseite */
  jQuery('div#overlay_adhoc a#close').removeAttr('href');
  jQuery('li#adhoc a').removeAttr('href');
  jQuery('div#download_wind a#close').removeAttr('href');
  jQuery('li#download a').removeAttr('href');
  var adhoc=false;
  var download = false;
  
  jQuery('div#overlay_adhoc a#close').click(function(){
	  jQuery('div#overlay_adhoc').fadeOut('slow'); 
	  adhoc = false;
  });
  
  jQuery('li#adhoc a').click(function(){
	  if(adhoc == false)
	  {
	    jQuery('div#overlay_adhoc').fadeIn('slow');
	    jQuery('div#download_wind').fadeOut('slow'); 
	    adhoc = true;
	    download = false;
	  }
	  else
	  {
		jQuery('div#overlay_adhoc').fadeOut('slow');
		adhoc = false;
	  }
  });  
  
  jQuery('div#download_wind a#close').click(function(){
	  jQuery('div#download_wind').fadeOut('slow'); 
	  download = false;
  });
  
  
  jQuery('li#download a').click(function(){
	  if(download == false)
	  {
	    jQuery('div#download_wind').fadeIn('slow'); 
	    jQuery('div#overlay_adhoc').fadeOut('slow');
	    download = true;
	    adhoc = false;
	  }
	  else
	  {
		jQuery('div#download_wind').fadeOut('slow');
		download = false;
	  }
  });
  
  


  var ie6=false;
  var ie7=false;
  if (jQuery.browser.msie) {
	  if(parseInt(jQuery.browser.version) == 6)
		 ie6=true;
	  else if(parseInt(jQuery.browser.version)==7)
	     ie7=true;
	}
  
  if(ie7 == true)
  {
	  jQuery(function() {
			var zIndexNumber = 1000;
			jQuery('div#head').each(function() {
				jQuery(this).css('zIndex', zIndexNumber);
				zIndexNumber -= 10;
			});
		});
  }

  /* ie6 - img auf der startseite tauschen */
  if(ie6==true)
  {
	  /* z-index bug*/
	  jQuery(function() {
			var zIndexNumber = 1000;
			jQuery('div#head').each(function() {
				jQuery(this).css('zIndex', zIndexNumber);
				zIndexNumber -= 10;
			});
		});
	  
	  jQuery('a#active_show_img').click(function(){
        jQuery('#start_tr_ct').css('background', 'none');  //TODO	
	  });
	  jQuery('a#inactive_show_img').click(function(){
		jQuery('#tr_bg div#start_tr_ct').css('background', 'url(../images/bg_spacer/ie6/start_ct_bg.jpg)');	
	  });
	  jQuery('div#show_vid img').attr('src', '../images/bg_spacer/ie6/logo_transp.gif');
	  jQuery('div.press_item_row>div').css('margin-left', '7px');
	  jQuery('div.press_item_row>div:first-child').css('margin-left', '0px');
	  
	  jQuery('div.welcomeMenu0 li.li_0_0').mouseenter(function(){
		 
		  if(jQuery(this).hasClass('active')==false)
		  {
    	    jQuery('div.welcomeMenu0 li.li_0_0').css('background', 'url(../images/bg_spacer/menu/menu_1.png) no-repeat right');
    	    jQuery('div.welcomeMenu0 li.li_0_0 a').css('color', 'white');
		  }
	  });
	  jQuery('div.welcomeMenu0 li.li_0_0').mouseleave(function(){
		  if(jQuery(this).hasClass('active')==false)
		  {
    	    jQuery('div.welcomeMenu0 li.li_0_0').css('background', '');
    	    jQuery('div.welcomeMenu0 li.li_0_0 a').css('color', '');
		  }
	  });
	  
	  jQuery('div.welcomeMenu0 li.li_1_0').mouseenter(function(){
		  if(jQuery(this).hasClass('active')==false)
		  {
    	    jQuery('div.welcomeMenu0 li.li_1_0').css('background', 'url(../images/bg_spacer/menu/menu_2.png) no-repeat right');
    	    jQuery('div.welcomeMenu0 li.li_1_0 a').css('color', 'white');
		  }
	  });
	  jQuery('div.welcomeMenu0 li.li_1_0').mouseleave(function(){
		  if(jQuery(this).hasClass('active')==false)
		  {
    	    jQuery('div.welcomeMenu0 li.li_1_0').css('background', '');
    	    jQuery('div.welcomeMenu0 li.li_1_0 a').css('color', '');
		  }
	  });
	  
	  jQuery('div.welcomeMenu0 li.li_2_0').mouseenter(function(){
		  if(jQuery(this).hasClass('active')==false)
		  {
    	    jQuery('div.welcomeMenu0 li.li_2_0').css('background', 'url(../images/bg_spacer/menu/menu_3.png) no-repeat right');
    	    jQuery('div.welcomeMenu0 li.li_2_0 a').css('color', 'white');
		  }
	  });
	  jQuery('div.welcomeMenu0 li.li_2_0').mouseleave(function(){
		  if(jQuery(this).hasClass('active')==false)
		  {
    	    jQuery('div.welcomeMenu0 li.li_2_0').css('background', '');
    	    jQuery('div.welcomeMenu0 li.li_2_0 a').css('color', '');
		  }
	  });
	  
	  jQuery('div.welcomeMenu0 li.li_3_0').mouseenter(function(){
		  if(jQuery(this).hasClass('active')==false)
		  {
    	    jQuery('div.welcomeMenu0 li.li_3_0').css('background', 'url(../images/bg_spacer/menu/menu_4.png) no-repeat right');
    	    jQuery('div.welcomeMenu0 li.li_3_0 a').css('color', 'white');
		  }
	  });
	  jQuery('div.welcomeMenu0 li.li_3_0').mouseleave(function(){
		  if(jQuery(this).hasClass('active')==false)
		  {
    	    jQuery('div.welcomeMenu0 li.li_3_0').css('background', '');
    	    jQuery('div.welcomeMenu0 li.li_3_0 a').css('color', '');
		  }
	  });
	  
	  
	  
	  if(jQuery('div.welcomeMenu0 li.li_0_0').hasClass('active')==true)
		jQuery('div.welcomeMenu0 li.li_0_0').css('background', 'url(../images/bg_spacer/menu/menu_1.png) no-repeat right');
	  else if(jQuery('div.welcomeMenu0 li.li_1_0').hasClass('active')==true)
	  	jQuery('div.welcomeMenu0 li.li_1_0').css('background', 'url(../images/bg_spacer/menu/menu_2.png) no-repeat right');
	  else if(jQuery('div.welcomeMenu0 li.li_2_0').hasClass('active')==true)
		jQuery('div.welcomeMenu0 li.li_2_0').css('background', 'url(../images/bg_spacer/menu/menu_3.png) no-repeat right');
	  else if(jQuery('div.welcomeMenu0 li.li_3_0').hasClass('active')==true)
	    jQuery('div.welcomeMenu0 li.li_3_0').css('background', 'url(../images/bg_spacer/menu/menu_4.png) no-repeat right');
	  
  }
  
});

