top.jaview_array = new Array();

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

top.jaview.prototype.init = function()
{
   this.index = top.jaview_array.length;
   top.jaview_array[this.index] = '';
}

top.jaview.prototype.output = function(){}

top.jaview.prototype.leave = function()
{
	this.value='';
}

top.jaview.prototype.preoutput = function()
{
   var header_style = '<html><head><title></title><link REL=stylesheet HREF="' +top.domain + top.page_jaview.stylesheet + '" TYPE="text/css">';
   var header_no_style = '<html><head><title></title>';

   if(this.value){return;}

   var tp = top.person;
   var ti = top['page_jainfo'];
  	var html = '';

   	html += '<b>Name:</B> ' + tp.first + ' ' + tp.middle + ' ' + tp.last ;

   if(top.firstmaiden != null)
	{
		if(tp.maiden)
   	{					
      		html += '<br><b>' +  ti.field_array[top.firstmaiden].name.substring(0,11) + '</b> ' + tp.maiden +'<br>';
   	}
	} 

   	html += '<p>';
 
	if(top.spouse)
	{
   		if(tp.sname || tp.slast)
   		{
      			html += '<b>Spouse Name:</b> ' + tp.sname + ' ' + tp.slast + ' ' + tp.smiddle; 
   		}  

   		if(tp.smaiden)
   		{
      			html += '<br><b>Spouse Maiden:</b> ' + tp.smaiden;
   		}
	}

	html+='<p>';

	if(top.address != null)
	{
		for(var i = 0; i <= top.address; i++)
		{
			var ta = top['page_jaadd' + i].field_array[0];
		
			if (tp.address_array[i].address1)
   			{
				html += '<b>' + ta.name + ' Address: </B><BR>' + tp.address_array[i].address1 + '<BR>';
      				if (tp.address_array[i].address2)
      				{
         				html += tp.address_array[i].address2 + '<BR>';
      				}
      				html += tp.address_array[i].city + ', ';
      				html += tp.address_array[i].state + ' ' + tp.address_array[i].zip + ' ' + tp.address_array[i].country;
      				html += '<p>';
   			}
		}
	}


	for(var i = 0; i <= top.general; i++)
	{
		var done = 'true';
		var not_done = true;
		var email_number = 0;
		var phone_number = 0;
	
		var gen_page = 'jagen' + i;
		var gen_page_profile = 'page_jagen' + i;
	
		for(var x = 0; x < top[gen_page_profile].field_index ; x++)
		{
			if(top[gen_page_profile].field_array[x].value == 'email')
			{
				if(tp.email_array[email_number])
				{	
					var email_name = top[gen_page_profile].field_array[x].name;
				
					html += '<b>' + email_name + ' Email: </B><BR>' + tp.email_array[email_number] + '<p>';
				}			
	
				email_number++;	
			}
			
			if(email_number == 2 && not_done)
         {
         	not_done=false;
	     		html+='</td><td valign="top"  width="341">&nbsp;';
			}

			if(top[gen_page_profile].field_array[x].value == 'homepage')
			{	
				if(tp.homepage)
				{			
					html += '<b>HomePage:</b><br>' + tp.homepage + '<p>';  
				}
			}

			if(top[gen_page_profile].field_array[x].value == 'phone')
			{
				var phone_entered = '';
		
				for(var w = 0; w < top.person.phone_array.length; w++)
				{
					if(tp.phone_array[w])
					{
						phone_entered = 'true';
					}
				}
		
				if(phone_entered && done)
				{
					done = '';
					html += '<b>Phone Numbers:</B>';
				}		

				if(tp.phone_array[phone_number])
				{
					var phone_name = top[gen_page_profile].field_array[x].name;
						
					html += '<BR>' + phone_name + ': '  + tp.phone_array[phone_number];
				}
				
				phone_number++;
			}

			if(top[gen_page_profile].field_array[x].value == 'year')
			{
   				if(tp.firstyear)
				{
					html+= '<p><b>First Year Attended Camp:</b> ' + tp.firstyear; 
   				}
		
				if(tp.lastyear)
				{
					html+= '<br><b>Last Year Attended Camp:</b> ' + tp.lastyear + '<p>';
				}
			}	   	
			
			if(top[gen_page_profile].field_array[x].value == 'season')
			{
				var season_name = top[gen_page_profile].field_array[x].name;
				
				if(tp.season)
				{	
   					html+= '<b>' + season_name  +':</b> ' + tp.season + '<br><p>'; 
				}
			}
			
			if(top[gen_page_profile].field_array[x].value == 'friend')
   			{ 
      				if(tp.friend_array_ans[0])
				{
					html+= '<b>Camp Memories: </b> ' + tp.friend_array_ans[0] + '<br><p>';
				}
	
				if(tp.friend_array_ans[1])
				{
       					html+= '<b>Long Lost Friends: </b> ' + tp.friend_array_ans[1] + '<br><p>';
   				}
			}
			
			if(top[gen_page_profile].field_array[x].value == 'comment')
   			{ 
				var comment_name = top[gen_page_profile].field_array[x].name;

       				if(tp.comment)
				{
					html+= '<b>' + comment_name + ':</b> ' + tp.comment + '<br><p>';
   				}
			}

			if(top[gen_page_profile].field_array[x].value == 'customtext1')
			{
				var customtext1_name = top[gen_page_profile].field_array[x].name;
				
				if(tp.customtext1)
				{
					html+= '<b>' + customtext1_name + ':</b> ' + tp.customtext1 + '<br><p>';
				}
			}
			
			if(top[gen_page_profile].field_array[x].value == 'customtext2')
			{
				var customtext2_name = top[gen_page_profile].field_array[x].name;
				
				if(tp.customtext2)
				{
					html+= '<b>' + customtext2_name + ':</b> ' + tp.customtext2 + '<br><p>';
				}
			}
		}
	}

        if(!top.page_jaview.stylesheet)
        {
                this.value += header_no_style;
        }
        else
        {
                this.value += header_style;
        }
	
        this.value += top.jaview_text1 + html + top.jaview_text2;
}

top.jaview.prototype.getedate = function()
{
   var tg = top.jagen_array[this.index];
   return tg.emonth + '/' + tg.eday + '/' + (tg.eyear - 1 + tyear);
}


