/* Std alert example */
fnExampleAlert = function( ) {
	Alert.fnAlert( "Congratulations - you are using Allan's Alert controls!" );
}


/* Std confirm example */
fnCallbackOkay = function () {
	Alert.fnAlert( "The okay button was selected." );
}

fnCallbackCancel = function () {
	Alert.fnAlert( "The cancel button was selected." );
}

fnExampleConfirm = function( ) {
	Alert.fnConfirm( "Would you like to continue to learn about the Alert controls?", 
		fnCallbackOkay, fnCallbackCancel );
}


/* Basic custom example */
fnCallbackYes = function () {
	Alert.fnAlert( "Fantastic! Keep reading this article and then download the code!" );
}

fnCallbackNo = function () {
	Alert.fnAlert( "Are you sure - Alert really is useful :-)" );
}

fnExampleSimpleCustom = function( ) {
	Alert.fnCustom( {
		'sTitle': 'Confirmation required',
		'sMessage': 'Would you like to continue to learn about the Alert controls?',
		'sDisplay': 'aabc',
		'aoButtons': [
			{
				'sLabel': 'Yes please!',
				'fnSelect': fnCallbackYes,
				'sClass': 'selected',
				'cPosition': 'c'
			},
			{
				'sLabel': 'No thanks',
				'fnSelect': fnCallbackNo,
				'cPosition': 'b'
			}
		]
	} );
}


/* Position example */
fnCallbackMeToo = function () {
	Alert.fnAlert( "It will happen some day - and I'll be celebrating when it does. Of course when it happens is another matter entirely..." );
}

fnCallbackWhen = function () {
	Alert.fnAlert( "You nay sayer. It's going to happen - it's just got to... please..." );
}

fnExamplePositions = function( ) {
	Alert.fnCustom( {
		'sTitle': 'Confirmation required',
		'sMessage': "Isn't this button position control wonderful!?<br>I'm telling you - I can't <b>wait</b> for CSS 3 advanced layouts!",
		'sDisplay': 'abbb',
		'aoButtons': [
			{
				'sLabel': 'Me neither!',
				'fnSelect': fnCallbackMeToo,
				'sClass': 'selected',
				'cPosition': 'b'
			},
			{
				'sLabel': "Pfft - when?",
				'fnSelect': fnCallbackWhen,
				'cPosition': 'a'
			}
		]
	} );
}


/* User input example */
fnExampleTextInput = function( ) {
	Alert.fnCustom( {
		'sTitle': 'Enter you name please',
		'sMessage': '<p>With alert you can do all sorts of working things. \
			Including asking for user input - please enter your name below:</p> \
			<center> \
				<input type="text" name="ip1" id="ip1" /> \
			</center>',
		'sDisplay': 'aaab',
		'fnPreComplete': function() {
			if ( document.getElementById('ip1').value == '' ) {
				document.getElementById('alert_header').innerHTML = 'You need to enter you name please';
				return false;
			}
			return true;
		},
		'aoButtons': [
			{
				'sLabel': 'Done',
				'sClass': 'selected',
				'cPosition': 'b',
				'fnSelect': function() {
					var sName = document.getElementById('ip1').value;
					Alert.fnAlert( "Thank you "+sName+". Hopefully you can see how this could be expanded to do something a lot more clever" );
				}
			}
		]
	} );
}


/* Style example */
fnExampleStyle = function( ) {
	Alert.fnCustom( {
		'sTitle': 'Alert',
		'sMessage': "Sorry, the file is not available. Please contact the administrator.",
		'sClass': 'different',
		'bAnimate': false,
		'sDisplay': 'abbc',
		'aoButtons': [
			{
				'sLabel': 'OK',
				'sClass': 'selected',
				'cPosition': 'b'
			}
		]
	} );
}

/* save example */
fnExampleSave = function( ) {
	Alert.fnCustom( {
		'sTitle': 'Unsaved work',
		'sMessage': 'You have unsaved work - are you sure you wish to quit?',
		'sDisplay': 'abcd',
		'aoButtons': [
			{
				'sLabel': 'Cancel',
				'cPosition': 'a'
			},
			{
				'sLabel': "Don't save",
				'cPosition': 'c'
			},
			{
				'sLabel': 'Save all',
				'sClass': 'selected',
				'cPosition': 'd'
			}
		]
	} );
}
