

$j(document).ready(function(){


$j("input, textarea").click(function(){
$j(this).removeClass("fehler");
});

$j("#deutsch #senden").click(function(){
									
$j("input, textarea").removeClass("fehler");
 var fehler = "";
     if( $j("#name").val()==""  ){
    fehler = 'Bitte geben Sie einen Namen an! <br>';
    $j("#name").addClass("fehler").animate({opacity : 1},1000);
    }
    if( $j("#vorname").val()==""  ){
    fehler = 'Bitte geben Sie einen Vornamen an! <br>';
    $j("#vorname").addClass("fehler").animate({opacity : 1},1000);
    }
   var kme = $j("#kme").attr("checked");
     if( kme==true ){
        if($j("#emailadresse").val()=="" ){
        fehler += 'Bitte tragen Sie Ihre Email ein! <br>';
        $j("#emailadresse").addClass("fehler").animate({opacity : 1},1000);
        }
    } 
     var kmt = $j("#kmt").attr("checked");
     if( kmt==true ){
       if($j("#telefonnummer").val()=="" ){
       fehler += 'Bitte tragen Sie Ihre Telefonnummer ein! <br>';
       $j("#telefonnummer").addClass("fehler").animate({opacity : 1},1000);
       }
    } 
      
    if(fehler!=""){
      $j("#nachrichtenFehler").html(fehler+"<br>");
     return false;
    }else{
    $j("#nachrichtenFehler").html("");
    }
    
 
 // $j("#nachrichtsenden").load("fileadmin/ltec/mail_senden.php?name="+encodeURIComponent($j("#name").val())+"&email="+$j("#email").val()+"&nachricht="+encodeURIComponent($j("#nachricht").val()));  
  //  return false;
 });
 
 
 $j("#englisch #senden").click(function(){
$j("input, textarea").removeClass("fehler");
    
    var fehler = ""; 
    if( $j("#vorname").val()==""  ){
      fehler += 'Please enter your first name! <br>';
      $j("#vorname").addClass("fehler").animate({opacity : 1},1000);
    }
    
    if( $j("#name").val()==""  ){
    fehler += 'Please enter your surname! <br>';
    $j("#name").addClass("fehler").animate({opacity : 1},1000);
    }
       
     var kmt = $j("#kmt").attr("checked");
     if( kmt==true ){
       if($j("#telefonnummer").val()=="" ){
       fehler += 'Please enter your phonenumber! <br>';
       $j("#telefonnummer").addClass("fehler").animate({opacity : 1},1000);
       }
    } 
   
    var kme = $j("#kme").attr("checked");
     if( kme==true ){
        if($j("#emailadresse").val()=="" ){
        fehler += 'Please enter your e-mail address! <br>';
        $j("#emailadresse").addClass("fehler").animate({opacity : 1},1000);
        }
    } 
       
      if(fehler!=""){
      $j("#nachrichtenFehler").html(fehler+"<br>");
     return false;
    }else{
    $j("#nachrichtenFehler").html("");
    }
    
 
 //  $j("#nachrichtsenden").load("fileadmin/ltec/mail_senden.php?name="+encodeURIComponent($j("#name").val())+"&email="+$j("#email").val()+"&nachricht="+encodeURIComponent($j("#nachricht").val()));  
//    return false;
 });
 
 //Anfrageformular
$j("#gleich_adress").click(
//var plz = $j("#ort").val();
  function (){
     if($j(this).attr("checked")){
    $j("#p_strasse").val($j("#strasse").val()).attr("readonly","readonly") ;
    $j("#p_plz").val($j("#plz").val()).attr("readonly","readonly");
    $j("#p_ort").val($j("#ort").val()).attr("readonly","readonly");
    $j("#p_land").val($j("#land").val()).attr("readonly","readonly");
    $j("#p_state").val($j("#state").val()).attr("readonly","readonly");
      
    }else{
    $j("#p_strasse").val("").removeAttr("readonly");
    $j("#p_plz").val("").removeAttr("readonly");
    $j("#p_ort").val("").removeAttr("readonly");
    $j("#p_land").val("").removeAttr("readonly");
    
    
    }
  }
);

$j("#anfrage_senden").click(function(){
  var fehler = ""; 

    if( $j("#vorname").val() == ""  ){
      fehler += 'Bitte Vorname eintragen! <br>';
      $j("#vorname").addClass("fehler").animate({opacity : 1},1000);
    }
    
    if( $j("#nachname").val() == ""  ){
    fehler += 'Bitte Nachname eintragen! <br>';
    $j("#nachname").addClass("fehler").animate({opacity : 1},1000);
    }
    
    if( $j("#email").val()==""  ){
    fehler += 'Bitte Email eintragen! <br>';
    $j("#email").addClass("fehler").animate({opacity : 1},1000);
    }
  
  if(fehler!=""){
       $j("#nachrichtenFehler").html(fehler+"<br>");
      return false;
    }else{
      $j("#nachrichtenFehler").html("");
    }
//  $j("#gesendet").load( "fileadmin/ltec/anfrage_senden.php?nachname="+encodeURIComponent($j("#nachname").val())+"&per_mail="+encodeURIComponent($j("#per_mail").val())+"&per_post="+encodeURIComponent($j("#per_post").val())+"&firma="+encodeURIComponent($j("#firma").val())+"&land="+encodeURIComponent($j("#land").val())+"&vorname="+encodeURIComponent($j("#vorname").val())+"&strasse="+encodeURIComponent($j("#strasse").val())+"&plz="+encodeURIComponent($j("#plz").val())+"&ort="+encodeURIComponent($j("#ort").val())+"&p_strasse="+encodeURIComponent($j("#p_strasse").val())+"&p_plz="+encodeURIComponent($j("#p_plz").val())+"&p_ort="+encodeURIComponent($j("#p_ort").val())+"&kurven_ja="+encodeURIComponent($j("#kurven_ja").val())+"&p_land="+encodeURIComponent($j("#p_land").val())+"&kurven_nein="+encodeURIComponent($j("#kurven_nein").val())+"&anrede="+$j("#anrede").val()+"&neigung="+encodeURIComponent($j("#neigung").val())+"&differenz="+encodeURIComponent($j("#differenz").val())+"&fahrbahn="+encodeURIComponent($j("#fahrbahn").val())+"&einstieg_ja="+encodeURIComponent($j("#einstieg_ja").val())+"&einstieg_nein="+encodeURIComponent($j("#einstieg_nein").val())+"&email="+$j("#email").val()+"&hinweis="+encodeURIComponent($j("#hinweis").val()) );
//  return false;
  }
);


$j("#anfrage_senden_eng").click(function(){
  var fehler = ""; 

  if( $j("#vorname").val() == ""  ){
      fehler += 'Please enter your first name! <br>';
      $j("#vorname").addClass("fehler").animate({opacity : 1},1000);
    }
    
    if( $j("#nachname").val() == ""  ){
    fehler += 'Please enter your surname! <br>';
    $j("#nachname").addClass("fehler").animate({opacity : 1},1000);
    }
    
    if( $j("#email").val()==""  ){
    fehler += 'Please enter your e-mail address!<br>';
    $j("#email").addClass("fehler").animate({opacity : 1},1000);
    }

  if(fehler!=""){
       $j("#nachrichtenFehler").html(fehler+"<br>");
      return false;
    }else{
      $j("#nachrichtenFehler").html("");
    }
//  $j("#gesendet").load( "fileadmin/ltec/anfrage_senden.php?nachname="+encodeURIComponent($j("#nachname").val())+"&per_mail="+encodeURIComponent($j("#per_mail").val())+"&per_post="+encodeURIComponent($j("#per_post").val())+"&firma="+encodeURIComponent($j("#firma").val())+"&land="+encodeURIComponent($j("#land").val())+"&vorname="+encodeURIComponent($j("#vorname").val())+"&strasse="+encodeURIComponent($j("#strasse").val())+"&plz="+encodeURIComponent($j("#plz").val())+"&ort="+encodeURIComponent($j("#ort").val())+"&p_strasse="+encodeURIComponent($j("#p_strasse").val())+"&p_plz="+encodeURIComponent($j("#p_plz").val())+"&p_ort="+encodeURIComponent($j("#p_ort").val())+"&kurven_ja="+encodeURIComponent($j("#kurven_ja").val())+"&p_land="+encodeURIComponent($j("#p_land").val())+"&kurven_nein="+encodeURIComponent($j("#kurven_nein").val())+"&anrede="+$j("#anrede").val()+"&neigung="+encodeURIComponent($j("#neigung").val())+"&differenz="+encodeURIComponent($j("#differenz").val())+"&fahrbahn="+encodeURIComponent($j("#fahrbahn").val())+"&einstieg_ja="+encodeURIComponent($j("#einstieg_ja").val())+"&einstieg_nein="+encodeURIComponent($j("#einstieg_nein").val())+"&email="+$j("#email").val()+"&hinweis="+encodeURIComponent($j("#hinweis").val()) );
//  return false;
  }
);


$j(".inhalt_rechts li a").click(function(){
  
  $j(".inhalt_rechts li a").css({
    "color" : "#626262",
    "font-weight" : "normal",
    "background" : "none"
  });
  
  $j(this).css({
  "color" : "#7ab800", 
  "font-weight" : "bold",
  "background" : "url(fileadmin/ltec/bilder/list_right_subnavi.gif) no-repeat 0 2px"
  });
 
/* $j(this).closest("ul").css({
  position:"fixed",
  top:20,
  "z-index":13});*/
  
  });
  
  
$j(".navigation li a img").mouseenter(
function(){
    if( $j(this).attr("alt") == "Technik" || $j(this).attr("alt") == "Technology"){
        $j(".dropdown").slideDown(10, function(){
          $j(".technikmenue").slideDown(250);
        });
      }
   }
);

$j(".dropdown").mouseleave(function (){
$j(".technikmenue").slideUp(250,
      function(){
          $j(".dropdown").slideUp(10);
      }
    );
});

//Accordion FAQ
/*$j("#faq .text_inhalt h2").mouseenter(function (){
    $j("#faq .text_inhalt .bodytext").slideUp(250);    
    $j(this).closest("div").next("p").slideDown(250);
   }
); */
 
 
 
 $j('a[href*=#],a[href="#"]').click(function() {

   // duration in ms
   var duration=1000;

   // easing values: swing | linear
   var easing='swing';

   // get / set parameters
   var newHash=this.hash;
   var target=$j(this.hash).offset().top;
   var oldLocation=window.location.href.replace(window.location.hash, '');
   var newLocation=this;

   // make sure it's the same location      
   if(oldLocation+newHash==newLocation)
   {
      // animate to target and set the hash to the window.location after the animation
      $j('html:not(:animated),body:not(:animated)').animate({ scrollTop: target }, duration, easing, function() {

         // add new hash to the browser location
         window.location.href=newLocation;
      });

      // cancel default click action
      return false;
   }

});






$j("#zumfilm").click(

function(){
$j("#schwarz").fadeIn(250, function() {
  $j("#pfilm")
  .css({
    display : "block"
  })
  .animate({
  top : 75,
  height : 361,
  width : 567
   },2000,
      function(){
       $j("#close").css("display","block");
       $j("#myytplayer").css("display","block");
      }
    );

   })
  }
);

$j("#schwarz, #close").click(

  function(){
     $j("#close").css("display","none");
      $j("#myytplayer").css("display","none");
      $j("#pfilm")
      .css({
        display : "none"
      })
      .animate({
        top : 205,
        height : 0,
        width : 0
        },1000,
          function(){
            $j("#schwarz").fadeOut(250);
          }
        )
      
      
    }
  )

// lightbox für bilder in text

$j("a[t3page^=file]").click(
    function(){
    var bildurl = $j(this).attr("href");
  
     loadImage(bildurl);
      return false;
        
        
    }
)


 var loadImage = function(url) {
   
    var img = new Image();
    img.onload = function() {
      
      $j("#schwarz2").animate({
      width : "100%",
      height : "100%"
     },250,
     function (){
      $j("#divpopup").css("display" , "block");
      $j("#popupbildladen")
      .append(
      $j("<img src='"+url+"' align='center'>")
      .addClass("popupbild")
      
      .click(
        function(){
        
        $j(".popupbild")
        .animate({
              width : 0,
              height: 0
            },500);
        $j("#divpopup").css("display","none");    
        $j("#schwarz2").fadeOut(500);
        $j(".popupbild").remove();
          })
        );
     })
    
    }
    img.src = url;
  }

$j("#divpopup").click(
        function(){
        
        $j(".popupbild")
        .animate({
              width : 0,
              height: 0
            },500);
        $j("#divpopup").css("display","none");    
        $j("#schwarz2").fadeOut(500);
        $j(".popupbild").remove();
          });

$j("#englisch #land").change(
function(){
  if($j("#land").val() == "United States"){
    $j(".state").css("display","block");
  }else{
    $j(".state").css("display","none");
  }
})

}); 

