// JavaScript Document
var Last_className="";
var Last_Row=null;
function SelectRow(Row){
	//如果上次有选中并且不是自己那一条则恢复
 
	if(Row!=Last_Row){ 
		//如果为空则设置上次选中的Class
		if(Last_Row==null){   
			Last_className=Row.cells[0].className;
			Last_Row=Row;
		}else{ 
			for(i=0;i<Last_Row.cells.length;i++){		
				Last_Row.cells[i].className=Last_className;				 
			}
			Last_className=Row.cells[0].className;
			Last_Row=Row;
		}		 
		//设置新的行的CSS为选中
		for(i=0;i<Row.cells.length;i++){		
			Row.cells[i].className="SelectRow";
		}		
	} 
	
}
function SelectDir(File,type){	
 
	if(type==1){  
	
		location.replace(File);
	}else{
		document.all.path.value=File;  
		HiddenDiv(); 
	} 
}
// JavaScript Document  
function SetUploadPath(){
	document.all.table0.style.display=''; 
	document.all.table1.style.display='none';
	document.all.table2.style.display='none';
	document.all.path1.value='';
	document.all.path.value='';
	HiddenDiv();
	LightDialogRtc();
}
function SetUploadSelect(){
	document.all.table0.style.display='none'; 
	document.all.table2.style.display=''; 
	document.all.table1.style.display='none'; 
	document.all.path1.value='';
	document.all.path0.value='';
	HiddenDiv();
	
	LightDialogRtc();
}
function SetUpload(){
	document.all.table0.style.display='none'; 
	document.all.table1.style.display='';
	document.all.table2.style.display='none';
	document.all.path0.value='';
	document.all.path.value='';
	HiddenDiv();
	LightDialogRtc();
}
function GetCheck(){
	var Flag=true;
	for (var i = 0; i < form1.elements.length; i++) {
		var e = form1.elements[i];
		if (e.id == "view_level") {
			if(e.checked ){
					document.all.local.checked=true;
					Flag=false;
			}
		}
	}
	if(Flag){
		document.all.local.checked=false;
	}
}
function GetCheckUnion(){
	var Flag=true;
	for (var i = 0; i < form1.elements.length; i++) {
		var e = form1.elements[i];
		if (e.id == "view_level_union") {
			if(e.checked){
					document.all.union.checked=true;
					Flag=false;
			}
		}
	}
	if(Flag){
		document.all.union.checked=false;
	}
}
function SetCheck(SelectPro){
if(SelectPro.checked){
		for (var i = 0; i < form1.elements.length; i++) {
			var e = form1.elements[i];
			if (e.id == "view_level") {
				e.checked=true;
			}
		}
	}else{
		for (var i = 0; i < form1.elements.length; i++) {
			var e = form1.elements[i];
			if (e.id == "view_level") {
				e.checked=false;
			}
		}
	}
}
function SetCheckUnion(SelectPro){
if(SelectPro.checked){
		for (var i = 0; i < form1.elements.length; i++) {
			var e = form1.elements[i];
			if (e.id == "view_level_union") {
				e.checked=true;
			}
		}
	}else{
		for (var i = 0; i < form1.elements.length; i++) {
			var e = form1.elements[i];
			if (e.id == "view_level_union") {
				e.checked=false;
			}
		}
	}
}
function getIE(src, obj)
{
	var temp=obj.id.split("_");
	rowid=temp[1];
	var aLeft=src.offsetLeft;
	var aTop=src.offsetTop;
	while(src.offsetParent!=null && src.offsetParent!=document.body){
		src=src.offsetParent;
		aLeft+=src.offsetLeft;
		aTop+=src.offsetTop;
	}
	switch(rowid){
		case "A":
			aTop=aTop-document.getElementById("TopTR").offsetTop-3;
			break;
		case "B":
			aTop=aTop-document.getElementById("LeftTR").offsetTop-3;
			break;
		case "C":
			if(status) aTop=aTop-document.getElementById("BottomTR").offsetTop-3;
			break;
		case "D":
			if(status) aTop=aTop-document.getElementById("RightTR").offsetTop-3;
			aLeft=aLeft-document.getElementById("RightTR").offsetLeft+5;
			break;
		default:
			if(status) aTop=aTop-document.getElementById("content").offsetTop-3;
			aLeft=aLeft-document.getElementById("content").offsetLeft+5;
	}
	obj.style.left=aLeft;
	obj.style.top=aTop;
}
function setFlashAd(){
	var   divs   =   document.getElementsByTagName("div");
	for(var   i   =   0;i<divs.length;i++)   
	{   
		if(divs[i].id.indexOf("mask_")!=-1){
			var temp=divs[i].id.split("_");
			tag = 	temp[2];
			oldtag = document.getElementById("flash_"+tag);
			getIE(oldtag, divs[i]);
			
		}
		
	}	
}

