// JavaScript Document
var tombstone_messages1 = Array(

	'<div class="tombstone_value">$250,000</div>'
	+'<div class="tombstone_title">Factoring Line</div>'
	+'<div class="tombstone_text">Type of Business:</div>'
	+'<div class="tombstone_business">Engineering Testing'
	+'<br>'
	+'Company</div>'

	,'<div class="tombstone_value">$50,000</div>'
	+'<div class="tombstone_title">Factoring Line</div>'
	+'<div class="tombstone_text">Type of Business:</div>'
	+'<div class="tombstone_business">Executive Search'
	+'<br>'
	+'Firm</div>'

	,'<div class="tombstone_value">$150,000</div>'
	+'<div class="tombstone_title">Factoring Line</div>'
	+'<div class="tombstone_text">Type of Business:</div>'
	+'<div class="tombstone_business">Trucking Company</div>'
);

function load_tombstone(init_load)
{
	var cell = document.getElementById('whiteBox');
	if(!cell) return;

	var html = '<img id="small_logo" src="http://www.liquidcapitalcorp.com/templates/lccmain_itmg/images/smallLogo.jpg" />';
	html += '<div style="height: 100px; width: 413px;">';
	if(init_load) {
		html += '<div id="tombstone_text" style="width:100%;">';
	} else {
		// make it complety transparent
		// advoids a flicking on certain browsers
		html += '<div id="tombstone_text" style="width:100%; opacity: 0; -moz-opacity: 0; -khtml-opacity: 0; filter:alpha(opacity=0);">';
	}
	html += tombstone_get_next_message();
	html += '</div></div>';
	html += '<div class="tombstone_funded_h">Funded By:<br />LIQUID CAPITAL EXCHANGE</div>';
	cell.innerHTML = html;

	setTimeout('tombstone_transfer()', 10000);
}

function tombstone_transfer()
{
	var timer = 0;
	// spend 500 milliseconds on fadeout
	for(i=100; i>=0; i-=5) {
		setTimeout('tombstone_fade('+i+')', timer);
		timer += 25;
	}
	// pause
	timer += 250;
	// load the new message
	setTimeout('load_tombstone(false)', timer);
	// spend 1000 milliseconds on fadein
	for(i=0; i<=100; i+=5) {
		setTimeout('tombstone_fade('+i+')', timer);
		timer += 50;
	}
}

function tombstone_fade(value)
{
	var cell = document.getElementById('tombstone_text');
	if(!cell) return;

	cell.style.opacity = (value/100);
	cell.style.MozOpacity = (value/100);
	cell.style.KhtmlOpacity = (value/100);
	if(value == 100) {
		// IE's alpha text looks like crap
		// so disable it when not in use
		cell.style.filter = '';
	} else {
		cell.style.filter = 'alpha(opacity='+value+')';
	}
}

function tombstone_get_next_message()
{
		//<div class="tombstone_value_h">$150,000 <span class="tombstone_title_h">Factoring Line</span></div>
		//<div class="tombstone_text_h">Type of Business: <span class="tombstone_business_h"> Trucking Company</span></div>
		//<div class="tombstone_funded_h">
		//	Funded By: LIQUID CAPITAL EXCHANGE CORP.
		//</div>
	// read the message index from a cookie
	var index = parseInt(read_cookie('tombstone_message'));

	if(isNaN(index)) {
		// start with a random message
		index = parseInt(Math.random()*tombstone_messages.length);
	}
	index = index % tombstone_messages.length;

	message = tombstone_messages[index++];

	// save the new index
	create_cookie('tombstone_message', index);

	return message;
}

function create_cookie(name,value,days)
{
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	} else {
		var expires = "";
	}
	document.cookie = name+"="+value+expires+"; path=/";
}

function read_cookie(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) {
			return c.substring(nameEQ.length,c.length);
		}
	}
	return null;
}

