function isEnter(evt) {
  var keyCode = null;
  if (evt.which) {
    keyCode = evt.which;
  } else {
    if (evt.keyCode) {
      keyCode = evt.keyCode;
    }
  }
  return keyCode == 13;
}

function skuTablesize() {
  var skuTable = jQuery("#skuTable");
  if (skuTable) {
    var skuWidth = skuTable.width();
    var sku = jQuery("#skuContainer");
    if (skuWidth > 460) {
      if (sku) {
        sku.css({
          width:"710px"
        });
      }
      skuTable.css({
        width:"710px",
        marginright:"0"
      });
	  
      jQuery("#palletTable").css({
        display:"none"
      });
    }
    if (skuWidth < 460) {
      if (sku) {
        sku.css({
          width:"460px"
        });
      }
      skuTable.css({
        width:"460px",
        marginright:"0"
      });
    }
  }
}

function shoppingListPanelSize() {
  var skuTable = jQuery("#skuTable");
  if (skuTable) {
    var skuWidth = skuTable.width();
    var sku = jQuery("#skuContainer");
    if (skuWidth > 460) {
      if (sku) {
        sku.css({
          width:"710px"
        });
      }
      skuTable.css({
        width:"710px",
        marginright:"0"
      });
      jQuery("#shoppingSize").css({
        display:"none"
      });
    }
    if (skuWidth < 460) {
      if (sku) {
        sku.css({
          width:"460px"
        });
      }
      skuTable.css({
        width:"460px",
        marginright:"0"
      });
    }
  }
}

function StatusboxSize() {
  var skuTable = jQuery("#skuTable");
  if (skuTable) {
    var skuWidth = skuTable.width();
    var sku = jQuery("#skuContainer");
    if (skuWidth > 460) {
      if (sku) {
        sku.css({
          width:"710px"
        });
      }
      skuTable.css({
        width:"710px",
        marginright:"0"
      });
      jQuery("#statusboxDetails").css({
        display:"none"
      });
    }
    if (skuWidth < 460) {
      if (sku) {
        sku.css({
          width:"460px"
        });
      }
      skuTable.css({
        width:"460px",
        marginright:"0"
      });
    }
  }
}


function shoppingListPanelsize() {
  var skuTable = jQuery("#skuTable");
  if (skuTable) {
    var skuWidth = skuTable.width();
    var sku = jQuery("#skuContainer");
    if (skuWidth > 460) {
      if (sku) {
        sku.css({
          width:"710px"
        });
      }
      skuTable.css({
        width:"710px",
        marginright:"0"
      });
      jQuery("#shoppingListBoxTable").css({
        display:"none"
      });
    }
    if (skuWidth < 460) {
      if (sku) {
        sku.css({
          width:"460px"
        });
      }
      skuTable.css({
        width:"460px",
        marginright:"0"
      });
    }
  }
}
function searchOrderHistoryByOrderNoBoxSize() {
  var skuTable = jQuery("#skuTable");
  if (skuTable) {
    var skuWidth = skuTable.width();
    var sku = jQuery("#skuContainer");
    if (skuWidth > 460) {
      if (sku) {
        sku.css({
          width:"710px"
        });
      }
      skuTable.css({
        width:"710px",
        marginright:"0"
      });
      jQuery("#searchOrderHistoryByOrderNoBox").css({
        display:"none"
      });
    }
  
    if (skuWidth < 460) {
      if (sku) {
        sku.css({
          width:"460px"
        });
      }
      skuTable.css({
        width:"460px",
        marginright:"0"
      });
    }
  }
}
   
