/*
 * Main application logic:
 */

$(function(){

    if(!$.browser.webkit)
    {
        // Simulate placeholder functionality
        $('input[placeholder]').each(function() {
            $(this).attr('value', $(this).attr('placeholder'))
        })
        $('input[placeholder]').focus(function() {
            $(this).attr('value') == $(this).attr('placeholder') ?  $(this).attr('value','') : true;
        })
        $('input[placeholder]').blur(function() {
            $(this).attr('value') == '' ?  $(this).attr('value',$(this).attr('placeholder')) : true;
        })
    }

    if($.browser.msie)
    {
        // IE6-notice
        $('#header').before('<div id="ie6-notice"><p id="ie6-text">Korzystasz ze starszej wersji przeglądarki Internet Explorer, przez co nasza strona może nie działać poprawnie. Proponujemy aktualizację oprogramowania do jednej z następujących przeglądarek: <a href="http://www.mozilla.com/firefox/">Firefox</a>, <a href="http://www.apple.com/safari/">Safari</a>, <a href="http://www.opera.com/">Opera</a> lub <a href="http://www.microsoft.com/windows/internet-explorer/">Internet Explorer 8</a><br /><br />Bardzo dziękujemy za wizytę!</p></div>');

        // Set last neighbour `margin-right` property to zero
        $('#sidebar + #content, #content + #sidebar').addClass('last');
    }

    // SlideDown/SlideUp #mainnav submenu
    var header_height = $('#header').height();

    $('#mainnav > li').hover(
        function(){
            $('#mainnav > li > ul').css('display','none');
            $(this).children('ul').css('display','block');
        }
    );

//    $('#mainnav > li').hover(
//        function() {
//            var children = $(this).children('ul');
//            //$(this).children('ul').clearQueue();
//            $('#header').clearQueue();
//
//            if(children.length)
//            {
//
//                children.slideDown();
//                var list_items_count = $(this).find('ul').children().length;
//                var new_height = (header_height + Math.ceil(list_items_count/8)*33);
//                $('#header').animate({
//                    'height': new_height+'px'
//                    }, 150);
//            }
//        },
//        function() {
//            var children = $(this).children('ul');
//            if(children.length)
//            {
//
//                children.slideUp(),
//                $('#header').animate({
//                    'height':header_height+'px'
//                    }, 150)
//            }
//        }
//        );

            
    // Add class to all inputs (ie. input[type=text] = input.text) - for IE (< 7) purposes mainly, if needed
    $('input').each(function() {
        $(this).addClass(this.type);
    });

    //  $('#job').val($('#job_options').val());
    //  $('#job_options').change(function() { $('#job').val($(this).val()); });
    $('#contact-form').after('<div class="clear" />');

    // Clients cycling
    $('#clients').cycle({
        fx: 'fade',
        timeout: 3000,
        next: '#next',
        prev: '#prev'
    });

// SWFObject(file, html_container_id, width, height, flash_version)
/*
  swfobject.embedSWF("OppenExpo_media.swf", "flash_movie", "224", "244", "9.0.0");
  */
// showMap();
  

});

//function showMap()
//{
//  var mapID = "map";
//  var mapZoom = 15;
//  var mapCoordinates = new google.maps.LatLng(52.409462,16.933966);
//  var mapTitle = "Oppen Expo, Wroniecka 24/4, Poznań";
//  var mapText = 'Opis<br/>...';
//  var mapType = google.maps.MapTypeId.ROADMAP;
//
//  var mapOptions = {
//    zoom: mapZoom,
//    center: mapCoordinates,
//    mapTypeId: mapType
//  };
//  var myMap = new google.maps.Map(document.getElementById(mapID), mapOptions);
//  var MarkerOptions =
//  {
//    position: mapCoordinates,
//    map: myMap,
//    title: mapTitle
//  }
//  var myMarker = new google.maps.Marker(MarkerOptions);
//  /*
//  var myInfoWindow = new google.maps.InfoWindow({
//    content: mapText
//  });
//
//  // Show info window automatically:
//  //myInfoWindow.open(myMap, myMarker);
//
//  // Or on marker-click:
//  google.maps.event.addListener(myMarker, 'click', function() {
//    myInfoWindow.open(myMap, myMarker);
//  });
//  */
//}