function LightBoxRtc(){
	
//得到页面的高度
//自适应lightbox的高度
var h=document.body.scrollHeight;

oriPanelHeight=self.parent.parent.document.getElementById("sysPanel").style.pixelHeight;
self.parent.parent.document.getElementById("sysPanel").style.pixelHeight=h;
self.parent.parent.document.getElementById("panelFrame").height=h;

}
function LightDialogRtc(){
	
//得到页面的高度
//自适应lightbox的高度
var h=document.body.scrollHeight;

oriPanelHeight=self.parent.document.getElementById("sysPanel").style.pixelHeight;
self.parent.document.getElementById("sysPanel").style.pixelHeight=h;
self.parent.document.getElementById("panelFrame").height=h;

}

function RTC(){
	
	var dh = parent.window.dialogHeight; 
	
	while (isNaN(dh))
	{
		dh = dh.substr(0,dh.length-1); 
	}
	var dw = parent.window.dialogWidth;
	while (isNaN(dw)) 
	{ 
		dw = dw.substr(0,dw.length-1);
	}

	difh = dh - parent.document.body.clientHeight;
	difw = dw - parent.document.body.clientWidth;

	parent.window.dialogHeight = (document.body.scrollHeight + 0 + parseInt(difh , 10)) + 'px';
	parent.window.dialogWidth = (parent.document.body.scrollWidth + parseInt(difw , 10)) + 'px';

	//parent.window.dialogHeight =document.body.scrollHeight +15+ 'px';
	//parent.window.dialogWidth = document.body.scrollWidth  +15+ 'px';
}
function showDialogary(url,width,height){
	var arry=window.showModalDialog(url,"","scroll:0;status:0;help:0;resizable:1;dialogWidth:"+width+"px;dialogHeight:"+height+"px");

	return arry;
}
function Dialogreload(url,width,height){
 try{
var a=showDialogary(url,width,height);
 
if(a==1){
 
	location.href=location.href;
}
}catch(e){}
}
function showDialog(url,width,height){
	window.showModalDialog(url,"","scroll:0;status:no;help:0;resizable:1;dialogWidth:"+width+"px;dialogHeight:"+height+"px");
}
function Dialogsearch(url,width,height){
	try{
		var a=showDialogary(url,width,height);
		if(a!=undefined){
			if(a.substr(0,1)=="?")
				location.href=a; 
			else
				return false;
		
		}
	}catch(e){}
}
var xmlhttp;
function FavProduct(PrdId){	 
		xmlhttp = new ActiveXObject("Microsoft.xmlhttp");
		urlpath="Xmlhttp/Fav_Product.php";	
		xmlhttp.open("POST",urlpath,false);	  
		xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		xmlhttp.setRequestHeader("Connection","close");
		xmlhttp.send("id="+PrdId); 
		var result = xmlhttp.responseText;
		eval(result); 
}
//产品导航
function NavProduct(PrdId,direction,range,orderby,f){	 
		xmlhttp = new ActiveXObject("Microsoft.xmlhttp");
		urlpath="Xmlhttp/Nav_Product.php?pid="+PrdId+"&d="+direction+"&r="+range+"&orderby="+orderby+"&f="+f;
		xmlhttp.open("GET",urlpath,true);	
		xmlhttp.onreadystatechange=doNavProduct;
		xmlhttp.send(null); 
}
function doNavProduct(){
	if (xmlhttp.readyState == 4) {
		if (xmlhttp.status == 200) {
			var res=xmlhttp.responseText.Trim().split(",");	//返回-1代表已到第一个产品或最后一个产品
			if(res!="-1"){
				top.location.replace("view_product.php?id="+parseInt(res[0])+"&orderby="+parseInt(res[1])+((!isNaN(parseInt(res[2])) && parseInt(res[2])>0)?"&f="+parseInt(res[2]):""));
			}
		}
	}
}
//文章导航
function NavNews(NewsId,direction,range,orderby,f){	 
		xmlhttp = new ActiveXObject("Microsoft.xmlhttp");
		urlpath="Xmlhttp/Nav_News.php?nid="+NewsId+"&d="+direction+"&r="+range+"&orderby="+orderby+"&f="+f;
		xmlhttp.open("GET",urlpath,true);	
		xmlhttp.onreadystatechange=doNavNews;
		xmlhttp.send(null); 
}
function doNavNews(){
	if (xmlhttp.readyState == 4) {
		if (xmlhttp.status == 200) {
			var res=xmlhttp.responseText.Trim().split(",");	//返回-1代表已到第一篇文章或最后一篇文章
			if(res!="-1"){
				top.location.replace("view_news.php?id="+parseInt(res[0])+"&orderby="+parseInt(res[1])+((!isNaN(parseInt(res[2])) && parseInt(res[2])>0)?"&f="+parseInt(res[2]):""));
			}
		}
	}
}
function CheckLogin(LForm){

	if(LForm.username.value.Trim()==""){
		alert("请输入用户名！");
		LForm.username.focus();
		return false;
	}
 
	if(LForm.password.value.Trim()==""){
		alert("请输入密码！");
		LForm.password.focus();
		return false; 
	}
	if(LForm.code.value.length!=4){
		alert("请输入正确的验证码！");
		LForm.code.focus();
		return false;
	}
	
	return true;
}
function FavAlert(Flag){
	switch(Flag){
		case 0:
			alert("对不起，要收藏该产品请先登录!");
			return false;
		break;
		case 1:
			alert("已成功收藏!");
			return false;
		break;
		case 2:
			alert("你已收藏了该产品!");
			return false;
		break;
		case 3:
			alert("只有会员才能收藏产品！");
			return false;
		break;
		case 4:
			alert("系统忙，请稍候再试！");
			return false;
		default :
			alert("对不起，要收藏该产品请先登录!");
			return false;
		break;
	
	
	}

}
function CheckDiscuss(DForm){
	if(DForm.Name.value.Trim()==""){
		alert("请输入您的姓名！");
		DForm.Name.focus();
		return false;
	}
	if(DForm.Email.value.Trim()==""){
		alert("请输入您的Email！");
		DForm.Email.focus();
		return false;
	}
	if(DForm.Info.value.Trim()==""){
		alert("请输入您要评论的内容!");
		DForm.Info.focus();
		return false;
	}

}
function CheckGuesstbook(GForm){
	if(GForm.Name.value.Trim()==""){
		alert("请输入您的姓名！");
		GForm.Name.focus();
		return false;
	}
	if(GForm.Email.value.Trim()==""){
		alert("请输入您的Email！");
		GForm.Email.focus();
		return false;
	}
	
	if(GForm.Subject.value.Trim()==""){
		alert("请输入您留言的主题！");
		GForm.Subject.focus();
		return false;
	}
	if(GForm.Info.value.Trim()==""){
		alert("请输入您要留言的内容!");
		GForm.Info.focus();
		return false;
	}
	if(GForm.code.value.Trim().length!=4){
		alert("请输入正确的验证码!");
		GForm.code.focus();
		return false;
	}
}
function CheckSearch(SForm){
	if(SForm.keyword.value.Trim()=="" || SForm.keyword.value=="请输入要查询的关键字"){	
		alert("请输入搜索关键字!");
		SForm.keyword.focus();
		return false;
	}
}
function SearchClick(Keyword){
	Keyword.value="";
}
function SearchOver(Keyword){
	Keyword.select();
}
function doZoom(size){
	document.getElementById('zoom').style.fontSize=size+'px';
}
//-----------------------------------------------------------------

