﻿/* UI scripts that appear on all or almost every page */
// Uses http://jQuery.com

/* pop up windows */
var poptype = {
    locationsGallery:
    {
      scrollbars:1,
      height:700,
      width:900,
      menu:0,
      resizable:1
    },
    practitionerPrint:
    {
      scrollbars:1,
      height:600,
      width:400,
      menu:0,
      resizable:1
    }
  };


$(function(){
	$("body").addClass("js");
	if(window.location.search.indexOf("displaylogin=true") < 0){
	    $("#topbar").hide();
	}
	
	if($('#topbar').length){
	    $('#top').after('<p id="togglelogin"><a href="#ctl00_ctl14_txbUserName"><span></span>Registered Users</a></p>');
	   	$('#togglelogin a').click(function(){
	        $('#topbar').slideToggle(function(){
	         $('#ctl00_ctl14_txbUserName').focus();
	        });
	    });
	}

  $('.locations-popup').popwindow(poptype.locationsGallery);
  $('.practitioner-print-popup').popwindow(poptype.practitionerPrint);
  
  // make con-supp panels clickable all over
  
  $('div.panel-large,div.panel-small').filter('.video').biggerlink({follow:false});
  $('div.panel-large,div.panel-small').not('.video').biggerlink();
  
});

// Quick search field
$(function(){
	var searchField = $("#search");
	searchField
	.focus(function(){
		$(this).toggleClass('focus');
		if(this.value == this.title){this.value = '';}
	})
	.blur(function(){
		$(this).toggleClass('focus');
		if(this.value == ''){this.value = this.title;}
	}).val(searchField.attr('title'));
});
