/*
#=============================================================#
#                                                             #
#           Powered by Dvbbs.PHP 2.0.0                        #
#           function  showemot 表型图片                           #
#           author    IvanSky                                 #
#           date      2007-10-26                                #
#                                                             #
#=============================================================#
*/
var dvPOSTEMOT = new NewsSpanBar();


//显示图片个数,更多状态,风格,宽度,高度,内容|||,表形路径,表形名称
function dv_ShowEmot(dv_shownum,dv_more,dv_bj,dv_Width,dv_Height,dv_strcon,dv_empath,dv_forum_emot){

	var getnum1 = 16;
	var getnum2 = 16;
	var getnum3 = 16;
	if (parseInt(dv_shownum) != 0)
	{
		getnum1 = parseInt(dv_shownum);
		getnum2 = parseInt(dv_shownum);
		getnum3 = parseInt(dv_shownum);
	}
	var getWidth ; 
	var getHeight ;
	var currEmot;
	var getArrEmot = new Array();
	var getArrstrcon = new Array();
	
	var emotcount=127;
	var emotcount_x = 217;
	var emotcount_xx = 237;

	var scount=127;
	var scount_x = 217;
	if (dv_more == '')
	{
		dv_more = 0;
	}
	if (parseInt(dv_more) != 1)
	{
		if (getnum1 < (emotcount_x-scount) )
		{
			emotcount_x = scount + getnum1-1;
		}
	}
	if (parseInt(dv_more) != 2)
	{

		if (getnum2 < emotcount)
		{
			emotcount = getnum2+1;
		}
	}
	if (parseInt(dv_more) != 3)
	{
		if (getnum3 <  (emotcount_xx-scount_x) )
		{
			emotcount_xx = scount_x + getnum3;
		}
	}
	var getEmpath = dv_empath;
	if (dv_Width.length > 0) getWidth=dv_Width; else getWidth = '100%';
	if (dv_Height.length > 0) getHeight=dv_Height; else getHeight = '190px';
	if (dv_forum_emot != '')
	{
		getArrEmot = dv_forum_emot.split('|||');
	}else
	{
		return false 
	}
	if (dv_strcon != '')
	{
		getArrstrcon = dv_strcon.split('|||');
	}else
	{
		return false 
	}
	dv_divcode = '<div id="forum_emot_r" class="border" style="float:right;width:'+getWidth+';padding:0px;margin:0px;">';
	dv_divcode += '		<div class="tabtitle" >';
	dv_divcode += '			<div id="tabgroup_bot">';
	dv_divcode += '			<p class="tabgroup_on">'+getArrstrcon[0]+'</p>';
	dv_divcode += '			<p class="tabgroup_on">'+getArrstrcon[1]+'</p>';
	dv_divcode += '			<p class="tabgroup_on">'+getArrstrcon[2]+'</p>';
	dv_divcode += '		    </div>';
	dv_divcode += '		<div id="tabgroupbody">';
	dv_divcode += '		<dl>';
	dv_divcode += '		<div style="overflow:auto;overflow-x:hidden;padding:0px;margin:0px;height:'+getHeight+';text-align : left;border:0px inset;background-color: #fff;width:99%;">';
	dv_divcode += '		<div style="padding:0px;margin:0px;">';
	dv_divcode += '			<ul style="padding:0px;margin:0px;">';
	var j=0 //默认表型
	for (i=scount; i <= emotcount_x; i++)
	{
		j++
		currEmot = getArrEmot[i];
		if (j === 1 )dv_divcode += '<li style="padding:0px;margin:0px;">';
		dv_divcode += '<img src="'+getEmpath+currEmot+'" style="margin:6px;width:24px;cursor: pointer;" onclick="putEmot(\'em'+i+'\');"/>';
		if (j === 4 ){dv_divcode += '</li>';j=0;}
		else if (emotcount_x === i )dv_divcode += '</li>';
	}
	if (dv_more != 1) dv_divcode += '<li style="padding:0 8px 0 0;margin:0px;text-align:right;"><DIV  style="cursor: pointer;" onclick=\'dv_ShowEmot("'+dv_shownum+'","1","'+dv_bj+'","'+dv_Width+'","'+dv_Height+'","'+dv_strcon+'","'+dv_empath+'","'+dv_forum_emot+'")\'>'+getArrstrcon[3]+'</DIV></li>';

	dv_divcode += '			</ul>';
	dv_divcode += '		</div>';
	dv_divcode += '		</div>';
	dv_divcode += '		</dl>';
	dv_divcode += '		<dl>';
	dv_divcode += '		<div style="overflow:auto;overflow-x:hidden;padding:0px;margin:0px;height:'+getHeight+';text-align : left;border:0px inset;background-color: #fff;width:98%;">';
	dv_divcode += '		<div >';
	dv_divcode += '			<ul>';

	var j=0 //悠嘻猴
	var ii =0;
	var position = 0
	for (i=0; i <= emotcount-2; i++)
	{
		j++
		ii=i+1;
		currEmot = getArrEmot[ii];
		if (j === 1 )dv_divcode += '<li style="padding:0px;margin:0px;">';
		if ( ii > 9)
		{
			dv_divcode += '<img src="'+getEmpath+currEmot+'" style="margin:6px;width:24px;cursor: pointer;border:1px; solid red" onclick="putEmot(\'em'+(ii)+'\');"/>';
		}else{
			dv_divcode += '<img src="'+getEmpath+currEmot+'" style="margin:6px;width:24px;cursor: pointer;border:1px; solid red" onclick="putEmot(\'em0'+(ii)+'\');"/>';
		}
		if (j === 4 ){dv_divcode += '</li>';j=0;}
		else if (emotcount-2 === i )dv_divcode += '</li>';
	}
	if (dv_more != 2) dv_divcode += '<li style="padding:0 8px 0 0;margin:0px;text-align:right"><DIV  style="cursor: pointer;" onclick=\'dv_ShowEmot("'+dv_shownum+'","2","'+dv_bj+'","'+dv_Width+'","'+dv_Height+'","'+dv_strcon+'","'+dv_empath+'","'+dv_forum_emot+'")\'>'+getArrstrcon[3]+'</DIV></li>';
				
	dv_divcode += '			</ul>';
	dv_divcode += '		</div>';
	dv_divcode += '		</div>';
	dv_divcode += '		</dl>';
	dv_divcode += '		<dl>';
	dv_divcode += '		<div style="overflow:auto;overflow-x:hidden;padding:0px;margin:0px;height:'+getHeight+';text-align : left;border:0px inset;background-color: #fff;width:98%;">';
	dv_divcode += '		<div >';
	dv_divcode += '			<ul>';
	var j=0 //绿豆蛙
	for (i=scount_x+1; i <= emotcount_xx; i++)
	{
		j++
		currEmot = getArrEmot[i];
		if (j === 1 )dv_divcode += '<li style="padding:0px;margin:0px;">';
		dv_divcode += '<img src="'+getEmpath+currEmot+'" style="margin:6px;width:24px;cursor: pointer;" onclick="putEmot(\'em'+i+'\');"/>';
		if (j === 4 ){dv_divcode += '</li>';j=0;}
		else if (emotcount_xx === i )dv_divcode += '</li>';

	}
	if (dv_more != 3) dv_divcode += '<li style="padding:0 8px 0 0;margin:0px;text-align:right"><DIV  style="cursor: pointer;" onclick=\'dv_ShowEmot("'+dv_shownum+'","3","'+dv_bj+'","'+dv_Width+'","'+dv_Height+'","'+dv_strcon+'","'+dv_empath+'","'+dv_forum_emot+'")\'>'+getArrstrcon[3]+'</DIV></li>';

	dv_divcode += '			</ul>';
	dv_divcode += '		</div>';
	dv_divcode += '		</div>';
	dv_divcode += '		</dl>';
	dv_divcode += '		</div>';
	dv_divcode += '		</div>';
	dv_divcode += '		</div>';

	document.getElementById('dv_ShowEmot').innerHTML =dv_divcode;
	if (parseInt(dv_more)>0)
	{
		dv_more = dv_more-1;
	}
	dvPOSTEMOT.f=dv_more;
	dvPOSTEMOT.titleid = "tabgroup_bot";
	dvPOSTEMOT.bodyid = "tabgroupbody";
	dvPOSTEMOT.class_hiton = "tabgroup_on";
	dvPOSTEMOT.class_hitno = "tabgroup";
	dvPOSTEMOT.load();

}

function putEmot(thenNo)
{

	var ToAdd = '['+thenNo+']';

	parent.frames["Dvbbs_Composition"].document.body.innerHTML+=ToAdd;
	parent.frames["Dvbbs_Composition"].focus();
}
