<%@ Page Language="C#" AutoEventWireup="true" CodeFile="themejs.aspx.cs" Inherits="themejs" %>
<html>
<head>
<title>选择模板</title>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<style>
body{font-size:12}
table,input,button,b{font-size:12;font-family:宋体}
a.link{color:#649E8E}
</style>
</head>
<script src="./include/ThemeData.js"></script>
<script type="text/javascript">
//init();
</script>

<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" style="overflow:hidden" >
<table id="bxDlg" width="500" border="0" cellspacing="0" cellpadding="0" height="420"  >

  <tr> 
    <td colspan="3">
      <table width="98%" border="0" cellspacing="0" cellpadding="0" align="center" height="340">
        <tr> 
          <td valign="top" width="146">
			<div style="height:20;padding-top:3px"><b>主题分类</b></div>
			<div style="border:1px solid #000000;width:140;height:338" align=center>
				<table width=90% height=100%>
					<tr><td align=center height=20><img onmouseover="this.src='http://blogteam.bokee.com/pub/images/dialog/theme-to-top2.gif';roll=true;tmpl_roll(-1)" onclick="roll=true;tmpl_roll(-2)" onmouseout="this.src='http://blogteam.bokee.com/pub/images/dialog/theme-to-top.gif';roll=false" src="http://blogteam.bokee.com/pub/images/dialog/theme-to-top.gif"></td></tr>
					<tr><td>
						<div id=Tmplclass align=center style="width:130;height:280;overflow:hidden">
						</div>
					</td></tr>
					<tr><td align=center height=20><img onmouseover="this.src='http://blogteam.bokee.com/pub/images/dialog/theme-to-bottom2.gif';roll=true;tmpl_roll(1)" onclick="roll=true;tmpl_roll(2)" onmouseout="this.src='http://blogteam.bokee.com/pub/images/dialog/theme-to-bottom.gif';roll=false" src="http://blogteam.bokee.com/pub/images/dialog/theme-to-bottom.gif"></td></tr>
				</table>
			</div>
		</td>
          <td valign="top">
			<table width=100%><tr><td><b>主题预览</b></td><td align=right id=page></td></tr></table>
			<div style="border:1px solid #000000;width:100%;height:338" id=show_small_tmpl></div>          
          </td>
        </tr>
      </table>
    </td>
  </tr>

</table>
<div id=smallbak style="display:none;filter:alpha(opacity=100);-moz-opacity:1;position:absolute;left:152;top:56;width:342;height:336;background:#FFFFFF"></div>
</body>
</html>
<script>
function $(s){return document.getElementById(s);}
function body_load(){
	var l="<table width='130' cellspacing='3' cellpadding='3'>"
	for(var i=0;i<Themes.length;i++){
		l+="<tr onmouseover=ov(this) onmouseout=out(this) onclick=ck(this) style='background:"+(i==0?"#D5E0DD":"#FFFFFF")+"' info='"+Themes[i].ClassName+"'><td style='border:1px solid #cccccc;padding-left:5px;CURSOR:pointer' height=22>"+Themes[i].ClassName+"</td></tr>"
	}
	$("Tmplclass").innerHTML=l+"<table>"
	//showtmpl(tmpl_class[0])
}
var rowid=0;
function ov(obj){if(rowid==obj.rowIndex)return;obj.style.background="#F6F6F6"}
function out(obj){if(rowid==obj.rowIndex)return;obj.style.background="#FFFFFF"}
function ck(obj){
	obj.style.background="#D5E0DD"
	obj.parentNode.parentNode.rows[rowid].style.background="#FFFFFF"
	rowid=obj.rowIndex
	$("page").innerHTML=""
	showtmpl(obj.getAttribute("info"))
}
function showtmpl(key,p){
	shade()
	var curr=-1;
	for(var i=0; i<Themes.length;i++)
	{
	  if(Themes[i].ClassName==key)
	  curr=i;
	}
	
	if(curr==-1||Themes[curr]==null){
		$("show_small_tmpl").innerHTML="<br>&nbsp;&nbsp;暂时没有相关模板"
		return;
	}
	p=p==null?1:p		//当前页
	var a=Themes[curr].Items;
	var ps=(a.length%9>0)?parseInt(a.length/9)+1:parseInt(a.length/9)	//总页数
	var l="<table width=100% height=100%>"
	if(ps!=1){
		$("page").innerHTML=""
		for(var pc=1;pc<=ps;pc++){
			$("page").innerHTML+=pc==p?"<a style='padding-right:8px'>"+pc+"</a>":"<a href='javascript:showtmpl(\""+key+"\","+pc+")' style='color:#649E8E;padding-right:8px'>"+pc+"</a>"
		}
	}
	
	for(var r=0;r<9;){
	if(r>a.length)break;
		l+="<tr valign='top'>"
		for(var d=0;d<3;d++){
			var imgid=r+(p-1)*9
			if(a[imgid])
			l+="<td width=110 height=108 val='"+a[imgid].Name+"' style='padding-top:3px' onmouseover='imgov(this)' onmouseout='imgout(this)' onclick='imgck(this)'>"+show_X(a[imgid])+"</td>"
			r++
		}
		l+="</tr>"
	}
	l+="</table>"
	$("show_small_tmpl").innerHTML=l
	
}
function show_X(r){
	//if(typeof(r)!="string")
	//	return ""
	//var a=r.split("/$/")
	var title='';
	if(r.Title.length>9)
	 title=r.Title.substring(0,9)+'..';
	 else
	 title=r.Title;
	var l="<div align=center><img src='"+r.Image+"' width=80 height=60 style='border:1px solid #cccccc'></div>\
			<div style='padding-left:10px;padding-top:3px;height:20'>"+title+"</div>";
			//"<div style='padding-left:10px;height:20'>设计:"+r.Title+"</div>";
	return l
}
function shade(){
	//if(parent.isNav){
	if(false){
		$("smallbak").style.top=55
		$("smallbak").style.left=152
		$("smallbak").style.width=344
		if($("smallbak").style.MozOpacity==0.1){
			$("smallbak").style.display="none"
			$("smallbak").innerHTML=""
			$("smallbak").style.MozOpacity=1
			return
		}
		$("smallbak").style.MozOpacity=$("smallbak").style.MozOpacity-0.1
	}else{
		if($("smallbak").filters.alpha.opacity==0){
			$("smallbak").innerHTML=""
			$("smallbak").filters.alpha.opacity=100
			$("smallbak").style.display="none"
			return
		}
		$("smallbak").filters.alpha.opacity+=-20
	}
	if($("smallbak").innerHTML==""){
		$("smallbak").innerHTML=$("show_small_tmpl").innerHTML
		$("smallbak").style.display=""
	}
	window.setTimeout("shade()",100)
	
}
function imgov(obj){
	if(obj.innerHTML=="")
		return
	obj.style.cursor="pointer"
	obj.style.background="#F3F3F3"
}
function imgout(obj){
	if(obj.innerHTML=="")
		return
	obj.style.background="#FFFFFF"
}
function imgck(obj){
	var val=obj.getAttribute("val");
	//window.top.close();
setTheme(val);
	//parent.changeTemplate("/"+cS+"/"+cF+"/"+val+"/index.css","http://blogteam.bokee.com/pub/template/"+cS+"/"+cF+"/"+val+"/index.css")
}
function setTheme(o)
{
 var theme=parent.document.getElementById('theme');
 if(theme!=null)
 {
 var themeUrl="../../style.aspx?style="+o;
 
 theme.setAttribute("href",themeUrl);
 theme.setAttribute("title",o);

 }
// alert('我发现不加上这一句就不能用，郁闷');
//alert('我发现不加上这一句就不能用，郁闷');
}
function tmpl_roll(c){
	if(!roll)return
	$('Tmplclass').scrollTop+=c
	window.setTimeout("tmpl_roll("+c+")",20)
}
body_load();
/*
var rowid=0;roll=false
var cS=parent.SkinConfig.currScreen
var cF=parent.SkinConfig.currFrame
function $(obj){return document.getElementById(obj)}
var ev = new Object();
var menu = parent.window.document.getElementById('menu');
function drag_start(obj,e){	
	ev.dragObj=$(obj)
	ev.dragPx=menu.offsetLeft
	ev.dragPy=menu.offsetTop
	ev.dragSx=e.screenX
	ev.dragSy=e.screenY
}
function move(e){
	if(ev.dragObj!=null){
		menu.style.left=ev.dragPx+e.screenX-ev.dragSx
		menu.style.top=ev.dragPy+e.screenY-ev.dragSy
	}
}
function stop(){
	 ev.dragObj=null;
}
function body_load(){
	var l="<table width='130' cellspacing='3' cellpadding='3'>"
	for(var i=0;i<Themes.length;i++){
		l+="<tr onmouseover=ov(this) onmouseout=out(this) onclick=ck(this) style='background:"+(i==0?"#D5E0DD":"#FFFFFF")+"' info='"+Themes[i].ClassName+"'><td style='border:1px solid #cccccc;padding-left:5px;CURSOR:pointer' height=22>"+Themes[i].ClassName+"</td></tr>"
	}
	$("Tmplclass").innerHTML=l+"<table>"
	//showtmpl(tmpl_class[0])
}

function ck(obj){
	obj.style.background="#D5E0DD"
	obj.parentNode.parentNode.rows[rowid].style.background="#FFFFFF"
	rowid=obj.rowIndex
	$("page").innerHTML=""
	showtmpl(obj.getAttribute("info"))
}
function tmpl_roll(c){
	if(!roll)return
	$('Tmplclass').scrollTop+=c
	window.setTimeout("tmpl_roll("+c+")",20)
}
function showtmpl(key,p){
	shade()
	if(tmpl_file[key]==null||tmpl_file[key]==""){
		$("show_small_tmpl").innerHTML="<br>&nbsp;&nbsp;暂时没有相关模板"
		return
	}
	p=p==null?1:p		//当前页
	var a=tmpl_file[key].split("|#|")
	var ps=(a.length%9>0)?parseInt(a.length/9)+1:parseInt(a.length/9)	//总页数
	var l="<table width=100% height=100%>"
	if(ps!=1){
		$("page").innerHTML=""
		for(var pc=1;pc<=ps;pc++){
			$("page").innerHTML+=pc==p?"<a style='padding-right:8px'>"+pc+"</a>":"<a href='javascript:showtmpl(\""+key+"\","+pc+")' style='color:#649E8E;padding-right:8px'>"+pc+"</a>"
		}
	}
	for(var r=0;r<9;){
		l+="<tr valign='top'>"
		for(var d=0;d<3;d++){
			var imgid=r+(p-1)*9
			l+="<td width=110 height=108 val='"+a[imgid]+"' style='padding-top:3px' onmouseover='imgov(this)' onmouseout='imgout(this)' onclick='imgck(this)'>"+show_X(a[imgid])+"</td>"
			r++
		}
		l+="</tr>"
	}
	l+="</table>"
	$("show_small_tmpl").innerHTML=l
}
function show_X(r){
	if(typeof(r)!="string")
		return ""
	var a=r.split("/$/")
	var l="<div align=center><img src='http://blogteam.bokee.com/pub/template/"+cS+"/31/"+a[2]+"/small.jpg' width=80 height=60 style='border:1px solid #cccccc'></div>\
			<div style='padding-left:10px;padding-top:3px;height:20'>名称:"+a[0]+"</div>\
			<div style='padding-left:10px;height:20'>设计:"+a[1]+"</div>";
	return l
}
function imgov(obj){
	if(obj.innerHTML=="")
		return
	obj.style.cursor="pointer"
	obj.style.background="#F3F3F3"
}
function imgout(obj){
	if(obj.innerHTML=="")
		return
	obj.style.background="#FFFFFF"
}
function imgck(obj){
	var val=obj.getAttribute("val").match(/\d+$/)
	parent.changeTemplate("/"+cS+"/"+cF+"/"+val+"/index.css","http://blogteam.bokee.com/pub/template/"+cS+"/"+cF+"/"+val+"/index.css")
}

function shade(){
	if(parent.isNav){
		$("smallbak").style.top=55
		$("smallbak").style.left=152
		$("smallbak").style.width=344
		if($("smallbak").style.MozOpacity==0.1){
			$("smallbak").style.display="none"
			$("smallbak").innerHTML=""
			$("smallbak").style.MozOpacity=1
			return
		}
		$("smallbak").style.MozOpacity=$("smallbak").style.MozOpacity-0.1
	}else{
		if($("smallbak").filters.alpha.opacity==0){
			$("smallbak").innerHTML=""
			$("smallbak").filters.alpha.opacity=100
			$("smallbak").style.display="none"
			return
		}
		$("smallbak").filters.alpha.opacity+=-20
	}
	if($("smallbak").innerHTML==""){
		$("smallbak").innerHTML=$("show_small_tmpl").innerHTML
		$("smallbak").style.display=""
	}
	window.setTimeout("shade()",100)
	
}*/
</script>
