function help(num)
{
    var message = new Array();
    // General
    message[0]  = "Help goes here.";
    message[1]  = "This is a required field.";
    message[2]  = "This is an optional field.";
    message[3]  = "This is your e-mail address.";
    message[4]  = "This is your telephone number.\nArea code first.";
    message[5]  = "This is any comments you want to be stored about this person.";
    message[6]  = "By clicking on this link, you will be able to download\nyour search result in a nicely formated text file.";
    message[7]  = "By clicking on this link, you will be able to download\nyour search result in a file where all fields are\nseparated by a coma.\n\nThis is useful when importing the data in a speadsheet.";

    // Login
    message[10] = "This is your UserID.";
    message[11] = "This is your password.";
    
    // Edit Pages
    message[15] = "This is the list of pages available for edition.\nPlease select one from the list.";
    
    // New Login
    message[20] = "This is your first name.";
    message[21] = "This is your last name.";
    message[22] = "This is your comapny name.\nIt is an optional field.";
    message[23] = "This is your job title.\nIt is an optional field.";
    message[24] = "This is the first line of your address.";
    message[25] = "This is the second line of your address.\nIt is an optional field.";
    message[26] = "This is the third line of your address.\nIt is an optional field.";
    message[27] = "This is your city name.";
    message[28] = "This is your state or province name.";
    message[29] = "This is your zip or postal code.";
    message[30] = "This is your country name.";
    message[31] = "This is your work telephone number.\nArea code first.";
    message[32] = "This is your home telephone number.\nArea code first.\nIt is an optional field.";
    message[33] = "This is your cellular telephone number.\nArea code first.\nIt is an optional field.";
    message[34] = "This is your fax number.\nArea code first.\nIt is an optional field.";
    message[35] = "This is your social security number without any ponctuation.";
    message[36] = "This is your date of birth.\nFirst 2 digits for the month.\nThird and fourth digits for the day.\nLast 4 digits for the year.";
    message[37] = "This is your e-mail address.";
    message[38] = "This is your password.\nPlease be creative. Use a combination of letters, numbers and ponctuations.";
    message[39] = "This is your password again.\nBoth password fields have to match.";
    message[40] = "This is your UserID.\nThis will be used to enter restricted part of the website.\nWe suggest to make the userid the same as your e-mail address.";
    message[41] = "This is your sms paging number.\nSMS stands for 'Short Message Service'.\nIt represents how to reach you by sending a\ntext message to your cellphone, your pager or your PDA.\nIt normally looks like an e-mail address.\nIt is an optional field.";

    // Exhibitor
    message[50] = "This is the company name.";
    message[51] = "This is the first line of the address of the company.\nIt is an optional field.";
    message[52] = "This is the second line of the address of the company.\nIt is an optional field.";
    message[53] = "This is the third line of the address of the company.\nIt is an optional field.";
    message[54] = "This is the city of the company.\nIt is an optional field.";
    message[55] = "This is the state or province of the company.\nIt is an optional field.";
    message[56] = "This is the zip or postal code of the company.\nIt is an optional field.";
    message[57] = "This is the country of the company.\nIt is an optional field.";
    message[58] = "This is the telephone number of the company.\nArea code first.\nIt is an optional field.";
    message[59] = "This is the fax number of the company.\nArea code first.\nIt is an optional field.";
    message[60] = "This is the e-mail address of the company.\nIt is an optional field.";
    message[61] = "This is the company URL.\nThe URL should be like 'http://www.comapny_name.com'.";
    message[62] = "This is the text description of the company.\nOnly the first 250 words will be used.\nThis description will be shown on the website exhibitors page.";
    message[63] = "This is what booth you want to assign to your company.\nThe list shows all unasigned booths.\nIf you're not interested in a booth,\nplease select the 'NO BOOTH NEEDED' option.";
    message[64] = "This is what the company wants to sponsor.\nThe list shows all unsponsored events.\nIf you're not interested in sponsoring an event,\nplease select the 'NOT INTERESTED' option.";
    message[65] = "This is the company advertising banner URLs.\nEnter one URL on each line. Each image URL should be a complete URL\n(http://www.yoursite.com/images/ad1.gif) and must be 468 pixels wide and 60 pixels tall.";
    message[66] = "This is the company advertising banner alternate text.\nEnter one ALT text string on each line. There must be one line for each image listed above.\nThis text will be shown to users when their mouse is placed over your advertising banner.";
    message[67] = "This is the company advertising banner click-through URLs.\nEnter one URL on each line. There must be one line for each image listed above.\nThe user will be taken to these URLs when they click on your advertising banner.";

    // Payment
    message[80] = "This is the payment method.\nPlease select one from the list.\nIf you choose to pay by check, all other payment fields are not required.";
    message[81] = "This is the credit card number.\nPlease enter the credit card number without spaces.";
    message[82] = "This is name on the credit card number.\nPlease enter the name as it appears on the the credit card.";
    message[83] = "This is the credit card number expiry date.\nPlease enter the expiry date as it appears on the credit card.";
    message[84] = "This is the payment status.";
    message[85] = "This is the payment method.";
    message[86] = "This is the payment authorization code.";
    message[87] = "This is comments you have regarding this payment.";
    
    // Proceedings
    message[90] = "This is the list of available proceedings from present and previous conferences."; 
    
    // Paper
    message[100] = "This is the event for which the presentation will be used for."; 
    message[101] = "This is the filename fo the presentation.\nThis file has to be in a Microsoft PowerPoint format (.ppt).\nBy using the browse button, you will be able to select the file from your computer."; 
    message[102] = "This is the co-author's names for this abstract.\nPlease list the co-authors, if any, separated by commas.\nIt is an optional field.";
    message[103] = "This is the category for this abstract.";
    message[104] = "This is the title of this abstract.";
    message[105] = "This is the keywords for this abstract.\nOnly the first 255 characters will be used. Put spaces between key words.\nThese keywords will be used by others to bring up your abstract based on the results of a keyword search.\nIt is an optional field.";
    message[106] = "This is the summary of this abstract.\nOnly the first 255 characters will be used.\nThis summary will be shown as a brief explanation of your abstract.";
    message[107] = "This is the author's biography for this abstract.\nOnly the first 255 characters will be used.\nThis biography will be used to share information about the authors of the papers\nIt is an optional field.";
    message[108] = "This is the abstract.\nYou can cut and paste the abstract's text from your editor to this field.";
    message[109] = "This is the abstract you want to submit a draft paper for.\nThe list shows only the abstracts that have been approved to receive a draft paper.";
    message[110] = "This is the filename for the draft paper.\nThis file has to be in a PDF format (.pdf).\nBy using the browse button, you will be able to select the file from your computer."; 
    message[111] = "This is the abstract you want to submit a final paper for.\nThe list shows only the abstracts that have been approved to receive a final paper.";
    message[112] = "This is the filename for the final paper.\nThis file has to be in a PDF format (.pdf).\nBy using the browse button, you will be able to select the file from your computer."; 
    message[113] = "This is the filename for the postscript document.\nThis file has to be in a postcript format (.ps).\nBy using the browse button, you will be able to select the file from your computer."; 
    message[114] = "This is comments you have about this paper."; 

    // Registration
    message[120] = "This is how you heard about this conference.\nPlease select one from the list."; 
    message[121] = "This is the registration type.\nIf you select the 'IEEE Member' option,\nyou must provide us with your IEEE membership number.\nIf you select any other option, you can leave the IEEE membership number blank."; 
    message[122] = "This is your IEEE membership number.\nOnly required when choosing the 'IEEE Member' option above."; 
    message[123] = "This is a list of available short courses.\nPlease select one if you wish to attend."; 
    message[124] = "This is additional proceedings material from this conference.";
    message[125] = "This is additional lunch coupons for your guests if any."; 
    message[126] = "This is additional reception coupons for your guests if any."; 
    
    // Mailing
    message[150] = "This is the e-mail address of the user.";
    message[151] = "These are all available mailing lists.\nPlease select one from the list.";
    message[152] = "This is the subject of the e-mail.";
    message[153] = "This is the text of the e-mail.";
    message[154] = "This is the first name of the user.";
    message[155] = "This is the last name of the user.";
    message[156] = "This is the company name of the user.";
    
    message[199] = "This is the year of the conference.";

    // Secure Category
    message[200] = "This is the listing order of the category.\n'n.0' represents a main category.\n'n.n' represents a sub-category.\nFor example, 1.1 will be listed before 1.2.";
    message[201] = "This is the name of the category.";
    message[202] = "This is the description of the category.";
    message[203] = "This is the status of the category.";
    message[204] = "This is the general chair of the category.\nPlease select one user from the list.";
    message[205] = "This is the co-chair(s) of the category.\nPlease select one or more users from the list.\nIn order to select a co-chair, a general chair has to be selected.";
    message[206] = "This is the identifier of the category.\nEach category has a unique identifier.";
    message[207] = "This is the general chair and co-chairs of the category.";
    
    // Secure Conference
    message[230] = "This is the name of the conference.";
    message[231] = "This is the description of the conference.";
    message[232] = "This is the status of the conference.";

    // Secure Paper
    message[250] = "This is the identifier of the paper.\nEach paper has a unique identifier.";
    message[251] = "This is the identifier of the author.\nEach author has a unique identifier.";
    message[252] = "This is the category of the paper.";
    message[253] = "This is the status of the paper.";
    message[254] = "This is the co-authors of the paper.\nType in the name(s) as they appear on the paper.";
    message[255] = "This is the title of the paper.";
    message[256] = "This is the summary of the paper.";
    message[257] = "This is the keywords of the paper.\nThese are only used to search papers on a content basis.";
    message[258] = "This is the list of people assigned to review this paper.";
    
    // Secure Daily Schedule
    message[300] = "This is the identifier of the program event.\nEach program event has a unique identifier.";
    message[301] = "This is the name of the program event.";
    message[302] = "This is the status of the program event.";
    message[303] = "This is the type of event.";
    message[304] = "This is the description of the program event.";
    message[305] = "This is the location of the program event.";
    message[306] = "These fields represent when the event will start.";
    message[307] = "These fields represent when the event will end.";
    message[308] = "This is the list of available event to sponsored.";
    message[309] = "This is the list of available short courses.";
    message[310] = "This is the filename of a 'more information'\npage regarding the short course selected above.";
    message[311] = "This is the list of available technical sessions.";
    message[312] = "This is the filename of a 'more information'\npage regarding the keynote speaker session selected above.";
    message[313] = "This is the speaker for this event.\nPlease select the speaker's name from the list.\nIt is an optional field.";
    message[314] = "This is the audio access information for this event.\nIt normally contains a telephone number and a passcode.\nIt is an optional field.";
    message[315] = "This is the audio access information for this event when you are an administrator for this event.\nIt normally contains a telephone number and a passcode.\nIt is an optional field.";
    message[316] = "This is the administrators for this event.\nPlease select the administrator(s) from the list.\nIt is an optional field.";
    message[317] = "This is the online presentation for this event.\nSelect the page from the presentation from the list on the left.\nClick on the 'View' button to view that page.\nClick on the 'Delete' button to delete the WHOLE presentation.";
    message[318] = "This is the status of the online presentation for this event.";
    message[319] = "This is the filename for the online presentation for this event.\nThis file has to be in a PowerPoint format (.ppt).\nBy using the browse button, you will be able to select the file from your computer."; 
    message[320] = "This is the type of the program event.\nPlease select one from the list."; 

    // Secure Exhibitor
    message[350] = "This is the identifier of the exhibitor.\nEach exhibitor has a unique identifier.";
    message[351] = "This is the status of the exhibitor.";
    message[352] = "This is the name of the exhibitor.";
    message[353] = "This is the first line of address of the exhibitor.";
    message[354] = "This is the second line of address of the exhibitor.";
    message[355] = "This is the third line of address of the exhibitor.";
    message[356] = "This is the city of the exhibitor.";
    message[357] = "This is the state or province of the exhibitor.";
    message[358] = "This is the zip or postal code of the exhibitor.";
    message[359] = "This is the country of the exhibitor.";
    message[360] = "This is the telephone number of the exhibitor.";
    message[361] = "This is the fax number of the exhibitor.";
    message[362] = "This is the e-mail address of the exhibitor.";
    message[363] = "This is the description of the exhibitor.";
    message[364] = "This is the booth selection of the exhibitor.";
    message[365] = "This is the sponsorship selection of the exhibitor.";
    message[366] = "This is the company advertising banner URLs.\nEnter one URL on each line. Each image URL should be a complete URL\n(http://www.yoursite.com/images/ad1.gif) and must be 468 pixels wide and 60 pixels tall.";
    message[367] = "This is the company advertising banner alternate text.\nEnter one ALT text string on each line. There must be one line for each image listed above.\nThis text will be shown to users when their mouse is placed over your advertising banner.";
    message[368] = "This is the company advertising banner click-through URLs.\nEnter one URL on each line. There must be one line for each image listed above.\nThe user will be taken to these URLs when they click on your advertising banner.";
    message[369] = "This is the company home URL.";
    message[370] = "This is the advertising banner display count.";
    
    // Secure People
    message[399] = "This is the UserID of the user.";
    message[400] = "This is the identifier of the user.\nEach user has a unique identifier.";
    message[401] = "This is the e-mail address of the user.";
    message[402] = "This is the status of the user.";
    message[403] = "This is the first name of the user.";
    message[404] = "This is the last name of the user.";
    message[405] = "This is the company name of the user.";
    message[406] = "This is the job title of the user.";
    message[407] = "This is the work telephone number of the user.";
    message[408] = "This is the home telephone number of the user.";
    message[409] = "This is the cellular telephone number of the user.";
    message[410] = "This is the fax number of the user.";
    message[411] = "This is the first line of address of the user.";
    message[412] = "This is the second line of address of the user.";
    message[413] = "This is the third line of address of the user.";
    message[414] = "This is the city of the user.";
    message[415] = "This is the state or province of the user.";
    message[416] = "This is the zip or postal code of the user.";
    message[417] = "This is the country of the user.";
    message[418] = "This is the group of the user.";
    message[419] = "This is the permissions of the user.";
    message[420] = "This is the password of the user.";
    message[421] = "This is the password confirmation of the user.";
    message[422] = "This is the social security number of the user without any spaces or ponctuation.";
    message[423] = "This is the date of birth of the user.\nFirst 2 digits for the month.\nThird and fourth digits for the day.\nLast 4 digits for the year.";
    message[424] = "This is the biography of the user.";
    message[425] = "This is a special message you want to be included in the e-mail confirmation.";
    message[426] = "This is the sms paging number of the user.\nSMS stands for 'Short Message Service'.\nIt represents how to reach the user by sending a\ntext message to a cellphone, a pager or a PDA.\nIt normally looks like an e-mail address.";

    // Secure Proceedings
    message[450] = "This is the identifier of the proceedings purchase.\nEach proceedings purchase has a unique identifier.";
    message[451] = "This is the first name of the proceedings buyer.";
    message[452] = "This is the last name of the proceedings buyer.";
    message[453] = "This is the e-mail address of the proceedings buyer.";
    message[454] = "This is the type of the proceedings bought.";
    message[455] = "This is the status of the proceedings submission.";

    // Secure Registration
    message[500] = "This is the identifier of the registration.\nEach registration has a unique identifier.";
    message[501] = "This is the first name."; 
    message[502] = "This is the last name."; 
    message[503] = "This is the status of the registration."; 
    message[504] = "This is how the registrant heard about this conference.\nPlease select one from the list."; 
    message[505] = "This is the registration type.\nIf you select the 'IEEE Member' option,\nyou must provide us with the IEEE membership number.\nIf you select any other option, you can leave the IEEE membership number blank."; 
    message[506] = "This is the IEEE membership number.\nOnly required when choosing the 'IEEE Member' option above."; 
    message[507] = "This is a list of available short courses/tutorials."; 
    message[508] = "This is additional proceedings material from this conference.";
    message[509] = "This is additional lunch coupons for guests if any."; 
    message[510] = "This is additional reception coupons for guests if any."; 


    if(num != null && message[num] != null)
        alert(message[num]);
    else
        alert("[" + num + "] " + message[0]);

    return false;
}

