var menu_show = 0;
var temp_obj;
var temp_obj1;
var temp_obj2;
var temp_obj3;

$(window).scroll(function(){
  if (!($.browser.msie == true && $.browser.version == 6.0)) {
    checkPosition();
  }
});

function checkPosition()
{
  var scrolled = $(window).scrollTop();
  var height = $('#header').height();
  
  if(scrolled >= height && menu_show==0 )
  {
    menu_show = 1;
    
    // NAVI TOP
    temp_obj = $('#navi_main_sub').clone();
    $('body').append(temp_obj);
    $(temp_obj).css("position","fixed");
    $(temp_obj).css("left", '50%');
    var width = $(temp_obj).width()/2;
    var width2 = width;
    if ($.browser.msie == true && $.browser.version == 7) {
      width2 += 1;
    }
    $(temp_obj).css("margin-left", '-'+width2+'px');
    $(temp_obj).css("top", '0');
    
    // NAVI LEFT
    temp_obj1 = $('#sub_left').clone();
    $('body').append(temp_obj1);
    $(temp_obj1).css("position","fixed");
    $(temp_obj1).css("left", '50%');
    $(temp_obj1).css("top", '27px');
    var width1 = width - 1; 
    
    if ($.browser.msie == true && $.browser.version == 7) {
      var width1 = width;
      $(temp_obj1).css("margin-left", '-'+width1+'px');
    } else {
      $(temp_obj1).css("margin-left", '-'+width1+'px');
    }
    
    // SEARCH HOME
    temp_obj2 = $('.search_home').clone();
    $('body').append(temp_obj2);
    $(temp_obj2).css("position","fixed");
    $(temp_obj2).css("left", '50%');
    $(temp_obj2).css("top", '27px');

    if ($.browser.msie == true && $.browser.version == 8) {
      $(temp_obj2).css("margin-left", '161px');
    } else {
      $(temp_obj2).css("margin-left", '160px');
    }
    $(temp_obj2).css("width", '299px');
    
    // SEARCH SUB
    temp_obj3 = $('.search_sub').clone();
    $('body').append(temp_obj3);
    $(temp_obj3).css("position","fixed");
    $(temp_obj3).css("left", '50%');
    $(temp_obj3).css("top", '27px');
    if ($.browser.msie == true && $.browser.version == 8) {
      $(temp_obj3).css("margin-left", '269px');
    } else {
      $(temp_obj3).css("margin-left", '268px');
    }
    $(temp_obj3).css("width", '192px');
  }
  
  if(scrolled <= height)
  {
    menu_show = 0;
    $(temp_obj).remove();	
    $(temp_obj1).remove();
    $(temp_obj2).remove();
    $(temp_obj3).remove();

  }
}//checkPosition()

