

function viewGallery(loader)
	{
	this.loader = loader;
	var url = "/gallery/manager/op/viewGallery";
	xmlHttp.open("GET",url, true);	
	xmlHttp.onreadystatechange = viewGallery_Handler;
	xmlHttp.send(null);
	}	

function viewGallery_Handler()
{
	if (xmlHttp.readyState == 1)
		{
			if(loader == 1)
			{
				document.getElementById("contentDiv").innerHTML="<img src="+ajaxloader.src+" alt='Loading..' />";
			}else{
				document.getElementById("contentDiv").innerHTML="";
			}
		}
	if (xmlHttp.readyState == 4) 
		{
			document.getElementById("contentDiv").innerHTML='<iframe width="600" height="620" border="0" style="border:0;" src="/gallery/manager/op/viewGallery"></iframe>';
		}
}	






function addCategory()
	{
	var categoryTitle = document.getElementById("category_title").value;
	var url = "/gallery/manager/op/addCategory/categoryTitle/"+categoryTitle;
	xmlHttp.open("GET",url, true);	
	xmlHttp.onreadystatechange = addCategory_Handler;
	xmlHttp.send(null);
	}	

function addCategory_Handler()
{
	if (xmlHttp.readyState == 1)
		{
		}
	if (xmlHttp.readyState == 4) 
		{
			//location.href="/gallery/manager/op/viewGallery"; 
			top.viewGallery('1');
		}
}	



function deleteCategory(id)
	{
	this.id = id;
	var url = "/gallery/manager/op/deleteCategory/categoryId/"+id;
	xmlHttp.open("GET",url, true);	
	xmlHttp.onreadystatechange = deleteCategory_Handler;
	xmlHttp.send(null);
	}	

function deleteCategory_Handler()
{
	if (xmlHttp.readyState == 1)
		{
		}
	if (xmlHttp.readyState == 4) 
		{
			//location.href="/gallery/manager/op/viewGallery"; 
			top.viewGallery('1');
		}
}	



function viewCategoryPics(categoryId)
	{
	this.categoryId = categoryId;
	var url = "/gallery/manager/op/viewCategoryPics/categoryId/"+categoryId;
	xmlHttp.open("GET",url, true);	
	xmlHttp.onreadystatechange = deleteCategoryPic_Handler;
	xmlHttp.send(null);
	}	

function viewCategoryPics_Handler()
{
	if (xmlHttp.readyState == 1)
		{
				document.getElementById("contentDiv").innerHTML = "<img src="+ajaxloader.src+" alt='Loading..' />";
		}
	if (xmlHttp.readyState == 4) 
		{
				document.getElementById("contentDiv").innerHTML = xmlHttp.responseText;
		}
}	





function deletePic(categoryId,picId)
	{
	this.picId = picId;
	this.categoryId = categoryId;
	var url = "/gallery/manager/op/deletePic/categoryId/"+categoryId+"/picId/"+picId;
	xmlHttp.open("GET",url, true);	
	xmlHttp.onreadystatechange = deletePic_Handler;
	xmlHttp.send(null);
	}	

function deletePic_Handler()
{
	if (xmlHttp.readyState == 1)
		{
				document.getElementById("contentDiv").innerHTML = "<img src="+ajaxloader.src+" alt='Loading..' />";
		}
	if (xmlHttp.readyState == 4) 
		{
				document.getElementById("contentDiv").innerHTML = xmlHttp.responseText;
		}
}	


