function changeDisplay(id, value)
{
	var q = document.getElementById('q'+id);
	var a = document.getElementById('a'+id);

	if (value) {
		q.style.display = 'block';
		a.style.display = 'block';
	} else {
		q.style.display = 'none';
		a.style.display = 'none';
	}
}


function displayField(dest_id, src_id, cond_value)
{
	src_fld = document.getElementById(src_id);
	dest_fld = document.getElementById(dest_id);
	if (src_fld[src_fld.selectedIndex].value == cond_value) {
		dest_fld.style.display = 'inline';
	} else {
		dest_fld.style.display = 'none';
	}
}


function selectPrimaryFont()
{
	font_1 = document.getElementById('font_1');
	font_2 = document.getElementById('font_2');
	if (font_1[font_1.selectedIndex].value == "") {
		font_2.selectedIndex = 0;
		changeDisplay(9, false);
	} else {
		changeDisplay(9, true);
	}
}


function openColorChart(select_id)
{
	window.open("colorchart.php?parent_id="+select_id, "color_window", "status=0, toolbar=0, location=0, menubar=0, directories=0, resizable=1, scrollbars=1, height=500, width=350");
	return false;
}
function openFontChart(select_id)
{
	window.open("viewfonts.php?parent_id="+select_id, "color_window", "status=0, toolbar=0, location=0, menubar=0, directories=0, resizable=1, scrollbars=1, height=560, width=520");
	return false;
}


function refactorSize(radioObj)
{
	width = document.getElementById('width');
	height = document.getElementById('height');
	if (radioObj.value == 'Other') {
		width.disabled = false;
		height.disabled = false;
		width.focus();
	} else {
		width.disabled = true;
		height.disabled = true;
	}
}
function checkMenuStyle()
{
    radio = document.getElementById('csds');
    fld = document.getElementById('menu_text_2');
    if (radio.checked) {
        changeDisplay(6, true);
    } else {
        changeDisplay(6, false);
    }
}


function checkCountry()
{
	var field = document.getElementById('country');
	var id = field.selectedIndex;
	var country = field[id].value;

	var state = document.getElementById('state');
	if (country == 'U.S.A.') {
		state.selectedIndex = 1;
	} else if (country == 'Canada') {
		state.selectedIndex = 52;
	} else if (country == 'United Kingdom') {
		state.selectedIndex = 65;
	} else {
		state.selectedIndex = 0;
	}
}


function checkState()
{
	var index = document.getElementById('state').selectedIndex;
	var country = document.getElementById('country');
	if ((index >= 1) && (index <= 51)) {
		country.selectedIndex = 188;
	} else if ((index >= 52) && (index <= 64)) {
		country.selectedIndex = 35;
	} else if ((index >= 65) && (index <= 68)) {
		country.selectedIndex = 193;
	}
}