/*
MyCart
*/
var Dtimer=null;
var Dtimer2=null;
var Mdisplay=false;
var hideDiv;
var Container;
var button;
var jqShowObj;
var offset;
var height;
var width;
var btnHeight;
var btnWidth;
function initDMenu(obj,showobj,Dtimeout,Dspeed){
	hideDiv=jQuery("<div class='hidediv' style='z-index:10000;'></div>");
	Container=jQuery("<div id=\"Container\"></div>");
	hideDiv.append(Container);
	button=jQuery(obj);
	jqShowObj=jQuery(showobj);
	offset=button.offset();
	width=jqShowObj.width();
	btnHeight=button.height();
	btnWidth=button.width();
	jQuery(document.body).prepend(hideDiv);
}
function showDMenu(){
	if (Mdisplay==true){
		return false;
	}else{
		Mdisplay=true;
		Container.css({margin:"0 auto",width:btnWidth+"px",height:btnHeight+"px"});
		hideDiv.css({position:"absolute",top:offset.top+30+"px",left:button.offset().left-38+"px",height:height+"px",width:width+"px"}).show();
		Container.css({border:"1px solid #666666"});
		Container.animate({marginTop:10,height:height+4,width:width+4,opacity:'100'},100,function(){
			jqShowObj.show();
			Container.append(jqShowObj);
			Container.css({border:"0px"});
			jqShowObj.mouseover(function(){
				clearTimeout(Dtimer);clearTimeout(Dtimer2);
			}).mouseout(function(){
				hideDMenu();
			});			
		});
	}
}
function hideDMenu(){
	clearTimeout(Dtimer);
	clearTimeout(Dtimer2);
	Dtimer=setTimeout(function(){
		Container.css({border:"1px solid #666666"});
		jQuery(document.body).prepend(jqShowObj);
		jqShowObj.hide();
		Container.empty();
		Container.animate({width:btnWidth,height:btnHeight,marginTop:'0',opacity:'0'},100,function(){
			Container.hide();
			hideDiv.hide();
			Mdisplay=false;
			});
		}, 100); 
}
/*
showTip
*/
jQuery(function(){
	initDMenu(".cartswitch_wrap",".mycart");
	jQuery(".cartswitch_wrap").mouseover(function(){

		clearTimeout(Dtimer);
		height=jQuery(".mycart").height();
		Dtimer=setTimeout("showDMenu()",100); 
	}).bind("mouseleave",function(){
		clearTimeout(Dtimer); 
		if(Mdisplay==true){
			Dtimer2=setTimeout("hideDMenu()",100);
		}
	}); 
})