jQuery(document).ready(function () {
  skuTablesize();
  shoppingListPanelSize();
  searchOrderHistoryByOrderNoBoxSize();
  StatusboxSize();
  shoppingListPanelsize();
 
    jQuery("#skuContainer").css("visibility", "visible");
    
    jQuery("#focusTosearch a").click(function () {
    jQuery("#searchBox input").focus();
  });
    jQuery("#box p").click(function (click) {
    jQuery("#box").slideUp();
    jQuery("#newsContainer").show();
    jQuery("#trigger").show();
    jQuery("#footer").css({
      "margin-top":"-35px"
  });
  });
    jQuery("#trigger").click(function () {
    jQuery("#trigger").hide();
    jQuery("#box").slideToggle();
    jQuery("#newsContainer").hide();
    jQuery("#footer").css({
      "margin-top":"0"
    });
   
   
 

  });
	



	
jQuery("#print_button").click(function (){
	printCss();
	});

    if(jQuery.browser.msie){ 
	jQuery("#emptyCell").css({
      "display":"none"
    });
	
	  }

function printCss(){
	// Save print style values
	var sidebarRight_display = jQuery("#sidebarRight").css("display");
	var searchBox_display = jQuery("#searchBox").css("display");
	var sidebarLeft_display = jQuery("#sidebarLeft").css("display");
	var print_button_display = jQuery("#print_button").css("display");
	var div_text_align = jQuery("#div").css("text-align");
	var div_font_size = jQuery("#div").css("font-size");
	var top_ul_display = jQuery("#link_top ul").css("display");
	var top_padding_left = jQuery("#top").css("padding-left");

	// Set print styles
    jQuery("#sidebarRight").css({"display":"none"});	
    jQuery("#searchBox").css({"display":"none"});	 
    jQuery("#sidebarLeft").css({"display":"none"});   
    jQuery("#print_button").css({"display":"none"});   
	jQuery("div").css({"text-align":"left","font-size":"12px"});	
   	jQuery("#link_top ul").css({"display":"none"});
    jQuery("#link_top").css({"padding-left":"20px"});	
   	jQuery("#link_top").prepend('<img id="printLogo" border="0" class="printLogo" src="../images/logo/noNO/logo.gif"/>');
   	
   	// Print
   	window.print();
   	
   	// Reset print styles
   	if (sidebarRight_display != null){
   		jQuery("#sidebarRight").css({"display":sidebarRight_display});
   	}
	if (searchBox_display != null){
   		jQuery("#searchBox").css({"display":searchBox_display});
   	}
   	if (sidebarLeft_display != null){
   		jQuery("#sidebarLeft").css({"display":sidebarLeft_display});
   	}
   	if (print_button_display != null){
   		jQuery("#print_button").css({"display":print_button_display});
   	}
   	if (div_text_align != null){
   		jQuery("div").css({"text-align":div_text_align});
   	}
   	if (div_font_size != null){
   		jQuery("div").css({"font-size":div_font_size});
   	}
   	if (top_ul_display != null){
   		jQuery("#link_top ul").css({"display":top_ul_display});
   	}
   	if (top_padding_left != null){
   		jQuery("#link_top").css({"padding-left":top_padding_left});
   	}
   	jQuery("#link_top img[id='printLogo']").remove();
  }
	
  changeCss();
  jQuery(window).bind("resize", function(){  
  changeCss();
  
  
  });
 
 function changeCss(){
    var windowWidth = document.documentElement.clientWidth;
    var lefPosotion=windowWidth/2+250;
    jQuery("#sidebarRight").css({
      "left":lefPosotion 
    });
     jQuery("#searchBox").css({
      "left":(lefPosotion-27)
    });
	
   jQuery("#sidebarRight").css({
      "display":"block"
     });
	
   jQuery("#searchBox").css({
         "display":"block"
		   });
  }
 
  jQuery("#orderfocusinput").focus(function (){									
  jQuery("#orderfocus").css({'border-top-color':'orange'});
  jQuery("#closeOrderHistoryButton").css({'display':'block'});
   });
  
  jQuery("#orderfocusinput").blur(function (){									  
  jQuery("#orderfocus").css({'border-top-color':'#7f7f7f'});
  jQuery("#closeOrderHistoryButton").css({'display':'none'});
   });

  jQuery("#closeOrderHistoryButton").click(function (){
  jQuery("#orderfocusinput").blur(function (){									  
  jQuery("#orderfocus").css({'border-top-color':'#7f7f7f'});
  jQuery("#closeOrderHistoryButton").css({'display':'none'});
  });
  });
  


  
 
 jQuery(".resizeimage").each(function () {
    var img = this;
    var a = img.width / img.height;
    if (img.height > 150 || img.width > 150) {
      if (img.height > img.width) {
        img.height = 150;
        img.width = 150 * a;
      } else {
        img.height = 150 / a;
        img.width = 150;
      }
    }
    this.style.visibility = "visible";
  }); 
});


   

jQuery(".clickableDiv").live("mouseover",
  function(){
    jQuery(this).addClass("clickableDivHover");
  }).live("mouseout",
  function(){
    jQuery(this).removeClass("clickableDivHover");
  });

 jQuery(".searchLink").live("mouseover",
  function(){
    jQuery(this).addClass("searchLinkHover");
  }).live("mouseout",
  function(){
    jQuery(this).removeClass("searchLinkHover");
  });



 jQuery("#orderReferens").live("mouseover",
  function(){
    jQuery(this).addClass("hoverColor");
  }).live("mouseout",
  function(){
    jQuery(this).removeClass("hoverColor");
  });

   
 jQuery(".ui-datepicker-trigger").live("mouseover",
  function(){
    jQuery(this).addClass("hoverColorCalender");
  }).live("mouseout",
  function(){
    jQuery(this).removeClass("hoverColorCalender");
  });

   
      
 jQuery(".ui-datepicker-trigger").live("mouseover",
  function(){
    jQuery(this).addClass("hoverColorCalender");
  }).live("mouseout",
  function(){
    jQuery(this).removeClass("hoverColorCalender");
  });


 jQuery("#leftlowerBottom").live("mouseover",
  function(){
    jQuery(this).css({'background-image':'url("../images/Icon/ActionIcon/RollOver/closeRed.gif")'}); 
  }).live("mouseout",
  function(){
    jQuery(this).css({'background-image':'url("../images/Icon/ActionIcon/closeGray.gif")'});
	});


    function goToCashier() {
      setBusy();
      window.location = "order.htm";  
    }





  
  
  