function startUpload()
{
	window.opener.top.document.docuploadform.submit();
}

function raiseAttendeeHandUp(formname, which)
{
	formname.RAISEATTENDEEHANDUP.value = which;
	formname.submit();
}

function lowerAttendeeHandUp(formname, which)
{
	formname.LOWERATTENDEEHANDUP.value = which;
	formname.submit();
}

function removeAttendeeHandUp(formname, which)
{
	formname.HANDLEATTENDEEHANDUP.value = which;
	formname.submit();
}

function showAudioAccessInstructions(admininst, publicinst)
{
	var outstring = "";

	if(admininst != null)
	{
		outstring = "Administrator Audio Access:\n     " + admininst;
	}
	if(outstring != "")
	{
		outstring = outstring + "\n\n";
	}
	if(publicinst != null)
	{
		outstring = outstring + "Public Audio Access:\n     " + publicinst;
	}

	alert(outstring);
	return false;
}

function startSlideShow(appurl, eventid, uniquecachestring)
{	
	var winname = "ECWVIRTUALSLIDESHOWWINDOW";
	var urltoopen = "" + appurl + "virtualframeset.cfm?EVENTID=" + eventid + "&UNIQUE_CACHE_STRING=" + uniquecachestring;

	openNewWindow(winname, urltoopen, '5', uniquecachestring);
}

