//公用函数文件

	/**
	* 功能：主页标题位置
	* 参数： back	参考上面函数
	*		obj		表示下拉列表框对象
	*		type	表示类型，如'spacetop'
	*		num		表示数组中的位置，如1
	*		desc	表示描述，如'toumingdu'
	*		objval	表示所操作对象的值，如果该值存在，则第2个参数obj无用
	*/
function savestyle()
{
getAjax('/user/ajax.aspx?does=save');
}
function restyle()
{
parent.mainFrame.location.reload();
getAjax('/user/ajax.aspx?does=re');
}
	function StyleSet(isback,name,kind,obj,desc)
	{			
			if (isback!='isback')
		{
	var ap=document.getElementById(obj).value;
	getAjaxData('/user/ajax.aspx?kind='+kind+'&name='+name+'&val='+escape(ap)+'',StyleSet,name,kind,obj,desc);
	return
		}
		else
		{
		var ap=obj;
		}

		if (name=='body') 
		{
		switch(kind)
			{
				//whole页面设置
			case 'alpha':
			parent.mainFrame.document.body.style.filter="alpha(opacity="+ap+")";	//透明度
			    break;
			  case 'height':
			parent.mainFrame.document.body.style.height=ap;	//透明度
			   break;
			case 'colorstr':
			document.getElementById(desc).style.background=ap;
			parent.mainFrame.document.body.style.fontcolor=ap;	//透明度
					   break;
		    case 'bgcolor':
      	     document.getElementById(desc).style.background=ap;
			 parent.mainFrame.document.body.style.backgroundColor=ap;	
				  break;
					case 'repeat':
            parent.mainFrame.document.body.style.backgroundRepeat=ap;	
			  break;
			  case 'position':
            parent.mainFrame.document.body.style.backgroundPosition=ap;	
			  break;
			  case 'bgpic':
            parent.mainFrame.document.body.style.backgroundImage="url('"+ap+"')";
						break;
			 			}
		
		}
				switch(kind)
			{
				//whole页面设置
			case 'alpha':
			parent.mainFrame.document.getElementById(name).style.filter="alpha(opacity="+ap+")";	//透明度
			    break;
			  case 'height':
			parent.mainFrame.document.getElementById(name).style.height=ap;	//透明度
			   break;
		    case 'bgcolor':
      	     document.getElementById(desc).style.background=ap;
			 			  			  if (name=='leftind')
			  {
				parent.mainFrame.document.getElementById('oneind').style.backgroundColor=ap;  
			parent.mainFrame.document.getElementById('callind').style.backgroundColor=ap;  
			parent.mainFrame.document.getElementById('friendind').style.backgroundColor=ap;  
			parent.mainFrame.document.getElementById('circleind').style.backgroundColor=ap;
			parent.mainFrame.document.getElementById('numberind').style.backgroundColor=ap; 
			break;
			  }
			if (name=='righttop')
			  {
		    parent.mainFrame.document.getElementById('righta1').style.backgroundColor=ap;  
			parent.mainFrame.document.getElementById('righta2').style.backgroundColor=ap;  
			parent.mainFrame.document.getElementById('righta3').style.backgroundColor=ap;  
			break;
			  }
			  if (name=='rightind')
			  {
		    parent.mainFrame.document.getElementById('rightb1').style.backgroundColor=ap;  

			break;
			  }
				  if (name=='lefttop')
			  {
			parent.mainFrame.document.getElementById('onetop').style.backgroundColor=ap;  
			parent.mainFrame.document.getElementById('calltop').style.backgroundColor=ap;  
			parent.mainFrame.document.getElementById('friendtop').style.backgroundColor=ap;  
			parent.mainFrame.document.getElementById('circletop').style.backgroundColor=ap;
			parent.mainFrame.document.getElementById('numbertop').style.backgroundColor=ap; 
						break;
			  }
             parent.mainFrame.document.getElementById(name).style.backgroundColor=ap;	
			 break
			case 'colorstr':
      	     document.getElementById(desc).style.background=ap;
			 			 			  			  if (name=='leftind')
			  {
				parent.mainFrame.document.getElementById('oneind').style.color=ap;  
			parent.mainFrame.document.getElementById('callind').style.color=ap;  
			parent.mainFrame.document.getElementById("friendind").style.bcolor=ap;  
			parent.mainFrame.document.getElementById('circleind').style.color=ap;
			parent.mainFrame.document.getElementById('numberind').style.color=ap; 
			break;
			  }
			  
				  if (name=='lefttop')
			  {
			parent.mainFrame.document.getElementById('onetop').style.color=ap;  
			parent.mainFrame.document.getElementById('calltop').style.color=ap;  
			parent.mainFrame.document.getElementById('friendtop').style.color=ap;  
			parent.mainFrame.document.getElementById('circletop').style.color=ap;
			parent.mainFrame.document.getElementById('numbertop').style.color=ap; 
			parent.mainFrame.document.getElementById('lefttop1').style.color=ap;
			parent.mainFrame.document.getElementById('lefttop2').style.color=ap; 
						break;
			  }
		     if (name=='righttop')
			  {
		    parent.mainFrame.document.getElementById('righta1').style.color=ap;  
			parent.mainFrame.document.getElementById('righta2').style.color=ap;  
			parent.mainFrame.document.getElementById('righta3').style.color=ap;  
			break;
			  }
			if (name=='rightind')
			  {
		    parent.mainFrame.document.getElementById('rightb1').style.color=ap;  


			break;
			  }
			 parent.mainFrame.document.getElementById(name).style.color=ap;	
break;
			case 'linkcolor':
			 document.getElementById(desc).style.background=ap;
			 parent.mainFrame.document.getElementById(name).style.color=ap;	
		
			  if (name=='nav')
			  {
                parent.mainFrame.document.getElementById('navtext0').style.color=ap;
			parent.mainFrame.document.getElementById('navtext1').style.color=ap;
			  parent.mainFrame.document.getElementById('navtext2').style.color=ap;	
			   parent.mainFrame.document.getElementById('navtext3').style.color=ap;	
			    parent.mainFrame.document.getElementById('navtext4').style.color=ap;
 }
//document.links["1"].style.color="#ff0000;";

			  break;
			case 'repeat':
			  if (name=='leftind')
			  {
				parent.mainFrame.document.getElementById('oneind').style.backgroundRepeat=ap;	
			parent.mainFrame.document.getElementById('callind').style.backgroundRepeat=ap;		
			parent.mainFrame.document.getElementById("friendind").style.backgroundRepeat=ap;	
			parent.mainFrame.document.getElementById('circleind').style.backgroundRepeat=ap;	
			parent.mainFrame.document.getElementById('numberind').style.backgroundRepeat=ap;	
			break;
			  }
			  
				  if (name=='lefttop')
			  {
			parent.mainFrame.document.getElementById('onetop').style.backgroundRepeat=ap;	
			parent.mainFrame.document.getElementById('calltop').style.backgroundRepeat=ap;	
			parent.mainFrame.document.getElementById('friendtop').style.backgroundRepeat=ap;	
			parent.mainFrame.document.getElementById('circletop').style.backgroundRepeat=ap;	
			parent.mainFrame.document.getElementById('numbertop').style.backgroundRepeat=ap;	
			parent.mainFrame.document.getElementById('lefttop1').style.backgroundRepeat=ap;	
			parent.mainFrame.document.getElementById('lefttop2').style.backgroundRepeat=ap;	
						break;
			  }
		     if (name=='righttop')
			  {
		    parent.mainFrame.document.getElementById('righta1').style.backgroundRepeat=ap;	
			parent.mainFrame.document.getElementById('righta2').style.backgroundRepeat=ap;	
			parent.mainFrame.document.getElementById('righta3').style.backgroundRepeat=ap;		
			break;
			  }
			if (name=='rightind')
			  {
		    parent.mainFrame.document.getElementById('rightb1').style.backgroundRepeat=ap;		

			break;
			  }
            parent.mainFrame.document.getElementById(name).style.backgroundRepeat=ap;	
			  break;
			  case 'position':
		{ 
				  if (name=='leftind')
			  {
				parent.mainFrame.document.getElementById('oneind').style.backgroundPosition=ap;	
			parent.mainFrame.document.getElementById('callind').style.backgroundPosition=ap;	
			parent.mainFrame.document.getElementById("friendind").style.backgroundPosition=ap;	
			parent.mainFrame.document.getElementById('circleind').style.backgroundPosition=ap;	
			parent.mainFrame.document.getElementById('numberind').style.backgroundPosition=ap;	
			break;
			  }
			  
				  if (name=='lefttop')
			  {
			parent.mainFrame.document.getElementById('onetop').style.backgroundPosition=ap;	
			parent.mainFrame.document.getElementById('calltop').style.backgroundPosition=ap;	
			parent.mainFrame.document.getElementById('friendtop').style.backgroundPosition=ap;	
			parent.mainFrame.document.getElementById('circletop').style.backgroundPosition=ap;	
			parent.mainFrame.document.getElementById('numbertop').style.backgroundPosition=ap;	
			parent.mainFrame.document.getElementById('lefttop1').style.backgroundPosition=ap;	
			parent.mainFrame.document.getElementById('lefttop2').style.backgroundPosition=ap;	
						break;
			  }
		     if (name=='righttop')
			  {
		    parent.mainFrame.document.getElementById('righta1').style.backgroundPosition=ap;	
			parent.mainFrame.document.getElementById('righta2').style.backgroundPosition=ap;	
			parent.mainFrame.document.getElementById('righta3').style.backgroundPosition=ap;	
			break;
			  }
			if (name=='rightind')
			  {
		    parent.mainFrame.document.getElementById('rightb1').style.backgroundPosition=ap;	

			break;
			  }
			              parent.mainFrame.document.getElementById(name).style.backgroundPosition=ap;	
						  		break;
			}
					  case 'bgpic':
 
				  if (name=='leftind')
			  {
				parent.mainFrame.document.getElementById('oneind').style.backgroundImage="url('"+ap+"')";   
			parent.mainFrame.document.getElementById('callind').style.backgroundImage="url('"+ap+"')"; 
			parent.mainFrame.document.getElementById("friendind").style.backgroundImage="url('"+ap+"')";  
			parent.mainFrame.document.getElementById('circleind').style.backgroundImage="url('"+ap+"')"; 
			parent.mainFrame.document.getElementById('numberind').style.backgroundImage="url('"+ap+"')"; 
			break;
			  }
			  
				  if (name=='lefttop')
			  {
			parent.mainFrame.document.getElementById('onetop').style.backgroundImage="url('"+ap+"')"; 
			parent.mainFrame.document.getElementById('calltop').style.backgroundImage="url('"+ap+"')"; 
			parent.mainFrame.document.getElementById('friendtop').style.backgroundImage="url('"+ap+"')";
			parent.mainFrame.document.getElementById('circletop').style.backgroundImage="url('"+ap+"')";
			parent.mainFrame.document.getElementById('numbertop').style.backgroundImage="url('"+ap+"')"; 
			parent.mainFrame.document.getElementById('lefttop1').style.backgroundImage="url('"+ap+"')";
			parent.mainFrame.document.getElementById('lefttop2').style.backgroundImage="url('"+ap+"')";
						break;
			  }
		     if (name=='righttop')
			  {
		    parent.mainFrame.document.getElementById('righta1').style.backgroundImage="url('"+ap+"')";
			parent.mainFrame.document.getElementById('righta2').style.backgroundImage="url('"+ap+"')";
			parent.mainFrame.document.getElementById('righta3').style.backgroundImage="url('"+ap+"')"; 
			break;
			  }
			if (name=='rightind')
			  {
	
		    parent.mainFrame.document.getElementById('rightb1').style.backgroundImage="url('"+ap+"')"; 


			break;
			  }
			  		parent.mainFrame.document.getElementById(name).style.backgroundImage="url('"+ap+"')";   
							break;
			 			}
						
	}

	/**
	* 功能：背景图位置
	* 参数： back	参见上面函数说明
	*		obj		表示所操作的对象
	*		type	表示类型，如 spacewhole
	*		num		表示数组下标
	*		num2	表示数组下标2
	*		desc	表示说明，如 wholebgp
	*/

	function topTitleSetPosition(back,obj,type,num,num2,desc)
	{
		var sTempValue=obj.value;
		var arTempValue=sTempValue.split(' ');

	}


	/**
	* 功能：背景颜色（通用）
	* 参数： back	参考上面函数
	*		obj		表示隐藏input框对象
	*		type	表示类型，如'spacetop'
	*		num		表示数组中的位置，如1
	*		desc	表示描述，如'bgpic'
	*		objval	表示初始值
	*		objnum2	表示颜色的正方形框span的对象的名称，如'2b'
	*		func	表示要调用的函数名称，如 topTitleSet
	*/

	function ColorSet(id,kind,obj)
	{
		if(back!='backmh')
		{
alert("dfsdf");
			var tempVal;
			if(objval)
				tempVal=objval;
			else
				tempVal=obj.value;
			document.getElementById(objnum2).style.background=tempVal;
			
			//去掉预览的隐藏层
						return;
		}
	}

	//模块栏目应用
	function refSortType(str,num)
	{
		var mknewwin=window.open('./SpaceRefSort.php?type='+str+'&styleid='+num,'refsortbt','width=200,height=350')
		mknewwin.focus();
	}

	//数据保存
	/**
	* 功能	保存数据
	* 参数	back	参考上面函数
	*		styleid	表示styleid号
	*		desc	临时参数
	*/
	function saveDataInfo(back,styleid,desc)
	{
		if(back!='backmh')
		{
			//getAjaxData('./SpaceDataSave.php?styleid='+styleid,saveDataInfo,desc);
		}
	}

	/**
	* 功能：拖动条滚动时，直接运行js，使预览产生效果
	* 参数： obj		表示要取值的对象
	*		desc	表示描述 如 spacetop
	*/

	function tdFunc(obj,desc)
	{
		//去掉预览的隐藏层
	
		switch(desc)
		{
			case 'spacetop':
				parent.mainFrame.document.getElementById('top_c').style.filter="alpha(opacity="+obj.value+")";
				break;
			case 'sorttoumingdu':
				parent.mainFrame.document.getElementById('menu').style.filter="alpha(opacity="+obj.value+")";
				break;
			case 'txtoumingdu':
			
				break;
		}
	}

	/**
	* 功能：点击图片或input框时，增加css样式，并使input框选中
	* 参数： simplenamepic	图片名称，如 <img name="simplenamepic" id="simplenamepic_1">
	*		simplenameinput	Input框名称，如 <input name="simplenameinput" id="simplenameinput_1">
	*/

	function picCheckClass(simplenamepic,simplenameinput,num)
	{
		//设置选中
		var oTemp=document.getElementsByName(simplenamepic);
		for(var i=0;i<oTemp.length;i++)
		{
			oTemp[i].className='photo';
		}
		document.getElementById(simplenamepic+'_'+num).className='xzl';
		document.getElementById(simplenameinput+'_'+num).checked=true;
	}

	//栏目高度设置函数
	function heightOfSort(obj,desc,oldvalue)
	{
		var ptnheight=/^[0-9]{0,3}$/i;
		var sValue=obj.value;
		var iValue=parseInt(sValue);
		if(!ptnheight.test(sValue))
		{
			alert('只能是数字');
			obj.value=oldvalue;
			return false;
		}

		switch(desc)
		{
			case 'top':
						{
								if(iValue<100 || iValue>450)
					{
						alert('高度不能小于100或超过450像素');
						obj.value=oldvalue;
						return false;
					}
					else
						return true;
				}
				break;
			case 'sort':
				if(sValue.length>=2)
				{
					if(iValue<35 || iValue>55)
					{
						alert('高度不能小于35或超过55像素');
						obj.value=oldvalue;
						return false;
					}
					else
						return true;
				}
				else
					return false;
				break;
			default:
				if(sValue.length>=2)
				{
					if(iValue<24 || iValue>35)
					{
						alert('高度不能小于24或超过35像素');
						obj.value=oldvalue;
						return false;
					}
					else
						return true;
				}
				else
					return false;
				break;
			
		}

	}
//其余控制
setInterval("Ajax('/user/ajax.aspx?does=keep');",30000);
function showdiv(obj,obj2)
{
	//显示、隐藏层
	obj.style.display='';
	obj2.style.display='none';
}
function showdiv2()
{
	document.all('texiao').style.display='none';
}

parent.document.all("left").style.height=screen.availHeight; 
parent.document.all("mainFrame").style.height=screen.availHeight; 
//function keepSessionData()
//{
	//getAjaxData2(null,'mylist.aspx?act=keepdata');
	//setTimeout("keepSessionData()",300000);
//}
//setTimeout("keepSessionData()",300000);
function stop() 
{ 
return false; 
} 

var iTempTT=0;
function txToumingdu()
{
	if(iTempTT==0)
	{
		var oldValue="50";
		var newValue=document.getElementById('s1').value;
		if(oldValue==newValue)
			return false;
		else
			return true;
	}
	else
		return false;
}
function keepstyle(kind)
{

s1.value=10;
jumptag(document.all('tdjiao'),document.all('s1'));

}

document.onmouseup=function()
{
	endtag();
}
