// 获得焦点后清空input文本框并改变颜色
function cls(){
//捕获触发事件的对象，并设置为以下语句的默认对象
with(event.srcElement)
//如果当前值为默认值，则清空
if(value==defaultValue){
	value="";
	window.document.getElementById("serch_key").style.color="#000";
	}
}

function res(){
//捕获触发事件的对象，并设置为以下语句的默认对象
with(event.srcElement)
//如果当前值为空，则重置为默认值
if(value==""){
	value=defaultValue;
	window.document.getElementById("serch_key").style.color="#999";
	}
}

//===========================================================

//video页，点击列表更改视频显示内容
function getVideo(flv,img,title){
	window.document.getElementById("VideoSource").value=flv;
	window.document.getElementById("ImageSource").value=img;
	window.document.getElementById("videoTitleAndTime").innerHTML=title;
	
	var playerWidth="400"
	var playerHeight="300"
	var playerHeight_v="280"
	var playerSource="/film/"+VideoSource.value
	var playerImgSource=ImageSource.value
	
	//播放器 , 播放器ID,宽 , 高,
	var s1 = new SWFObject("../swf/mediaplayer.swf","player_id",playerWidth,playerHeight,"6");
	s1.addParam("allowfullscreen","true");//是否允许全屏播放
	s1.addVariable('autostart', 'false');//自动开始
	s1.addVariable("file",playerSource);//单文件播放
	//s1.addVariable("file","playlist.xml");//列表播放
	s1.addVariable("image",playerImgSource);//背景图片
	s1.addVariable("displayheight",playerHeight_v);//播放区域高度
	s1.addVariable("backcolor","0x000000");
	s1.addVariable("frontcolor","0x5ecdef");
	s1.addVariable("lightcolor","0x8df6f2");
	s1.addVariable("enablejs","true");//是否允许javascript脚本控制flash
	s1.addVariable("javascriptid","javascript_id");//控制脚本javascriptid
	s1.write("myPlayer");//将播放器写入到myPlayer
	
	//confirm(window.document.getElementById("VideoSource").value);
}

//===========================================================