function targetLinkToMainWindow(url)
{
	var winName = new String(window.top.name);
			
	if(winName.indexOf("eCWPOPUPWINDOW_") != -1)
	{
		var winhandle = window.open('', 'eCWMAINWINDOW');
		winhandle.document.location.href = url;
		window.top.close();
	}
	else
	{
		document.location.href = url;
	}
}

function isANumber(instr)
{
	if(instr == null) return true;
	if(instr.length < 1) return true;

	for(x=0;x < instr.length; x++)
	{
		if(instr.charAt(x) < '0' || instr.charAt(x) > '9')
		{
			return false;
		}
	}
	return true;
}

function isAFloat(instr)
{
	if(instr == null) return true;
	if(instr.length < 1) return true;

    var foundone = false;
	for(x=0;x < instr.length; x++)
	{
		if(instr.charAt(x) < '0' || instr.charAt(x) > '9')
		{
		    if(!(instr.charAt(x) == '.' && foundone))
			    return false;
		}
		foundone = true;
	}
	return true;
}

function getPaymentType(formname)
{
	if(formname.PAYTYPE.selectedIndex == 0)
	{
		return -1;
	}

	var payinfo = formname.PAYTYPE[formname.PAYTYPE.selectedIndex].value.split("*");
	var paytype = parseInt(payinfo[1]);

	return paytype;
}

