//
// Pops up a Modal Dialog containing "message", and return 
// Very Similar to the window.alert( message ), except that the 
// Ok button caption is customizable, the style is also cutomizable
// IMPORTANT NOTE: this currently works on ** INTERNET EXPLORER 5+ ONLY ** 
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 : "../ConfirmButton/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);
}


//
// Pops up a Modal Dialog containing "message", and return 
// Very Similar to the window.confirm( message ), except that the 
// Ok and Cancel buttons captions are customizable, the style is also cutomizable
// IMPORTANT NOTE: this currently works on ** INTERNET EXPLORER 5+ ONLY ** 
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 = 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 : "../ConfirmButton/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;
}
//
// Pops up a Modal Dialog containing "message", and return 
// Very Similar to the window.alert( message ), except that the 
// Ok button caption is customizable, the style is also cutomizable
// IMPORTANT NOTE: this currently works on ** INTERNET EXPLORER 5+ ONLY ** 
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 : "../ConfirmButton/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;
	}
	
}

