﻿// By SNCO,Inc.
function OpenSearch(No,Sum)
{
	var Sum=Sum+1;
	for(var i=1; i< Sum; i++)
	{
		if(i==No)
		{
			document.getElementById("Sbut"+i).className="SearchBtn_On";
			document.getElementById("SearchTd").className="SearchTD_"+i;
			document.SearchForm.Action.value=i;
		}
		else
		{
			document.getElementById("Sbut"+i).className="SearchBtn_Off";
		}
	}
}
function CheckSearch()
{
	if(document.SearchForm.SearchKey.value==""||document.SearchForm.SearchKey.value=="请输入您想要搜索的关键字！")
	{
		alert("请输入您想要搜索的关键字！")	
		document.SearchForm.SearchKey.focus();
		return false
	}
	if(document.SearchForm.Action.value=="2")
	{
		document.SearchForm.action="http://www.youyb.com/AdvertiserNav.asp?Big=1&KeyWord="+encodeURIComponent(document.SearchForm.SearchKey.value);
	}
	if(document.SearchForm.Action.value=="1")
	{
		document.SearchForm.action="http://www.youyb.com/AdvertiserNav.asp?KeyWord="+encodeURIComponent(document.SearchForm.SearchKey.value);
	}
	if(document.SearchForm.Action.value=="3")
	{
		document.SearchForm.action="http://www.youyb.com/ArticleList.asp?KeyWord="+encodeURIComponent(document.SearchForm.SearchKey.value);
	}
	if(document.SearchForm.Action.value=="4")
	{
		document.SearchForm.action="http://www.youyb.com/InforList.asp?Mov=Search&KeyWord="+encodeURIComponent(document.SearchForm.SearchKey.value);
	}
	if(document.SearchForm.Action.value=="5")
	{
		document.SearchForm.action="http://www.youyb.com/PhotoList.asp?Mov=Search&KeyWord="+encodeURIComponent(document.SearchForm.SearchKey.value);
	}
	if(document.SearchForm.Action.value=="6")
	{
		document.SearchForm.action="http://www.youyb.com/video.asp?Mov=Search&Keyword="+encodeURIComponent(document.SearchForm.SearchKey.value);
	}
}
function CheckLogin()
{
	if(document.myform.UserName.value=="")
	{
		alert("请输入登录名称！")
		document.myform.UserName.focus();
		return false
	}
	if(document.myform.Password.value=="")
	{
		alert("请输入登录密码！")
		document.myform.Password.focus();
		return false
	}
}
function CheckLoginSys()
{
	if(document.myform.UserName.value=="")
	{
		alert("请输入登录名称！")
		document.myform.UserName.focus();
		return false
	}
	if(document.myform.UserPassword.value=="")
	{
		alert("请输入登录密码！")
		document.myform.UserPassword.focus();
		return false
	}
}
function ChangeMenu(No,Sum)
{
	var Sum=Sum+1;
	for(var i=1; i< Sum; i++)
	{
		if(i==No)
		{
			document.getElementById("SubMenu"+i).style.display="block";
		}
		else
		{
			document.getElementById("SubMenu"+i).style.display="none";
		}
	}
}
var showImageIndex = -1;
var imageTimer;
function showImage(imageIndex)
{
	var flash_img_div = document.getElementById("flash_img");
	var flash_title = document.getElementById("flash_title");
	if(imageIndex>fImgs.length-1)
	{
		imageIndex = 0;
	}
	if(!fImgs[imageIndex] || imageIndex==showImageIndex)
	return false;	
	var imgId = "__fImg"+imageIndex;
	flash_img_div.filters && flash_img_div.filters[0].Apply();
	for(i=0; i<flash_img_div.childNodes.length; i++)
	{
		flash_img_div.childNodes[i].style.display = "none";
	}
	if( document.getElementById(imgId) )
	{
		var imga = document.getElementById(imgId);
		imga.style.display = "block";
		if(imga.tagName=="OBJECT")
		{
			imga.rewind();
			imga.Play();
		}
	}
	else
	{
		var pos = fImgs[imageIndex].img.lastIndexOf(".");
		if( fImgs[imageIndex].img.substr(pos+1).substr(0,3).toLowerCase()=="swf" )
		{
			flash_img_div.innerHTML += '\
				<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" id="'+imgId+'">\
					<param name="movie" value="'+fImgs[imageIndex].img+'" />\
					<param name="quality" value="high" />\
					<embed src="'+fImgs[imageIndex].img+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>\
				</object>';

		}
		else
		{
			var img = new Image();
			img.border = "0";
			img.src = fImgs[imageIndex].img;
			var a = document.createElement("a");
			a.href = fImgs[imageIndex].href;
			a.target = "_blank";
			a.id = imgId;
			a.appendChild(img);
			flash_img_div.appendChild(a);
		}
	}
	flash_img_div.filters && flash_img_div.filters[0].Play();
	var flash_show_ctl_msg = document.getElementById("flash_show_ctl_msg");
	flash_show_ctl_msg.filters && flash_show_ctl_msg.filters[0].Apply();
	flash_title.href = fImgs[imageIndex].href;
	flash_title.innerHTML = fImgs[imageIndex].title;
	flash_show_ctl_msg.filters && flash_show_ctl_msg.filters[0].Play();
	showImageIndex = imageIndex;
	return true;
}
function imagePlay()
{
	if(imageTimer) return;
	if(showImageIndex>=fImgs.length-1)
	{
		showImageIndex = -1;
	}
	showImage(showImageIndex+1);
	imageTimer = setInterval(function(){
		var stat = showImage(showImageIndex+1);
		if(!stat)
		{
			stop();
		}
	},5000);
}
function stop()
{
	clearInterval(imageTimer);
	imageTimer = null;
}
function showNextImage()
{
	showImage(showImageIndex+1);
}
function showPrevImage()
{
	showImage(showImageIndex-1);
}
function Chang_ShowBox(ObjName,No,Sum)
{
	var Sum=Sum+1;
	for(var i=1; i< Sum; i++)
	{
		if(i==No)
		{
			document.getElementById(ObjName+i).src="/Images/"+ObjName+i+"_.jpg";
			document.getElementById(ObjName+"_Box"+i).style.display="block";
		}
		else
		{
			document.getElementById(ObjName+i).src="/Images/"+ObjName+i+".jpg";
			document.getElementById(ObjName+"_Box"+i).style.display="none";
		}
	}
}
function Chang_ShowBoxVip(ObjName,No,Sum)
{
	var Sum=Sum+1;
	for(var i=1; i< Sum; i++)
	{
		if(i==No)
		{
			document.getElementById(ObjName+i).src="/Images/jiameng/"+ObjName+i+"_.gif";
			document.getElementById(ObjName+"_Box"+i).style.display="block";
		}
		else
		{
			document.getElementById(ObjName+i).src="/Images/jiameng/"+ObjName+i+".gif";
			document.getElementById(ObjName+"_Box"+i).style.display="none";
		}
	}
}
function Chang_ShowBoxEat(ObjName,No,Sum)
{
	var Sum=Sum+1;
	for(var i=1; i< Sum; i++)
	{
		if(i==No)
		{
			document.getElementById(ObjName+i).src="/Images/ybeat/"+ObjName+i+".jpg";
			document.getElementById(ObjName+"_Box"+i).style.display="block";
		}
		else
		{
			document.getElementById(ObjName+i).src="/Images/ybeat/"+ObjName+i+"_.jpg";
			document.getElementById(ObjName+"_Box"+i).style.display="none";
		}
	}
}
function Chang_BBS(No)
{
	for(var i=1; i< 4; i++)
	{
		if(i==No)
		{
			document.getElementById("BBS_"+i).style.display="block";
		}
		else
		{
			document.getElementById("BBS_"+i).style.display="none";
		}
	}
}
function Chang_BBSS(No)
{
	for(var i=1; i< 5; i++)
	{
		if(i==No)
		{
			document.getElementById("BBSS_"+i).style.display="block";
		}
		else
		{
			document.getElementById("BBSS_"+i).style.display="none";
		}
	}
}
function Chang_ShowBoxEatB(ObjName,No,Sum)
{
	var Sum=Sum+1;
	for(var i=1; i< Sum; i++)
	{
		if(i==No)
		{
			document.getElementById(ObjName+"_"+i).src="/Images/ybeat/"+ObjName+i+".gif";
			document.getElementById(ObjName+"_TBox"+i).style.display="block";
		}
		else
		{
			document.getElementById(ObjName+"_"+i).src="/Images/ybeat/"+ObjName+i+"_.gif";
			document.getElementById(ObjName+"_TBox"+i).style.display="none";
		}
	}
}
function show(no)
{
	if(no!=="")
	var showtr=eval(document.getElementById("show"+no));
	{
		if(showtr.style.display!="block")
		{
			showtr.style.display="block";
		}
		else
		{
			showtr.style.display="none";
		}
	}
}
function showadd()
{
  	var l=event.clientX;//(document.body.clientWidth-AddChannel.offsetWidth)/2   
  	var t=event.clientY+15;//(document.body.clientHeight-AddChannel.offsetHeight)/2 
 	with(AddChannel.style){   
  	left=l   
  	top=t   
  	display="block"   
	}   	
}
function unshowadd()
{
	AddChannel.style.display="none";
}
function showadds()
{
  	var l=event.clientX-120;  
  	var t=event.clientY+15;
 	with(AddChannels.style)
	{   
		left=l   
		top=t   
		display="block"   
	}   	
}
function unshowadds()
{
	AddChannels.style.display="none";
}
function showrepass(uid)
{
  	var l=event.clientX-240;
  	var t=event.clientY+10;
	if(uid!=="")
	{
		document.newpassword.uid.value=eval(uid);
	}
 	with(Repass.style)
	{   
  		left=l   
  		top=t   
  		display="block"   
	}   	
}
function unshowrepass()
{
	Repass.style.display="none";
}
function startMove(objDiv)
{
	document.attachEvent("onmousemove",moveDiv);
	document.attachEvent("onmouseup",endMove);
	document.attachEvent("onselectstart",selectNo);
	document["moveDiv"] = objDiv;
	document["startX"] = event.x;
	document["startY"] = event.y;
	document["oldX"] = objDiv.getBoundingClientRect().left;
	document["oldY"] = objDiv.getBoundingClientRect().top;
}
function moveDiv()
{
//try{
var obj = document["moveDiv"];
if(obj)
{
	var l = document["oldX"];
	var t = document["oldY"];
	obj.style.position = "absolute";
	obj.style.left = l + (event.x-document["startX"]);
	obj.style.top = t + (event.y-document["startY"]);
}
//}catch(e){endMove();}
}
function endMove()
{
	document.detachEvent("onmousemove",moveDiv);
	document.detachEvent("onmouseup",endMove);
	document.detachEvent("onselectstart",selectNo);
	document["moveDiv"] = null;
	document["startX"] = null;
	document["startY"] = null;
}
function selectNo()
{ 
	return false; 
}
function CheckForm()
{
	var must = /^[\+\-]?\d*?\d*?$/;
	if(document.myform.CName.value=="")
	{
		alert("栏目名称不能为空！");
		document.myform.CName.focus();
		return false;
	}
	if(document.myform.Values.value=="")
	{
		alert("属性值不能为空！");
		document.myform.Values.focus();
		return false;
	}
	if(!must.test(document.myform.Values.value))
	{
		alert("属性值只能填写数字！");
		document.myform.Values.focus();
		return false;
	}
	if(document.myform.Orders.value=="")
	{
		alert("排序值不能为空！");
		document.myform.Orders.focus();
		return false;
	}
	if(!must.test(document.myform.Orders.value))
	{
		alert("排序值只能填写数字！");
		document.myform.Orders.focus();
		return false;
	}
	return true;  
}
function CheckForms()
{
	var must = /^[\+\-]?\d*?\d*?$/;
	if(document.myforms.CName.value=="")
	{
		alert("栏目名称不能为空！");
		document.myforms.CName.focus();
		return false;
	}
	if(document.myforms.Values.value=="")
	{
		alert("属性值不能为空！");
		document.myforms.Values.focus();
		return false;
	}
	if(!must.test(document.myforms.Values.value))
	{
		alert("属性值只能填写数字！");
		document.myforms.Values.focus();
		return false;
	}
	if(document.myforms.Orders.value=="")
	{
		alert("排序值不能为空！");
		document.myforms.Orders.focus();
		return false;
	}
	if(!must.test(document.myforms.Orders.value))
	{
		alert("排序值只能填写数字！");
		document.myforms.Orders.focus();
		return false;
	}
	return true;  
}
function CheckFormMagager()
{
	if(document.myform.username.value=="")
	{
		alert("管理员名称不能为空！");
		document.myform.username.focus();
		return false;
	}
	if(document.myform.password.value=="")
	{
		alert("管理员密码不能为空！");
		document.myform.password.focus();	
		return false;
	}
	return true;  
}
function CheckRepass()
{
	if(document.newpassword.newpass.value=="")
	{
		alert("密码不能为空！");
		document.newpassword.newpass.focus();
		return false;
	}
	return true;  
}
function showform()
{ 
	var oDiv = document.createElement('div'); 
	oDiv.id='OverLayDiv'; 
	with(oDiv.style)
	{ 
		width = '100%'; 
		height = '100%'; 
		position = 'absolute'; 
		left = '0px'; 
		top = '0px'; 
		zIndex = 1; 
	} 
	document.body.appendChild(oDiv); 
	var l=(document.body.clientWidth-demo.offsetWidth)/2 
	var t=(document.body.clientHeight-demo.offsetHeight)/2 
	with(demo.style)
	{ 
		left=l 
		top=t 
		visibility="visible" 
		zIndex = 2; 
	} 
} 
function check()
{
	if(document.login.Username.value=="")
	{
		document.login.Username.focus();
		alert(" 用户帐号不能为空！ ");
		return false;
	}
	if(document.login.Password.value=="")
	{
		document.login.Password.focus();
		alert(" 用户密码不能为空！ ");
		return false;
	}
}
function LoginSystem()
{
	if(document.Comment.UserName.value=="")
	{
		alert("请输入用户名！")
		document.Comment.UserName.focus()
		return false
	}
	else if(document.Comment.UserPassword.value=="")
	{
		alert("请输入密码！")
		document.Comment.UserPassword.focus()
		return false
	}
	else
	{
		document.Comment.action="http://bbs.youyb.com/Login.asp";
		document.Comment.submit()
	}
}
function CreateXHR()
{
	try
	{
		xhr = new ActiveXObject("Microsoft.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			xhr = new ActiveXObject("Msxm12.XMLHTTP");
		}
		catch(E)
		{
		    xhr = false;
		}
	}
	if(!xhr && typeof XMLHttpRequest != 'undefined')
	{
		xhr =new XMLHttpRequest();
	}
	else
	{
		
	}	
	return xhr;
}
function ToComment()
{
	if(document.Comment.Content.value=="")
	{
		alert("请填写评论内容！")
		document.Comment.Content.focus();
		return false
	}
	if(document.Comment.Content.value.length<10)
	{
		alert("写评论内容不能少于10个字符！")
		document.Comment.Content.focus();
		return false
	}
	if(document.Comment.randNum.value=="")
	{
		alert("请填写验证码！")
		document.Comment.randNum.focus();
		return false
	}
	document.Comment.action="?Mov=Comment&ID="+document.Comment.ToID.value;
	document.Comment.submit()
}
function CommentInfo()
{
	if(document.Comment.Content.value=="")
	{
		alert("请填写内容！")
		document.Comment.Content.focus();
		return false
	}
	if(document.Comment.randNum.value=="")
	{
		alert("请填写验证码！")
		document.Comment.randNum.focus();
		return false
	}
	document.Comment.action="?Act=Comment&ID="+document.Comment.ToID.value+"&Mov="+document.Comment.LastMov.value+"&AdvID="+document.Comment.LastAdvID.value+"&ByBig="+document.Comment.LastByBig.value;
	document.Comment.submit()
}
function setTab(name,cursel,n)
{
	for(i=1;i<=n;i++)
	{
		var menu=document.getElementById(name+i);
		var con=document.getElementById("con_"+name+"_"+i);
		menu.className=i==cursel?"hover":"";
		con.style.display=i==cursel?"block":"none";
	}
}
var divTop,divLeft,divWidth,divHeight,docHeight,docWidth,objTimer,i = 0; 
function getMsg() 
{ 
	try
	{ 
		divTop = parseInt(document.getElementById ("eMeng").style.top,10) 
		divLeft = parseInt(document.getElementById("eMeng").style.left,10) 
		divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10) 
		divWidth = parseInt( document.getElementById("eMeng").offsetWidth,10) 
		docWidth = document.body.clientWidth; 
		docHeight = document.body.clientHeight; 
		document.getElementById("eMeng").style.top = parseInt(document.body.scrollTop ,10) + docHeight + 10;//  divHeight 
		document.getElementById("eMeng").style.left = parseInt(document.body.scrollLeft,10) + docWidth - divWidth 
		document.getElementById("eMeng").style.visibility="visible" 
		objTimer = window.setInterval("moveDiv()",6) 
	} 
	catch(e)
	{
	} 
} 
function resizeDiv() 
{ 
	i+=1 
	try
	{ 
		divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10) 
		divWidth = parseInt(document.getElementById("eMeng").offsetWidth,10) 
		docWidth = document.body.clientWidth; 
		docHeight = document.body.clientHeight; 
		document.getElementById("eMeng").style.top = docHeight - divHeight + parseInt(document.body.scrollTop,10) 
		document.getElementById ("eMeng").style.left = docWidth - divWidth + parseInt(document.body.scrollLeft,10) 
		loadBar(2);
	} 
	catch(e)
	{
	} 
} 
function moveDiv() 
{ 
	try 
	{ 
		if(parseInt(document.getElementById("eMeng").style.top,10) <= (docHeight - divHeight + parseInt(document.body.scrollTop,10))) 
		{ 
			window.clearInterval(objTimer) 
			objTimer = window.setInterval("resizeDiv()",1) 
		} 
		divTop = parseInt(document.getElementById("eMeng").style.top,10) 
		document.getElementById("eMeng").style.top = divTop - 1 
	} 
	catch(e)
	{
	} 
} 
function closeDiv() 
{ 
	document.getElementById('eMeng').style.visibility='hidden'; 
	if(objTimer) window.clearInterval(objTimer) 
} 
window.onload = getMsg; 
window.onresize = resizeDiv; 
//window.onerror = function(){return false} 