function checkEmailAddress(formfield)
{
	var inputStr = new String(formfield.value);

	var at = inputStr.indexOf("@");
	var name = inputStr.substring(0, at);
	var isp = inputStr.substring(at + 1, inputStr.length);
	var dot = inputStr.lastIndexOf(".");

	if (at == -1 || at == 0 || name == "" || isp == "" || dot == -1 || dot == (inputStr.length - 1)) 
	{
		return false;
	} 

	if (inputStr.indexOf(" ") > -1)
	{
		return false;
	}

	return true;
}

function addFees(currenttotal, formfield, additionalamt)
{
	if(additionalamt == null)
	{
		additionalamt = 0.0;
	}
	currenttotal = currenttotal + additionalamt; 
	if(formfield != null)
	{
		var bothvalues = formfield[formfield.selectedIndex].value.split("*");
		var citem = parseFloat(bothvalues[1]);
		if(citem > 0)
		{
			currenttotal = currenttotal + citem;
		}
	}

	return currenttotal;
}

function isAURL(instr)
{
	if(instr == null) return true;
	if(instr.length == 0) return true;

	var fhttp = instr.indexOf("http://", 0);
	if(fhttp != 0)
	{
		return false;
	}

	return true;
}

function countWords(fieldvalue)
{
	var idx = fieldvalue.indexOf(" ", 0);
	var word = 0;
	var i = 0;
	while(idx != -1)
	{
		i = fieldvalue.indexOf(" ", idx);
	    idx = i+1;
		word++;
	    if(i == -1)
	    {
	        idx=-1;
        }
	}
	if(word == 0 && fieldvalue.length != 0) word = 1;

	return word;
}

