<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UploadProfile.aspx.cs" EnableEventValidation="False" Inherits="DocumentRouter.UploadProfile" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<%@ Register TagPrefix="uc1" TagName="LocationPane" Src="GenericControls/LocationPane.ascx" %>
<%@ Register TagPrefix="uc1" TagName="ProfilePane" Src="GenericControls/ProfilePane.ascx" %>

<%@ Register assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" namespace="System.Web.UI" tagprefix="asp" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
		<title>Tarvos Document Router</title>
		<link href="Data/DocumentRouter.css" type="text/css" rel="stylesheet" />
		<script src="Scripts/Tools.js" type="text/javascript"></script>
		<script src="Scripts/FieldUpdate.js" type="text/javascript"></script>
		<script language="javascript" type="text/javascript">
<!--

// This page can not be without it's parent!
function CheckParent()
{
	try
	{
		if((parent == null) || (parent.location == null) || (parent.location.href == null))
		{
			self.location.href = "UploadPage.aspx";
			return false;
		}
		else
		{
			var sPath = parent.location.href;
			if(sPath.toLowerCase().indexOf("uploadpage.aspx") == -1)
			{
				self.location.href = "UploadPage.aspx";
				return false;
			}
		}
	}
	catch(e)
	{
		alert("Error: " + e.description);
		return false;
	}
}

function ShowWait()
{
	try
	{
		parent.document.body.style.cursor = 'wait';
		parent.document.getElementById('waitImg').style.display = "";
	}
	catch(e)
	{
	}
}

function HideWait()
{
	try
	{
		parent.document.body.style.cursor = 'default';
		parent.document.getElementById('waitImg').style.display = "none";
	}
	catch(e)
	{
	}
}

var bSaveClicked = false;


function CheckValues()
{
	try
	{
		// Handle error
		if(document.getElementById('HiddenError').value != "")
		{
			//parent.SetError(document.getElementById('HiddenError').value);
			alert(document.getElementById('HiddenError').value);
			return;
		}
		var objDatabase = document.getElementById('HiddenDatabase');
		var objDBPath = document.getElementById('HiddenDBPath');
		var objProfiles = document.getElementById('HiddenProfiles');

		parent.DoUpload(objDatabase.value, objDBPath.value, objProfiles.value, window);
	}
	catch(e)
	{
		alert("Error: " + e.description);
	}
}


//-->
	</script>
</head>
<body onmouseover="javascript:window.status='Tarvos DocumentRouter'; return true;"
	 style="margin:0; padding:0" onload="if(CheckParent()== false) return; javascript:RefreshCombos(); javascript:HideWait(); javascript:CheckValues();">
    <form id="form1" runat="server">
	<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" ClientEvents-OnResponseEnd="javascript:RefreshCombos(); javascript:HideWait(); javascript:CheckValues();" >
			<table id="tblMain" class="RightColumn" width="100%" cellspacing="0" cellpadding="0" align="center">
				<tr>
					<td class="RightColumn"><br />
						<table class="ButtonBar" id="tbButtons" cellspacing="0" cellpadding="0" border="0">
							<tr>
								<td height="10"><asp:imagebutton id="btnSave" runat="server" ImageUrl="~/Images/opslaan.PNG" CssClass="ImgButton" ToolTip="Bestand toevoegen"></asp:imagebutton></td>
							</tr>
						</table>
						<br />
						<table id="tblDestination" style="width: 100%" cellspacing="2" cellpadding="0" border="0">
							<tr>
								<td><uc1:locationpane id="LocationPane1" runat="server"></uc1:locationpane><uc1:profilepane id="ProfilePane1" runat="server" HideCheckBox="true"></uc1:profilepane>
									<asp:ScriptManager ID="ScriptManager1" runat="server">
									</asp:ScriptManager>
								</td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
			<asp:HiddenField ID="HiddenError" runat="server" EnableViewState="False" />
			<asp:HiddenField ID="HiddenDatabase" runat="server" EnableViewState="False" />
			<asp:HiddenField ID="HiddenDBPath" runat="server" EnableViewState="False" />
			<asp:HiddenField ID="HiddenProfiles" runat="server" EnableViewState="False" />
	</telerik:RadAjaxPanel>
	<telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" Skin="Web20" />
    </form>
</body>
</html>