//video页面视频列表翻页
function videoList(PageNumber,PageCount){
	for(i=1;i<=PageCount;i++){
		window.document.getElementById("List"+i).style.display="none";
	}
	window.document.getElementById("List"+PageNumber).style.display="block";
	
	//以下开始页面清单数字显示
	var linkString="";
	var linkStringFirstPage="<a href='javascript:void(0)' onclick='videoList(1,"+PageCount+")'>1</a> . . . ";
	var linkStringLastPage=" . . . <a href='javascript:void(0)' onclick='videoList("+PageCount+","+PageCount+")'>"+PageCount+"</a>";
	
	if(PageNumber-4>1){
		var linkStringToFirstPage="<div id='listpageLeft'></div><a href='javascript:void(0)' title='第一页' onclick='videoList(1,"+PageCount+")'>|&lt;&lt;</a> <a href='javascript:void(0)' title='前一页' onclick='videoList("+parseInt(PageNumber-5)+","+PageCount+")'>&lt;</a> ";
	}else{
		var linkStringToFirstPage="<div id='listpageLeft'></div><a href='javascript:void(0)' title='第一页' onclick='videoList(1,"+PageCount+")'>|&lt;&lt;</a> ";
	}
	
	if(PageNumber+4<PageCount){
		var linkStringToLastPage=" <a href='javascript:void(0)' title='后一页' onclick='videoList("+parseInt(PageNumber+5)+","+PageCount+")'>&gt;</a> <a href='javascript:void(0)' title='最后一页' onclick='videoList("+PageCount+","+PageCount+")'>&gt;&gt;|</a>";
	}else{
		var linkStringToLastPage=" <a href='javascript:void(0)' title='最后一页' onclick='videoList("+PageCount+","+PageCount+")'>&gt;&gt;|</a>";
	}
	
	if(PageNumber==1){
		if(PageNumber+2<PageCount){
			for(i=0;i<=2;i++){
				linkString=linkString + " <a href='javascript:void(0)' onclick='videoList("+parseInt(parseInt(PageNumber)+parseInt(i))+","+PageCount+")'>"+parseInt(parseInt(PageNumber)+parseInt(i))+"</a> ";
			}
			linkString = linkString + linkStringLastPage;
		}
		if(PageNumber+2==PageCount){
			for(i=0;i<=2;i++){
				linkString=linkString + " <a href='javascript:void(0)' onclick='videoList("+parseInt(parseInt(PageNumber)+parseInt(i))+","+PageCount+")'>"+parseInt(parseInt(PageNumber)+parseInt(i))+"</a> ";
			}
		}
		if(PageNumber+1==PageCount){
			for(i=0;i<=1;i++){
				linkString=linkString + " <a href='javascript:void(0)' onclick='videoList("+parseInt(parseInt(PageNumber)+parseInt(i))+","+PageCount+")'>"+parseInt(parseInt(PageNumber)+parseInt(i))+"</a> ";
			}
		}
		if(PageNumber==PageCount){
			for(i=0;i<=0;i++){
				linkString=linkString + " <a href='javascript:void(0)' onclick='videoList("+parseInt(parseInt(PageNumber)+parseInt(i))+","+PageCount+")'>"+parseInt(parseInt(PageNumber)+parseInt(i))+"</a> ";
			}
		}
	}
	if(PageNumber==2){
		if(PageNumber+2<PageCount){
			for(i=-1;i<=2;i++){
				linkString=linkString + " <a href='javascript:void(0)' onclick='videoList("+parseInt(parseInt(PageNumber)+parseInt(i))+","+PageCount+")'>"+parseInt(parseInt(PageNumber)+parseInt(i))+"</a> ";
			}
			linkString = linkString + linkStringLastPage;
		}
		if(PageNumber+2==PageCount){
			for(i=-1;i<=2;i++){
				linkString=linkString + " <a href='javascript:void(0)' onclick='videoList("+parseInt(parseInt(PageNumber)+parseInt(i))+","+PageCount+")'>"+parseInt(parseInt(PageNumber)+parseInt(i))+"</a> ";
			}
		}
		if(PageNumber+1==PageCount){
			for(i=-1;i<=1;i++){
				linkString=linkString + " <a href='javascript:void(0)' onclick='videoList("+parseInt(parseInt(PageNumber)+parseInt(i))+","+PageCount+")'>"+parseInt(parseInt(PageNumber)+parseInt(i))+"</a> ";
			}
		}
		if(PageNumber==PageCount){
			for(i=-1;i<=0;i++){
				linkString=linkString + " <a href='javascript:void(0)' onclick='videoList("+parseInt(parseInt(PageNumber)+parseInt(i))+","+PageCount+")'>"+parseInt(parseInt(PageNumber)+parseInt(i))+"</a> ";
			}
		}
	}
	if(PageNumber==3){
		if(PageNumber+2<PageCount){
			for(i=-2;i<=2;i++){
				linkString=linkString + " <a href='javascript:void(0)' onclick='videoList("+parseInt(parseInt(PageNumber)+parseInt(i))+","+PageCount+")'>"+parseInt(parseInt(PageNumber)+parseInt(i))+"</a> ";
			}
			linkString = linkString + linkStringLastPage;
		}
		if(PageNumber+2==PageCount){
			for(i=-2;i<=2;i++){
				linkString=linkString + " <a href='javascript:void(0)' onclick='videoList("+parseInt(parseInt(PageNumber)+parseInt(i))+","+PageCount+")'>"+parseInt(parseInt(PageNumber)+parseInt(i))+"</a> ";
			}
		}
		if(PageNumber+1==PageCount){
			for(i=-2;i<=1;i++){
				linkString=linkString + " <a href='javascript:void(0)' onclick='videoList("+parseInt(parseInt(PageNumber)+parseInt(i))+","+PageCount+")'>"+parseInt(parseInt(PageNumber)+parseInt(i))+"</a> ";
			}
		}
		if(PageNumber==PageCount){
			for(i=-2;i<=0;i++){
				linkString=linkString + " <a href='javascript:void(0)' onclick='videoList("+parseInt(parseInt(PageNumber)+parseInt(i))+","+PageCount+")'>"+parseInt(parseInt(PageNumber)+parseInt(i))+"</a> ";
			}
		}
	}
	if(PageNumber>3){
		if(PageNumber+2<PageCount){
			for(i=-2;i<=2;i++){
				linkString=linkString + " <a href='javascript:void(0)' onclick='videoList("+parseInt(parseInt(PageNumber)+parseInt(i))+","+PageCount+")'>"+parseInt(parseInt(PageNumber)+parseInt(i))+"</a> ";
			}
			linkString = linkStringFirstPage + linkString + linkStringLastPage;
		}
		if(PageNumber+2==PageCount){
			for(i=-2;i<=2;i++){
				linkString=linkString + " <a href='javascript:void(0)' onclick='videoList("+parseInt(parseInt(PageNumber)+parseInt(i))+","+PageCount+")'>"+parseInt(parseInt(PageNumber)+parseInt(i))+"</a> ";
			}
			linkString = linkStringFirstPage + linkString;
		}
		if(PageNumber+1==PageCount){
			for(i=-2;i<=1;i++){
				linkString=linkString + " <a href='javascript:void(0)' onclick='videoList("+parseInt(parseInt(PageNumber)+parseInt(i))+","+PageCount+")'>"+parseInt(parseInt(PageNumber)+parseInt(i))+"</a> ";
			}
			linkString = linkStringFirstPage + linkString;
		}
		if(PageNumber==PageCount){
			for(i=-2;i<=0;i++){
				linkString=linkString + " <a href='javascript:void(0)' onclick='videoList("+parseInt(parseInt(PageNumber)+parseInt(i))+","+PageCount+")'>"+parseInt(parseInt(PageNumber)+parseInt(i))+"</a> ";
			}
			linkString = linkStringFirstPage + linkString;
		}
	}
	
	window.document.getElementById("listpage").innerHTML=linkStringToFirstPage + linkString + linkStringToLastPage;
}

