$(window).load(function() {

  $('#loader, #loader_press ').fadeOut();
  $(".content_fade, .footer").fadeIn(700);
  $(".press_cycle ").fadeIn("slow");
});



$(document).ready(function(){

  /**** Press page **********************************************************/
  
  $(".press_cycle").load(function() {

  $(".press_cycle").fadeIn();
  });
  
  $('#item_504608').addClass('active');


  $(".icon, .press_nave").live('click',function(){
    
    var link = $(this).attr('href');
    
    $.ajax({
      beforeSend: function() {
        $(" .press").fadeOut("fast");
      },
      url:link,
      cache: true,
      success: function(html){
      
        $("#horizontalwrap, .press_cycle").html(html);
        if($.browser.msie && parseInt($.browser.version) == 8) {
            
            $(".thumb img").css( "opacity", 1);
            $(".active img").css( "opacity", .40);
            $(".press_head a img").css( "background-color", "#f9f9f9");
            $(' .press_head a img')
                    .hover(function() {
                        $(this).stop().animate({opacity:.60}, 700);
                    }, function() {
                        $(this).stop().animate({opacity:1}, 700);
                    });
          }
                        
                
        // Press detail page
        $(".press").fadeIn("slow");
        
        

          $('.press_cycle, .press_cycle_fade').before('<div class="press_cycle_nav">').cycle({
          fx: 'scrollHorz',
          speed:  600, 
          delay: 2000,
          pager: '.press_cycle_nav',
          timeout: 0,
          pagerAnchorBuilder: function(idx, slide) {
            return '<a href="#">&nbsp;</a>';
          }
        });
          
            $(".press_cycle").fadeIn();
            $('#loader_press ').fadeOut();                                                
      }
      
    });    
          
    return false;    
   });  

    $('.press_cycle, .press_cycle_fade').before('<div class="press_cycle_nav">').cycle({
      fx: 'scrollHorz',
      speed:  600, 
      delay: 2000,
      pager: '.press_cycle_nav',
      timeout: 0,
      pagerAnchorBuilder: function(idx, slide) {
        return '<a href="#">&nbsp;</a>';
      }
    });

    $(".icon").click(function(){
      $('.press_cycle').removeClass('press_cycle').addClass('press_cycle_new');
      $(".newClass").fadeOut("fast");
      $(window).stop().scrollTo(0,'fast',{axis:'y'});;
      
      
      
    });

    
    $('a.icon, #logo a, .icons_home a,  .icons a, .facebook a, .twitter a, .box #button, .x, .press_head a, .subscribe a, .subscribe input')
            .hover(function() {
                $(this).stop().animate({opacity:.60}, 700);
            }, function() {
                $(this).stop().animate({opacity:1}, 700);
            });


    $('#nav ul li a')
           .hover(function() {
               $(this).stop().animate({ color: "#83B1C9" }, 700 );
           }, function() {
               $(this).stop().animate({ color: "#808080" }, 700 );
           });

     $('#menu .place a .contact_store  ')
            .hover(function() {
                $(this).stop().animate({ color: "#666666" }, 700 );
            }, function() {
                $(this).stop().animate({ color: "#83B1C9" }, 700 );
            }); 
            
      $('.blog_title a,.sign a, .thanks h3 a, #news_link a, a#s-report, .load_more_link h2 a, .arrow_more a, .press_text a, .sub input, .arrow_more ')
             .hover(function() {
                 $(this).stop().animate({ color: "#999999" }, 700 );
             }, function() {
                 $(this).stop().animate({ color: "#83B1C9" }, 700 );
             });
             
        $('.popup_nav li a')
             .hover(function() {
                 $(this).stop().animate({ color: "#555555" }, 700 );
             }, function() {
                 $(this).stop().animate({ color: "#999999" }, 700 );
             });
                 
         
         $('a.l_blue, .map a ')
              .hover(function() {
                  $(this).stop().animate({ color: "#555555" }, 700 );
              }, function() {
                  $(this).stop().animate({ color: "#83B1C9" }, 700 );
              });
        
          $('.credit a, .footerLinks ul li a  ')
                 .hover(function() {
                     $(this).stop().animate({ color: "#444444" }, 700 );
                 }, function() {
                     $(this).stop().animate({ color: "#808080" }, 700 );
                 });
                 
          $("select").focus(function(){
             $(".real_subject").css("border-color", "#83B1C9");
           });
         
          $("textarea, input").focus(function(){
             $(".real_subject").css("border-color", "#CCC");
           });
           
           /**** Store Page **********************************************************/

           $(".store_cycle img").load(function() {

           $(".store_cycle").fadeIn();
           });


           $(".place a").live('click',function(){

             var link = $(this).attr('href');

             $.ajax({
               beforeSend: function() {
                 $(" .store_cycle, .store_cycle_nav").fadeOut("fast");
               },
               url:link,
               cache: true,
               success: function(html){

                 $("#horizontalwrap, .press_cycle").html(html);
                 // if($.browser.msie && parseInt($.browser.version) == 8) {
                 // 
                 //     
                 //     
                 //     
                 //     $('.press_head a img')
                 //             .hover(function() {
                 //                 $(this).stop().animate({opacity:.60}, 700);
                 //             }, function() {
                 //                 $(this).stop().animate({opacity:1}, 700);
                 //             });
                 //   }


                 // Press detail page
                 $("storez").fadeIn("slow");



                   $('.store_cycle').before('<div class="store_cycle_nav">').cycle({
                   fx: 'fade',
                   speed:  900, 
                   delay: 2000,
                   pager: '.store_cycle_nav',
                   timeout: 0,
                   pagerAnchorBuilder: function(idx, slide) {
                     return '<a href="#">&nbsp;</a>';
                   }
                 });

                     // $(".store_cycle").fadeIn();
                     // $('#loader_store ').fadeOut();                                                
               }

             });    

             return false;    
            });  

             // $('.store_cycle').before('<div class=".store_cycle_nav">').cycle({
             // fx: 'scrollHorz',
             // speed:  600, 
             // delay: 2000,
             // pager: '.store_cycle_nav',
             // timeout: 0,
             // pagerAnchorBuilder: function(idx, slide) {
             //   return '<a href="#">&nbsp;</a>';
             // }
             // });


          
           
         /** Browser Fix **********************************************************/


            if($.browser.msie && parseInt($.browser.version) == 7) {
                $(".rights").css( "float", "none");
                $("img").css( "background-color", "#f9f9f9");
                
            }

            if($.browser.msie && parseInt($.browser.version) == 8) {
             
                $(".active img").css( "opacity", .40);
                $(".x a").css( "margin-left", 0);
                $(".idle").css( "opacity", .50);
                $(".press_cycle").css( "position", "relative");
                $(".footer_popup .x").css( "margin-left", -276).css( "width", 550);
                $(".idle, a.icon img, #logo a img, .icons_home a img,  .icons a img, .facebook a img, .twitter a img, .press_head a img").css( "background-color", "#f9f9f9");
                $('a.icon img, #logo a img, .icons_home a img,  .icons a img, .facebook a img, .twitter a img, .box #button, .x, .press_head a img, .subscribe a, .subscribe input')
                        .hover(function() {
                            $(this).stop().animate({opacity:.60}, 700);
                        }, function() {
                            $(this).stop().animate({opacity:1}, 700);
                        });
                
            }


           
});

// ACCORDIAN MENU 

function initMenu() {
  $('#menu ol').hide().animate({'opacity':0});
  $('#menu ol:first').show().animate({'opacity':1}).addClass('active-slide');
  
  $('#menu li a').click(
    function() {
      var checkElement = $(this).next();
      if((checkElement.is('ol')) && (checkElement.is(':visible'))) {
       
        $('#menu ol:visible').slideUp('normal');        
        return false;
        }
      if((checkElement.is('ol')) && (!checkElement.is(':visible'))) {
        $('#menu ol:visible').slideUp('normal').animate({'opacity':0}).removeClass('active-slide');        
        checkElement.slideDown('normal').animate({'opacity':1}).addClass('active-slide');
        return true;
        }
      }
    );
    
  }
$(document).ready(function() {initMenu();});




