share1=new Image();
share2=new Image();
share1.src="http://mdlbts.com/sys_files/cssfooter/SharePageNormal.png"; 
share2.src="http://mdlbts.com/sys_files/cssfooter/SharePageHighlighted.png"; 
var share1 = "http://mdlbts.com/sys_files/cssfooter/SharePageNormal.png";
var share2 = "http://mdlbts.com/sys_files/cssfooter/SharePageHighlighted.png";
facebook1=new Image();
facebook2=new Image();
facebook1.src="http://mdlbts.com/sys_files/cssfooter/FacebookNormal.png"; 
facebook2.src="http://mdlbts.com/sys_files/cssfooter/FacebookHighlighted.png"; 
var facebook1 = "http://mdlbts.com/sys_files/cssfooter/FacebookNormal.png";
var facebook2 = "http://mdlbts.com/sys_files/cssfooter/FacebookHighlighted.png";
twitter1=new Image();
twitter2=new Image();
twitter1.src="http://mdlbts.com/sys_files/cssfooter/TwitterNormal.png"; 
twitter2.src="http://mdlbts.com/sys_files/cssfooter/TwitterHighlighted.png"; 
var twitter1 = "http://mdlbts.com/sys_files/cssfooter/TwitterNormal.png";
var twitter2 = "http://mdlbts.com/sys_files/cssfooter/TwitterHighlighted.png";
feed1=new Image();
feed2=new Image();
feed1.src="http://mdlbts.com/sys_files/cssfooter/FeedNormal.png"; 
feed2.src="http://mdlbts.com/sys_files/cssfooter/FeedHighlighted.png"; 
var feed1 = "http://mdlbts.com/sys_files/cssfooter/FeedNormal.png";
var feed2 = "http://mdlbts.com/sys_files/cssfooter/FeedHighlighted.png";
function setCookie( name, value, expires, path, domain, secure )
{
// set time, it's in milliseconds
var today = new Date();
today.setTime( today.getTime() );

/*
if the expires variable is set, make the correct
expires time, the current script below will set
it for x number of days, to make it for hours,
delete * 24, for minutes, delete * 60 * 24
*/
if ( expires )
{
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date( today.getTime() + (expires) );

document.cookie = name + "=" +escape( value ) +
( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
( ( path ) ? ";path=" + path : "" ) +
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1 ;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length
    return unescape(document.cookie.substring(c_start,c_end));
    } 
  }
return ""
}
function toggleLayer(whichLayer)
{
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( whichLayer );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)

    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
    
    if(elem.offsetWidth!=0&&elem.offsetHeight!=0)
    	setCookie("ChatBoxToggle","hide","365","/","mdlbts.com");
    
    
  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
  
  if(vis.display==''||vis.display=='block')
  	setCookie("ChatBoxToggle","show","365","/","mdlbts.com");
  

}
function showLayer(whichLayer) {
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( whichLayer );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'none':'block';
  vis.display = (vis.display==''||vis.display=='block')?'block':'block';
}

function reloadchat() {
	//alert("Step 1");
	var timestamp = Number(new Date()); // current time as number
	var params = "http://mdlbts.com/sys_files/cssfooter/api.php?type=list&notneeded="+timestamp;
	//alert(params);
	$.ajax({
		type: "GET",
		url: params,
		data: '',
		dataType: "html",
		success: function(msg){
			//alert(msg);
			
				//alert("Step 2");
				var find1=/blah/;
				if (msg.match(find1)) {
          			//alert("Step 3");
            		document.getElementById('OnlineMemberMenu').innerHTML = msg.substring(26);
					document.getElementById('OnlineMemberMenuCount').innerHTML = msg.substring(0,2).replace(/^\s*|\s*$/g,'').replace(' ','');
            		var CHAT_REQUEST = msg.substring(2,6).replace(/^\s*|\s*$/g,'').replace(' ','');
            		var CHAT_USERNAME = msg.substring(6,26).replace(/^\s*|\s*$/g,'').replace(' ','');
            		var CHAT_CHATID = msg.substring(26,36).replace(/^\s*|\s*$/g,'').replace(' ','');
            		if (msg.substring(0,2).replace(/^\s*|\s*$/g,'').replace(' ','') > "0") {
            			if (getCookie('ChatBoxToggle')=="show") {
            				showLayer('OnlineMemberMenu');
            			}
            		}
					if (CHAT_REQUEST >= "1") {
						var answer = confirm(CHAT_USERNAME+' has sent you an instant message. Click OK below to read and accept.');
          				if (answer) {
          					startLyteFrame('Fireboat Website Live Chat!','http://mdlbts.com/sys_files/chat.php?type=private&user='+CHAT_REQUEST+'&chatid='+CHAT_CHATID);
          				} 
            		}
          		}
			
		}
	});
    setTimeout("reloadchat()",10000); // 10 seconds
}




function startLyteFrame(title, url) {
	var anchor = this.document.createElement('a');
	anchor.setAttribute('rev', 'width: 600px; height: 480px; scrolling: auto;');
	anchor.setAttribute('title', title);
	anchor.setAttribute('href', url);
	anchor.setAttribute('rel', 'lyteframe');
	//alert(anchor.getAttrbute('title'));
	myLytebox.start(anchor, false, true);
	return false;
}

