$(wireupInputs);
$(wireUpSearchForm);
   
function makeNewsLinkFancyBoxLink(){

  $("a.iframe").fancybox({
        'width': 692,
        'height'      : 260,
        'autoScale'         : false,
        'autoDimensions'    : false,
        'type'        : 'iframe',
        'scrolling'         : 'no',
        'titleShow'         : false
  });

}
   
function insertChooseIntoSelects(){
  $("div select option:eq(0)").after(new Option('Please choose...', ''));
  $("div select option:eq(0)").remove();
}

function wireUpSearchForm(){
    $('.btnGo').submit(function(){
        if($('.searchInput').val().length==0 || $('.searchInput').val()==$('.searchInput').title){
            alert("Please enter search term");
            return false;
        }   
    });
}


function addDivider(startNode){
  var divider ='<div class="divider"></div>';
  $(startNode).before(divider);
}
function addDividerAfter(startNode){
  var divider ='<div class="divider"></div>';
  $(startNode).after(divider);
}
function wireupInputs(){
  $("input:text, textarea, input:password").each(function(){
    if(this.value == ''){
      this.value = this.title;
    }
  });
  $("input:text, textarea, input:password").focus(function(){
    if(this.value == this.title){
      this.value = '';
    }
  });
  $("input:text, textarea, input:password").blur(function(){
    if(this.value == ''){
      this.value = this.title;
    }
  });
  $("input:image, input:button, input:submit").click(function(){
    $(this.form.elements).each(function(){
      if(this.type =='text' || this.type =='textarea' || this.type =='password' ){
        if(this.value == this.title && this.title != ''){
          this.value='';
        }
      }
    });
  });

}
