var $navLeft, $navRight;
var $topHeight = 100;
var $navWidth = 105;
function leftAndRightAd(filename){
    
  if(window.screen.width > 1118){
      
      var $nav = jQuery("<div></div>").addClass("LeftAndRightNav");
      var $navTitle = jQuery('<div></div>').html('<img src="../'+filename+'" alt=""/>');
      $nav.append( $navTitle );
      
      $navLeft = $nav.clone();
      $navLeft.appendTo("body");
      
      $navRight = $nav.clone();
      $navRight.appendTo("body");
      
      jQuery(".LeftAndRightNav .Nav2").mouseover(function(){
        this.style.background = "#FFA468";
      });
      jQuery(".LeftAndRightNav .Nav2").mouseout(function(){
        this.style.background = "";
      });       
      
      setTop();
      setLeft();
      
      jQuery(window).scroll(function(){
        setTop();
      });

      jQuery(window).resize(function(){
        setLeft();
      }); 
  }
  
}




function setTop(){  
 if($navLeft.css("visibility") != "hidden"){
     var $scrollTop = jQuery(document).scrollTop(); 
     $navLeft.css({"top" : $scrollTop + $topHeight});
     $navRight.css({"top" : $scrollTop + $topHeight});
  } 
}

function setLeft(){
  var $bodyWidth = jQuery("body").width();  
  if($bodyWidth < 1000){
    $navLeft.css({"visibility":"hidden"});
    $navRight.css({"visibility":"hidden"});
    return;
  } 
  var $left = $bodyWidth > 1000 ? 5 : 0;
  try{ 
    $navLeft.css({"visibility":"visible","position":"absolute","left" : 0 + $left});    
    $navRight.css({"visibility":"visible","position":"absolute","left" : $bodyWidth - $navWidth - $left });    
   }catch(e){
   }
}
