var acc;

function init()
{
	document.getElementById("hidethis").style.display = '';
	document.getElementById("hidethis1").style.display = 'none';
	document.getElementById("hidethis2").style.display = 'none';
	document.getElementById("State").innerHTML= 'City/State';
	document.getElementById("Business").innerHTML= 'Business Name';
	jQuery.noConflict();
//	acc = new Accordion("left_menu_home_div", "h3", "acc");
}

function init_alt()
{
//	acc = new Accordion("left_menu", "h3", "acc");
	jQuery.noConflict();
}

function submitNewSearch()
{
	zip_c = document.getElementById("new_search_zip").value;
//	window.alert(zip_c);
	window.location = 'listing.html?txt_zip=' + zip_c;
}

function opennewsletter()
{
	emailwindow=dhtmlmodal.open('EmailBox', 'iframe', 'zipfinder.php', 'Zip Code Finder', 'width=460px,height=305px,center=1,resize=0,scrolling=1');
}

function pickZip(zc)
{
	document.getElementById("txt_zip").value=zc;
	emailwindow.hide();
}

function toggle()
{
	if((document.getElementById("hidethis").style.display=='none') && (document.getElementById("hidethis2").style.display== 'none'))
	{
		document.getElementById("hidethis1").style.display = 'none';
		document.getElementById("State").innerHTML= 'City/State';
		document.getElementById("Business").innerHTML= 'Business Name';
		document.getElementById("hidethis").style.display = '';
		document.getElementById("hidethis2").style.display = 'none';
	} else {
		document.getElementById("hidethis").style.display = 'none';
		document.getElementById("txt_city").value = "Enter City/State";
		document.getElementById("State").innerHTML= 'Zip Code';
		document.getElementById("Business").innerHTML= 'Business Name';
		document.getElementById("hidethis1").style.display = '';
		document.getElementById("hidethis2").style.display = 'none';
	}
}

function toggle_business()
{
	if((document.getElementById("hidethis").style.display=='none') && (document.getElementById("hidethis1").style.display== 'none'))
	{
		document.getElementById("hidethis2").style.display = 'none';
		document.getElementById("hidethis1").style.display = 'none';
		document.getElementById("txt_zip").value	= "Enter Zip Code";
		document.getElementById("State").innerHTML = 'City/State';
		document.getElementById("Business").innerHTML= 'Business Name';
		document.getElementById("hidethis").style.display = '';
	} else {
		document.getElementById("hidethis").style.display = 'none';
		document.getElementById("hidethis1").style.display = 'none';
		document.getElementById("txt_business").value = "Enter Business Name";
		document.getElementById("State").innerHTML= 'City/State';
		document.getElementById("Business").innerHTML= 'Zip Code';
		document.getElementById("hidethis2").style.display = '';
	}
}

function validate_city(theform)
{
	if((theform.txt_city.value=='') || (theform.txt_city.value=='Enter City/State'))
	{
		alert("Please Enter City/State!");
		theform.txt_city.focus();
		return false;
	}
	return true;
}

function validate_business(theform)
{
	if((theform.txt_business.value=='') || (theform.txt_business.value=='Enter Business Name'))
	{
		alert("Enter Business Name");
		theform.txt_business.focus();
		return false;
	}
	return true;
}

function emailcheck(str)
{
	if(str == undefined)
	{
		return true;
	}

	var at="@";
	var dot=".";
	var lat=str.indexOf(at);
	var lstr=str.length;
	var ldot=str.indexOf(dot);

	if( lat == -1 || lat == 0 || lat == lstr || ldot == -1 || ldot == 0 || ldot == lstr ||
		(str.indexOf(at,(lat+1))!=-1) || (str.substring(lat-1,lat)==dot) ||
		(str.substring(lat+1,lat+2)==dot) || (str.indexOf(dot,(lat+2))==-1) ||
		(str.indexOf(" ")!=-1) )
	{
		return false;
	}

	return true;
}

