function searchText() {
	if (document.getElementById('searchInput').value == "Search") {
		document.getElementById('searchInput').value = "";
	} else if (document.getElementById('searchInput').value == "") {
		document.getElementById('searchInput').value = "Search";
	}
}


function searchButtonClicked() {
	searchinput = document.getElementById('searchInput');
	query = searchinput.value == 'Search' ? '' : searchinput.value;
	
	document.getElementById('hiddenfield1').value = query;
	document.getElementById('hiddenfield2').value = query;
	document.getElementById('hiddenfield3').value = query;
}

// Show and Hide Div Script
function display(elementID){
    nodeItem = elementID.parentNode.nextSibling;
	
    while(nodeItem.innerHTML == null || nodeItem.innerHTML == ""){
        nodeItem = nodeItem.nextSibling;
    }
	
	$(nodeItem).slideToggle('normal');
}

function IsNumeric(inputString)
{
	var validChars = "0123456789";
	
	for (i = 0; i < inputString.length; i++)
	{
		if (validChars.indexOf(inputString.charAt(i)) < 0)
		{
			return false;
		}
	}	
	return inputString.length == 0 ? false : true;
}

$(document).ready(function(){
	$('.toggleContent').hide();
	$('.toggleLink').click(function(){
		$(this).nextAll('#secLeftCol .toggleContent').slice(0,1).slideToggle();
	});
	
	$('a').click(function(){
		var loc = "";
		if			($(this).parents().is("#header")) { loc = "Head"; }
		else if 	($(this).parents().is("#menu")) { loc = "Top"; }
		else if 	($(this).parents().is(".blueBreadCrumb")) { loc = "Bread"; }
		else if 	($(this).parents().is("#mainLeftCol") && !$(this).parents().is("#rotatingPanel")) { loc = "HomeMainL"; }
		else if 	($(this).parents().is("#mainLeftCol") && $(this).parents().is("#rotatingPanel")) { loc = "HomeRotate"; }
		else if 	($(this).parents().is("#mainRightCol")) { loc = "HomeMainR"; }
		else if 	($(this).parents().is("#lowerLeftCol")) { loc = "HomeFeat"; }
		else if 	($(this).parents().is("#lowerRightCol")) { loc = "HomeLowR"; }
		else if 	($(this).parents().is("#footer")) { loc = "Foot"; }
		else if 	($(this).parents().is("#secLeftCol") && !$(this).parents().is(".quotePageBox, .quotePageBoxR")) { loc = "ContBod"; }
		else if 	($(this).parents().is("#secLeftCol") && $(this).parents().is(".quotePageBox, .quotePageBoxR")) { loc = "ContMainFrm"; }
		else if 	($(this).parents().is("#secRightCol")) { loc = "ContMargin"; }
		$.cookie('browse1', loc, { expires: 30, path: '/', domain: '', secure: false });
		$.cookie('browse2', window.location.pathname, { expires: 30, path: '/', domain: '', secure: false });
	});
});
