function youAreHere() {
	
	if (!document.getElementsByTagName) return false;
	if (!document.getElementById) return false;
	if (!document.getElementById("nav_main")) return false;
	var nav = document.getElementById("nav_main");
	var links = nav.getElementsByTagName("a");
	
	for (var i=0; i<links.length; i++) {
		var linkurl = links[i].getAttribute("href");
		var currenturl = window.location.href;
		if (currenturl.indexOf(linkurl) != -1) {
			links[i].className = "here";
		}
	}

}

/* 
Copyright 2008 by Marco van Hylckama Vlieg

web: http://www.i-marco.nl/weblog/
email: marco@i-marco.nl

Free for non-commercial use

Heavily modified by Chip Cullen
web: http://touchstone.com
*/

function myContactForm()
{

return ('<FORM METHOD = "POST" ACTION = "/cgi-bin/business-mail.pl"><INPUT TYPE=HIDDEN NAME="Recipient" VALUE="customer-service@business.gov"><table align="center" class="contact-us"><tr><td><table><tr><td><table border="0" cellSpacing=7 cellPadding=0 align="left"><tr><th align="left" class="label">First Name:</th><th align="left" class="label">Last Name:</th></tr><tr><td align="left"><input type="text" name="First_Name" value="" maxlength="32" size="28"></td><td align="left"><input type="text" name="Last_Name" value="" maxlength="256" size="28"></td></tr><tr><td align="left"></td><td align="left"></td></tr><tr><th align="left" class="label">*Your Email Address:</th><th align="left" class="label">*Zip Code</th></tr><tr><td align="left"><input type="text" name="Sender_mandatory" value="" maxlength="256" size="28"></td><td align="left"><input type="text" name="Zip" value="" maxlength="5" size="5"></td></tr></table></td></tr><tr><td colspan="2"><table border="0" cellSpacing=7 cellPadding=0 align="left"><tr><td align="left"></td></tr><tr><th align="left" class="label">*Subject:</th></tr><tr><td align="left"><select name="Subject"><option value="0">Select</option><option value="Broken Link">Broken Link</option><option value="Cannot Find Information (Need Additional Help)">Cannot Find Information (Need Additional Help)</option><option value="Incorrect Information">Incorrect Information</option><option value="General Comments about the Site">General Comments about the Site</option><option value="Other">Other</option></select></td></tr><tr><td align="left"></td></tr><tr><th align="left" class="label">*Comment:</th></tr><tr><td align="left"><textarea name="Comments" rows="10" cols="50"></textarea></td></tr><tr><th align="left"><input type="submit" class="bgButtonDark" value="Submit your comment "></th></tr></table></td></tr></table></td></tr></table></center></form>');

}

function myPermitMeForm()
{
var tagName = "PermitMe";
var center2Text = "Center 2 - Home";
var quotes = "''";
return ('<div id="permitme"><h3 id="pmTitle">Find Licenses and Permits</h3><form class="permit" name="permitMeForm" action="http://search.business.gov/permitme.do" method="get"><h4>Enter City &amp; State or Zip Code:</h4><input class="address" id="pmAddress" name="pmAddress" onfocus="this.value='+quotes+';" /><h4>Choose:</h4><select name="pmType" id="pmType" size="1"><option value="0">Business Type</option><option value="General Licensing">General Licensing</option><option value="Auto Dealership">Auto Dealership</option><option value="Barber Shop">Barber Shop</option><option value="Beauty Salon">Beauty Salon</option><option value="Child Care Services">Child Care Services</option><option value="Construction Contractor">Construction Contractor</option><option value="Debt Collection Agency">Debt Collection Agency</option><option value="Electrician">Electrician</option><option value="Massage Therapist">Massage Therapist</option><option value="Plumber">Plumber</option><option value="Restaurant">Restaurant</option></select><input type="submit" value="Search" class="pmButton" onclick="cmCreatePageElementTag('+tagName+','+center2Text+');return validate(permitMeForm);" /></form></div><!-- end #permitme -->');

}

