		Event.addBehavior({			
				// Step 1 - Username	
				'textarea#tags:keyup': function()
				{
					dom.checkTags();
				},
				'textarea#dialogue:keyup': function()
				{
					dom.checkDialogue();
				},
				'input#submit-tags:click': function()
				{
					dom.submitTags();	
				}
		 });
		
		dom = {
			checkTags:function() {
				 new Ajax.Updater('tagsLoader','ajax.php',
								  {parameters: {action:'tags.validate',tags:$('tags').value, strip:$('strip').value }});
			},
			checkDialogue:function() {
				 new Ajax.Updater('tagsLoader','ajax.php',
								  {parameters: {action:'dialogue.validate',dialogue:$('dialogue').value, strip:$('strip').value }});
			},
			submitTags:function() {
				$('tagsLoader').update('<img src="../IMAGES/loading.gif" border="0">');
				//build quick tags
				var quick_tags = '';
				for(i=0;i<$('form_tags').quickTag.length;i++) {
					if($('form_tags').quickTag[i].checked) {
						quick_tags += $('form_tags').quickTag[i].value + ';';	
					}
				}				 
				 new Ajax.Updater('tagsLoader','ajax.php',
						{   				
							parameters: {action:'tags.submit',dialogue:$('dialogue').value,tags:$('tags').value, quickTags:quick_tags, strip:$('strip').value },
							onSuccess: function(t) {   								  
								 var output = t.responseText || 'Error';	
								 if(output == 1) {
									$('tagsForm').update('<strong>Thank You</strong>, your tags have been submitted!. <br/>To continue tagging, please click on the "Next" and "Previous" links just above the comic strip'); 
								 }
								  
							},
							onLoaded: function() {
								$('tagsLoader').update(''); 							
								
							},
							onFailure: function() { alert('Error'); } 
						}
					 ); 
			},
			
			reportTags:function() {
				
				//build quick tags
				var reported_tags = '';
				var total_tags = 0;
				for(i=0;i<$('form_tags').tag_entry.length;i++) {
					if($('form_tags').tag_entry[i].checked) {
						total_tags++;
						reported_tags += $('form_tags').tag_entry[i].value + ';';	
					}
				}				 
				
				if(total_tags == 0) {
					alert('Please select the tags you consider inappropiate');
					return false;
				}
				$('tagsReportLoader').update('<img src="../IMAGES/loading.gif" border="0">');
				 new Ajax.Updater('tagsReportLoader','ajax.php',
						{   				
							parameters: {action:'tags_report.submit',tag_entries:reported_tags, strip:$('strip').value },
							onSuccess: function(t) {   								  
								 var output = t.responseText || 'Error';	
								 if(output == 1) {
									$('tagsReport').update('<strong>Thank You</strong>, '+total_tags+' tag(s) have been reported'); 
								 }
								  
							},
							onLoaded: function() {
								$('tagsReportLoader').update(''); 							
								
							},
							onFailure: function() { alert('Error'); } 
						}
					 ); 
			}
		}
		
		// Other functions
		function clearBoxes(form) {
			var theForm = $(form);
			for(i=0;i<theForm.length;i++) {
				if($(form).elements[i].type == 'checkbox') {
					$(form).elements[i].checked = false;
				}
			}
		}
		
		function popUp(theURL, Name, popW, popH, scroll) { 
			var winleft = (screen.width - popW) / 2;
			var winUp = (screen.height - popH) / 2;
			winProp = 'width='+popW+',height='+popH+',left='+winleft+',top='+winUp+',scrollbars='+scroll+',resizable';
			Win = window.open(theURL, Name, winProp);
			if (parseInt(navigator.appVersion) >= 4) { Win.window.focus(); }
		}
