// assumes email_check.js has been called
function GoIFrame(loc){IFRAME.location.replace(loc)}
function getObj(ID){ return document.getElementById(ID)}
function CompClose(){getObj('DIV_COMPANY').className='HIDE'}
function CompAdd(){
	myURL="/comsite5/bin/goliath_tt_home_page.pl?template=2_column_layout_search&page=goliath_addcomp_form&gsp=1"
	window.open(myURL,"COMPANY_ADD","status=1,location=0,scrollbars=1,width=790,height=500")
}
function CompEdit(acc_num){
	COMP=getObj('DIV_COMPANY')
	center=document.body.clientWidth / 2
	COMP.style.left=center - 184
	COMP.className='SHOW'
	myURL="/comsite5/bin/goliath_tt_home_page.pl?template=empty_layout&page=goliath_IFRAME_editcomp_form&gsp=1&accession_number="+acc_num;
	GoIFrame(myURL)
}

comp_fields="error_type,company_name,contact_name,phone_number,email,description"
comp_names="Error Type,Company Name,Your Name,Your Phone Number,Your Email Address,Error Description"
function CompSubmit(){
	F=document.CompUpdate; SubmitOK=1
	c_arr=comp_fields.split(',');
	comp_names_arr=comp_names.split(',')
	for (x=0; x < c_arr.length; x++){
		myfield=eval("F."+c_arr[x]); //alert(myfield)
		if (c_arr[x] == 'email'){ if (!emailCheck(myfield.value)) {SubmitOK=0;}}
		else if (myfield.value==''){
			alert('You must fill in ' + comp_names_arr[x] + "."); myfield.focus(); SubmitOK=0;
			return false
		}
	}
	if (SubmitOK){F.submit()}

}