function myPermitMeSq() 
{
return ('<div id="permitme_sq"><form class="permit" name="permitMeForm" action="http://search.business.gov/permitme.do" method="get"><h3 id="pmTitle">Find Business Licenses &amp; Permits</h3><h4 class="label">Enter City/State OR Zip Code:</h4><input type="text" value="" class="address" id="pmAddress" name="pmAddress" /><br /><h4 class="label">Choose Type:</h4><select name="pmType" id="pmType" size="1"><option value="0">Business Type</option><option value="General Licensing" selected="true">General Licensing</option><option value="Auto Dealership">Auto Dealership</option><option value="Barber Shop">Barber Shop</option><option value="Beauty Salon">Beauty Salon</option><option value="Child Care Services">Child Care Service</option><option value="Construction Contractor">Construction Contractor</option><option value="Debt Collection Agency">Debt Collection Agency</option><option value="Electrician">Electrician</option><option value="Massage Therapist">Massage Therapist</option><option value="Plumber">Plumber</option><option value="Restaurant">Restaurant</option></select><br /><input type="submit" value="Search" class="pmButton" /></form></div>');
}

function submitPermitMe(){
    var bizAddress=document.getElementById("pmAddress").value;
    var bizType=document.getElementById("pmType").options[document.getElementById("pmType").selectedIndex].value;
    if (bizAddress=="") {
        alert("Please enter address for Permit Information!");
        document.permitForm.pmState.focus();
	}
	else if (bizAddress=="City & State") {
		alert("Please enter address for Permit Information!");
        document.permitForm.pmState.focus();
    }
	else if(bizType=="0"){
        alert("Please choose a Business Type for Permit Information!");
        document.permitForm.pmType.focus();
    }
    else{            
        document.permitForm.action="/permitme/";
        document.permitForm.submit();
    }
}

function stateGo(){
	var stateSelect = document.select_state_form.select_state.value;
	window.open(stateSelect , '_self');

}




 jQuery.noConflict();

(function($) {           



function initMenus() {


	$('ul.menu ul').hide();
	
	$('a.here').parents('li').children('ul').show();
		
	$('ul.menu > li:has(a.here)').children('a').addClass('open');
	
	$('ul.menu > li > a').click(
		function() {
			var checkElement = $(this).next();
			var parent = this.parentNode.parentNode.id;
					
			$('a.open').removeClass('open');
			$(this).addClass('open');
			
			
			//default action - collapses list
			if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
				if($('#' + parent).hasClass('collapsible')) {
					$('#' + parent + ' ul:visible').slideUp('normal');
					$('a.open').removeClass('open');
				}
				return false;
			}
							
				// level 2 - checks for here state
				if($('a.here').parents('ul').attr('id') == checkElement.attr('id'))
				{
					$('#' + parent + ' ul:visible').slideUp('normal');
					checkElement.slideDown('normal');
					$('a.here').parents('ul').show();
					$('a.here').parents('li').children('ul').show();
					return false;
	
				}
				// level 3 - checks for here state
				if($('a.here').parents('ul').parents('ul').attr('id') == checkElement.attr('id'))
				{
					$('#' + parent + ' ul:visible').slideUp('normal');
					checkElement.slideDown('normal');
					$('a.here').parents('ul').show();
					$('a.here').parents('li').children('ul').show();
					return false;

				}		
				// level 4 - checks for here state
				if($('a.here').parents('ul').parents('ul').parents('ul').attr('id') == checkElement.attr('id'))
				{
					$('#' + parent + ' ul:visible').slideUp('normal');
					checkElement.slideDown('normal');
					$('a.here').parents('ul').show();
					$('a.here').parents('li').children('ul').show();
					return false;
				}
					
					// non-here menu sections		
			if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
				$('#' + parent + ' ul:visible').slideUp('normal');
				checkElement.slideDown('normal');
				return false;
			}					
		}
	);
	

$('ul.menu ul').hide();
$('a.open').removeClass('open');
}

$(document).ready(function() {initMenus();});
$(document).ready(function() {youAreHere();});
	


})(jQuery);