i = 0;
$('document').ready(function() {

  $(".top_menu_item_home").hover(function(){
    $(this).children("div").css('background-color','#AEAEAE');
  }, function(){
    $(this).children("div").css('background-color','#C5D256');
  });

  $(".top_menu_item").hover(function(){
    if($(this).children("div").attr("class") != 'main_item_select'){
      $(this).children("div").removeClass('main_item_out');
      $(this).children("div").addClass('main_item_over');
    }
  }, function(){
    if($(this).children("div").attr("class") != 'main_item_select'){
      $(this).children("div").removeClass('main_item_over');
      $(this).children("div").addClass('main_item_out');
    }
  });
  
  $("#logo").click(function(){
     window.location.href="/site/";
  });
  
  $("#home_bot_l").click(function(){
     window.location.href="/site/Events.html";
  });
  
  $("#home_bot_c").click(function(){
     window.location.href="/site/Next-Sunday.html";
  });
  $("#left_pic1_b").click(function(){
     window.location.href="/site/Next-Sunday.html";
  });

  $("#home_bot_r").click(function(){
     window.location.href="/site/About Us/Sunday-Service.html";
  });
  
  $("#left_pic2_b").click(function(){
     window.location.href="/site/Events.html";
  });
  
  $(".top_menu_item").hover(function(){
     if($(this).attr("style") != 'background: transparent url(/imgs/top_menu_sel.jpg) repeat-x scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;'){
       $(this).attr("style","background: url(/imgs/top_menu_over.jpg) repeat-x;");
     }
  }, function(){
     if($(this).attr("style") != 'background: transparent url(/imgs/top_menu_sel.jpg) repeat-x scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;'){
       $(this).attr("style","background: url(/imgs/top_menu_out.jpg) repeat-x;");
     }
  });

  $("#form_contact").submit(function(){
    if($("#input_email").attr("value") == ''){
      alert("Please, enter the email address");
      return false;
    }
    var pos1 =  $("#input_email").attr("value").indexOf("@");
    var pos2 =  $("#input_email").attr("value").indexOf(".");
    if(pos1 == -1 || pos1 == -1){
      alert("Please enter a valid email address");
      return false;
    }
    
    $(".radio_to").each(function(){
      if($(this).attr("checked") == true){
        i++;
      }
    });
    if(i == 0){
      alert("Please select addressee");
      return false;
    }
    if($("#contact_msg").attr('value') == ''){
       alert("Please, enter the message");
       return false;
    }
    if($(".contact_inp").attr('value') == ''){
       alert("Please enter the characters shown on the image");
       return false;
    }
    return true;
  });
  
  $(".main_item_select").parent(".top_menu_item").css("font-weight","bold");
  

  if ($.browser.msie && $.browser.version == 6) {
    DD_belatedPNG.fix("#logo");
    DD_belatedPNG.fix("#home_header");
    DD_belatedPNG.fix("#home_header_top");
    DD_belatedPNG.fix("#home_header_bot");
    DD_belatedPNG.fix("#headerr");
    DD_belatedPNG.fix("#header_top");
    DD_belatedPNG.fix("#header_bot");
    DD_belatedPNG.fix("#main");
    DD_belatedPNG.fix("#left_pic1");
    DD_belatedPNG.fix("#bot_img");
    DD_belatedPNG.fix("#main_sermons");
    DD_belatedPNG.fix("#bot_img_sermons");
    DD_belatedPNG.fix("#bottom_image");
  }
  
  if ($.browser.msie && $.browser.version == 7) {
    $("#bot_img").hide();
  }
  
  
})







