var prox;
	var proy;
	var proxc;
	var proyc;
	function show(id,favor_id,imgType,imgWidth,imgHeight){/*--打开--*/
	
		clearInterval(prox);
		clearInterval(proy);
		clearInterval(proxc);
		clearInterval(proyc);
		var o = document.getElementById(id);
		var oImg=document.getElementById(favor_id);
		//alert(oImg.id);
		position(oImg,o,imgType,imgWidth,imgHeight); 
		o.style.display = "block";
		o.style.width = "1px";
		o.style.height = "1px"; 
		o.style.zIndex=100;
		prox = setInterval(function(){openx(o,250)},1);
		  
	}	
	function openx(o,x){/*--打开x--*/
		var cx = parseInt(o.style.width);
		if(cx < x)
		{
			o.style.width = (cx + Math.ceil((x-cx)/5)) +"px";
		}
		else
		{
			clearInterval(prox);
			proy = setInterval(function(){openy(o,100)},1);
		}
	}	
	function openy(o,y){/*--打开y--*/	
		var cy = parseInt(o.style.height);
		if(cy < y)
		{
			o.style.height = (cy + Math.ceil((y-cy)/5)) +"px";
		}
		else
		{
			clearInterval(proy);			
		}
	}	
	function closeed(id){/*--关闭--*/
		clearInterval(prox);
		clearInterval(proy);
		clearInterval(proxc);
		clearInterval(proyc);		
		var o = document.getElementById(id);
		if(o.style.display == "block")
		{
		o.style.display="none";
			//proyc = setInterval(function(){closey(o)},10);			
			//proxc = setInterval(function(){closex(o)},10);			
		}		
	}	
	function closey(o){/*--打开y--*/	
		var cy = parseInt(o.style.height);
		if(cy > 0)
		{
			o.style.height = (cy - Math.ceil(cy/5)) +"px";
		}
		else
		{
			clearInterval(proyc);				
			proxc = setInterval(function(){closex(o)},10);
		}
	}	
	function closex(o){/*--打开x--*/
		var cx = parseInt(o.style.width);
		if(cx > 0)
		{
			o.style.width = (cx - Math.ceil(cx/5)) +"px";
		}
		else
		{
			clearInterval(proxc);
			o.style.display = "none";
		}
	}	
	
	
	/*-------------------------鼠标拖动---------------------*/	
	var od = document.getElementById("fd");	
	var dx,dy,mx,my,mouseD;
	var odrag;
	var isIE = document.all ? true : false;
	document.onmousedown = function(e){
		var e = e ? e : event;
		if(e.button == (document.all ? 1 : 0))
		{
			mouseD = true;			
		}
	}
	document.onmouseup = function(){
		mouseD = false;
		odrag = "";
		if(isIE)
		{
			od.releaseCapture();
			od.filters.alpha.opacity = 100;
		}
		else
		{
			window.releaseEvents(od.MOUSEMOVE);
			od.style.opacity = 1;
		}		
	}
	
	
	//function readyMove(e){	
	od.onmousedown = function(e){
		odrag = this;
		var e = e ? e : event;
		if(e.button == (document.all ? 1 : 0))
		{
			mx = e.clientX;
			my = e.clientY;
			od.style.left = od.offsetLeft + "px";
			od.style.top = od.offsetTop + "px";
			if(isIE)
			{
				od.setCapture();				
				od.filters.alpha.opacity = 50;
			}
			else
			{
				window.captureEvents(Event.MOUSEMOVE);
				od.style.opacity = 0.5;
			}
			
			//alert(mx);
			//alert(my);
			
		} 
	}
	document.onmousemove = function(e){
		var e = e ? e : event;
		
		//alert(mrx);
		//alert(e.button);		
		if(mouseD==true && odrag)
		{		
			var mrx = e.clientX - mx;
			var mry = e.clientY - my;	
			od.style.left = parseInt(od.style.left) +mrx + "px";
			od.style.top = parseInt(od.style.top) + mry + "px";			
			mx = e.clientX;
			my = e.clientY;
			
		}
	}
function getMouseXY(){
var obj=document.getElementById('productInfo_save');
//alert(get_X(obj));
//alert(get_Y(obj));
obj.style.left=get_X(obj);
obj.style.top=get_Y(obj);
obj.style.zIndex=100;
}

function get_X(obj){
    var ParentObj=obj;
    var left=obj.offsetLeft;
    while(ParentObj=ParentObj.offsetParent){
        left+=ParentObj.offsetLeft;
    }
    return left;
}

function get_Y(obj){
    var ParentObj=obj;
    var top=obj.offsetTop;
    while(ParentObj=ParentObj.offsetParent){
        top+=ParentObj.offsetTop;
    }
    return top;
}

function IsIE()
{
    return ( navigator.appName=="Microsoft Internet Explorer" ); 
}

function position(control,obj,imgType,imgWidth,imgHeight)
{
	
	var range=getRange();
    obj.ox=(range.width-278)/2;
	obj.oy=(range.height-102)/2;
	obj.style.left=(range.left+obj.ox) +"px";
	obj.style.top=(range.top+obj.oy) +"px";
	
	
	
	
	/*
    var eT=0,eL=0,p=control;
	var sT=document.documentElement.scrollTop,sL=document.documentElement.scrollLeft;
	var eH=control.height,eW=control.width;
	while(p&&p.tagName!="BODY")
	{
		eT+=p.offsetTop;
		eL+=p.offsetLeft;
		p=p.offsetParent;
	}
	obj.style.top=(document.documentElement.clientHeight-(eT-sT)-eH>=obj.height)?eT+eH:eT+35 + "px";
	if(imgType=='F')obj.style.top=(document.documentElement.clientHeight-(eT-sT)-eH>=obj.height)?eT+eH+imgHeight/2-100:eT+35 +imgHeight/2-100+ "px";
	if(IsIE())
	{
	    var objwidth=0;
	    if(obj.width!=undefined)
	    {	 
	        objwidth=obj.width;	
	    }
	    obj.style.left=(document.documentElement.clientWidth-(eL-sL)>=objwidth)?eL-230:eL  + "px";
	    if(imgType=='F') obj.style.left=(document.documentElement.clientWidth-(eL-sL)>=objwidth)?eL-230+imgWidth/2+90:eL+imgWidth/2+90  + "px";
	}
	else
	{
	    obj.style.left=eL-200 + "px";
	     if(imgType=='F') obj.style.left=eL-200+imgWidth/2+90 + "px";
	}
	*/
}


function getRange() {
      var top     = document.documentElement.scrollTop;
      var left    = document.documentElement.scrollLeft;
      var height  = document.documentElement.clientHeight;
      var width   = document.documentElement.clientWidth;

      if (top==0 && left==0 && height==0 && width==0) {
        top     = document.body.scrollTop;
        left    = document.body.scrollLeft;
        height  = document.body.clientHeight;
        width   = document.body.clientWidth;
      }
      //alert(height);
      return  {top:top  ,left:left ,height:height ,width:width } ;
}
