function cLoadWin(){
parent.document.getElementById("loading").style.display = "none";	
}

function oLoadWin(){
document.getElementById("loading").style.display = "block";
}
function oLoadWin2(){
parent.document.getElementById("loading").style.display = "block";
}

var LastItem=null;
function menuClick(obj,url){
 if (LastItem!=null){
  LastItem.className="menuA"
 }
 obj.className="menuAS"
 LastItem=obj
 obj.blur()
 if (url.length>0) {oLoadWin();document.cframe.location=url;}
}



var x0=0,y0=0,x1=0,y1=0;
var offx=4,offy=4;
var moveable=false;
var hover='green',normal='orange';//normal='slategray';//color;
var index=10000;//z-index;
//开始拖动;
function startDrag(obj)
{
	if(event.button==1)
	{
		//锁定标题栏;
		obj.setCapture();
		//定义对象;
		var win = obj.parentNode;
		var sha = win.nextSibling;
		//记录鼠标和层位置;
		x0 = event.clientX;
		y0 = event.clientY;
		x1 = parseInt(win.style.left);
		y1 = parseInt(win.style.top);
		//记录颜色;
		normal = obj.style.backgroundColor;
		//改变风格;
		obj.style.backgroundColor = hover;
		win.style.backgroundColor = hover;
		obj.nextSibling.style.color = hover;
		sha.style.left = x1 + offx;
		sha.style.top  = y1 + offy;
		moveable = true;
	}
}
//拖动;
function drag(obj)
{
	if(moveable)
	{
		var win = obj.parentNode;
		var sha = win.nextSibling;
		var cLeft=x1 + event.clientX - x0;
		var cTop=y1 + event.clientY - y0;
		if(cLeft<0)cLeft=0;
		if(cTop<0)cTop=0;
		win.style.left = cLeft;
		win.style.top  = cTop;
		sha.style.left = parseInt(win.style.left) + offx;
		sha.style.top  = parseInt(win.style.top) + offy;
	}
}
//停止拖动;
function stopDrag(obj)
{
	if(moveable)
	{
		var win = obj.parentNode;
		var sha = win.nextSibling;
		var msg = obj.nextSibling;
		win.style.backgroundColor = normal;
		obj.style.backgroundColor = normal;
		msg.style.color           = normal;
		//sha.style.left = obj.parentNode.style.left+offx;
		//sha.style.top  = obj.parentNode.style.top+offy;
		obj.releaseCapture();
		moveable = false;
	}
}
//获得焦点;
function getFocus(obj)
{
	if(obj.style.zIndex!=index)
	{
		index = index + 2;
		var idx = index;
		obj.style.zIndex=idx;
		obj.nextSibling.style.zIndex=idx-1;
	}
}
//最小化;
function min(obj)
{
	var win = obj.parentNode.parentNode;
	var sha = win.nextSibling;
	var tit = obj.parentNode;
	var msg = tit.nextSibling;
	var flg = msg.style.display=="none";
	if(flg)
	{
		win.style.height  = parseInt(msg.style.height) + parseInt(tit.style.height) + 10;
		sha.style.height  = win.style.height;
		msg.style.display = "block";
		obj.innerHTML = "0";
	}
	else
	{
		win.style.height  = parseInt(tit.style.height) + 10;
		sha.style.height  = win.style.height;
		obj.innerHTML = "2";
		msg.style.display = "none";
	}
}
//关闭;
function cls(obj)
{
	var win = obj.parentNode.parentNode;
	var sha = win.nextSibling;
	win.style.display = "none";
	sha.style.display = "none";
	win.style.width=0;
	win.style.height=0;
	sha.style.width=0;
	sha.style.height=0;
}



function xWin(id,w,h,l,t,tit,msg)
{
	index = index+2;
	this.id      = id;
	this.width   = w;
	this.height  = h;
	this.left    = l;
	this.top     = t;
	this.zIndex  = index;
	this.title   = tit;
	this.message = msg;
	this.obj     = null;
	this.bulid   = bulid;
	this.bulid();
}
//初始化;
function bulid()
{
	var str=document.getElementById("winpage").value;
	str=str.replace(/\{\$id\}/g,this.id);
	str=str.replace(/\{\$index\}/g,this.zIndex);
	str=str.replace(/\{\$sindex\}/g,this.zIndex-1);
	str=str.replace(/\{\$width\}/g,this.width);
	str=str.replace(/\{\$height\}/g,this.height);
	str=str.replace(/\{\$left\}/g,this.left);
	str=str.replace(/\{\$top\}/g,this.top);
	str=str.replace(/\{\$normal\}/g,normal);
	str=str.replace(/\{\$hover\}/g,hover);
	str=str.replace(/\{\$twidth\}/g,this.width-4);
	str=str.replace(/\{\$theight\}/g,19);
	str=str.replace(/\{\$title\}/g,this.title);
	str=str.replace(/\{\$content\}/g,this.message);
	str=str.replace(/\{\$cheight\}/g,this.height-29);
	str=str.replace(/\{\$stop\}/g,this.top+offy);
	str=str.replace(/\{\$sleft\}/g,this.left+offx);
	document.body.insertAdjacentHTML("beforeEnd",str);
}


