/* 
Transamerica
Global Scripts [global.js]

Thomas Gainar [thomas.gainar@acquitygroup.com]

Copyright (c) 2010 Acquity Group LLC

	AUTHOR / LOG:
	TG 10/21/10, Initial creation

TOC:

	1) Input Field Instructional Copy Hide/Show
	2) Handles Solution Filter Hide/Show
	3) Find a Financial Professional popup function

*/
// To avoid conflicts with other libraries.
var $j = jQuery;


// 1) Input Field Instructional Copy Hide/Show: removes the default value onfocus, and adds back if nothing entered 
// 	INPUT: Element's Object
function fieldClear(obj) {
	if(obj.Val) {
		if (obj.value == '') { 
			obj.value = obj.Val;
			obj.Val = null;
			obj.first = null;
		} 
		else {
			obj.Val = null;
		}
	} else if (!obj.first) { 
		obj.Val = obj.value;
		obj.value = ''; 
		obj.first = 'true';
	} 
}
//   These are the input fields it should be applied to:
$j(function(){ $j('#utility_bar .search input[type="text"]').focus(function() { fieldClear(this); }).blur(function() { fieldClear(this); });});
$j(function(){ $j('#termLife .quote_form input[type="text"]').focus(function() { fieldClear(this); }).blur(function() { fieldClear(this); });});


/* 2) Handles Solution Filter Hide/Show */
function filerSolutions (type) {
	switch (type) {
		case 0:
			$j('#slider_results .item:visible').not('.one').fadeOut('fast');
			$j('#slider_results .one').fadeIn('fast');
			break;
		case 1:
			$j('#slider_results .item:visible').not('.two').fadeOut('fast');
			$j('#slider_results .two').fadeIn('fast');
			break;
		case 2:
			$j('#slider_results .item:visible').not('.three').fadeOut('fast');
			$j('#slider_results .three').fadeIn('fast');
			break;
		case 3:
			$j('#slider_results .item').fadeIn('fast');
			break;
	}
}

/* 3) Find a Financial Professional popup function */
function winOpenAgencyLocator(url) {
	contentWinCalculator = window.open(url,"calculator","resizable=yes,toolbar=yes,location=no,width=550,height=650,top=5,left=5,directories=no,status=yes,scroll=yes,scrollbars=yes,menubar=no");
} 
