//图片按比例缩放 
var flag=false; 
function DrawImage120(ImgD){ 
 var image=new Image(); 
 var iwidth = 120;  //定义允许图片宽度 
 var iheight = 100;  //定义允许图片高度 
 image.src=ImgD.src; 
 if(image.width>0 && image.height>0){ 
 flag=true; 
 if(image.width/image.height>= iwidth/iheight){ 
  if(image.width>iwidth){   
  ImgD.width=iwidth; 
  ImgD.height=(image.height*iwidth)/image.width; 
  }else{ 
  ImgD.width=image.width;   
  ImgD.height=image.height; 
  } 
  } 
 else{ 
  if(image.height>iheight){   
  ImgD.height=iheight; 
  ImgD.width=(image.width*iheight)/image.height;   
  }else{ 
  ImgD.width=image.width;   
  ImgD.height=image.height; 
  } 
  } 
 } 
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function DrawImage50(ImgD)
{ //JS控制图片大小50*50按比例放缩图片 ，调用 onload=javascript:DrawImage50(this)
var image=new Image(); 
var iwidth = 50; 
var iheight = 50; 
image.src=ImgD.src; 
if(image.width>0 && image.height>0){ 
flag=true; 
if(image.width/image.height>= iwidth/iheight){ 
if(image.width>iwidth){ 
ImgD.width=iwidth; 
ImgD.height=(image.height*iwidth)/image.width; 
}else{ 
ImgD.width=image.width; 
ImgD.height=image.height; 
} 
}else{ 
if(image.height>iheight){ 
ImgD.height=iheight; 
ImgD.width=(image.width*iheight)/image.height; 
}else{ 
ImgD.width=image.width; 
ImgD.height=image.height; 
} 
} 
} 
} //结束


function DrawImage80(ImgD)
{ //JS控制图片大小80*80按比例放缩图片 ，调用 onload=javascript:DrawImage80(this)
var image=new Image(); 
var iwidth = 80; 
var iheight = 80; 
image.src=ImgD.src; 
if(image.width>0 && image.height>0){ 
flag=true; 
if(image.width/image.height>= iwidth/iheight){ 
if(image.width>iwidth){ 
ImgD.width=iwidth; 
ImgD.height=(image.height*iwidth)/image.width; 
}else{ 
ImgD.width=image.width; 
ImgD.height=image.height; 
} 
}else{ 
if(image.height>iheight){ 
ImgD.height=iheight; 
ImgD.width=(image.width*iheight)/image.height; 
}else{ 
ImgD.width=image.width; 
ImgD.height=image.height; 
} 
} 
} 
} //结束


function DrawImage100(ImgD)
{ //JS控制图片大小100*100按比例放缩图片 ，调用 onload=javascript:DrawImage100(this)
var image=new Image(); 
var iwidth = 100; 
var iheight = 100; 
image.src=ImgD.src; 
if(image.width>0 && image.height>0){ 
flag=true; 
if(image.width/image.height>= iwidth/iheight){ 
if(image.width>iwidth){ 
ImgD.width=iwidth; 
ImgD.height=(image.height*iwidth)/image.width; 
}else{ 
ImgD.width=image.width; 
ImgD.height=image.height; 
} 
}else{ 
if(image.height>iheight){ 
ImgD.height=iheight; 
ImgD.width=(image.width*iheight)/image.height; 
}else{ 
ImgD.width=image.width; 
ImgD.height=image.height; 
} 
} 
} 
} //结束


function DrawImage140(ImgD)
{ //JS控制图片大小140*140按比例放缩图片 ，调用 onload=javascript:DrawImage140(this)
var image=new Image(); 
var iwidth = 140; 
var iheight = 140; 
image.src=ImgD.src; 
if(image.width>0 && image.height>0){ 
flag=true; 
if(image.width/image.height>= iwidth/iheight){ 
if(image.width>iwidth){ 
ImgD.width=iwidth; 
ImgD.height=(image.height*iwidth)/image.width; 
}else{ 
ImgD.width=image.width; 
ImgD.height=image.height; 
} 
}else{ 
if(image.height>iheight){ 
ImgD.height=iheight; 
ImgD.width=(image.width*iheight)/image.height; 
}else{ 
ImgD.width=image.width; 
ImgD.height=image.height; 
} 
} 
} 
} //结束


function DrawImage150(ImgD)
{ //JS控制图片大小150*150 按比例放缩图片 ，调用 onload=javascript:DrawImage150(this)
var image=new Image(); 
var iwidth = 150; 
var iheight = 150; 
image.src=ImgD.src; 
if(image.width>0 && image.height>0){ 
flag=true; 
if(image.width/image.height>= iwidth/iheight){ 
if(image.width>iwidth){ 
ImgD.width=iwidth; 
ImgD.height=(image.height*iwidth)/image.width; 
}else{ 
ImgD.width=image.width; 
ImgD.height=image.height; 
} 
}else{ 
if(image.height>iheight){ 
ImgD.height=iheight; 
ImgD.width=(image.width*iheight)/image.height; 
}else{ 
ImgD.width=image.width; 
ImgD.height=image.height; 
} 
} 
} 
} //结束

function DrawImage200(ImgD)
{ //JS控制图片大小200*200 按比例放缩图片 ，调用 onload=javascript:DrawImage200(this)
var image=new Image(); 
var iwidth = 200; 
var iheight = 200; 
image.src=ImgD.src; 
if(image.width>0 && image.height>0){ 
flag=true; 
if(image.width/image.height>= iwidth/iheight){ 
if(image.width>iwidth){ 
ImgD.width=iwidth; 
ImgD.height=(image.height*iwidth)/image.width; 
}else{ 
ImgD.width=image.width; 
ImgD.height=image.height; 
} 
}else{ 
if(image.height>iheight){ 
ImgD.height=iheight; 
ImgD.width=(image.width*iheight)/image.height; 
}else{ 
ImgD.width=image.width; 
ImgD.height=image.height; 
} 
} 
} 
} //结束

function DrawImage250(ImgD)
{ //JS控制图片大小250*250 按比例放缩图片 ，调用 onload=javascript:DrawImage250(this)
var image=new Image(); 
var iwidth = 250; 
var iheight = 250; 
image.src=ImgD.src; 
if(image.width>0 && image.height>0){ 
flag=true; 
if(image.width/image.height>= iwidth/iheight){ 
if(image.width>iwidth){ 
ImgD.width=iwidth; 
ImgD.height=(image.height*iwidth)/image.width; 
}else{ 
ImgD.width=image.width; 
ImgD.height=image.height; 
} 
}else{ 
if(image.height>iheight){ 
ImgD.height=iheight; 
ImgD.width=(image.width*iheight)/image.height; 
}else{ 
ImgD.width=image.width; 
ImgD.height=image.height; 
} 
} 
} 
} //结束
                
//图片文件不显示,用 onerror="javascript:errpic(this)" 
function errpic(thepic){
thepic.src="images/nopic_del.gif" //pic_err.gif is the picture which you want to show onerror
}
//player点击后在最上面页用 onClick="return newpage(this.href);"
function newpage(htmlurl) {
var newwin=window.open(htmlurl,"newWin","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,top=2,left=2,width=310,height=50");
newwin.focus();
return false;
}



function musicadd()
{//音乐加
window.open("about:blank","musicadd","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,top=10,left=10,width=280,height=200");
}
function musicbox()
{//音乐盒窗口
window.open("./player.htm","musicbox","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,top=0,left=0,width=330,height=450");
}
function zxtvbox()
{//在线电视窗口
window.open("./zxtv_Player.asp","tvbox","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,top=0,left=0,width=330,height=450");
}

//电影窗口
function movie(htmlurl) {
var newwin=window.open(htmlurl,"movieWin","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,top=2,left=2,width=300,height=200");
newwin.focus();
return false;
}

//图片窗口
function img_pic(htmlurl) {
var newwin=window.open(htmlurl,"imgWin","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,top=200,left=400,width=400,height=300");
newwin.focus();
return false;
}

function lbsong()
{
window.open("about:blank","lbsong","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,top=10,left=10,width=280,height=200");
}

function open_window(url,windowname,size) 
{ 
window.open(url,windowname,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=yes,top=10,left=10,"+ size); 
}



function down(id)
{ 
window.open('../play/down.asp?id='+id,'musicdown'); 
}
function WriteSMusic(id)
{ 
window.open('../qqdg/qqdg.asp?id='+id,'Writesmusic'); 
}
function SendSong(singer,song)
{ 
window.open('/caishow/?dg','SendSong'); 
}
function mms(singer,song)
{ 
window.open('http://www.7town.com/TnSend/mpn.aspx?uid=14845&dy=1&mn='+song,'mms','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width=420,height=300,top=100,left=100'); 
}
function wytj(id)
{ 
window.open('../play/wytj.asp?id='+id,'wytj','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width=1,height=1,top=-1000,left=-1000'); 
}
function Addbox(id)
{ 
window.open('../user/Albumsc1.asp?id='+id+'&action=add','addbox','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width=50,height=20,top=10,left=10'); 
}
function adderror(id)
{ 
window.open('../play/error.asp?id='+id,'adderror','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width=1,height=1,top=-1000,left=-1000'); 
}
function txtwords(singer,song)
{ 
window.open('./txtgc.asp?t=1&singer='+singer+'&song='+song,'txtwords','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=yes,width=350,height=360,top=10,left=10'); 
}
function lrcwords(id)
{ 
window.open('./music_lrc.asp?id='+id,'lrcwords','toolbar=no,location=no,directories=no,status=no,menubar=no,copyhistory=yes,width=250,height=300'); 
}

function lrcwording(htmlurl) {
var newwin=window.open(htmlurl,"lrcwording","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,top=200,left=500,width=310,height=400");
newwin.focus();
return false;
}


function CheckOthers(form)
{//全选代码
	for (var i=0;i<form.elements.length;i++)
	{
		var e = form.elements[i];
//		if (e.name != 'chkall')
			if (e.checked==false)
			{
				e.checked = true;// form.chkall.checked;
			}
			else
			{
				e.checked = false;
			}
	}
}

function CheckAll(form)
{
	for (var i=0;i<form.elements.length;i++)
	{
		var e = form.elements[i];
//		if (e.name != 'chkall')
			e.checked = true// form.chkall.checked;
	}
}



// 隐藏显示常用网址 
function weblinkDiv(init) { 
    if(document.getElementById("weblink").style.display == "block"){ 
       document.getElementById("weblink").style.display = "none"; 
  } 
  else{ 
       document.getElementById("weblink").style.display = "block"; 
  } 
} 
//



// 隐藏显示语言栏 
function LanguageDiv(init) { 
    if(document.getElementById("Language").style.display == "block"){ 
       document.getElementById("Language").style.display = "none"; 
  } 
  else{ 
       document.getElementById("Language").style.display = "block"; 
  } 
} 
//


