var strRedirect = "main.asp?div=gallery";
var strViewPage = "galleries.asp";
var strMailPage = "main.asp?div=gallery";
function gallery_Download(cat,ph,t)
{
	var strFormAction = strViewPage+"?action=download&folder=" + cat + "&file=" +ph+"&type="+t;	
	window.open(strFormAction, null);
}
function gallery_SendMail(cat,ph)
{
	var strFormAction = strViewPage + "?action=mail&folder=" + cat +"&file=" + ph;
	
	if ("" == document.getElementById("txtToName").value)
	{
		alert("Input Your friend's name");
		document.getElementById("txtToName").focus();
		return;
	}
	
	if ("" == document.getElementById("txtToMail").value)
	{
		alert("Input Your friend's email address");
		document.getElementById("txtToMail").focus();
		return;
	}
	
	if ("" == document.getElementById("txtFromName").value)
	{
		alert("Input Your name");
		document.getElementById("txtFromName").focus();
		return;
	}

	if ("" == document.getElementById("txtFromMail").value)
	{
		alert("Input Your email address");
		document.getElementById("txtFromMail").focus();
		return;
	}

	if ("" == document.getElementById("txtMessage").value)
	{
		alert("Input Your personalized message");
		document.getElementById("txtMessage").focus();
		return;
	}

	//document.forms("frmImage").action = strFormAction;
	//document.forms("frmImage").submit();
	document.frmImage.action = strFormAction;
	document.frmImage.submit();
}

function gallery_BackToPicture()
{
	document.getElementById("divMail_send").style.display = "none";
}

function gallery_mailpicture()
{
	if ("inline" == document.getElementById("divMail_send").style.display)
		gallery_BackToPicture();
	else
	{
		document.getElementById("divMail_send").style.display = "inline";
		document.getElementById("divMain").scrollTop = 800;
	}
}



function gallery_view(cat,ph)
{
	var strFormAction = strViewPage + "?action=view&folder=" + cat+"&file="+ph;	
	window.open(strFormAction, null, "width=648,height=600,top=0,scrollbars=no,status=no,toolbar=no,menubar=no,location=no");
}


function gallery_MakeUrl(strPage, strAction, strSelected, strFilter)
{
	var strFormAction = strRedirect + "&page=" + strPage;
	
	if (strAction != null)
		strFormAction += "&action=" + strAction;
	
	if (strSelected != null)
		strFormAction += "&selected=" + strSelected;

	if (strFilter != null)
		strFormAction += "&filter=" + strFilter;
		
	return strFormAction;
}