﻿function CreateNewProjectChannel()
{
	openDialogue("../Console/Dialogs/CreateNewProjectChannel.aspx");
}

// Creates an iFrame and loads the CreateNewProperty page
function openDialogue(url, queryString)
{
	var urlString = url;
		
	// Create the IFrame to load the GeoCodeMapping page
	var containerJQ =
		$(
			"<div style='width:100%;height:100%'>" +
				"<iframe class='dialogueFrame' src='" + urlString + "' style='width:100%;height:100%;border:none;overflow:hidden;'></iframe>" +
			"</div>");

	$.extend($.blockUI.defaults.overlayCSS,
		{
			backgroundColor: '#ccc'
		});
			
	// Display the IFrame and block the underlying page, creating a Modal system
	jQuery.blockUI(
			containerJQ,
			{
				width: "700px",
				height: "220px",
				margin: "0 0 0 -350px",
				border: "solid 2px #444"
			});
	
	var iframeWindowDOM = $(".dialogueFrame", containerJQ)[0].contentWindow;
	// Add the callback function to the window of the GeoCode Mapping page
	iframeWindowDOM.callback = dialogueCallback;
	
	return iframeWindowDOM;
}

// This function is called from any other dialogue loaded page
function dialogueCallback(propertyURL)
{
	jQuery.unblockUI();
	
	if (propertyURL != null)
	{
		if (propertyURL != "")
		{
			window.location.href = propertyURL;
		}
	}
}