﻿function BuildAlbums(id,p,mid,pid){
	$jq .ajax({ 
		 cache:false,
		 url: spath + "/DesktopModules/DNNInfo_ImageGallery/AlbumHandler.ashx?id=" + id + "&p=" + p + "&mid=" + mid + "&pid=" + pid,  
		 data: "{}",  
		 contentType: "text/html; charset=utf-8",
		 dataType: "html", 
		 error: function(xhr, status, error) {
				//alert the error if needed
				//alert(xhr.responseText);
		 }, 
		 success: function(msg) {  
			 $jq("#" + id).html(msg);
			 $jq("#" + id).removeClass("ajaxloadingbar");
		 }
	});  
}

function BuildImages(id,p,aid,mid,pid){
    $jq("#" + id).html("");
	$jq("#" + id).addClass("ajaxloadingbar");
	$jq .ajax({ 
		 cache:false,
		 url: spath + "/DesktopModules/DNNInfo_ImageGallery/ImageHandler.ashx?id=" + id + "&p=" + p + "&aid=" + aid + "&mid=" + mid + "&pid=" + pid,  
		 data: "{}",  
		 contentType: "text/html; charset=utf-8",
		 dataType: "html", 
		 error: function(xhr, status, error) {
				//alert the error if needed
				//alert(xhr.responseText);
		 }, 
		 success: function(msg) {  
			 $jq("#" + id).html(msg);
			 $jq("#" + id).removeClass("ajaxloadingbar");
		 }
	});  
}

function BuildSelectedImages(id,p,aid,mid,pid){
    obj = document.getElementById(aid);
    if (obj.selectedIndex == 0) {
        BuildAlbums(id, p, mid, pid);
    } else {
        BuildImages(id, p, obj.options[obj.selectedIndex].value, mid, pid);
    }
}

function addmoverclass(id){
    $jq("#" + id).addClass(" mouseover ");
    j = document.getElementById(id);
}

function addmoutclass(id){
    $jq("#" + id).removeClass(" mouseover ");
}

