// JavaScript Document
/**
* @author Cody Swann
* @version 1.0 sept, 2004
*/
function NN4Model()
{
	//this.m_iStartWidth;
	//this.m_iStartHeight;
	this.m_strClass = "NN4Model";
	this.m_sModelText;
}



NN4Model.inherits(Model);

NN4Model.method('resetWidth', function(/*String*/ strHolderId)
{
	var theIlayer = strHolderId;
	var theLayer = strHolderId+"layer";
	var layerProp = eval('document.' +theIlayer + '.document.' + theLayer);
	var index = this.findHolder(strHolderId);
	layerProp.clip.width = this.m_arrHolders[index][this.m_iOrigWidth];
	this.m_arrHolders[index][this.m_iCurrWidth] = this.m_arrHolders[index][this.m_iOrigWidth];
});

NN4Model.method('getHolder', function(/*String*/ strHolderId)
{
	var theIlayer = strHolderId;
	var theLayer = strHolderId+"layer";
	var layerProp = eval('document.' +theIlayer + '.document.' + theLayer);
	return layerProp;
});

NN4Model.method('resetHeight', function(/*String*/ strHolderId)
{
	var theIlayer = strHolderId;
	var theLayer = strHolderId+"layer";
	var layerProp = eval('document.' +theIlayer + '.document.' + theLayer);
	var index = this.findHolder(strHolderId);
	layerProp.clip.height = this.m_arrHolders[index][this.m_iOrigHeight];
	this.m_arrHolders[index][this.m_iCurrHeight] = this.m_arrHolders[index][this.m_iOrigHeight];
});

NN4Model.method('resetAll', function(/*String*/ strHolderId)
{
	this.uber('resetAll', strHolderId);
	window.resizeBy(0, 0);
	
});

NN4Model.method('resetTextColor', function(/*String*/ strHolderId)
{
	var theIlayer = strHolderId;
	var theLayer = strHolderId+"layer";
	var layerProp = eval('document.' +theIlayer + '.document.' + theLayer);
	var index = this.findHolder(strHolderId);
	var hColor = this.m_arrHolders[index][this.m_iOrigTextColor];
	this.changeFontColor(strHolderId, hColor);
	this.m_arrHolders[index][this.m_iCurrTextColor] = this.m_arrHolders[index][this.m_iOrigTextColor];
});

NN4Model.method('resetFontSize', function(/*String*/ strHolderId)
{
	var theIlayer = strHolderId;
	var theLayer = strHolderId+"layer";
	var layerProp = eval('document.' +theIlayer + '.document.' + theLayer);
	var index = this.findHolder(strHolderId);
	var mSize = this.m_arrHolders[index][this.m_iOrigFontSize];
	this.changeFontSize(strHolderId, mSize);
	this.m_arrHolders[index][this.m_iCurrFontSize] = this.m_arrHolders[index][this.m_iOrigFontSize];
});

NN4Model.method('resetBgColor', function(/*String*/ strHolderId)
{
	var theIlayer = strHolderId;
	var theLayer = strHolderId+"layer";
	var layerProp = eval('document.' +theIlayer + '.document.' + theLayer);
	var index = this.findHolder(strHolderId);
	layerProp.bgColor = this.m_arrHolders[index][this.m_iOrigBgColor];
	this.m_arrHolders[index][this.m_iCurrBgColor] = this.m_arrHolders[index][this.m_iOrigBgColor];
});



NN4Model.method('makeHolder', function(/*String*/ strId, /*Boolean*/ writeNow)
{
	this.uber('makeHolder', strId);
	this.m_sModelText = '<ilayer id="'+strId+'"><layer id="'+strId+'layer'+'"> <\/layer><\/ilayer>';
	if(writeNow)
	{
		document.write(this.m_sModelText);
	}
});

