<public:component>
<public:attach event="oncontentready" onevent="init();" />
<public:attach event=onclick onevent="showThemeMenu();" />
<public:method name="setTheme"/>
</public:component>
<script language="javascript">
var themeList=new Array();
function themeItem(t,n,i)
{
this.Title=t;
this.Name=n;
this.Image=i;
}
function setTheme(o)
{
 var theme=element.document.getElementById('theme');
 if(theme!=null)
 {
 var themeUrl="../../style.aspx?style="+o;
 
 theme.setAttribute("href",themeUrl);
 theme.setAttribute("title",o);

 }
//alert('我发现不加上这一句就不能用，郁闷');
}

function init()
{
themeList[0]=new themeItem('uniteair_aipi1','uniteair_aipi1','../../style/uniteair_aipi1/Aipi1.gif');
themeList[1]=new themeItem('uniteair_aipi2','uniteair_aipi2','../../style/uniteair_aipi2/Aipi2.jpg');
themeList[2]=new themeItem('xbox_gray','xbox_gray','../../style/xbox_gray/xbox_gray.jpg');

themeList[3]=new themeItem('AGI_smoke','AGI_smoke','../../style/AGI_smoke/AGI_smoke.gif');
themeList[4]=new themeItem('夜色','NightScene','../../style/NightScene/NightScene.gif');

themeList[5]=new themeItem('狗狗啊','uk_bulldog','../../style/uk_bulldog/uk_bulldog.gif');
themeList[6]=new themeItem('uk_oceanlife','uk_oceanlife','../../style/uk_oceanlife/uk_oceanlife.gif');
themeList[7]=new themeItem('music','music','../../style/music/music.gif');
themeList[8]=new themeItem('uk_djmixingitup','uk_djmixingitup','../../style/uk_djmixingitup/uk_djmixingitup.gif');
themeList[9]=new themeItem('uk_spacenebula','uk_spacenebula','../../style/uk_spacenebula/uk_spacenebula.gif')
themeList[10]=new themeItem('megan_plainblack','megan_plainblack','../../style/megan_plainblack/megan_plainblack.gif')
themeList[11]=new themeItem('uniteair_photogallery','uniteair_photogallery','../../style/uniteair_photogallery/uniteair_photogallery.gif')
}

function showThemeMenu()
{
var vs=element.document.getElementById('system_theme_menu');
if(vs==null)
{
var menu = element.document.createElement("DIV");
menu.style.top=event.y +10+"px";
	menu.style.left=event.x+"px";
	//menu.style.top="1px";
	//menu.style.left="1px";
	menu.style.width="90px";
	menu.style.height="480px";
	menu.style.overflow='auto';
    menu.style.border='solid 1px #698AAA';
	menu.style.display='block';
	menu.style.position='absolute';
	menu.className='secondaryseltab';
	menu.id="system_theme_menu";
	
	//menu.Name="system_layout_menu";
	menu.innerHTML=getThemeMenuItems();
	//element.document.body.insertAdjacentElement("beforeEnd",menu);
	element.document.body.appendChild(menu);

	return;
	}
	if(vs.style.display=='none')
	{
	 vs.style.display='block';
	}else
	{
	 vs.style.display='none';
	}
}
function getThemeMenuItems()
{
var s='';
//alert(themeList.length);
for(var i=0;i<themeList.length;i++)
{
s+='<DIV class=" Spaces_Customize_LayoutThumbnail Spaces_Customize_Thumbnail Web_Bindings_Base">';
  s+='      <DIV title='+themeList[i].Title+' style="LEFT: 5px; WIDTH: 66px; POSITION: absolute; TOP: '+i*66+'px; HEIGHT: 66px" Alt='+themeList[i].Title+'></DIV>';
   s+='     <DIV style="LEFT: 5px; WIDTH: 60px; POSITION: absolute; TOP:  '+i*66+'px; HEIGHT: 60px"><A href="javascript:;" onclick="EditThemeSetting.setTheme(\''+themeList[i].Name+'\');">';
    s+='<IMG class=thumbnailImg title='+themeList[i].Title+' style="WIDTH: 60px; HEIGHT: 60px" ';
s+='height=58 alt='+themeList[i].Title+' src="'+themeList[i].Image+'" width=50 pixelHeight="60" ';
s+='pixelWidth="60"></A></DIV></DIV>';
      
}
return s;
}
</script>

