function cms_show_pic(elem, url, id, classname) {
		var img = new Element('img', { 'class':classname, 'src':url, 'id':id+'-cms-pic', style:'position:absolute;' } );
		img.fade('hide');
		//alert($(id));

		//alert(url);
		img.inject(elem,'after');

		img.addEvent('mouseout', function() {
			img.fade('out');
		});
		$(elem).addEvent('mouseout', function() {
			try {
			img.fade('out');
			} catch(e) {
			};
		});

		img.fade('in');
}

/*
function cms_show_pic(elem, url, id, classname) {

	var img = $(id);
	var img_created = false;
	img.onload = function() { _show_pic(img); };
	img.src = url;


	if (!img) {
		img = new Image();

		if (!id || id == "") {
			id = get_show_pic_id(elem);
		}

		if (!classname || classname == "") {
			classname = "cms-show-pic";
		}

		//alert(elem.id + " " + elem.nodeType + " " + elem.nodeName);
		//alert(url);
		img.id = id;

		img.className=classname;

		img_created = true;
	} 
	//img.setStyle('opacity',0);
	//var fx = new Fx.Styles(img, {duration:500, wait:true});

	img.onclick= function () { cms_hide_pic(elem,id) }

	var parentNode;

	if (img_created) {
		try {
			parentNode = document.getElementById('cms-show-pic');
			parentNode.appendChild(img);
		} catch (e) {
			//elem.parentNode.style.position="relative";
			elem.parentNode.insertBefore(img,elem);
			//elem.parentNode.style.border="1px solid blue;";
		}
	}
	//img.style.top = "500px;";
	//alert(window.getScrollTop());
	//alert(elem.getPosition().y);
	img.style.top = elem.getPosition().y - 80 + "px"; //310 + window.getScrollTop() + "px";
	//fx.start({ 'opacity': [0,1] });

	//alert(elem + " " + url);
}
*/
function _show_pic(img) {
	var fx = new Fx.Morph(img, {duration:500, wait: false});
	//var fx = new Fx.Styles(img, {duration:500, wait: false});
	fx.start({ 'opacity': [0,1] });
}

function cms_hide_pic(elem,id) {
	var fx = new Fx.Morph($(id), {duration:500, wait: false});
	//var fx = new Fx.Styles($(id), {duration:500, wait: false});
	fx.start({ 'opacity': [1,0] });
}

window.addEvent('domready',function () { init(); });

var fx;
function init() {
	//fx = new Fx.Styles( $('search-box'), {duration:400, wait:false});
	fx = new Fx.Morph( $('search-box'), {duration:400, wait:false});

	$('search-box').style.display = 'block';
	$('search-box').setOpacity(0);
	$('search').addEvent("mouseenter", function (event) {
		fx.start({width: 160, height: 32, opacity: 1});	
	});
	$('search-close-img').addEvent("click", function (event) {
		fx.start({width: 0, height: 0, opacity: 0});	
	})
	$('search-close-txt').addEvent("click", function (event) {
		fx.start({width: 0, height: 0, opacity: 0});	
	})
	$('cms-show-pic').setOpacity(0);
	/*
	$('search-box').addEvent("mouseleave", function (event) {
		fx.start({width: 0, height: 0, opacity: 0});	
	})
	*/
}
function nil() {  }