//===========================================================

//video页提交留言时检查表单
function checkForm(){
if (CommentForm.CommentText.value==''){
	alert("不能发表空内容的评论！");
	CommentForm.CommentText.focus();
	return false;
	}
if (CommentForm.CommentCode.value==""){
	alert("验证码不能为空！");
	CommentForm.CommentCode.focus();
	return false;
	}
return true;
}

//===========================================================

//music歌曲列表onmouseover显示效果
function showList(obj){
	listenListFocus.id="";
	obj.id="listenListFocus";
}

//===========================================================

//musiclist展示图片onmouseover切换效果
function showImg(obj){
	window.document.getElementById("singerShow1").className="singerBannerList";
	window.document.getElementById("singerShow2").className="singerBannerList";
	window.document.getElementById("singerShow3").className="singerBannerList";
	window.document.getElementById("singerShow4").className="singerBannerList";
	obj.className="singerBannerListFocus";
	window.document.getElementById("singerBannerShowImg").src="../images/temp/"+obj.id+".jpg";
}

//===========================================================

//album专辑图片onmouseover切换效果
function albumShowImg(obj,albumID){
	window.document.getElementById("albumShowImg").src=obj.src;
	setAlbumImgSize(window.document.getElementById("albumShowImg"),220,260)
}

//===========================================================

//newslist图片onmouseover切换效果
function newsListShowImg(obj){
	for(i=0;i<4;i++){
		obj.parentNode.parentNode.childNodes[i].style.border="#AAA 1px solid";
	}
	obj.parentNode.style.border="#fb9f15 1px solid";
	window.document.getElementById("focusImgListText").innerHTML=obj.title;
	window.document.getElementById("focusImgBig").src=obj.src;
	window.document.getElementById("focusImgLink").href=obj.alt;
}

//===========================================================

//imagelist图片边框onmouseover切换效果
function ImgBorderOver(obj){
	obj.style.borderColor="#CCC";
}

//===========================================================

//imagelist图片边框onmouseout切换效果
function ImgBorderOut(obj){
	obj.style.borderColor="#FFF";
}

//===========================================================

//imagelist图片父元素a边框onmouseover切换效果
function ImgLinkBorderOver(obj){
	obj.parentNode.style.borderColor="#CCC";
}

//===========================================================

//imagelist图片父元素a边框onmouseout切换效果
function ImgLinkBorderOut(obj){
	obj.parentNode.style.borderColor="#FFF";
}

//===========================================================

//自动按照比例调整图片尺寸，缩小，显示全图
function chkImgSize(obj,max_width,max_height){
	var p=obj;
	var pw = p.width;
	var ph = p.height;
	var ratio=pw/ph;
	
	if((max_width/max_height)>ratio){
	//实际图片w<h图，长图
		if (ph < max_height){
		//实际高小于边框
			p.style.padding = (max_height - ph)/2 + "px " + (max_width - pw)/2 + "px";
		}else if(ph > max_height){
		//实际高大于边框
			p.style.width = (ratio*max_height|0) + "px";
			p.style.height = max_height + "px";
			p.style.padding = "0px " + (max_width - (ratio*max_height|0))/2 + "px";
		}else if(ph = max_height){
			p.style.padding = "0px " + (max_width - (ratio*max_height|0))/2 + "px";
		}
	}
	else{
	//实际图片w>h图，宽图
		if(pw < max_width){
		//实际宽小于边框
			p.style.padding = (max_height - ph)/2 + "px " + (max_width - pw)/2 + "px";
		}else if(pw > max_width){
		//实际宽大于边框
			p.style.width = max_width + "px";
			p.style.height = (max_width/ratio|0) + "px";
			p.style.padding = ((max_height - (max_width/ratio|0))/2|0) + "px 0px";
		}else if(pw = max_width){
			p.style.padding = ((max_height - (max_width/ratio|0))/2|0) + "px 0px";
		}
	}
}

