function setPos(){
    var w_width = $(window).width();
    var w_height = $(window).height();
    
    if (w_height < 600) {
        height = 600;
    } else {
        height = w_height;
    }
    //Footer 
    $('.wrapper').css({ height: height + 'px' });

    if (w_width < 1003) {
        $("img.bg").removeClass('width_100').addClass('width_1003px').removeClass('height_100');
    } else  {
        $("img.bg").addClass('width_100').removeClass('width_1003px').removeClass('height_100');
    }
    if($("img.bg").height()>w_height){        
        //$("img.bg").addClass('height_100').removeClass('width_1003px');
    	$("img.bg").removeClass('width_1003px');
    }
    var img_h = $("img.bg").height(); 
    var bottom_h = height-50;   
    
    if(img_h < bottom_h){
      $(".menu_line").css({top: img_h+'px'});       
    } else {     
      $(".menu_line").css({top: height - 50 + 'px'});
    }
}

$(window).resize(function() {
   setPos();
});


$(function () {
  var img = new Image();
  $(img).load(function () {        
        $('.wrapper').append('<img class="bg width_100" src="images/img.jpg" />')
        .find('img')
        .attr('style',"filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/img.jpg', sizingMethod='scale');")
        ;//.animate({opacity:0},0)
        //.animate({opacity:1},1500);
       
        
        setPos();
    })  
    .error(function () {
      // notify the user that the image could not be loaded
    })
    .attr('src', 'images/img.jpg');
    
    
});

/*<img class="bg width_100" src="images/img.jpg" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(
        src='img_test2.jpg', sizingMethod='scale');" />*/