//c2c.js

function affiliates()
{
var s = document.forms.Zip.ZIP.value;
return showAffiliates(s)
}

function showAffiliates(s)
{
if(s == "none")
	{
	alert("No city selected");
	return false;
	}
if(s.length != 5)
	{
	alert("Zip codes must be five digits");
	return false;
	}
for(var i = 0; i < 5; i++)
	if(s.charAt(i) < '0' || s.charAt(i) > '9')
		{
		alert("Zip codes must be all digits");
		return false;
		}
countWindow();
var NewWindow = window.open("afframe.php?" + s, "_blank",  "resizable=yes,scrollbars=yes,width=700");
return true;
}

function countWindow()
{
var NewWindow = window.open("newAd.php", "_blank",  "resizable=no,scrollbars=no,width=100 height=50 status=no titlebar=no toolbar=no");
}

function details(c)
{
var NewWindow = window.open("details.php?" + c, "_blank",  "resizable=yes,scrollbars=yes,width=350");
}

function firstSlot()
{
domlay("P6",0);
domlay("P1",-1,-1,-1,1);
domlay("P2",-1,-1,-1,2);
domlay("P3",-1,-1,-1,2);
domlay("P4",-1,-1,-1,2);
domlay("P5",-1,-1,-1,2);
}

function getCities()
{
var c = document.forms.stateForm.stateSelect.value;
document.location = "getCity.php?" + c;
}

function loadCity()
{
domlay("P1",1,-1,-1,1);
domlay("P2",0,-1,-1,2);
domlay("P3",1,-1,-1,2);
domlay("P4",0,-1,-1,2);
domlay("P5",1,-1,-1,2);
}

function citySubmit()
{
var c = document.forms.stateForm.selectCity.value;
return showAffiliates(c)
}

function sMode()
{
for (counter = 0; counter < document.forms.selectMode.R1.length; counter++)
    {
    if (document.forms.selectMode.R1[counter].checked)
        break; 
    }
if(document.forms.selectMode.R1[counter].value == "Zip")
    {
    domlay("P4", 0);
    domlay("P2", 1);
    document.forms.Zip.ZIP.focus();
    }
else
    {
    domlay("P4", 0);
    domlay("P5", 1);
    }
}
