/**
//图片等比缩放
var flag=false; 
function DrawImage(ImgD,width,height){ 
  if(!ImgD){
    return false;
   }
 var image=new Image(); 
 image.src=ImgD.src;
 if(image.width>0 && image.height>0){ 
  flag=true; 
  if(image.width/image.height>= width/height){ 
   if(image.width>width){
    ImgD.width=width; 
    ImgD.height=(image.height*width)/image.width; 
   }else{ 
    ImgD.width=image.width;
    ImgD.height=image.height; 
   } 
  // ImgD.alt=image.width+"x"+image.height; 
  } 
  else{ 
   if(image.height>height){
    ImgD.height=height; 
    ImgD.width=(image.width*height)/image.height; 
   }else{ 
    ImgD.width=image.width;
    ImgD.height=image.height; 
   } 
  // ImgD.alt=image.width+"x"+image.height; 
  } 
 }
}
*/
//图片不等比缩放
function DrawImage(ImgD,width,height){ 
	if(!ImgD){ 
		return false;
	}else{
		ImgD.width = width;
		ImgD.height = height;
	}

}
//图片列表特效
var ttt;
var divCur;
//读取图片大小
function readimg(obj,id)
{
document.getElementById("fileLength"+id).innerHTML=Math.ceil(obj.fileSize/1024)+"K";
}
function ShowBigOne(id){}
/**
function ShowBigOne(id) {
DrawImage(document.getElementById("pic"+id),500,500);
document.getElementById("ImgInfoDiv").style.display="none";
//ttt=setTimeout("ShowDiv('"+id+"')",500);
} 
function ShowDiv(id)
{
        //获得当前屏幕TOP和left
	var scrollPos; 
	var scrollLeft;
	if(isFirefox=navigator.userAgent.indexOf("Firefox")>0)
	{
	   scrollPos = window.innerHegiht; 
	   scrollLeft ="0";
	}
	else if (typeof window.pageYOffset != 'undefined') { 
	   scrollPos = window.pageYOffset; 
	   scrollLeft =window.pageXOffset;
	} 
	else if (typeof document.compatMode != 'undefined' && 
		 document.compatMode != 'BackCompat') { 
	   scrollPos = document.documentElement.scrollTop; 
	   scrollLeft = document.documentElement.scrollLeft;
	} 
	else if (typeof document.body != 'undefined') { 
	   scrollPos = document.body.scrollTop; 
	   scrollLeft = document.body.scrollLeft;
	}
        //结束
    var e=document.getElementById("pic"+id);
    var   t=e.offsetTop;   
          var   l=e.offsetLeft;   
          while(e=e.offsetParent){   
              t+=e.offsetTop;   
              l+=e.offsetLeft;   
              }  
    var lleft=l-58;
     var iimg = new Image();
  iimg.src = document.getElementById("RealImg").src;
    var h = iimg.height>230?(230+155):(iimg.height+155);
    if(iimg.width>230){ 
    h=((iimg.height*230)/iimg.width)+155; 
   }
   if(iimg.height>230){ 
    h=230+155; 
   }
    var ltop = (t-h/2);
     if(ltop<scrollPos)
      {
       ltop = scrollPos;
      }
      if(ltop>(scrollPos+document.documentElement.offsetHeight-h))
      {
      ltop =scrollPos+document.documentElement.offsetHeight-h;
      }   
      if(lleft<scrollLeft)
      {
      lleft = scrollLeft;
      }
      if(lleft>(scrollLeft+document.documentElement.offsetWidth-230))
      {
      lleft=scrollLeft+document.documentElement.offsetWidth-230;
      }
    // alert((t-h)+"---"+(scrollPos+document.documentElement.offsetHeight-h+100));
    document.getElementById("ImgInfoDiv").style.top= ltop+"px"; 
    document.getElementById("ImgInfoDiv").style.left= lleft+"px";
    document.getElementById("ImgInfoDiv").style.display="block";
  // alert(scrollLeft+"--"+document.documentElement.offsetWidth);
 
}*/
function Hide(id) { 
clearTimeout(ttt);
document.getElementById("div"+id).style.display="none";
//returnitem("div"+id);
}
function pic(id,uid)
    {
    window.open ('http://'+uid+'.webspace.joyes.com/picInfo.aspx?res_id='+id+'','newwindow') 
    }
function SetImgDivInfo(res_id,res_name,web_pic,group,down_times,user_id,user_name)
 {
 var image=new Image(); 
 image.src=web_pic; 
 var info='<i>分辨率：</i>'+image.width+'×'+image.height+'<br /><i>大小：</i><span>'+Math.ceil(document.getElementById("pic"+res_id).fileSize/1024)+"K"+'</span><font>|</font><i>人 气：</i>'+down_times;
   if(user_id!=""&&user_name!="")
    {
     info=info+'<br /><i>上传人：</i><a href="http://'+user_id+'.webspace.joyes.com/">'+user_name+'</a>';
     }
 document.getElementById("ImgInfoDiv_info").innerHTML=info;
    // var rImg=document.getElementById("RealImg");
     document.getElementById("RealImg").src=web_pic;  
     document.getElementById("RealImg").onclick=function (){pic(res_id,user_id)};
 document.getElementById("ImgInfoDiv_sc").innerHTML="<a target=\"_blank\" href=\"http://"+user_id+".webspace.joyes.com/picInfo.aspx?res_id="+res_id+"\" class=\"down\">下载该图片</a><a href=\"javascript:void(0)\" onclick=\"shouCang('"+res_id+"','3','"+res_name+"');\" class=\"shouc\">收藏该图片</a>";
  document.getElementById("ImgInfoDiv_name").innerHTML=res_name;
 }
 
//取cookie
 function getJoyesCookie(cookieName) 
    {
	var cookieString = document.cookie;
	var start = cookieString.indexOf(cookieName + '=');
	if (start == -1)
	return null;
	start += cookieName.length + 1;
	var end = cookieString.indexOf('&', start);
	if (end == -1)
	{
	end = cookieString.indexOf(';', start);
	if (end == -1) return unescape(cookieString.substring(start));
	}
	return unescape(cookieString.substring(start, end));
    }
 var obj = document.documentElement;
var w = obj.scrollWidth;
var h = window.screen.height;
function show(div1) {
window.onscroll = function() {document.getElementById(div1).style.top = (obj.scrollTop + 100) + "px";};
document.getElementById(div1).style.display = "block";
document.getElementById(div1).style.top = (obj.scrollTop + 100) + "px";
}

function close(div1) {
document.getElementById(div1).style.display = "none";
window.onscroll = null;
}
 // 收藏
 function shouCang(rid,type,rname)
{
    var uid=getJoyesCookie("UGID");
    var k = Math.random()*100;
    if(uid!=null&&uid!=0){show("chouChangDiv");getListDataSource("js/resFav.aspx?res_id="+rid+"&type="+type+"&res_name="+rname+"&k="+k);}
    else{alert("请您先登陆!"); setTimeout("window.location.href='http://club.joyes.com/user/login.aspx';",50);}  
}

function showProductInfo(id){
	//window.location="showproduct.asp?id="+id;
	var url = "showproduct.asp?id="+id;
	window.open(url);
}