function GetHeadImages(){//得到会员头像
try{
	Nums=rand(ImagesData.length)-1;
	return ImagesData[Nums];
}catch(e){
	return "Web/Images/guestbook_product.jpg";
}
		
}
function rnd() {
rnd.today=new Date(); 
rnd.seed=rnd.today.getTime(); 
rnd.seed = (rnd.seed*9301+49297) % 233280;
return rnd.seed/(233280.0);
};
function rand(number) {
	return Math.ceil(rnd()*number);
}
//-----------------------------------------------------------------
//大幅
function GetBigAdImage(){

 	 try{
		switch(BigAdImage[0]){//图片
			case 1:
				DivStr="<a href='"+BigAdImage[2]+"' target='_blank'><img border=0 src='"+BigAdImage[1]+"' width='490' height='200'></a>";
			break;
			case 2:			 
				DivStr="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='490' height='200'><param name='movie' value='"+BigAdImage[1]+"'><param name='quality' value='high'><embed src='"+BigAdImage[1]+"' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='490' height='200'></embed></object>";
			break;
			default :
				DivStr="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='490' height='200'><param name='movie' value='Web/Images/default_banner.swf'><param name='quality' value='high'><embed src='Web/Images/default_banner.swf' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='490' height='200'></embed></object>";
			break;
		}
		
	}catch(e){	
		 DivStr="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='490' height='200'><param name='movie' value='Web/Images/meifu.swf'><param name='quality' value='high'><embed src='Web/Images/meifu.swf' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='490' height='200'></embed></object>";
	 
	}  

  	document.all.BigAdImage.innerHTML=DivStr;
 
 
}
function GetAdImage(){
 	try{
		switch(AdImage[0]){//图片
			case 1:
				DivStr="<a href='"+AdImage[2]+"'  target='_blank'><img src='"+AdImage[1]+"' width='725' height='60' border=0></a>";
			break;
			case 2:
				DivStr="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='725' height='80'><param name='movie' value='"+AdImage[1]+"'><param name='quality' value='high'><embed src='"+AdImage[1]+"' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='725' height='80'></embed></object>";
			break;
			default :
				DivStr="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='725' height='80'><param name='movie' value='Web/Images/default_banner_inner.swf'><param name='quality' value='high'><embed src=''Web/Images/default_banner_inner.swf' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='725' height='80'></embed></object>";
			break;
		}
	}catch(e){
			DivStr="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='725' height='80'><param name='movie' value='Web/Images/default_banner_inner.swf'><param name='quality' value='high'><embed src=''Web/Images/default_banner_inner.swf' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='725' height='80'></embed></object>";
 	}
	document.all.AdImage.innerHTML=DivStr;
	 
}
//内页
String.prototype.Trim = function() 
{ 
return this.replace(/(^\s*)|(\s*$)/g, ""); 
} 

