curlypage_do_peel = function (cpid, position) {
  if (position == 'topleft' || position =='topright') {
    jQuery("#curlypage_peelDiv_" + cpid).css("top", "124px");
    jQuery("#curlypage_flagDiv_" + cpid).css("top", "-1000px");

  } 
  else {
    jQuery("#curlypage_peelDiv_" + cpid).css("bottom", "0px");
    jQuery("#curlypage_flagDiv_" + cpid).css("bottom", "-1000px");
  }
  document.getElementById('curlypage_peel' + cpid).doPeel();
}

curlypage_start = function (cpid, position) {
  jQuery("#curlypage_waitDiv_" + cpid).remove();
  if (position == 'topleft' || position =='topright') {
    jQuery("#curlypage_flagDiv_" + cpid).css("top", "124px");
  } 
  else {
    jQuery("#curlypage_flagDiv_" + cpid).css("bottom", "0px");
  }
  document.getElementById('curlypage_peel' + cpid).startMovie();
}

curlypage_do_flag = function (cpid, position){
  if (position == 'topleft' || position =='topright') {
    jQuery("#curlypage_flagDiv_" + cpid).css("top", "124px");
    jQuery("#curlypage_peelDiv_" + cpid).css("top", "-1000px");
  } 
  else {
    jQuery("#curlypage_flagDiv_" + cpid).css("bottom", "0px");
    jQuery("#curlypage_peelDiv_" + cpid).css("bottom", "-1000px");
  }
}

jQuery(function(){
  // disable superfish top-level links
  jQuery('#superfish-1 > li > a').each(function() {
    if ($(this).attr('href') != '/') {
      $(this).click(function() { return false; });
    }
  });
  
  // prepopulate search field
  jQuery('.kw-theme #block-faceted_search_ui-1_keyword .form-text').attr({
    value: 'SEARCH',
    onFocus: 'if (!$(this).hasClass("cleared")) {$(this).addClass("cleared"); $(this).val("");}'
  });
});
