hintArray = new Array();
hintArray[hintArray.length] = "Green tea helps prevent memory loss.";
hintArray[hintArray.length] = "Placing information into categories makes it easier to remember.";
hintArray[hintArray.length] = "Test yourself on something you've learned to keep from having to re-learn it.";
hintArray[hintArray.length] = "The true art of memory is the art of attention.";
hintArray[hintArray.length] = "Wordplay is good for linking information that's hard to remember.";
hintArray[hintArray.length] = "If you're sleep deprived your memory process cannot function properly.";
hintArray[hintArray.length] = "Start putting your most used items (keys, pens and eye glasses) in the same place every time.";
hintArray[hintArray.length] = "Exercise and diet are an essential part of keeping your memory working for you.";
hintArray[hintArray.length] = "It is easier to remember three three-digit numbers rather than one nine digit number.";
hintArray[hintArray.length] = "Memory exercises increase brain power. The simplest memory exercise is to start telling yourself to remember.";

quoteArray = new Array();
quoteArray[quoteArray.length] = "Sometimes I think I am losing my mind. It seems like I often forget something that I knew just seconds before. Maybe reQall is just what I need.";
quoteArray[quoteArray.length] = "ReQall is a new and interesting service that can be a lifesaver if you are the forgetful type. ";
quoteArray[quoteArray.length] = "Just when our life is too complicated and too easy to forget important things in your family or business life appears ReQall.";
quoteArray[quoteArray.length] = "Keep it all straight and don’t forget a thing with ReQall.";
quoteArray[quoteArray.length] = "Give your brain a rest, use your phone to remember.";
quoteArray[quoteArray.length] = "What’s astonishing is the simplicity and accuracy of the user experience.";
quoteArray[quoteArray.length] = "It’s clear that usability and access for every day consumers are very important for this mobile company.";


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+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;
}

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

function getNextId(imageid,cnt){
  imgid = parseInt(imageid) + 1;
  switch(cnt){
  case 0:
    if(imgid >= imgArray.length)
      imgid = 0;
    break;
  case 1:
    if(imgid >= hintArray.length)
      imgid = 0;
    break;
  case 2:
    if(imgid >= quoteArray.length)
      imgid = 0;
    break;
  }
  return imgid;
}

function getImage(){
 imageid = readCookie("imageid")
 if(imageid){
  imageid = getNextId(imageid,0);
 }else{
   imageid = Math.ceil(Math.random() * imgArray.length);
   if(imageid ==  imgArray.length)
    imageid -= 1;
 }
 createCookie("imageid",imageid,7);
 return path + imgArray[imageid];
}

function getHint(){
 hintid = readCookie("hintid")
 if(hintid){
  hintid = getNextId(textid,1);
 }else{
   hintid = Math.ceil(Math.random() * hintArray.length);
   if(hintid ==  hintArray.length)
    hintid -= 1;
 }
 createCookie("hintid",hintid,7);
 return hintArray[hintid];
}

function getPressQuote(){
 quoteid = readCookie("quoteid")
 if(quoteid){
  quoteid = getNextId(quoteid,2);
 }else{
   quoteid = Math.ceil(Math.random() * quoteArray.length);
   if(quoteid == quoteArray.length)
    quoteid -= 1;
 }
 createCookie("quoteid",quoteid,7);
 return quoteArray[quoteid];
}