// zipcode.js

function zipFind(flnm)
{
	var op_flnm = window.open(flnm, "zipfind", "width=510,height=500,scrollbars=yes,resizable=yes,top=100,left=200")
	op_flnm.focus();
}

function setzip(zip, index)
{
	var ziparray = zip.split("_");
	zip = ziparray[0];
    if(index != null)
    {
        window.opener.document.getElementById("cartItem(" + index + ").zip").value = zip;
    }
    else
    {
		var zc = window.opener.document.getElementById("zipCode");
		if(zc!=null)
        	zc.value = zip;
    }
    if(ziparray.length>1 && ziparray[1].length>0 && window.opener.refreshProductPage!=null)
    {
    	var recipientSelect = window.opener.document.getElementById("recipient");
    	if(recipientSelect!=null)
    	{
    		recipientSelect.options[0].value = "$AD_"+ziparray[1];
    		recipientSelect.value = "$AD_"+ziparray[1];
    		window.opener.refreshProductPage(recipientSelect);
    	}
    }
    window.close();
}

function submitForm(city)
{
    if(city)
    {
        document.getElementById("city").value = city;
        document.getElementById("zipCode").value = "";
    }
	document.forms["zipCodeFindForm"].submit();
}
