function loadGal(sub)
{
	el('gallery_slide_pos').value=1;
	$.post(vl("gal_root")+"/mint-module/gallery/ajax/gallery.ajax.php",{rs:"load_gallery", sub:sub},function(data)
	{
		el('control_inner').innerHTML=data;
		$("#control_inner").fadeIn("slow");
		$('.img_pod').css("width",(($('#control_area').width()*0.8)/8)+"px");
		$('.padder').css("width",(($('#control_area').width()*0.2)/8)+"px");
		$('#control_inner').css("width",(($('.img_pod').width()+$('.padder').width())*$('.img_pod').size())+"px");	
		$("#gallery_image").html("<img src='"+$("#control_inner img:first-child").attr("src")+"' alt='No images'/>");
		$("#gallery_image").fadeIn("slow",function(){
			// addEl("div","des_bg","gallery_image");
			// $("#des_bg").css({"height": "40px", "width":$('#gallery_image > img').width()+1+"px","top":"-3px","left":Math.ceil(($('#gallery_image').width()-$('#gallery_image > img').width())/2)-1+"px"});
			addEl("div","des_txt","gallery_image");
			$("#des_txt").css({"height": "40px","line-height":"40px;", "width":$('#gallery_image > img').width()+"px","top":"-3px","left":Math.ceil(($('#gallery_image').width()-$('#gallery_image > img').width())/2)+"px"});
			$("#des_txt").html($("#control_inner img:first-child").attr("title"));
			$("#des_bg, #des_txt").fadeIn("fast");
		});
	});
}
function loadImg(id, ext, desc)
{
	$("#gallery_image").css("display","none");
	el('gallery_image').innerHTML="<img src='"+vl("gal_root")+"/mint-project/uploads/"+id+"."+ext+"' alt='No images'/>";
	$("#gallery_image").fadeIn("slow",function(){
		// addEl("div","des_bg","gallery_image");
		// $("#des_bg").css({"height": "40px", "width":$('#gallery_image > img').width()+1+"px","top":"-3px","left":Math.ceil(($('#gallery_image').width()-$('#gallery_image > img').width())/2)-1+"px"});
		addEl("div","des_txt","gallery_image");
		$("#des_txt").css({"height": "40px","line-height":"40px;", "width":$('#gallery_image > img').width()+"px","top":"-3px","left":($('#gallery_image').width()-$('#gallery_image > img').width())/2+"px"});
		$("#des_txt").html(desc);
		$("#des_bg, #des_txt").fadeIn("fast");
		// el('enlarge_img').innerHTML="<span onclick='enlarge("+id+")'>Enlarge Image</span>";
	});
	
}
function hideDesc()
{
	$("#des_bg, #des_txt").fadeOut("fast");	
}
function showDesc()
{
	$("#des_bg, #des_txt").fadeIn("fast");	
}
function moveRight()
{
	if($('.img_pod').size()>8)
	{
		if(el('gallery_slide_pos').value<Math.ceil($('.img_pod').size()/8))
		{
			el('gallery_slide_pos').value++;
			$("#control_inner div").animate({"left": "-="+$("#control_area").width()}, 1000);
		}
	}
}
function moveLeft()
{
	if(el('gallery_slide_pos').value!="1")
	{
		el('gallery_slide_pos').value--;
		$("#control_inner div").animate({"left": "+="+$("#control_area").width()}, 1000);
	}
}
function loadGalFirst()
{
	el('gallery_slide_pos').value=1;
	$.post(vl("gal_root")+"/mint-module/gallery/ajax/gallery.ajax.php",{rs:"load_first"},function(data)
	{
		el('control_inner').innerHTML=data;
		$("#control_inner").fadeIn("slow");
		$('.img_pod').css("width",(($('#control_area').width()*0.8)/8)+"px");
		$('.padder').css("width",(($('#control_area').width()*0.2)/8)+"px");
		$('#control_inner').css("width",(($('.img_pod').width()+$('.padder').width())*$('.img_pod').size())+"px");	
		$("#gallery_image").html("<img onmouseover='hideDesc();' onmouseout='showDesc();' src='"+$("#control_inner img:first-child").attr("src")+"' alt='No images'/>");
		$("#gallery_image").fadeIn("slow",function(){
			addEl("div","des_bg","gallery_image");
			$("#des_bg").css({"height": "40px", "width":$('#gallery_image > img').width()+"px","top":"-43px","left":($('#gallery_image').width()-$('#gallery_image > img').width())/2+"px"});
			addEl("div","des_txt","gallery_image");
			$("#des_txt").css({"height": "40px","line-height":"40px;", "width":$('#gallery_image > img').width()+"px","top":"-83px","left":($('#gallery_image').width()-$('#gallery_image > img').width())/2+"px"});
			$("#des_txt").html($("#control_inner img:first-child").attr("title"));
			$("#des_bg, #des_txt").fadeIn("fast");	
		});
	});
}