var winb;
function showWindow(did,w,h,l,t,title,url)
{
	var title2=title;
	title2=title2.replace(/\</g,"");
	title2=title2.replace(/\>/g,"");
	title2=title2.replace(/\\/g,"");
	title2=title2.replace(/\//g,"");
	//if(eval("document.all.xMsg"+did)){document.getElementById("xMsg"+did).style.visibility = "visible";
				//document.getElementById("xMsg"+did).nextSibling.style.visibility = "visible";}
	//else{
		winb = new xWin(did,w,h,l,t,title2,"<iframe src="+url+" width="+(w-10)+" height="+(h-29)+" frameborder='0'></iframe>");
		//}
}

function showWindow2(did,w,h,l,t,title,url)
{
	var title2=title;
	title2=title2.replace(/\</g,"");
	title2=title2.replace(/\>/g,"");
	title2=title2.replace(/\\/g,"");
	title2=title2.replace(/\//g,"");
	winb = new xWin(did,w,h,l,t,title2,"<iframe src="+url+" width="+(w-10)+" height="+(h-29)+" frameborder='0'></iframe>");
}



function setPage(s, i)
{
return s.replace('{p}', i.toString());
}
function pager(url, page, maxPage, total, per, countsIsVisible)
{
var first = "<img src='images/m_b1.gif' border=0>";
var previous = "<img src='images/m_b2.gif' border=0>";
var next = "<img src='images/m_b3.gif' border=0>";
var last = "<img src='images/m_b4.gif' border=0>";

var s = "<div><div style='float:left; font-family:courier new,sans-serif'>";
if (page == 1)
{
s += (first + " " + previous + " <b>");
}
else
{
if (first != "") s += ("<a href='" + setPage(url, 1) + "' onclick='oLoadWin2();'>" + first + "</a> ");
s += ("<a href='" + setPage(url, (page-1)) + "' onclick='oLoadWin2();'>" + previous + "</a> <b>");
}

var j = (page-5 < 1) ? 1 : page-5;
var k = (page+5 > maxPage) ? maxPage : page+5;

if (j > 1) s += " <a href='" + setPage(url, 1) + "' onclick='oLoadWin2();'>1</a> ... ";
for (var i=j; i<k+1; i++)
{
if (page == i)
{
s += ("<font style='background:#898989;font:14px;font-weight:bold;color:fff;'>" + i + "</font> ");
continue;
}
s += ("<a href='" + setPage(url, i) + "' onclick='oLoadWin2();'>" + i + "</a> ");
}
if (maxPage > k) s += " ... <a href='" + setPage(url, maxPage) + "' onclick='oLoadWin2();'>" + maxPage + "</a> ";
if (page == maxPage)
{
s += ("</b>" + next + " " + last);
}
else
{
s += ("</b><a href='" + setPage(url, page+1) + "' onclick='oLoadWin2();'>" + next + "</a> ");
if (last != "") s += ("<a href='" + setPage(url, maxPage) + "' onclick='oLoadWin2();'>" + last + "</a>");
}

s += ("</div>");
if (countsIsVisible)
{
s += ("<div class='pager-stat' style='float:right'>");
s += ("总记录:<span class='t2'>" + total + "</span>　");
s += ("每页:<span class='t2'>" + per + "</span>　");
s += ("总页数:<span class='t2'>" + maxPage + "</span></div>");
}
s += "</div>";

return s;
} 


function S()
{
 this.items = {};
}
S.prototype.add = function(id,iArray)
{
 this.items[id] = iArray;
}
S.prototype.Exists = function(id)
{
 if(typeof(this.items[id]) == "undefined") return false;
 return true;
}



					function gosearch(){
					var type=document.getElementById("type").value;
					var key=document.getElementById("key").value;
					if(key.replace(/\s/g,"").length<1){alert("对不起,关键字未填写!");return;}
					oLoadWin2();
					document.searchfrom.submit();
					}
					
function showFlash(flashWIDTH,flashHEIGHT,flashURL){
		document.writeln ('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" WIDTH='+flashWIDTH+' HEIGHT='+flashHEIGHT+'>');
		document.writeln ('<PARAM NAME=movie VALUE="'+flashURL+'">');
		document.writeln ('<PARAM NAME=wmode VALUE=transparent>');
		document.writeln ('<PARAM NAME=loop VALUE=true>');
		document.writeln ('<PARAM NAME=quality VALUE=high>');
		document.writeln ('<EMBED src="'+flashURL+'" loop=true wmode=transparent quality=high swLiveConnect=FALSE WIDTH='+flashWIDTH+' HEIGHT='+flashHEIGHT+' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED>');
		document.writeln ('</OBJECT>');
}