// common artcms js
var lastImageClicked;

// return the value of the radio button that is checked
// return an empty string if none are checked, or
// there are no radio buttons
function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var j = 0; j < radioLength; j++) {
		if(radioObj[j].checked) {
			return radioObj[j].value;
		}
	}
	return "";
}

function deletePhoto(caller)
{
	//console.log(CURR_WEB_PATH+"/page/DeleteImage/"+caller.getAttribute("imageID"));
	window.location = CURR_WEB_PATH+"/page/DeleteImage/"+caller.getAttribute("imageID");
}

function showPhoto(caller)
{
	//console.log(caller);
	mylightbox.show(caller.getAttribute("fullImg"), caller.getAttribute("title"));	
}

var mylightbox;
function startGallery() {
var myGallery = new gallery($('myGallery'), {
timed: true,
showArrows: false,
showCarousel: false,
embedLinks: true,
lightbox: true
});
mylightbox = new Lightbox();	
}

function startLightbox() {
mylightbox = new Lightbox();	
}

function preLoad()
{
	//menuPreLoad();
	//displayEvenly(0);
	//hidemenuie5();
}

window.addEvent('domready', function(){
	var list = $$(' li');
	list.each(function(element) {
		
		var fx = new Fx.Styles(element, {duration:200, wait:false});
		
		element.addEvent('mouseover', function(){
			fx.start({
				'margin-left': 5,
				'background-color': '#330066',
				'color': '#000'
			});
		});
		
		element.addEvent('mouseout', function(){
			fx.start({
				'margin-left': 0,
				'background-color': '#330033',
				'color': '#000'
			});
		});
		
	});
	
	var imgList = $$('#pageImages img');
	var menuObj = document.getElementById('ie5menu');
	if(menuObj)
	{
	imgList.each(function(element) {
		//console.log(element);
		//console.log(menuObj);
		var fx = new Fx.Styles(menuObj, {duration:200, wait:false});
		var fx2 = new Fx.Styles(menuObj, {duration:0, wait:false});
		element.addEvent('mousedown', function(event){
			//console.log(this);
			lastImageClicked = this;
			event = new Event(event);
			fx2.start({
				'top': [event.page.y - 60],
				'left': [event.page.x - 60]
			}).chain(function(){
				fx.start({
					'opacity': '1',
					'filter':'alpha(opacity=1)'
			});
				
			});
			event.stop();
		});
		
		window.addEvent('mouseup', function(){
			fx.start({
				'opacity': '0',
				'filter':'alpha(opacity=0)'
			});
			
			//console.log(menuObj);
		});
	
	});
	}
	
}); 