/*
 * File:        FlashTextField.js
 * Version:     1.0.0
 * Description: Generates Textarea for Flash files (.SWF)
 * Author:      Ardalan Naghshineh (Ardalan.Naghshineh@gmail.com)
 * Created:     2/8/2010
 * Language:    Javascript
 * License:     GPL v2 or BSD 3 point style
 * Contact:     Ardalan.Naghshineh@gmail.com
 * 
 * Copyright 2010 Ardalan Naghshineh, all rights reserved.
 *
 * This source file is free software, under either the GPL v2 license or a
 * BSD style license, as supplied with this software.
 * 
 * This source file is distributed in the hope that it will be useful, but 
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
 * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
 */
 
function FlashTextField(Type /* textarea, textinput */, Action /* Build, Move, Get, Remove */, Name, X, Y, Width, Height, classname)
{
	if (Action=='Build') {
		var Div = document.createElement("div");
		Div.id = Name + '_Div';
		Div.style.position = 'absolute';
		Div.style.width = Width + 'px';
		Div.style.height = Height + 'px';
		Div.style.left = X + 'px';
		Div.style.top = Y + 'px';
		if (Type!='textarea') Div.innerHTML = '<input type="text" class="' + classname + '" name="' + Name + '" id="' + Name + '_ID" style="width:' + Width + 'px;height:' + Height + 'px" />';
		else Div.innerHTML = '<textarea class="' + classname + '" name="' + Name + '" id="' + Name + '_ID" style="width:' + Width + 'px;height:' + Height + 'px"></textarea>';
		document.getElementById('tfcontent').appendChild(Div);
	} else if (Action=='Move') {
		//alert(Action);
		var Div = document.getElementById(Name + '_Div');
		Div.style.left = X+"px";
		Div.style.top = Y+"px";
	} else if (Action=='Get') {
		var Value = document.getElementById(Name + '_ID').value;
		return Value;
	} else if (Action=='Remove') {
		var Div = document.getElementById(Name + '_Div');
		document.body.removeChild(Div);
	}
}


function setStyle( target ,_var , value){
	var htmlTarget = document.getElementById(target);
	htmlTarget.style[_var] = value;
}


function setText(target , str){
	var htmlTarget = document.getElementById(target + '_ID');
	htmlTarget.value = str;
}




