// JavaScript Document
function setActiveStyleSheet(title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("rel").indexOf("alt") == -1
       && a.getAttribute("title")
       ) return a.getAttribute("title");
  }
  return null;
}

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 expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

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;
}

window.onload = function(e) {
  var cookie = readCookie("style");
  var title = cookie ? cookie : getPreferredStyleSheet();
  setActiveStyleSheet(title);
}

window.onunload = function(e) {
  var title = getActiveStyleSheet();
  createCookie("style", title, 365);
}

function randomImage( s, n )
{
	var s = '<img border="0" src=\"'+s+Math.round(Math.random()*(n-1)).toString()+'.jpg\" height=\"210\" width=\"870\" />';
	return s;
}


function load()
{
	var load_map_exists = eval("window." + "load_map") ? true : false;
	if( load_map_exists )
		load_map();
}

function randomQuote()
{
	var i = Math.round(Math.random()*8);
	var s = "<p>Home Choice Care &mdash; bringing choice back into your life</p>";

	switch( i )
	{
		case 0: 
			s="<p><q>Debbie has done a super job in caring for my mother. She takes a real and personal interest in my mother's welfare and has established a very good rapport. What is especially appreciated is her reliability and responsibility. She is a credit to your organisation.</q></p><p><strong>Dr D. H</strong></p>";
			break;

		case 1: 
			s="<p><q>Mark went out to at short notice to do my shopping. He did a really good job &mdash; he was very helpful	in putting everything away &mdash; I would like to thank him for arranging everything.</q></p><p><strong> Mr J. S</strong></p>";
			break;
				
		case 2: 
			s="<p><q>Mrs T has requested that Maxine be complimented for her caring nature, she never makes her feel rushed and always sticks to the agreed times. Maxine is always flexible around Mrs T's hospital appointments. She is so pleased to have Maxine as her regular morning care worker and has built up a truly beneficial rapport in which she feels comfortable and at ease. Maxine should be commended for her hard work and dedication.</q></p><p><strong> K. P<br/>Essex County Council<br/>Writing on behalf of Mrs T</strong></p>";
			break;
			
		case 3: 
			s="<p><q>Maxine was an absolute brick yesterday &mdash; 5th March. I was not well and Maxine just got on and did everything above and beyond the call of duty. Please pass on my thanks.</q></p><p><strong> Mrs E. L</strong></p>";
			break;

		case 4: 
			s="<p><q>Your care workers were all praised for the way in which they attended Mrs C &mdash; &ldquo;they are all lovely girls&rdquo;</q></p>";
			break;			

		case 5: 
			s="<p><q>Martha is doing an excellent job for me.</q></p><p><strong>Mr F</strong></p>";
			break;

		case 6: 
			s="<p><q>Margarent's calm, caring judgement has been requested when Mrs B's care package is reinstated.</q></p>";
			break;

		case 7: 	
			s="<p><q>I am very happy with the way the rota is working out with my Father &mdash; he is very pleased with the way things are going.</q></p><p><strong>Mr B</strong></p>";
			break;

		case 8: 
			s="<p><q>Mrs H is extremely delighted with Anita, Lisa and Shelley &mdash; all are very lovely girls, nothing is too much for them.  They are all caring and understainding &mdash; they pick you up when you are down.  Although we had a lot of teething problems to begin with, we have all smiled through them &mdash; also thanks to Lyn for being a lovely supervisor.</q></p>";
			break;

}

	return s;
}
/***********************************************
* Bookmark site script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
function gs_bookmark( title, url )
{
	if(document.all)
		window.external.AddFavorite(url, title);
	else if (window.sidebar)
		window.sidebar.addPanel(title, url, "")
}



