YAHOO.namespace("lemon.cx.container");
function previewAlbum(Title,PicSn) {
	if (!YAHOO.lemon.cx.container.wait) {
		YAHOO.lemon.cx.container.wait =
		new YAHOO.widget.Panel("wait",
			{ width: "425px",
			  height: "425px",
			  fixedcenter: true,
			  close: true,
			  draggable: false,
			  modal: true,
			  zindex:100,
			  visible: false
			}
		 );
	}
	with(YAHOO.lemon.cx.container.wait){
		setHeader(Title);
		setBody("<a href=\"javascript:YAHOO.lemon.cx.container.wait.hide();\"><img src=\"tools/getPic/album.php?SN="+PicSn+"&W=400&H=400&bgCol=255255255\" border=\"0\" /></a>");
		render(document.body);
	}
	YAHOO.lemon.cx.container.wait.show();
}
function add2ShoppingCart(sObjId){
	sObjId='ProductCart';
	var o=document.getElementById(sObjId);
	//var myAnim = new YAHOO.util.Anim(sObjId, { width: {  to: 100 }}, 1);
   // var myAnim = new YAHOO.util.Motion(sObjId, {points: { to: [600, 10] }});
	//myAnim.animate();
	FadeOut(o,100);
		//alert(sObjId);

	/*
	YAHOO.lemon.cx.container.overlayCart = 
			new YAHOO.widget.Overlay(sObjId, { xy:[350,100],
				  visible:false,
				  width:"300px",
				  zIndex:1000,
				  effect:[{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.5},
						  {effect:YAHOO.widget.ContainerEffect.SLIDE,duration:0.5}] } );
	alert(o.style.x+'/'+o.style.y+'/'+o.style.width);
	YAHOO.lemon.cx.container.overlayCart.render("lemon.cx");
	//YAHOO.lemon.cx.container.overlayCart.show();
	//YAHOO.lemon.cx.container.overlayCart.hide();
	YAHOO.util.Event.addListener("btn_Add2Cart", "click", YAHOO.lemon.cx.container.overlayCart.hide, YAHOO.lemon.cx.container.overlayCart, true);
	*/
}
function FadeIn(element, opacity) {
	var reduce_opacity_by = 15;
	var rate = 30;	// 15 fps
	if (opacity < 100) {
		opacity += reduce_opacity_by;
		if (opacity > 100) opacity = 100;

		if (element.filters) {
			try {
				element.filters.item("DXImageTransform.Microsoft.Alpha").opacity = opacity;
			} catch (e) {
				// If it is not set initially, the browser will throw an error.  This will set it if it is not set yet.
				element.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=' + opacity + ')';
			}
		} else {
			element.style.opacity = opacity / 100;
		}
	}
	if (opacity < 100) {
		setTimeout(function() { FadeIn(element, opacity); }, rate);
	}
}
function FadeOut(element, opacity) {
	var reduce_opacity_by = 15;
	var rate = 30;	// 15 fps
	if (opacity > 0) {
		opacity -= reduce_opacity_by;
		alert(opacity);
		if (opacity < 0) opacity = 0;

		if (element.filters) {

			try {
				element.filters.item("DXImageTransform.Microsoft.Alpha").opacity = opacity;
			} catch (e) {
				// If it is not set initially, the browser will throw an error.  This will set it if it is not set yet.
				element.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=' + opacity + ')';
				alert(element.style.filter);
			}
		} else {
			element.style.opacity = opacity / 100;
		}
	}
	if (opacity > 0) {
		setTimeout(function() { FadeOut(element, opacity); }, rate);
	}
}
//YAHOO.util.Event.onDOMReady(add2ShoppingCart);
