/*##########################################################################
	Insert Object Into Form Input
	Creator: Ibnu (webdeveloper@trulymoney.com)
	Created: April 19, 2006 (Wednesday)
	To insert object or certain text into a form input (textarea/text)

	MORE JAVASCRIPTs & PHP SCRIPTS
	http://www.TRULYMONEY.COM/php_scripts

USE THIS JAVASCRIPT FOR FREE BUT DO NOT REMOVE ANY INFORMATION ABOVE !
###########################################################################*/

function InsertVal(txt,n_form,n_input,dif_win,close_win,add_space)
{
	// txt      = the text/value (string) that will be inserted
	// n_form   = form name
	// n_input  = input/element name
	// dif_win  = is the window form and the window of its link different?
	//     0: the form resides in the same window, 1=the form is a parent window of its link (link to open a child window that shown available text (string) which can be inserted)
	// close_win = if it has child window, close it after clicking or not ?
	// add_space = add space after the inserted text/value
	//
	// Application: onClick="InsertVal('text here','form name here','element/input name here',0(zero) / 1(one) here,0(zero) / 1(one) here,0(zero) / 1(one) here);"

	if (dif_win) var ob_elm=parent.opener.document.forms[n_form].elements[n_input];
	else var ob_elm=document.forms[n_form].elements[n_input];

	ob_elm.focus();

	ob_elm.value+=txt;

	if (add_space) ob_elm.value+=" ";

	if (dif_win)
	{
		if (close_win) window.close();
		else window.focus();
	}
}