
		  

			var nextHiddenIndex = 1;
			
			//This Function is used for Adding a Text Box at the end of the page
			function AddFileInput()
			{
				ylib_getObj("fileInput" + nextHiddenIndex).style.display = document.all ? "block" : "table-row";
				nextHiddenIndex++;
				if(nextHiddenIndex >= 50) ylib_getObj("attachMoreLink").style.display = "none";
			}
		
			function KeyPress()
			{
				if (event.keyCode == 13) 
				{
					BeginAttach();
				}
			}
		
		
		    function BeginAttach()
		    {
				if(!GoodMailTo())
				{
					document.Attachments.UPL.value = "1";
					// Can't set the target in javascript, we can only clear it! [Bug 6770509]
					// document.Attachments.target = "asynch";
					
					if ( document.Attachments.submit ) 
					{
    					try 
						{
							document.Attachments.submit();												
						}
						catch ( e ) 
						{
							alert( "Invalid file specified . Please try again." );
							return;
						}                   
						document.all.stuff.style.display = "none";
						document.all.globalbuttonbartop.style.display = "none";
						document.all.globalbuttonbarbottom.style.display = "none";
						if (document.all.problem) 
						{
						    document.all.problem.style.display = "none";
						}
						document.all.progress.style.display = "inline";
					}
				}
				else 
				{
					alert ("file Upoaded");
					for (var i=0; i<50; i++)
					{
						var e = document.Attachments["userFile" + i];
						if(e && e.value != "")
						{
							document.all.stuff.style.display = "none";

							// this fixes the addition (width="340")
							// that is part of layout changes to photomail. 
							document.all.firsttd.style.width="100%";

							document.all.ymAttach.style.display = "inline";
							document.all.globalbuttonbartop.style.display = "none";
							document.all.globalbuttonbarbottom.style.display = "none";							
							if (document.all.problem) 
							{
							    document.all.problem.style.display = "none";
							}
							window.setTimeout("FinishAttach()", 100);
							break;
						}
					}
				}
			}
			
		    function FinishAttach()
		    {
				alert ("Finish Attach");
			for (var i = 0; i < 50; i++) 
			{
			    var e = document.Attachments["userFile" + i];
			    if (e && e.value != "") 
				{
					var path = e.value;
					var displayName = GetDisplayName(path);
					if (displayName == "")
					{
						document.Attachments.Prob.value = "BadFile";
						break;
					}
					document.all.ymAttach.AddFile(path, displayName);
					e.disabled = true;
			    }
			}
			
			if (document.Attachments.Prob.value == "") {
			    document.all.ymAttach.Upload();
			    if (document.all.ymAttach.AttData == "") {
				document.Attachments.Prob.value = "NoUpload";
			    }
			    if (document.all.ymAttach.ResultErrorCode != 0) {
				if (document.all.ymAttach.ResultErrorCode & 2) {
				    document.Attachments.Prob.value = "TotalSize";
				}
				else if (document.all.ymAttach.ResultErrorCode & 4) {
				    document.Attachments.Prob.value = "NumFiles";
				}
				else if (document.all.ymAttach.ResultErrorCode & 32) {
				    document.Attachments.Prob.value = "BadFile";
				}
				else if (document.all.ymAttach.ResultErrorCode & 64) {
				    document.Attachments.Prob.value = "FileSize";
				}
				else {
				    document.Attachments.Prob.value = "NoUpload";
				}
			    }
			}
			document.Attachments.AttData.value = document.all.ymAttach.AttData;
			document.Attachments.submit();
		    }
		
		    function Initialize()
		    {
		    }
		
		    function AsynchReady()
		    {
			window.setTimeout("CopyFromAsynch()", 100);
		    }
		
		
		