function countLines(fieldvalue)
{
	var idx = fieldvalue.indexOf("\r\n", 0);
	var line = 0;
	var i = 0;
	while(idx != -1)
	{
		i = fieldvalue.indexOf("\r\n", idx+1);
	    idx = i;
	    line++;
	    if(i == -1)
	    {
	        idx=-1;
        }
	}
	if(line == 0 && fieldvalue.length != 0) line = 1;
	else if(line != 0)
	{
		if(fieldvalue[fieldvalue.length-2] != '\r' && fieldvalue[fieldvalue.length-1] != '\n')
		{
			line++;
		}
	}
	return line;
}

function getLine(fieldvalue, whichone)
{
	var idx = fieldvalue.indexOf("\r\n", 0);
	if(fieldvalue.length == 0)
	{
		return null;
	}
	if(idx == -1 && whichone == 1)
	{
		return fieldvalue;
	}
	if(whichone < 0 || (idx == -1 && whichone != 1))
	{
		return null;
	}

	if(fieldvalue[fieldvalue.length-2] != '\r' && fieldvalue[fieldvalue.length-1] != '\n')
	{
		newfieldvalue = fieldvalue + "\r\n";
	} else
	{
		newfieldvalue = fieldvalue;
	}

	var lines = newfieldvalue.split("\r\n");
	lines.length = lines.length - 1;

	if(whichone > lines.length)
	{
		return null;
	}
	return lines[whichone-1];
}

