$(document).ready(function(){
//full screen set
  var document_height = $(document).height();
  var document_width = $(document).width();
  var window_height = $(window).height();
  var window_width = $(window).width();
  var html_height = $("html").height();
  var html_width = $("html").width();
  var main_height = $("#main").height();
  var side_width = Math.ceil(window_width*0.2);
  /*alert(document_width);
  alert(window_height);
  alert(window_width);
  alert(html_height);
  alert(html_width);
  alert(main_height);
  */
  if (side_width>354) {
    side_width = 354;
  }
  else if (side_width<250) {
    side_width = 250;
  }
  $("#side").width(side_width);
  
  var root= document.compatMode=='BackCompat'? document.body : document.documentElement;
  var isVerticalScrollbar= root.scrollHeight>root.clientHeight;
  var isHorizontalScrollbar= root.scrollWidth>root.clientWidth;  
  
  
  
  if (window_width<1050) {
    var main_width = 1050-side_width;
  }
  else {
  var main_width = window_width-side_width;
  }
  //alert(isVerticalScrollbar);
  //alert(isHorizontalScrollbar);
  
  if ($.browser.msie) {
  	//ie¦³ª½±²¶b
  	if (isVerticalScrollbar==true) {
  	  var menu_height = document_height;
    }
    else {
      var menu_height = window_height;
    }
  	if (($("body").is('.news'))||($("body").is('.search'))) {
  	  menu_height+=16;
  	}
  }
  else {
  	if (isVerticalScrollbar==true) {
      var menu_height = document_height;
    }
    else {
      var menu_height = window_height;
    }
  	if (($("body").is('.news'))||($("body").is('.search'))) {
  	  menu_height+=16;
  	}
  }
  
  $("#brands_menu").height(menu_height);
  $("#products_menu").height(menu_height);
  $("#class_menu").height(menu_height);
  $("#year_menu").height(menu_height);
  $("#open").height(menu_height);
  $("#side").height(menu_height);
  
  $("#main").height(menu_height);
  $("#main").width(main_width);

//knowledge page gradient
  $('#knowledge_part').append('<div id="gradient"></div>'); 
  $("#paragraph p:last-child").addClass('last');
//knowledge page img cover
  $('#perfumer_img').append('<div id="photo_cover"></div>'); 

//news page gradient
  $('#news_part').append('<div id="gradient"></div>'); 
  $("#news_content p:last-child").addClass('last');
  $("ul.list li:last-child").addClass('last');

//search page gradient
  $('#questions_part').append('<div id="gradient"></div>'); 
  $("#questions input.button").addClass('last');

  $('#results_part').append('<div id="gradient"></div>'); 
  $("#results ul:last-child").addClass('last');

});

$(window).resize(function(){
//full screen set
  var document_height = $(document).height();
  var document_width = $(document).width();
  var window_height = $(window).height();
  var window_width = $(window).width();
  var html_height = $("html").height();
  var html_width = $("html").width();
  var main_height = $("#main").height();
  var side_width = Math.ceil(window_width*0.2);
  
  /*alert(document_height);
  alert(document_width);
  alert(window_height);
  alert(window_width);
  alert(html_height);
  alert(html_width);
  alert(main_height);
  */
  if (side_width>354) {
    side_width = 354;
  }
  else if (side_width<250) {
    side_width = 250;
  }
  $("#side").width(side_width);
  
  var root= document.compatMode=='BackCompat'? document.body : document.documentElement;
  var isVerticalScrollbar= root.scrollHeight>root.clientHeight;
  var isHorizontalScrollbar= root.scrollWidth>root.clientWidth;  
  
  
  
  if (window_width<1050) {
    var main_width = 1050-side_width;
  }
  else {
  var main_width = window_width-side_width;
  }
  //alert(isVerticalScrollbar);
  //alert(isHorizontalScrollbar);
  
  if ($.browser.msie) {
  	//ie¦³ª½±²¶b
  	if (isVerticalScrollbar==true) {
  	  var menu_height = document_height;
    }
    else {
      var menu_height = window_height;
    }
  	if (($("body").is('.news'))||($("body").is('.search'))) {
  	  menu_height+=16;
  	}
  }
  else {
  	if (isVerticalScrollbar==true) {
      var menu_height = document_height;
    }
    else {
      var menu_height = window_height;
    }
  }
  
  $("#brands_menu").height(menu_height);
  $("#products_menu").height(menu_height);
  $("#class_menu").height(menu_height);
  $("#year_menu").height(menu_height);
  $("#open").height(menu_height);
  $("#side").height(menu_height);
  
  $("#main").height(menu_height);
  $("#main").width(main_width);

});

