<?xml version="1.0" encoding="utf-8" standalone="no"?>
<?xml-stylesheet type="text/css" href="./images/main.css" media="screen"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html id="xhtml10" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://www.w3.org/2005/10/profile">
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<title>http://www.daniweb.com/</title>
<script type="text/javascript">
// <![CDATA[
/******************************
* Developed by DANIuser : essential ~
* This notice must stay intact for use -
* http://www.daniweb.com/forums/member383844.html
******************************/
var doc = ( document );
var Session = function( name, value, expires, path, domain, secure ) {
var today = new Date();
today.setTime( today.getTime() );
if ( expires ) {
this.expires = ( expires * ( 1000 * 60 * 60 * 24 ));
this.willExpire = new Date( today.getTime() + ( this.expires ));
} else {
this.willExpire = new Date( today.getTime() + ( 365 * 1000 * 60 * 60 * 24 ));
}
this.name = name || "";
this.value = value || "";
this.path = path || "";
this.domain = domain || "";
this.secure = secure || "";
this.getSession = ( function( name ) {
var extract;
var val;
if ( name ) {
try {
val = doc.cookie.match("(^|;) ?" + name + "=([^;]*)(;|$)");
extract = ( RegExp.$2 );
} catch( d ) {
val = doc.cookie.indexOf( String( name + "=" ));
if ( val !== -1 ) {
val += ((( val ) + name.length ) + 1 );
var colon = document.cookie.indexOf( ";", val );
(( colon !== -1 ) ? colon = document.cookie.length : colon = "" );
extract = document.cookie.substr( val, colon );
} else {
extract = 0;
}
}
} return (( extract ) ? unescape( extract ) : "" );
} );
this.createSession = ( function( name, value, expires, path, domain, secure ) {
try {
var session = name + "=" + escape( value );
session += "; expires=" + expires.toGMTString();
session += "; path=" + escape( path );
session += "; domain=" + domain;
session += secure;
document.cookie = session;
} catch( e ) {
}
} )( this.name, this.value, this.willExpire, this.path, this.domain, this.secure );
};
Session.prototype.destroySession = function( name ) {
this.name = "";
document.cookie = name + "=" + ";path=" + this.path + ";domain=" + this.domain + ";expires=Thu, 01-Jan-1970 00:00:00 GMT";
}; var $ = function( name, value, expires, path, domain, secure ) {
if ( arguments.length >= 2 ) {
new Session( name, value, expires, path, domain, secure );
return;
} else {
return false; } // [ Exit Session ]
}
var displayStatus = 0;
var element = ( function( ids ) {
var ids = (( ids = document.getElementById( ids )) ? ids : ids ) || 0;
return ids;
} );
var toggle_change = ( function( ele ) {
var ele = element( ele ) || element("change_log");
var text = element("Toggle_change");
(( ele.style.display === "none" ) ? (( ele.style.display = "block" ) && ( text.innerHTML = "<b>-</b>" )) : (( ele.style.display = "none" ) && ( text.innerHTML = "<b>+</b>" )));
$( ele.id, ele.style.display ); // Saving status display in cookie session.
$( text.id, text.innerHTML ) // Saving the content of text element.
} );
onload = ( function( state ) {
var state = state || 0;
return function() {
var statusDisplay;
var elem = element("change_log");
var txt = element("Toggle_change");
if( statusDisplay = state.getSession( elem.id )) {
elem.style.display = statusDisplay;
txt.innerHTML = state.getSession( txt.id );
return;
} return false;
}
} )( new Session() )
// ]]>
</script>
</head>
<body>
<div id="Toggle_change" onclick="toggle_change(); "><b>-</b></div>
<div id="change_log"><h1>JavaScript Live Demo!</h1></div>
</body>
</html>