String.prototype.LTrim = function()  
{ 
return this.replace(/(^\s*)/g, ""); 
} 

String.prototype.RTrim = function() 
{ 
return this.replace(/(\s*$)/g, ""); 
}
 
var Car=false;
function openUrl(Url,top,left,width,height){	
		if(Car && !Car.closed){			
			 Car=window.open(Url,'Car','scrollbars=no,status=no,width='+width+',height='+height+',top='+top+',left='+left);
				Car.focus();
			//	Car.location.reload();		 
		}else{
		  //top=screen.height/2-height/2;
		  top=50;
		  left=screen.width/2-width/2; 
		  Car=window.open(Url,'Car','scrollbars=no,status=no,width='+width+',height='+height+',top='+top+',left='+left);
		  Car.focus();
		//  Car.location.reload();
		}
	 
}
 

function FucCheckSingnNum(NUM)
{
    var i,j,strTemp;
    strTemp="0123456789";
    if ( NUM.length== 0)
        return 0
    for (i=0;i<NUM.length;i++)
    {
        j=strTemp.indexOf(NUM.charAt(i));
        if (j==-1)
        {
        //说明有字符不是数字
            return 0;
        }
    }
    //说明是数字
    return 1;
}

function fucCheckNUM(NUM)
{
    var i,j,strTemp;
    strTemp="012345678.9";
    if ( NUM.length== 0)
        return 0
    for (i=0;i<NUM.length;i++)
    {
        j=strTemp.indexOf(NUM.charAt(i));
        if (j==-1)
        {
        //说明有字符不是数字
            return 0;
        }
    }
    //说明是数字
    return 1;
}

