﻿/// <reference path="jquery-1.3.2-vsdoc2.js" />


function formatText(index, panel) {
  return index + "";
}

//CMS class

function cms(){
  this.Search = function(q){
    if (q.length > 2) {
      var qs = "?q=" + encodeURIComponent(q);
      window.location.href = "/search/" + qs;
      }
  }
}

var $CMS = new cms();

function setHeight(){
  var $wh = $(window).height();
  var $ch = $("#header").height() + $("#menu").height() + $("#wrap").height();

  if ($wh>$ch){
    $("#wrap").height($("#wrap").height()+($wh-$ch)-102);
  }
}
  
$(function(){
  $("#inputSearchTop,#inputSearchBottom").keypress(function(e){
    if (e.which == 13) {
      $CMS.Search($(this).val());
    }
  });
  
  $("#search-btn,.search-btn").click(function(e){
    $CMS.Search($(this).parent().find("INPUT").eq(0).val());
    return false;
  });
    
  $(window).resize(function() {
    setHeight();
  });
  
  setHeight();
  
  //$(".jclite").jCarouselLite({
//        btnNext: ".next",
//        btnPrev: ".prev"
    //});
    
  //simple menu
//  $(window).bind("onload", function(){
//    var menu = new menu.dd("menu");
//	  menu.init("menu","menuhover");
//  });
  
  $('ul.mainMenu').superfish();
  $(".mainMenu .sf-sub-indicator").wrapInner("<em>");
  
//  $(".mainMenu > LI > UL").each(function(){
//      console.debug($(this).parent());
//      $(this).css("width", $(this).parent().width());
//    });
  
//  $(".jclite UL").liScroll();
  
});
