// JavaScript Document

// include this file to use on pages that need the disclaimer. 
// This file requires jquery.

function getCookie( name ) {
	var start = document.cookie.indexOf( name + "=" );
	var len = start + name.length + 1;
	if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) {
		return null;
	}
	if ( start == -1 ) return null;
	var end = document.cookie.indexOf( ';', len );
	if ( end == -1 ) end = document.cookie.length;
	return unescape( document.cookie.substring( len, end ) );
}

function setCookie( name, value, expires, path, domain, secure ) {
	var today = new Date();
	today.setTime( today.getTime() );
	if ( expires ) {
		// last section commented out to allow 
		// for exact time to be passed to the function in minutes
		expires = expires * 1000 * 60;
	}
	var expires_date = new Date( today.getTime() + (expires) );
	document.cookie = name+'='+escape( value ) +
		( ( expires ) ? ';expires='+expires_date.toGMTString() : '' ) + //expires.toGMTString()
		( ( path ) ? ';path=' + path : '' ) +
		( ( domain ) ? ';domain=' + domain : '' ) +
		( ( secure ) ? ';secure' : '' );
}
function deleteCookie( name, path, domain ) {
	if ( getCookie( name ) ) document.cookie = name + '=' +
			( ( path ) ? ';path=' + path : '') +
			( ( domain ) ? ';domain=' + domain : '' ) +
			';expires=Thu, 01-Jan-1970 00:00:01 GMT';
}
function disclaimer_check(){
	
	
	
	if(getCookie('accepted') == 'true'){
		return true;
	}else{
		// the "\" at the end of every line is for javascript multi-line strings.
		
		$disclaimer_message = 'This web site makes information and documents pertaining to bankruptcy cases available for the convenience of its users.\n \
			\
			\nJager Smith neither guarantees nor warrants the accuracy, completeness or currentness of any information or documents made available by this web site, and shall not be liable for any loss or injury arising out of, relating to or caused, either in whole or in part, by any acts, errors or omissions of Jager Smith, whether negligent or otherwise, in gathering, compiling, formatting, interpreting, reporting, communicating or delivering such information and documents.\n \
			\n \
			\nJager Smith does not undertake any obligation to update, modify, revise or reorganize the information and documents made available by this web site, or any obligation to provide notice should the information and documents be updated, modified, revised or reorganized. \
			\n \
			\nIn no event shall Jager Smith be liable for any direct, indirect, incidental, consequential or special damages of any nature whatsoever, whether foreseeable or unforeseeable and however caused, arising out of, relating to or caused, either in whole or in part, by the use of this feature of its web site.';
		if(confirm($disclaimer_message)){
			setCookie('accepted', 'true',  20);
			return true;
		}else{
			return false;
		}
	}
	
}

jQuery(document).ready(function(){
	
		$('.disclaimer').click(function() {

		if(disclaimer_check()){
				document.location = $(this).href;

			}else{

				return false;
			}
			
	  });

});