top.jasubmit_array = new Array();

top.jasubmit = function()
{
   this.value = '';
   this.controlvalue = top.generic_con;
   this.edited = false;
   this.tohandle = '';
}

top.jasubmit.prototype.init = function(){}

top.jasubmit.prototype.gethiddens = function()
{
   	var temp = '';
   	temp += top.maindoc['jainfo0'].type.gethiddens();
	
	for(var i = 0; i <= top.address; i++)
	{   
		temp += top.maindoc['jaadd' + i].type.gethiddens();
   	}

	for(var i = 0; i <= top.general; i++)
	{
		temp += top.maindoc['jagen' + i].type.gethiddens();
	}
   
	return temp;
}

top.jasubmit.prototype.sethiddens = function()
{
  	var temp = '';
	var tf = top.mainwindow.document.form1;
  	temp += top.maindoc['jainfo0'].type.sethiddens();
	
	for(var i = 0; i <= top.address; i++)
	{   
		temp += top.maindoc['jaadd' + i].type.sethiddens();
  	}

	for(var i = 0; i <= top.general; i++)
	{
		temp += top.maindoc['jagen' + i].type.sethiddens();
	}
 
   tf['property_no'].value = top.property_no;
   tf['actiontype'].value = 'submit_profile';
}

top.jasubmit.prototype.preoutput = function()
{
	this.value='';

   var header_style = '<html><head><title></title><link REL=stylesheet HREF="' + top.domain + top.page_jasubmit.stylesheet + '" TYPE="text/css">';
   var header_no_style = '<html><head><title></title>';

   if(!top.page_jasubmit.stylesheet)
   {       
   	this.value += header_no_style;
   }
   else
   {
  		this.value += header_style;
   }

	//var newsletter_request = '<br><br><tr><td align="center" class="text-11"> Do you currently receive the alumni newsletter?<INPUT NAME="nondb_answer_0" TYPE=radio VALUE="yes" checked>Yes <INPUT NAME="nondb_answer_0" TYPE=radio VALUE="no">No <INPUT TYPE=hidden name="nondb_question_0" value="Do you currently like to recieve the alumni newsletter?"></td></tr>'

	var html0 = '<input type="hidden" name="property_no" value=""><br>';
	var html1 = '<input type="hidden" name="actiontype" value=""><br>';
	var html2 = '<input type="hidden" name="jainfo_0_contact_type" value=""><br>';
	var html3 = '<input type="hidden" name="jainfo_0_group" value=""><br>';

  	if(top.maindoc.jasubmit0.previous)
	{
  		this.value += top.header + top.jasubmit_text2 + this.gethiddens() + html0 + html1 + top.jasubmit_text1  +  top.footer;
  	}else
	{
  		this.value += top.header + top.jasubmit_text3 + top.footer;
  	}
}

top.jasubmit.prototype.output = function()
{
	var tf = top.mainwindow.document.form1;
  	var citem = this;
  	if(tf.sbutton)
	{
  		tf.sbutton.onclick = function(){citem.dosubmit();}
  		this.sethiddens();
  	}
}

top.jasubmit.prototype.dosubmit = function()
{
  	if(top.loading)
	{
 		return;
  	}
   
	var tf = top.mainwindow.document.form1; 
  	tf.action = '/cgi-bin/alumni_submit.cgi';
  	tf.encoding = 'multipart/form-data';
  	tf.method = 'post';
  	tf.target = '_top';
  	tf.actiontype.value = 'submit_profile';
  	top.loading = true;
  	tf.sbutton.value = 'Saving';
  	this.tohandle = top.setTimeout("top.maindoc.jasubmit" + this.index + ".type.timeouterror();",60000);
  	tf.submit();
}

top.jasubmit.prototype.timeouterror = function()
{
  	var tf = top.mainwindow.document.form1; 
  	if (navigator.appName.indexOf("Microsoft") != -1) 
	{
  		top.buffer.location = "/scatico/html/empty.html";
  	}else
	{
  		top.stop();
  	}
   
	tf.sbutton.value = 'Submit';
  	alert('In attempting to submit your application there was a network error. Please check your network connection and try again.');
  	top.loading = false;
}

top.jasubmit.prototype.dosuccess = function()
{
  	top.clearTimeout(this.tohandle);
  	top.loading = false;
  	top.maindoc.jasubmit0.previous = '';
  	top.maindoc.jasubmit0.output();
}