function showDiv(divName){
	if(divName=="newpdtDiv"){
		document.getElementById(divName).style.display="block";
		document.getElementById("cmdpdtDiv").style.display="none";
		document.getElementById("divTab1").style.fontWeight="bold";
		document.getElementById("divTab2").style.fontWeight="normal";
	}else if(divName=="cmdpdtDiv"){
		document.getElementById(divName).style.display="block";
		document.getElementById("newpdtDiv").style.display="none";
		document.getElementById("divTab1").style.fontWeight="normal";
		document.getElementById("divTab2").style.fontWeight="bold";
	}
	return false;
}
function CheckTel(TEL)
{
	var i,j,strTemp;
	strTemp="0123456789-()#呼转 ";
	for (i=0;i<TEL.length;i++)
	{
		j=strTemp.indexOf(TEL.charAt(i));
		if (j==-1)
		{
		//说明有字符不合法
			return 0;
		}
		}
    //说明合法
    return 1;
}

//模块配置属性转换函数
/**
*	{prop1:value1,prop2:value2} => arr[prop1]=value1,arr[prop2]=value2
**/
function str2arr(str){
	str=str.replace(/^\{/,"");
	str=str.replace(/\}$/,"");
	str=str.replace(/\"/g,"");
	//str=str.replace("\\","");
	var temp=str.split(",");
	var arr=new Array();
	for(var i=0;i<temp.length;i++){
		if(temp[i].Trim()=="") continue;
		var temp2=temp[i].split(":");
		if(temp2[1]!=undefined) var temp3=temp2[1].replace(/%3A/g,":");
		temp3=temp3.replace(/%2C/g,",");
		arr[temp2[0]]=temp3;
	}
	
	return arr;
}

/**
*	arr[prop1]=value1,arr[prop2]=value2 => {prop1:value1,prop2:value2}
**/
function arr2str(arr){
	var str='{';
	var temp;
	for(var prop in arr){
		if(typeof arr[prop]=="string"){
			temp=arr[prop].replace(/:/g,"%3A");
			temp=temp.replace(/,/g,"%2C");
			temp=temp.replace(/\r\n/g,"");
			str+=prop+":\""+temp+"\",";
		}else str+=prop+":"+arr[prop]+",";
	}
	str=str.substr(0,str.length-1);
	str+="}";
	
	return str;
}

//渲染页面背景以及分区背景
function renderBG(){
	if(PageProps['prop_page_bgcolor']==undefined) PageProps['prop_page_bgcolor']="";
	if(PageProps['prop_page_bgfile']==undefined) PageProps['prop_page_bgfile']="";
	if(PageProps['prop_bgrepeat']==undefined) PageProps['prop_bgrepeat']="";
	if(PageProps['prop_align']==undefined) PageProps['prop_align']="";
	if(PageProps['prop_valign']==undefined) PageProps['prop_valign']="";

	var _props=new Array();
	_props[_props.length]="TopProps";
	_props[_props.length]="LeftProps";
	_props[_props.length]="ContentProps";
	_props[_props.length]="RightProps";
	_props[_props.length]="BottomProps";
	
	for(var i=0;i<_props.length;i++){
		var obj=eval(_props[i]);
		if(obj['prop_bgcolor']==undefined) obj['prop_bgcolor']="";
		if(obj['prop_bgfile']==undefined) obj['prop_bgfile']="";
		if(obj['prop_bgrepeat']==undefined) obj['prop_bgrepeat']="";
		if(obj['prop_align']==undefined) obj['prop_align']="";
		if(obj['prop_valign']==undefined) obj['prop_valign']="";
	}

	//页面背景
	document.body.style.background=PageProps['prop_page_bgcolor']+" url("+PageProps['prop_page_bgfile']+") "+PageProps['prop_bgrepeat']+" "+PageProps['prop_align']+" "+PageProps['prop_valign'];
	
	//头部背景
	if(document.getElementById("TopTR")!=null) document.getElementById("TopTR").style.background=TopProps['prop_bgcolor']+" url("+TopProps['prop_bgfile']+") "+TopProps['prop_bgrepeat']+" "+TopProps['prop_align']+" "+TopProps['prop_valign'];
	
	//左区背景
	if(document.getElementById("LeftTR")!=null) document.getElementById("LeftTR").style.background=LeftProps['prop_bgcolor']+" url("+LeftProps['prop_bgfile']+") "+LeftProps['prop_bgrepeat']+" "+LeftProps['prop_align']+" "+LeftProps['prop_valign'];
	
	//内容区背景
	document.getElementById("content").style.background=ContentProps['prop_bgcolor']+" url("+ContentProps['prop_bgfile']+") "+ContentProps['prop_bgrepeat']+" "+ContentProps['prop_align']+" "+ContentProps['prop_valign'];
	
	//右区背景
	if(document.getElementById("RightTR")!=null) document.getElementById("RightTR").style.background=RightProps['prop_bgcolor']+" url("+RightProps['prop_bgfile']+") "+RightProps['prop_bgrepeat']+" "+RightProps['prop_align']+" "+RightProps['prop_valign'];
	
	//底部背景
	if(document.getElementById("BottomTR")!=null) document.getElementById("BottomTR").style.background=BottomProps['prop_bgcolor']+" url("+BottomProps['prop_bgfile']+") "+BottomProps['prop_bgrepeat']+" "+BottomProps['prop_align']+" "+BottomProps['prop_valign'];
}

function CheckViewPassword(loginForm){
	if(loginForm.password.value.Trim()=="" || loginForm.code.value.Trim()==""){
		alert("请输入密码与验证码！");
		return false;
		
	}else return true;
}

var newslogin="",movielogin="",downlogin="",photologin="";
function checkaccess(pwflag,datatype,dataid,page,detail,formno,orderby){
	pwflag=pwflag.Trim()!=""?parseInt(pwflag):0;
	var idstr=";"+dataid+";";
	var idsstr="";
	switch(datatype){
		case "NEWS":
			idsstr=";"+newslogin+";";
			break;
		case "MOVIE":
			idsstr=";"+movielogin+";";
			break;
		case "DOWN":
			idsstr=";"+downlogin+";";
			break;
		case "PHOTO":
			idsstr=";"+photologin+";";
			break;
		case "PICTURE":
			idsstr=";"+photologin+";";
			break;
	}
	if(pwflag && idsstr.indexOf(idstr)==-1){
		showLightbox(300,150,"psw_movie.php?datatype="+datatype+"&dataid="+dataid+"&page="+page+"&detail="+detail+"&orderby="+orderby);
		return false;
		
	}else return doOp(datatype,dataid,page,detail,formno,orderby);
}

function doOp(datatype,dataid,page,detail,formno,orderby){
	if(detail==undefined){
		detail=0;
	}else{
		detail=(detail.Trim()!="")?parseInt(detail):0;
	}
	hideLightbox(scrollPanel);
	switch(datatype){
		case "NEWS":
			if(detail){
				window.open("/view_news.php?f="+page+"&id="+dataid,"","");
			}else top.location="/view_news.php?f="+page+"&id="+dataid+"&orderby="+orderby;
			break;
		case "MOVIE":
			if(detail){
				playMovie1(dataid,formno);
			}else playMovie2(dataid,formno)
			break;
		case "DOWN":
			top.location="/download.php?id="+dataid;
			break;
		case "PHOTO":
			if(detail){
				window.open("/pictures.php?f="+page+"&photoid="+dataid,"","");
			}else top.location="/pictures.php?f="+page+"&photoid="+dataid;
			break;
		case "PICTURE":
			if(detail){
				window.open("/view_picture.php?f="+page+"&picid="+dataid,"","");
			}else top.location="/view_picture.php?f="+page+"&picid="+dataid;
			break;
	}
	return false;
}

function changefunc(Entity){
	for (i = 1 ; i <= 2; i ++){
		document.all["func" + i].background	= "Images/down.gif";
	}
	document.all["func" + Entity].background="Images/up.gif";
	for (i = 1 ; i <= 2; i ++){
		document.all["funcfont" + i].color	= ""; 
	}
	document.all["funcfont" + Entity].color	= "#FF0000";	
	for (i = 1 ; i <= 2; i ++){ 
		document.all["functable" + i].style.display	= "none";
	}
	document.all["functable" + Entity].style.display	= "";	 
 
	LightBoxRtc();
}

function format(formatfield,icon,fcode){
	var curlink_format=parseInt(document.form1.elements[formatfield].value);
	if((curlink_format & fcode)==fcode){
		curlink_format&=(~fcode);
		var imgsrcArr=icon.src.substring(icon.src.lastIndexOf("/")+1).split(".");
		icon.src="Images/"+imgsrcArr[0].substr(0,imgsrcArr[0].length-3)+"."+imgsrcArr[1];
	}else{
		curlink_format|=fcode;
		var imgsrcArr=icon.src.substring(icon.src.lastIndexOf("/")+1).split(".");
		icon.src="Images/"+imgsrcArr[0]+"_on."+imgsrcArr[1];
	}
	document.form1.elements[formatfield].value=curlink_format;
}

function selectImage(theform,imagename){
	var modelsite="http://model.winha.net/";
	try{
		var icon=showDialogary('selectimages_frame.php?flag='+imagename,500,380);
		if(icon!=undefined){
			if(icon!=""){
				html='<img src="'+modelsite+icon+'" align="absmiddle">';
			}else html='';
			switch(imagename){
				case "Split_Line":	//分隔线
					theform.elements["prop_app_split"].value=icon;
					document.getElementById("Split_Line").innerHTML=html;
					document.getElementById("Split_Line").style.backgroundImage='url('+modelsite+icon+')';
					break;
				case "Border":	//图片框
					theform.elements["prop_app_frame"].value=icon;
					document.getElementById("Border").innerHTML=html;
					break;
				case "BackGround":	//背景
					theform.elements["prop_bgfile"].value=icon;
					document.getElementById("BackGround").innerHTML=html;
					break;
				case "Icon_Title":	//标题图标
					theform.elements["prop_app_titleicon"].value=icon;
					document.getElementById("Icon_Title").innerHTML=html;
					break;
				case "More":	//更多
					theform.elements["prop_app_moreicon"].value=icon;
					document.getElementById("More").innerHTML=html;
					break;
				case "Icon_New":	//最新标记图标
					theform.elements["prop_new"].value=icon;
					document.getElementById("Icon_New").innerHTML=html;
					break;
				case "Icon_Hot":	//热门标记图标
					theform.elements["prop_hot"].value=icon;
					document.getElementById("Icon_Hot").innerHTML=html;
					break;
				case "Buttom_Play":	//播放按钮
					theform.elements["prop_playbutton"].value=icon;
					document.getElementById("Buttom_Play").innerHTML=html;
					break;
				case "Buttom_Download":	//下载按钮
					theform.elements["prop_downbutton"].value=icon;
					document.getElementById("Buttom_Download").innerHTML=html;
					break;
				case "Split_Img":	//Split_Img
					theform.elements["prop_spliticon"].value=icon;
					document.getElementById("Split_Img").innerHTML=html;
					break;
				case "Item_Img":	//Item_Img
					theform.elements["prop_icon"].value=icon;
					document.getElementById("Item_Img").innerHTML=html;
					break;
			}
			//打勾checkbox
			
		}
	}catch(e){};
}

function selectButton(theform,imagename){
	var modelsite="http://model.winha.net/File/Button/";
	try{
		var button=showDialogary('selectbutton_frame.php',500,380);
		if(button!=undefined){
			if(button!=""){
				html='<img src="'+modelsite+button+'.gif" align="absmiddle">';
			}else html='';
			theform.elements["prop_button"].value=button;
			document.getElementById(imagename).innerHTML=html;
		}
	}catch(e){};
}

function initPropContent(){
	var paramForm=document.form1;
	for(var i=0;i<paramForm.prop_content.length;i++){
		if((prop_content_value & parseInt(paramForm.prop_content[i].value))>0) paramForm.prop_content[i].checked=true;
	}
}

function setDebugInfo(info){
	document.getElementById("debuginfo").innerText=info;
	document.getElementById("debuginfo2").innerText=info;
}

//折叠、展开编辑面板
var oriPanelHeight;
function changePanelSize(btn){
	if(self.parent.parent.document.getElementById("sysPanel").style.pixelHeight>30){
		oriPanelHeight=self.parent.parent.document.getElementById("sysPanel").style.pixelHeight;
		self.parent.parent.document.getElementById("sysPanel").style.pixelHeight=30;
		self.parent.parent.document.getElementById("panelFrame").height=30;
		btn.src="/Web/Images/restoreSizeBtn.gif";
	}else{
		self.parent.parent.document.getElementById("sysPanel").style.pixelHeight=oriPanelHeight;
		self.parent.parent.document.getElementById("panelFrame").height=oriPanelHeight;
		btn.src="/Web/Images/minSizeBtn.gif";
	}
}

//页面属性配置
function page_config(ds,phppage,page){
	if(ds.Trim()!=self.parent.parent.ds || page.Trim()!=self.parent.parent.saveScheme.page.value.Trim()){
		top.location="/"+phppage+"?ds="+ds+"&page="+page+"&taskid=2";
	}else{
		self.parent.parent.hideLightbox(self.parent.parent.scrollPanel);
		self.parent.parent.showLightbox(700,270,'/Page/page_config.php');
	}
	return false;
}

//评论评分
function grade(g,discussObj,id){
	var v=getCookie(discussObj+id);
	if(parseInt(v)==1){
		alert("请不要重复评分！");
		return false;
	}else location="/Action/Grade_Action.php?s="+g+"&do="+discussObj+"&id="+id;
}

function validWidth(NUM){
	var v=NUM.value.Trim();
	if(v=="") return false;
	if(isNaN(parseInt(v)) || parseInt(v)<=0 || parseInt(v)>1000 || FucCheckSingnNum(v)==0){
		alert("自定义宽度必须是小于等于1000的正整数！\n\n如果您想使用左边下拉列表中的宽度值，请清空此输入框。");
		NUM.focus();
		return false;
	}
	return true;
}

//模块添加删除编辑按钮调用函数
function showPublishBox(width,height,lan,dataType,method,id){
	if (dataType.substring(dataType.length-2,dataType.length) == "cl"){
	width = 400;
	height = 200;
	}
	var Url = "/Publish/" + dataType + "/";
	switch (method)
	{
	case 1:
		Url += "add_record.php";
		break;
	case 2:
		Url += "edit_record.php";
		break;
	case 3:
		Url += "del_dialog.php";
		width = 300;
		height = 200;
		break;
	default:
		break;
	}
	Url += "?lan=" + lan + "&id=" + id;
	showLightbox(width,height,Url);
}
function MU(e){
if (!e)
	var e=window.event;
var S=e.srcElement;
while (S.tagName!="TD"){
	S=S.parentElement;}
	S.className="P";
}
function MO(e){
if (!e)
	var e=window.event;
var S=e.srcElement;
while (S.tagName!="TD"){
	S=S.parentElement;}
	S.className="T";
}
function SearchsendTo(query){
  self.parent.location.href =query; 

}
function swapImg(imgobj,newimg){
	imgobj.src=newimg;
}
function popupSlideshow(w,h,ssid){
	showLightbox(w,h,"/popupss.php?ssid="+ssid);
}