function openNewWindow(winName, inUrl, size)
{
	if(winName == null)
	{
		winName = "eCWPOPUPWINDOW_" + size;
	} else
	{
		winName = "eCWPOPUPWINDOW_" + winName;
	}

	if(size == "1")
	{
		win_chk = window.open( inUrl, winName,'scrollbars=yes,toolbar=no,location=no,status=yes,resizable=yes,width=300,height=200',false);
	}
	if(size == "2")
	{
		win_chk = window.open( inUrl, winName,'scrollbars=yes,toolbar=no,location=no,status=yes,resizable=yes,width=500,height=400',false);
	}
	if(size == "3")
	{
		win_chk = window.open( inUrl, winName,'scrollbars=yes,toolbar=no,location=no,status=yes,resizable=yes,width=600,height=400',false);
	}
	if(size == "4")
	{
		win_chk = window.open( inUrl, winName,'scrollbars=yes,toolbar=no,location=no,status=yes,resizable=yes,width=600,height=600',false);
	}
	if(size == "5")
	{
		win_chk = window.open( inUrl, winName,'scrollbars=yes,toolbar=no,location=no,status=yes,resizable=yes,width=975,height=600',false);
	}
	if(size == "full")
	{
		win_chk = window.open( inUrl, winName,'menubar=yes,scrollbars=yes,toolbar=yes,location=yes,status=yes,resizable=yes',false);
	}
	win_chk.focus();
}

function checkWhiteSpace(formfield, fieldname, fieldtype)
{
	if(fieldtype == null)
	{
		fieldtype = 1;
	}

	if(fieldtype == 1)
	{
		// text boxes
		if(formfield.value.length == 0)
		{
			alert(fieldname + " cannot be blank.");
			return false;
		}

		var i = 0;
		for(i=0;i<formfield.value.length;i++)
		{
			if(formfield.value.charAt(i) != ' ')
			{
				return true;
			}
		}
		if(i == formfield.value.length)
		{
			alert(fieldname + " cannot be blank.");
			formfield.focus();
			return false;
		}
	} else if(fieldtype == 2)
	{
		// pull-downs - must be set to something other than 0
		if(formfield.selectedIndex == 0)
		{
			alert("You must select " + fieldname + ".");
			return false;
		} else
		{
			return true;
		}
	}
	return false;
}

function validateCreditCardNumber(formfield)
{
	var field = new String(formfield.value);

	if ( (field.length < 13) || (field.length > 19) )
	{
		return false;
	}
	
	if (!verifyMod10(field))
	{
		return false;
	}

	return true;
}

function verifyMod10(field)
{
	var PAN = field

	PAN= removeSpaces(PAN);
	var st = PAN;

	if (st.length > 19)
		return false;

	var sum = 0;
	var mul = 1;
	var st_len = st.length;
	var tproduct;
	
	for (i = 0; i < st_len; i++) 
	{
		digit = st.substring(st_len-i-1, st_len-i);
		
		if (digit == " " || digit == "-")
			continue;
			
		tproduct = parseInt(digit ,10) * mul;
	    
	    if (tproduct >= 10)
	      sum += (tproduct % 10) + 1;
	    else
	      sum += tproduct;
	    
	    if (mul == 1)
	      mul++;
	    else
	      mul--;
	}

	if ((sum % 10) != 0)
		return false;

	return true;
}

function removeSpaces(fieldName)
{

	var startIndex, lastIndex;
	var newFieldName, newC;

	lastIndex = fieldName.length-1;
	startIndex = 0;
	
	newC = fieldName.charAt(startIndex);
	while ((startIndex<lastIndex) && ((newC == " ") || (newC == "\n") || (newC == "\r") || (newC == "\t"))) {
		startIndex++;
		newC = fieldName.charAt(startIndex);
	}

	newC = fieldName.charAt(lastIndex);
	while ((lastIndex>=0) && ((newC == " ") || (newC == "\n") || (newC == "\r") || (newC == "\t"))) {
		lastIndex--;
		newC = fieldName.charAt(lastIndex);
	}
	if (startIndex<=lastIndex) {
		newFieldName = fieldName.substring(startIndex, lastIndex+1);
		return newFieldName;
	} else {
		return fieldName;
	}
}
