﻿

function secure() {
	setTimeout( function() {
		window.alert( 'Due to inactivity, your session has timed out.  You will now be logged out.' );
		WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("plcRoot$Layout$Logout$SignOutButton$btnSignOut", "", false, "", "", false, true));
		//$( '#plcRoot_Layout_Logout_SignOutButton_btnSignOut' ).click();
	}, 15 * 60 * 1000 );
	
	$('a').click( function( e ) {
		var a = $(this);
		var href = a.attr( 'href' ) || '';
		if(
			!new RegExp( '^/secure/', 'i' ).exec( href )
		&&	!new RegExp( '^/get(doc|file)/', 'i' ).exec( href )
		&&	!new RegExp( '^[a-z]+:', 'i' ).exec( href )
		) {
			if( !confirm( 'You are about to leave the secure area and will be automatically logged out.  Do you wish to proceed?' ) ) e.preventDefault();
		}
	} );
};


// JScript File

function SecureTimeout() {
    myTimeout = setTimeout("Logout()",900000);
}

function Logout() {
    window.alert('Due to inactivity, your session has timed out.  You will now be logged out.');
    document.getElementById('plcRoot_Layout_Logout_SignOutButton_btnSignOut').click();
}

$( function() {
	var rotate_items = $( '#rotate li' );
	if( rotate_items.length > 0 ) {
		rotate_items
		.bind( 'select', function() {
			var $t = $(this);

			var fn = function() {
				var duration = parseInt( /\bms-(\d+)\b/i.exec( $t.attr('class') )[ 1 ], 10 );

				var i = rotate_items.index( $t );

				var o = rotate_items.eq( i + 1 );

				if( !( o.length > 0 ) && ( i > 0 ) ) o = rotate_items.eq( 0 );

				$t.fadeIn( 'slow', function() {
					if( o.length > 0 ) setTimeout( function() { o.triggerHandler( 'select' ); }, duration );
				} );
			};


			var last = rotate_items.filter(':visible').eq(0);

			if( ( last.length <= 0 ) || ( last.index( $t ) >= 0 ) ) fn();
			else last.fadeOut( 'slow', fn );
		} )
		.hide()
		.eq(0)
		.triggerHandler( 'select' );
	}
} );