// JavaScript Document
function Mon(tr){
	tr.style.backgroundColor="#f5f5f5";
}
function Mout(tr){
	tr.style.backgroundColor="#ffffff";
}


function reSize(img,x,y){
	
	window.setTimeout(function(){
	
		if(img.width/img.height>=x/y){
			if (img.widht>x){
				img.width=x;	
			}
			
		}else{
			if (img.height>y){
				img.height=y;
			}
		}
	
	},100);
	
	
	
}

function ProOpen(id,canshu){
	objNext = new Image();
	objNext.src="admin/"+id;
	$("body").append("<div id='ProOpenBG'></div>");
	$("body").append("<div id='ProInfo'></div>");

	$('#ProOpenBG').css({
				opacity:0.7,
				height:document.body.scrollHeight
	}).fadeIn();

	
	
	$("#ProInfo").append(objNext);
	if((objNext.width/objNext.height)>500/400){
		if(objNext.width>500){
			objNext.width=500;	
			
		}else{
			objNext.style.cssText="margin-top:"+(400-objNext.height)/2+"px;";	
		}
	}else{
		if(objNext.height>400){
			objNext.height=400;	
		}else{
			objNext.style.cssText="margin-top:"+(400-objNext.height)/2+"px;";	
		}
	}
	$('#ProInfo').css({
				top:document.documentElement.scrollTop+100
	}).fadeIn();
		
	
	$('#ProOpenBG').click(function(){
		$('#ProOpenBG').animate({
			opacity:0
		},500);	
		$('#ProInfo').animate({
			opacity:0
		},500);	
		
		emement = document.getElementById("ProOpenBG"); 
		emement2 = document.getElementById("ProInfo"); 
		setTimeout(function(){emement.parentNode.removeChild(emement);emement2.parentNode.removeChild(emement2)},500);
	});
	//window.open("admin/PICinfo.asp?id="+id+"&canshu="+canshu,"picinfo","toolbar=no,meun=no,width=500,height=400,")
	//alert(id);
}
function ProOpenEN(id,canshu){

	window.open("../admin/PICinfo.asp?id="+id+"&canshu="+canshu,"picinfo","toolbar=no,meun=no,width=500,height=400,")
	//alert(id);
}



function MarqueeX(d,s,h){
	var div=document.getElementById(d);
	var div1=document.getElementById(d+"1");
	var div2=document.getElementById(d+"2");
	div2.innerHTML=div1.innerHTML;
	var MyMar=setInterval("MarqueeX1('"+d+"')",s);
	div.onmouseover=function() {clearInterval(MyMar);}
	div.onmouseout=function() {MyMar=setInterval("MarqueeX1('"+d+"')",s);}
}
function MarqueeX1(d){
	var div=document.getElementById(d);
	var div1=document.getElementById(d+"1");
	var div2=document.getElementById(d+"2");
	//alert(div.scrollTop);
	if(div2.offsetHeight-div.scrollTop<=0){
		div.scrollTop-=div2.offsetHeight;
	}else{
		div.scrollTop++;
	}
	
}
