/** * JS functions for displaying the companies search box. * * @author Rahul * @param url */$(document).ready(function(){	/* Highlight the selected brand */	if($("#companyName").attr("value")){		$("#" + $("#companyName").attr("value") + "Search").css('font-weight', 'bold');	}	else {		if($("#hidCompany").length > 0){			var hidCompany = $("#hidCompany").attr("value");			hidCompany = hidCompany.split('/').join('-');			$("#" + hidCompany + "Search").css('font-weight', 'bold');		}	}	/* Slide the box up/down on the click of arrow */	$("img#downArrow").click(function() {		$('#loginSection').hide();		if($("div#companyList").css('display') == 'none') {			$("div#companyList").slideDown();			return false;		}		else {			$("div#companyList").slideUp();		}	});	/* Slide up the box when the focus comes on Search Text box*/	$("#searchText").focus(function(){		$("div#companyList").slideUp();	});	/* Dynamically set the width for all the childs, this is to avoid handcur in blank area.*/	/*for(var i=0; i < $("div #companyList").children().size(); i++) {		$("div #companyList").children()[i].style.width = ($("div #companyList").children()[i].innerHTML.length) * 6.5 + "px";	}*/	/* The brand when clicked should be highlighted and previous should be made normal,	   the selected ones value should be set in hidden variable, box should slide up.*/	for(var i=0; i < $("div #companyList").children().size(); i++) {		$("div#" + $("div #companyList").children()[i].id).click(function() {			$("div #companyList").children().css('font-weight', 'normal');			$(this).css('font-weight', 'bold');			$("#hidCompany").attr("value", $(this).attr('id').replace('Search', ''));			$("div#companyList").slideUp();		});	}	/* Clicking outside should slide the box up*/	$(document).click(function() {		$('div#companyList').slideUp();	});});