NN4Model.method('fillHolder',function(/*String*/ strHolderId, /*String*/ strHolderContent)
{
	var theIlayer = strHolderId;
	var theLayer = strHolderId+"layer";
	var layerProp = eval('document.' +theIlayer + '.document.' + theLayer);
	var oLayer = eval('document.' +theIlayer + '.document.' + theLayer + '.document');
	oLayer.open();
   	oLayer.write(strHolderContent);
   	oLayer.close();
	window.resizeBy(0, 0);
	
	var index = this.findHolder(strHolderId);
	this.m_arrHolders[index][this.m_iCurrTextColor] = this.m_arrHolders[index][this.m_iOrigTextColor] =  oLayer.fgColor || "#000000";
	this.m_arrHolders[index][this.m_iCurrBgColor] = this.m_arrHolders[index][this.m_iOrigBgColor] = oLayer.bgColor || "#FFFFFF";
	this.m_arrHolders[index][this.m_iCurrWidth] = this.m_arrHolders[index][this.m_iOrigWidth] = layerProp.clip.width;
	this.m_arrHolders[index][this.m_iCurrHeight] = this.m_arrHolders[index][this.m_iOrigHeight] = layerProp.clip.height;
	this.m_arrHolders[index][this.m_iCurrContent] = this.m_arrHolders[index][this.m_iOrigContent] = strHolderContent;
	this.m_arrHolders[index][this.m_iCurrFontSize] = "12px"; 
	this.m_arrHolders[index][this.m_iOrigFontSize] = "12px";
});

NN4Model.method('hideHolder', function(/*String*/ strHolderId)
{
	var theIlayer = strHolderId;
	var theLayer = strHolderId+"layer";
	var layerProp = eval('document.' +theIlayer + '.document.' + theLayer);
	layerProp.visibility = "hide";
});

NN4Model.method('showHolder', function(/*String*/ strHolderId)
{
	var theIlayer = strHolderId;
	var theLayer = strHolderId+"layer";
	var layerProp = eval('document.' +theIlayer + '.document.' + theLayer);
	layerProp.visibility = "show";
});

NN4Model.method('resizeHolder', function(/*String*/strHolderId, /*mixed*/mWidth, /*mixed*/mHeight)
{
	var theIlayer = strHolderId;
	var theLayer = strHolderId+"layer";
	var layerProp = eval('document.' +theIlayer + '.document.' + theLayer);
	var index = this.findHolder(strHolderId);
	this.m_arrHolders[index][this.m_iCurrWidth] = layerProp.clip.width = mWidth;
	this.m_arrHolders[index][this.m_iCurrHeight] = layerProp.clip.height = mHeight;
});

NN4Model.method('callParent', function(message)
{
	this.uber('callParent', message);
});

NN4Model.method('changeBgColor', function(/*String*/ strHolderId, /*Hex*/hColor)
{
	var theIlayer = strHolderId;
	var theLayer = strHolderId+"layer";
	var layerProp = eval('document.' +theIlayer + '.document.' + theLayer);
	var index = this.findHolder(strHolderId);
	this.m_arrHolders[index][this.m_iCurrBgColor] = layerProp.bgColor = hColor;
});

NN4Model.method('changeFontSize', function(/*String*/ strHolderId, /*mixed*/mSize)
{
	var index = this.findHolder(strHolderId);
	var strHolderContent = this.m_arrHolders[index][this.m_iOrigContent];
	var theIlayer = strHolderId;
	var theLayer = strHolderId+"layer";
	var layerProp = eval('document.' +theIlayer + '.document.' + theLayer);
	var oLayer = eval('document.' +theIlayer + '.document.' + theLayer + '.document');
	this.m_arrHolders[index][this.m_iCurrFontSize] = mSize;
	var hColor = this.m_arrHolders[index][this.m_iCurrTextColor];
	oLayer.open();
   	oLayer.write('<span style="font-size:'+mSize+'; color:'+hColor+';">'+strHolderContent+'<\/span>');
   	oLayer.close();
	window.resizeBy(0, 0);
});

NN4Model.method('changeFontColor', function(/*String*/ strHolderId, /*Hex*/hColor)
{
	var index = this.findHolder(strHolderId);
	var strHolderContent = this.m_arrHolders[index][this.m_iOrigContent];
	var theIlayer = strHolderId;
	var theLayer = strHolderId+"layer";
	var layerProp = eval('document.' +theIlayer + '.document.' + theLayer);
	var oLayer = eval('document.' +theIlayer + '.document.' + theLayer + '.document');
	var mSize = this.m_arrHolders[index][this.m_iCurrFontSize];
	this.m_arrHolders[index][this.m_iCurrTextColor] = hColor;
	oLayer.open();
   	oLayer.write('<span style="font-size:'+mSize+'; color:'+hColor+';">'+strHolderContent+'<\/span>');
   	oLayer.close(); 
});



