// JavaScript Document

var random_images = new Array ( );
random_images[0] = "images/top_quote1.gif";
random_images[1] = "images/top_quote2.gif";
random_images[2] = "images/top_quote3.gif";
random_images[3] = "images/top_quote4.gif";
random_images[4] = "images/top_quote5.gif";
random_images[5] = "images/top_quote6.gif";
random_images[6] = "images/top_quote7.gif";
random_images[7] = "images/top_quote8.gif";
random_images[8] = "images/top_quote9.gif";
random_images[9] = "images/top_quote10.gif";
random_images[10] = "images/top_quote11.gif";
random_images[11] = "images/top_quote12.gif";
random_images[12] = "images/top_quote13.gif";
random_images[13] = "images/top_quote14.gif";
random_images[14] = "images/top_quote15.gif";

var numberOfQuotes = 15;

function rand ( n )
{
  return ( Math.floor ( Math.random ( ) * n + 1 ) );
}

// Pick a random image from the list,
// and set the image source to that image

function getQuote ( )
{
	document.getElementById('top_quote').src = random_images[rand(numberOfQuotes)-1];
}

function checkFrameset( )
{
	var sPath = window.location.pathname;
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	

	if ((sPage.substring((sPage.length - 5),(sPage.length))) == ".html")
	{
		sPage = sPage.substring(0, (sPage.length - 5));
	}
	
	if (top == self)
    {
        top.location.href = "../index.html?case=" + sPage;
    }
}

function gup( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}

function loadClient( )
{
	var page = gup("case");
	if (page != "")
	{
		content.location.href = "clients/" + page + ".html";
	}
}