$(document).ready(function(){

	// remove focus outline on all links when clicked
  $("a").focus(function(){
    $(this).blur();
  });
	
	
	// Hot OFf The Press hide/display default text on focus/blur
	$("#fld_hotoffthepress").focus(function() {
		$(this).css({'color':'#000'});
		if(this.value == this.defaultValue) {
			this.value = "";
		}
	}).blur(function() {
		if(!this.value.length) {
			$(this).css({'color':'#bbb'});
			$('#signupMsg').css('display','none');
			this.value = this.defaultValue;
		}
	});
	
	
	// Search box hide/display default text on focus/blur
	$("#searchField").focus(function() {
		if(this.value == this.defaultValue) {
			this.value = "";
		}
	}).blur(function() {
		if(!this.value.length) {
			this.value = this.defaultValue;
		}
	});

		
	var popWin = null    // use this when referring to pop-up window
	var winCount = 0
	var winName = "popWin"
	
	function openPopWin(winURL, winWidth, winHeight, winFeatures, winLeft, winTop){
	  var d_winLeft = 20  // default, pixels from screen left to window left
	  var d_winTop = 20   // default, pixels from screen top to window top
	  winName = "popWin" + winCount++ //unique name for each pop-up window
	  closePopWin()           // close any previously opened pop-up window
	  if (openPopWin.arguments.length >= 4)  // any additional features?
	    winFeatures = "," + winFeatures
	  else
	    winFeatures = ""
	  if (openPopWin.arguments.length == 6)  // location specified
	    winFeatures += getLocation(winWidth, winHeight, winLeft, winTop)
	  else
	    winFeatures += getLocation(winWidth, winHeight, d_winLeft, d_winTop)
	  popWin = window.open(winURL, winName, "width=" + winWidth
	           + ",height=" + winHeight + winFeatures)
	}
	
	function closePopWin(){    // close pop-up window if it is open
	  if (navigator.appName != "Microsoft Internet Explorer"
	      || parseInt(navigator.appVersion) >=4) //do not close if early IE
	    if(popWin != null) if(!popWin.closed) popWin.close()
	}

	$('a.lightbox').lightBox(); // Select all links with lightbox class

	$('a#request_print_companion').each(function(){
		$(this).attr('href','javascript:OpenRequestCDRom(\'/request_print_companion.php\');');
		$(this).removeAttr('target');
	});
	$('a#request_virtual_tour').each(function(){
		$(this).attr('href','javascript:OpenRequestTour(\'/request_virtual_tour.php\');');
		$(this).removeAttr('target');
	});
	$('a#seminar_booking').each(function(){
		$(this).attr('href','javascript:OpenRequestSeminar(\'http://www.client.belmont.co.uk/seminar/booking.aspx\');');
		$(this).removeAttr('target');
	});
})