var init_w_width;
var init_w_height;

function check_w_size()
{
	$(document).ready(function(){
		$(window).resize(function() {
			if(init_w_width != $(window).width() || init_w_height != $(window).height()){
				set_bottom_bar();
				set_size_bottom_bar_top();
				set_bottom_bar_top();
			}
		});
	});
}

function right_quick_floating(arg_left, arg_top, arg_speed)
{
    $(document).ready(function(){
       

      $("#right_pop").css({left:arg_left + "px"});
       
       
        var currentPosition = parseInt($("#right_pop").css("top"));
       

        $(window).scroll(function() {
            var position = $(window).scrollTop(); // 현재 스크롤바의 위치값을 반환합니다.
			var height = (position < arg_top) ? arg_top + position : position;
			$("#right_pop").css({top:height + "px"});
            //$("#right_pop").stop().animate({"top":height+"px"},arg_speed);
        });


    });
}

function right_quick_floating2(arg_left, arg_top, arg_speed)
{
    $(document).ready(function(){
       

	    $("#right_pop").css({left:arg_left + "px"});

       
       
        var currentPosition = parseInt($("#right_pop").css("top"));
       

        $(window).scroll(function() {
            var position = $(window).scrollTop(); // 현재 스크롤바의 위치값을 반환합니다.
			var height = (position < arg_top) ? $("#right_pop").className =  "right_quick1" : "right_quick2";
			//$("#right_pop").css({top:height + "px"});
            //$("#right_pop").stop().animate({"top":height+"px"},arg_speed);
        });


    });
}

function set_bottom_bar()
{
    $(document).ready(function(){
       
        var b_width = $(document.body).width(); //페이지 전체크기
		var b_height = $(document.body).height(); //페이지 전체크기
        var o_heigh = parseInt($("#bottom_bar").height());

			var position = $(window).scrollTop(); // 현재 스크롤바의 위치값을 반환합니다.
			var w_height = $(window).height();	// 창 세로크기

			var height = position + w_height - o_heigh;

			$("#bottom_bar").stop().animate({"top":height+"px"},1);	   


        $(window).scroll(function() {
            var position = $(window).scrollTop(); // 현재 스크롤바의 위치값을 반환합니다.
			var w_height = $(window).height();	// 창 세로크기

			var height = position + w_height - o_heigh;

            $("#bottom_bar").stop().animate({"top":height+"px"},1);
        });


    });

}

function set_bottom_bar_top()
{
    $(document).ready(function(){
       
		var obj1 = $("#bottom_bar_top");
		var obj2 = $("#bottom_bar_top_frame");

        var b_width = $(document.body).width(); //페이지 전체크기
		var b_height = $(document.body).height(); //페이지 전체크기
        //var o_heigh = parseInt($("#bottom_bar_top").height());

		var o_heigh = parseInt($("#bottom_bar").height());

            var position = $(window).scrollTop(); // 현재 스크롤바의 위치값을 반환합니다.
			var w_height = $(window).height();	// 창 세로크기

			var set_height = set_size_bottom_bar_top();

			var height = position + w_height - o_heigh - set_height;

            $("#bottom_bar_top").stop().animate({"top":height+"px"},1);	   


        $(window).scroll(function() {
            var position = $(window).scrollTop(); // 현재 스크롤바의 위치값을 반환합니다.
			var w_height = $(window).height();	// 창 세로크기

			var set_height = set_size_bottom_bar_top();

			var height = position + w_height - o_heigh - set_height;

            $("#bottom_bar_top").stop().animate({"top":height+"px"},1);
        });


    });

}

function set_size_bottom_bar_top()
{
	var obj1 = $("#bottom_bar_top");
	var obj2 = $("#bottom_bar_top_frame");
	var from_bottom = $("#bottom_bar").height();;

	var w_height = $(window).height();	// 창 세로크기

	var set_height = w_height - 100 - from_bottom;

	obj1.css({height:set_height + "px"});
	obj2.css({height:set_height + "px"});

	return set_height;
}
