/* 
 * COPYRIGHT MITTELSTANDSSOFTWARE.de
 * 
 */

var $j = jQuery.noConflict();

$j(function(){
    $j('.navigation').click(function() {
      //hide all
      $j('.navigation-columns').each( function(){
          $j('#' + this.id).addClass('hide-'+this.id);
          //alert(this.id);
      });
      
      //show the clicked one
      $j('#nav-' + this.id).removeClass('hide-nav-'+this.id);

      $j('#common-menu').show();
    });

    $j('#close-common-menu').click(function() {
      $j('#common-menu').toggle();
    });

    /*Suchfeld bereinigen und füllen*/
    $j('#q').focus(function () {
      if($j(this).val()=="Suchen")
         $j(this).val('');
    });
    $j('#q').blur(function() {
      if($j(this).val()=="")
          $j(this).val('Suchen')
    });


    /* dialog-contact-formular */
    $j( "#dialog-contact-formular-result" ).dialog({
            autoOpen: false,
            height: 200,
            width: 350,
            modal: true,
            show: "slide",
            hide: "slide",
            buttons: {
                    OK: function() {
                        $j('#name').val(""),
                        $j('#email').val(""),
                        $j('#message').val("")
                        $j(this).dialog('close');
                    }
            }
    });

    /* dialog-contact-formular */
    $j( "#dialog-contact-formular" ).dialog({
            autoOpen: false,
            height: 300,
            width: 450,
            modal: true,
            show: "slide",
            buttons: {
                    "Abbrechen": function() {
                            $j( this ).dialog( "close" );
                    },
                    "Nachricht senden": function() {
                            //Reset result window
                            $j('#dialog-contact-formular-result').html("Nachricht wird versandt. Bitte warten...");

                            $j.post('mail.php', {
                                action:"Kontaktformular",
                                name:$j('#name').val(),
                                email:$j('#email').val(),
                                message:$j('#message').val()
                                },
                                function(data){
                                    $j('#dialog-contact-formular-result').html(data);
                                }
                            );
                        $j( this ).dialog( "close" );
                        $j( "#dialog-contact-formular-result" ).dialog( "open" );
                    }
            },
            close: function() {
                
            }
    });

    $j('.kontaktformular').click(function() {
        $j( "#dialog-contact-formular" ).dialog( "open" );
        return false;
    });



});


$j(document).ready(function() {
//    $j('#ticker').list_ticker({
//            speed:2000,
//            effect:'fade',
//            run_once:false
//    })
 /*   $j('#ticker').ticker({
        speed: 0.10,           
        ajaxFeed: false,       
        feedUrl: false,    
        feedType: 'xml',       
        htmlFeed: true,        
        debugMode: true,              
        controls: true,        
        titleText: 'Latest',   
        displayType: 'reveal', 
        direction: 'ltr'  ,
        pauseOnItems: 2000,    
        fadeInSpeed: 600,      
        fadeOutSpeed: 300      
    });*/
});
