var popupWindow=null;

function countryInfoSubmit(){
	f = document.countryinfo
	fc = f.country
	k = fc.selectedIndex
	sectVal = sectionVal()
	if (isValid(k,sectVal)){
		if(popupWindow!=null){
		    popupWindow.close();
		}
		popupWindow=window.open(buildQuery(fc.options[k].value,sectVal), 'Country', 'width=660,height=500,resizable=yes,scrollbars=yes');
	    popupWindow.focus();
	}else{return
	}
}


function submit(){
	f = document.countryinfo
	fc = f.country
	k = fc.selectedIndex
	sectVal = sectionVal()
	if (isValid(k,sectVal)){
		if(popupWindow!=null){
		    popupWindow.close();
		}
		popupWindow=window.open(buildQuery(fc.options[k].value,sectVal), 'Country', 'width=660,height=500,resizable=yes,scrollbars=yes');
	    popupWindow.focus();
	}else{return
	}
}


function sectionVal(){
	for (i=0;i < f.section.length;i++){
		if (f.section[i].checked){
			return f.section[i].value}
	}
	return "0"
}

function isValid(i,j){
	msgA = "Please select a country"
	msgB = "Please select a section"
	if (i=="0"){
		alert(msgA)
		return false
	}else if (j=="0"){
		alert(msgB)
		return false
	}
	return true
}
function buildQuery(country,section){
query = "http://www.timaticweb.com/cgi-bin/tim_website_client.cgi?FullText=1&COUNTRY="+country+
	"&SECTION="+section+"&user=QF&subuser=QANTAS"
return query
}

