function CustomAlert( message, title, OkCaption, width, height, dialogURL, direction )
{
	if( ! (navigator.appName.indexOf("Microsoft") >= 0) ) { alert( message ); return; };

	// Make sure height and width of dialog are ok.
	var w = parseInt( width );
	var h = parseInt( height );
	if ( isNaN( w ) ) w = 320; if( w < 320 ) w = 320;
	if ( w > screen.width ) w = screen.width;
	if ( isNaN( h ) ) h = 120; if( h < 120 ) h = 120;
	if ( h > screen.height ) h = screen.height;
	
	// Initialize URL
	var sURL = dialogURL ? dialogURL : "Controls/ConfirmControl/CustomDialog.html";

	// Initialize Arguments
	var vArguments = Array();
	vArguments["Message"] = message;
	vArguments["OkCaption"] = OkCaption;
	vArguments["Title"] = title;
	vArguments["DialogType"] = "Alert";
	vArguments["Direction"] = (direction) ? direction : "ltr";
	
	// The width, height and other features of the dialog
	var sFeatures = "dialogHeight: "+h+"px; dialogWidth: "+w+"px; edge: Raised; center: yes; help: no; resizable: no; status: no; menu: no";
	
	// Open Dialog and Return 
	// (true if confirmed, false if not or if closed)
	window.showModalDialog(sURL, vArguments, sFeatures);
}

function CustomConfirm( message, YesCaption, NoCaption, title, width, height, dialogURL, direction )
{
	if( ! (navigator.appName.indexOf("Microsoft") >= 0) ) return confirm( message );

	// Make sure height and width of dialog are ok.
	var w = parseInt( width );
	var h = parseInt( height );
	if ( isNaN( w ) ) w = 300; if( w < 300 ) w = 300;
	if ( w > screen.width ) w = screen.width;
	if (isNaN(h)) h = 100; if (h < 100) h = 100;	
	if (h > screen.height) h = screen.height;
	
	// Initialize URL
	var sURL = dialogURL ? dialogURL : "Controls/ConfirmControl/CustomDialog.html";
	
	// Initialize Arguments
	var vArguments = Array();
	vArguments["Message"] = message;
	vArguments["YesCaption"] = YesCaption;
	vArguments["NoCaption"] = NoCaption;
	vArguments["Title"] = title;
	vArguments["DialogType"] = "Confirm";
	vArguments["Direction"] = (direction) ? direction : "ltr";
	
	// The width, height and other features of the dialog
	var sFeatures = "dialogHeight: "+h+"px; dialogWidth: "+w+"px; edge: Raised; center: yes; help: no; resizable: no; status: no; menu: no";
	
	// Open Dialog and Return 
	// (true if confirmed, false if not or if closed)
	var vReturnValue = window.showModalDialog(sURL, vArguments, sFeatures);
	return vReturnValue;
}

function CustomAlert2( message, title, OkCaption, width, height, dialogURL, direction ,RedirectUrl)
{
	if( ! (navigator.appName.indexOf("Microsoft") >= 0) ) { alert( message ); return; };

	// Make sure height and width of dialog are ok.
	var w = parseInt( width );
	var h = parseInt( height );
	if ( isNaN( w ) ) w = 320; if( w < 320 ) w = 320;
	if ( w > screen.width ) w = screen.width;
	if ( isNaN( h ) ) h = 120; if( h < 120 ) h = 120;
	if ( h > screen.height ) h = screen.height;
	
	// Initialize URL
	var sURL = dialogURL ? dialogURL : "../Controls/ConfirmControl/CustomDialog.html";

	// Initialize Arguments
	var vArguments = Array();
	vArguments["Message"] = message;
	vArguments["OkCaption"] = OkCaption;
	vArguments["Title"] = title;
	vArguments["DialogType"] = "Alert";
	vArguments["Direction"] = (direction) ? direction : "ltr";
	
	// The width, height and other features of the dialog
	var sFeatures = "dialogHeight: "+h+"px; dialogWidth: "+w+"px; edge: Raised; center: yes; help: no; resizable: no; status: no; menu: no";
	
	// Open Dialog and Return 
	// (true if confirmed, false if not or if closed)
	window.showModalDialog(sURL, vArguments, sFeatures);
	if (RedirectUrl)
	{
		location.href = RedirectUrl;
	}
}
