/**
 * Set up live queries.
 */
function live_setup()
{
  $('.datepicker_ymd').livequery(function(){
    $(this).datepicker({dateFormat:'yy/mm/dd', constrainInput:false, changeMonth: true, changeYear: true});
  });

  $('.qtip_title').livequery(function(){

    var corner_spec = {target: 'bottomRight', tooltip: 'topLeft'};
    if ( $(this).hasClass('qtip_12oclock') ) {
      corner_spec = {target: 'topMiddle', tooltip: 'bottomMiddle'};
    }
    else if ( $(this).hasClass('qtip_1oclock') ) {
      corner_spec = {target: 'topMiddle', tooltip: 'bottomLeft'};
    }
    else if ( $(this).hasClass('qtip_2oclock') ) {
      corner_spec = {target: 'topRight', tooltip: 'bottomLeft'};
    }
    else if ( $(this).hasClass('qtip_5oclock') ) {
      corner_spec = {target: 'bottomMiddle', tooltip: 'topLeft'};
    }
    else if ( $(this).hasClass('qtip_8oclock') ) {
      corner_spec = {target: 'bottomLeft', tooltip: 'topRight'};
    }
    else if ( $(this).hasClass('qtip_11oclock') ) {
      corner_spec = {target: 'topLeft', tooltip: 'bottomRight'};
    }

    if ( typeof qtip_bgcolor === 'undefined' ) {
      qtip_bgcolor = 'white';
    }

    $(this).qtip({
      content: {text: false},
      show: {delay: 500},
      position: {corner: corner_spec},
      style: {
        tip: true,
        background: qtip_bgcolor,
        border: { width: 1, radius: 1, color: 'black'}
      }
    });
  });
}