//===========================================================

//自动按照比例调整图片尺寸，扩大，填满边框，用于小图显示列表
function setImgSize(obj,max_width,max_height){
	var p=obj;
	var pw = p.width;
	var ph = p.height;
	var ratio=pw/ph;
	
	//实际图片为长图片
	if((max_width/max_height)>ratio){
		p.style.width = max_width + "px";
		p.style.height = "auto";
		//p.style.margin = "-"+(ph - max_height)/2 + "px auto auto";
		p.style.margin = "-"+(ph - max_height)/4 + "px auto auto";
	}
	//实际图片为宽图片
	else{
		p.style.height = max_height + "px";
		p.style.width = "auto";
		p.style.margin = "auto auto auto " + "-"+(pw - max_width)/2;
	}
}

//===========================================================

//album显示专辑图片调整大小专用  自动按照比例调整图片尺寸，扩大，填满边框，用于小图显示列表
function setAlbumImgSize(obj,max_width,max_height){
	var p=obj;
	var pw = p.width;
	var ph = p.height;
	var ratio=pw/ph;
	
	//实际图片为长图片
	if((max_width/max_height)>ratio){
		p.style.width = max_width + "px";
		p.style.height = "auto";
	}
	//实际图片为宽图片
	else{
		p.style.height = max_height + "px";
		p.style.width = "auto";
	}
}

//===========================================================

//获取图片实际尺寸
var OriginImage=new Image();
function GetImageWidth(oImage)
{
  if(OriginImage.src!=oImage.src)OriginImage.src=oImage.src;
  return OriginImage.width;
}
function GetImageHeight(oImage)
{
  if(OriginImage.src!=oImage.src)OriginImage.src=oImage.src;
  return OriginImage.height;
}

//imagesshow页面点击切换大图

function showMainImg(thisObj){
	//以下为切换右侧列表样式，点击即变换本身背景
	var elementObj = window.document.getElementById("mainImgView");
	for(i=0;i<thisObj.parentNode.parentNode.childNodes.length;i++){
		thisObj.parentNode.parentNode.childNodes[i].id="";
	}
	thisObj.parentNode.id = "imageShowListBoxFocus";
	//以下为改变目标大图src，切换大图
	elementObj.src = thisObj.src;
	//以下为改变大图尺寸
	var pw = GetImageWidth(thisObj);
	var ph = GetImageHeight(thisObj);

	var ratio=pw/ph;
	
	elementObj.style.width = "auto";
	elementObj.style.height = "auto";
	
	if((730/650)>ratio){
		if (ph < 650){
			elementObj.style.padding = (650 - ph)/2 + "px " + (730 - pw)/2 + "px";
		}else if (ph > 650){
			elementObj.style.width = (ratio*650|0) + "px";
			elementObj.style.height = 650 + "px";
			elementObj.style.padding = "0px " + (730 - (ratio*650|0))/2 + "px";
		}else if (ph = 650){
			elementObj.style.padding = "0px " + (730 - (ratio*650|0))/2 + "px";
		}
	}
	else{
		if(pw < 730){
			elementObj.style.padding = (650 - ph)/2 + "px " + (730 - pw)/2 + "px";
		}else if(pw > 730){
			elementObj.style.width = 730 + "px";
			elementObj.style.height = (730/ratio|0) + "px";
			elementObj.style.padding = ((650 - (730/ratio|0))/2|0) + "px 0px";
		}else if(pw = 730){
			elementObj.style.padding = ((650 - (730/ratio|0))/2|0) + "px 0px";
		}
	}
}

//===========================================================

//musicplayer页面点击弹出播放页面
function musicPlayerWindow(_ID){
	window.open ("musicPlayer.asp?ID="+_ID,"","width=760; height=510; status=no; scrollbars=no; menubar=no; toolbar=no; location=no;")
}