// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
function ShowMessage(o)
   {
	messages =  $$('p#solutions-detail span');
	for (i=0; i < messages.length; i++) { if(messages[i].id == o.className) { messages[i].show(); } else { messages[i].hide(); } }
	return false;
   }


function ShowSolutionImage()
{
	var image = document.getElementById("solution_image");
	var file_name = Cookie.get("solution");
	if (image && file_name ) 
	{ 
		image.src = "/images/" + file_name;
	} 
}

function createCookie(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;
}

function readCookie(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;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

function checkCook(){
	window.seenBlock = readCookie("seenPre");
	//alert(window.seenBlock);
	if (seenBlock!=null && seenBlock!=''){
		// Cookie exists
	} else {
		// Cookie doesn't exist
		createCookie("seenPre","seen",1);
	}
}

function railsHome(){
  railsConf = new Date(2010, 5, 7, 8, 0, 0);
  today = new Date();

  if (railsConf > today) {
  // Countdown
    document.write('<div id="left">');
    document.write('<h4 class="gothamlight">Launching in</h4>');
    document.write('<div id="countdown"></div>');
    document.write('</div>');
    document.write('<div id="mid">');
    document.write('<img src="http://stageweb.int.blueboxgrid.com/assets/58/home-blocks.png">');
    document.write('</div>');
    document.write('<div id="right">');
    document.write('<h4 class="gothamlight">Blue Box Blocks</h4>');
    document.write('<p>A cloud computing product designed to scale your VPS up and down with ease!</p>');
    document.write('<div id="skip"><a href="">Skip to home &rsaquo;</a></div>');
    document.write('</div>');
    document.write('<div class="clear"></div>');
  } else {
    // Blocks available now
    document.write('<div id="left" class="center">');
    document.write('<h4 class="gothamlight available">Available Now!</h4>');
    document.write('<a href="" class="btn">More Info</a>');
    document.write('</div>');
    document.write('<div id="mid">');
    document.write('<img src="http://stageweb.int.blueboxgrid.com/assets/58/home-blocks.png">');
    document.write('</div>');
    document.write('<div id="right">');
    document.write('<h4 class="gothamlight">Blue Box Blocks</h4>');
    document.write('<p>A cloud computing product designed to scale your VPS up and down with ease!</p>');
    document.write('<div id="skip"><a href="">Skip to home &rsaquo;</a></div>');
    document.write('</div>');
    document.write('<div class="clear"></div>');
  }
}

function regularHome(){
  document.write('<div id="solutions-list">');
  document.write('<ul class="solutions">');
  document.write('<li class="simple"><a href="/solutions/simple/overview" class="simple" onMouseOver="ShowMessage(this);">simple</a></li>');
  document.write('<li class="scalable"><a href="/solutions/scalable/overview" class="scalable" onMouseOver="ShowMessage(this);">scalable</a></li>');
  document.write('<li class="enterprise"><a href="/solutions/enterprise/overview" class="enterprise" onMouseOver="ShowMessage(this);">enterprise</a></li>');
  document.write('</ul>');
  document.write('<div id="sidedots"></div>');
  document.write('</div>');
  document.write('<!-- End of Solutions UL -->');
  document.write('<div id="solutions-wrapper">');
  document.write('<div id="default"> <img src="/images/ui/home-msg.gif" class="match" alt="Choose your solution"> </div>');
  document.write('<div id="simple" style="display:none"><h2 class="gothambold">Jump on Board!</h2><h3 class="gothamlight">512MB VPS - 8 GB VPS</h3><p>Becoming a Blue Box Group customer means being able to get started right away because we make it simple. With us, you\'ll get what you need to launch your business to success!</p><span class="learnmore"><a href="/solutions/simple/overview">LEARN MORE &rsaquo;</a></span></div>');
  document.write('<div id="scalable" style="display:none"><h2 class="gothambold">Growth is Progress!</h2><h3 class="gothamlight">4GB dedi. RAM - 16 GB dedi. RAM</h3<p>You\'ll have an easy road for upgrades and constant assistance along the way. Begin with what you need now and when you need more, we\'ll be there to make it happen.</p><span class="learnmore"><a href="solutions/scalable/overview">LEARN MORE &rsaquo; </a></span></div> ');
  document.write('<div id="enterprise" style="display:none"><h2 class="gothambold">We know how to handle volume!</h2><h3 class="gothamlight">Dedi. App Server - Database Server</h3<p>Optimize your database and deal effectively with bandwidth management. Excel with 45 million hits a day across large server Rails clusters.</p><span class="learnmore"><a href="/solutions/enterprise/overview">LEARN MORE &rsaquo;</a></span></div>');
  document.write('</div>');
}
