// **************************************************************
// FILE: utilities.js
// **************************************************************
// Copyright (c) 2010 Craig Austin
// 
// **************************************************************
// Author(s):  Craig Austin <CraigWAustin@hotmail.com>
// **************************************************************

var   gObjScreenDiv  = null;

// **********************************************
// FUNCTION: ShowCaptureForm()
// **********************************************
function ShowCaptureForm(strForm, strType)
{
   var   objScreen;
   var   objForm;
   
   objScreen   = document.getElementById('InputScreen');
   objScreen.style.display = '';
   

   if (strType && (strType != ''))
      strForm += '?Type=' + strType;

   objForm     = document.getElementById('InputForm');
   objForm.style.display= '';
   objForm.innerHTML     = '<div>' +
                              '<div style="margin: 0px 4px 0px 4px; border-bottom-style: solid; border-width: 2px; border-color: #000000;">' +
                                 '<div style="float: right; cursor: pointer; width: 50px;" onclick="ClearScreen();">Close</div>' +
                                 '<div style="clear: both;"></div>' +
                              '</div>' +
                              '<iframe style="height: 520px; width: 810px; border-style: none; border-width: 0px;" ' +
                                       'frameborder="0" ' +
                                       'src="'+strForm+'"></iframe>' +
                           '</div>';
}
// End ShowCaptureForm

// **********************************************
// FUNCTION: ClearScreen()
// **********************************************
function ClearScreen()
{
   var   objScreen;
   var   objForm;
   
   objScreen   = document.getElementById('InputScreen');
   objScreen.style.display = 'none';
   
   objForm     = document.getElementById('InputForm');
   objForm.style.display= 'none';
   objForm.innerHTML     = '';
}
// End ClearScreen


// ***************************************************
// FUNCTION: CreateRequestObject()
// ***************************************************
function CreateRequestObject()
{
	var  RequestObject; //declare the variable to hold the object.
	var  WebBrowser;
   
   WebBrowser = navigator.appName; //find the Web Browser name
	if (WebBrowser == "Microsoft Internet Explorer")
   {
		// Create the object using MSIE's method 
		RequestObject = new ActiveXObject("Microsoft.XMLHTTP");
	}
   else
   {
		RequestObject = new XMLHttpRequest();
	}
	return RequestObject; //return the object
}
// End CreateRequestObject

// ***************************************************
// FUNCTION: GetURL()
// ***************************************************
function GetURL(strURL)
{
   var newAjax;
   
   newAjax = CreateRequestObject();   

   newAjax.open('get', strURL, false);
   newAjax.send(null);
   return newAjax.responseText;
}
// End GetURL

// ***************************************************
// FUNCTION: PostURL()
// ***************************************************
function PostURL(strURL, strPostValues)
{
   var newAjax;
   
   newAjax = CreateRequestObject();   

   newAjax.open('post', strURL, false);
   // Send the data.
	newAjax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

   newAjax.send(strPostValues);
   return newAjax.responseText;
}
// End PostURL


