var myHtml = '<h5>Cirque de Miss&eacute; / Circle of Misse</h5><h6>Poitiers &nbsp;&nbsp;&nbsp;- 1 hour&nbsp;&nbsp;&nbsp;Tours &nbsp;- 1 hour<br />La Rochelle - 2 hours&nbsp;&nbsp;Nantes - 2 hours<br />Bordeaux &nbsp;&nbsp;&nbsp;- 3 hours&nbsp;&nbsp;Paris &nbsp;- 3 hours</h6><a class="dirs" href="http://maps.google.com/maps/ms?saddr=&daddr=46.953201,-0.181589&ie=UTF8&hl=en&msa=0&msid=118257138801539955687.00046c88fde019bf816f9&ll=46.954246,-0.181596&spn=0.008861,0.015256&z=16" target ="_blank">Get directions<\/a>';

/*
// Multiple onload function created by: Simon Willison
// http://simonwillison.net/2004/May/26/addLoadEvent/
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

addLoadEvent(changetopboxbg);

function changetopboxbg() {
element = document.getElementById('top-box'); 
// element.style.backgroundColor = "#070b0a"; 
element.style.backgroundColor = "#060a0b";
}

function remove_toms() {
element = document.getElementById('load2');
element.style.backgroundImage = "url('/i/new/blank_bg.gif')";
element.style.backgroundColor = "";
}

*/

function loadgallery()
{
document.getElementById('rotator').style.display = 'block';
setTimeout(so_init,500);
}

/*
	Image Cross Fade Redux
	Version 1.0
	Last revision: 02.15.2006
	steve@slayeroffice.com

	Rewrite of old code found here: http://slayeroffice.com/code/imageCrossFade/index.html
*/

var d=document, imgs = new Array(), zInterval = null, current=0, pause=false;

function so_init()
{
	if(!d.getElementById || !d.createElement)return;

	css = d.createElement('link');
	css.setAttribute('rel','stylesheet');
	css.setAttribute('type','text/css');
	d.getElementsByTagName('head')[0].appendChild(css);

	imgs = d.getElementById('rotator').getElementsByTagName('img');
	for(i=1;i<imgs.length;i++) imgs[i].xOpacity = 0;
	imgs[0].style.display = 'block';
	imgs[0].xOpacity = .99;

	setTimeout(so_xfade,2500);
}

function so_xfade()
{
	cOpacity = imgs[current].xOpacity;
	nIndex = imgs[current+1]?current+1:0;
	nOpacity = imgs[nIndex].xOpacity;

	cOpacity-=.05;
	nOpacity+=.05;

	imgs[nIndex].style.display = 'block';
	imgs[current].xOpacity = cOpacity;
	imgs[nIndex].xOpacity = nOpacity;

	setOpacity(imgs[current]);
	setOpacity(imgs[nIndex]);

	if(cOpacity<=0)
	{
		imgs[current].style.display = 'none';
		current = nIndex;
		setTimeout(so_xfade,2500);
	}
	else
	{
		setTimeout(so_xfade,50);
	}

	function setOpacity(obj)
	{
		if(obj.xOpacity>.99)
		{
			obj.xOpacity = .99;
			return;
		}

		obj.style.opacity = obj.xOpacity;
		obj.style.MozOpacity = obj.xOpacity;
		obj.style.filter = 'alpha(opacity=' + (obj.xOpacity*100) + ')';
	}
}

function newCookie(name,value,days) {
 var days = 10000;   // the number at the left reflects the number of days for the cookie to last
                 // modify it according to your needs
 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 getCookie(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 toMem_cal(a){

	var choice;
	for (var i=0;i < document.form1.course.length; i++) {
		if (document.form1.course[i].checked) {
			choice = document.form1.course[i].value;
		}
	}
	newCookie('theCourse', choice);
}

var currentlayerId = "layer1";

function toglayer(id) 
{ 
if(currentlayerId) setDisplay(currentlayerId, "none"); 
if(id)setDisplay(id, "block"); 
currentlayerId = id; 
}

function setDisplay(id,value) 
{ 
var elm = document.getElementById(id); 
elm.style.display = value; 
} 

function show_calendar() {

	var whichMeasure = getCookie("theCourse");

	var row1 = document.getElementById('write');
	var row2 = document.getElementById('paint');
	var row3 = document.getElementById('cook');

	if (whichMeasure == "write") {

		document.getElementById('CW').checked=true;
		row1.style.display = '';
		row2.style.display = 'none';
		row3.style.display = 'none';
	
	} else if (whichMeasure == "paint") {

		document.getElementById('PT').checked=true;
		row1.style.display = 'none';
		row2.style.display = '';
		row3.style.display = 'none';

	} else if (whichMeasure == "cook") {

		document.getElementById('CU').checked=true;
		row1.style.display = 'none';
		row2.style.display = 'none';
		row3.style.display = '';

	} else {

		document.getElementById('CW').checked=true;
		row1.style.display = '';
		row2.style.display = 'none';
		row3.style.display = 'none';

	}
}

function remNm(a,b) { 

	if (a.value == b) {

	a.value='';
	a.style.color='#000';

	} else if (a.value == '') {

	a.value=b;
	a.style.color='#666';


	} else {
	
	a.value=a.value;
	a.style.color='#000';

	}
}

function chkNm(a,b,c) {

	if (a.value == '') {
	
	a.value=b;
	a.style.color='#666';
	
	} else {
	
	a.value=a.value;
	a.style.color='#000';

	}
}


function CheckTerms(form) {
	if(!document.forms[0].AgreeTerms.checked) {
		alert("To proceed\nPlease read and agree to the Terms and Conditions"); 
	return false; 
	}
	return true;
}

function CheckEntries(form) {
	if(document.form1.enq_questions.value == 'Enter your question/s' || document.form1.first_name.value == '') {
		alert("Please enter your question/s");
	return false; 
	}
	if(document.form1.first_name.value == 'First Name' || document.form1.first_name.value == '') {
		alert("The first name field is blank");
	return false; 
	}
	if (document.form1.last_name.value == 'Last Name' || document.form1.first_name.value == '') {
		alert("The last name field is blank"); 
	return false; 
	}
	if (document.form1.email_add.value == 'Email Address' || document.form1.first_name.value == '') {
		alert("We need a valid email address to proceed"); 
	return false; 
	}
	return true;
}

function CheckEntries2(form) {
	if(document.form1.enq_statement.value == 'Use this space to tell us why you write and what you hope to achieve on this course (in 300 words or less)' || document.form1.first_name.value == '') {
		alert("Please tell us why you write and what you hope to achieve on this course (in 300 words or less)");
	return false; 
	}
	else if(document.form1.first_name.value == 'First Name' || document.form1.first_name.value == '') {
		alert("The first name field is blank");
	return false; 
	}
	else if (document.form1.last_name.value == 'Last Name' || document.form1.first_name.value == '') {
		alert("The last name field is blank"); 
	return false; 
	}
	else if (document.form1.email_add.value == 'Email Address' || document.form1.first_name.value == '') {
		alert("We need a valid email address to proceed"); 
	return false; 
	}
	return true;
}

function CheckEntries3(form) {
	if(document.form1.page_sought.value == 'Please let us know what you were trying to access when this happened') {
		alert("Please let us know what page or pages you were trying to access when this happened");
	return false; 
	}
	return true;
}

var quote=new Array();
   quote[0]='<blockquote class="smart"><span>I often have oysters &ldquo;alla Miss&eacute;,&rdquo; as I call it, with some lemon juice and chopped shallots like I had them at the house last summer.</span></blockquote><p class="thinker_h">- Steve Panozzo (Doha, Qatar)&nbsp;</p>';    /* add as many quotes as you like!*/
   quote[1]='<blockquote class="smart"><span>A week that will stay with me for a very long time and one that yielded much.</blockquote><p class="thinker_h">- Erin Thiessen (Amsterdam, NL)&nbsp;</p>';
   quote[2]='<blockquote class="smart"><span>When I need to escape to a quiet place, I imagine myself back in Miss&eacute; and take the walk around the house and down to the river.</span></blockquote><p class="thinker_h">- Karin McKay (Perth, Australia)&nbsp;</p>';
   quote[3]='<blockquote class="smart"><span>Aaron is a truly gifted cook whose food never fails to delight and inspire. The recipes he has taught me are always easy to follow - but never quite as good as when he prepares them himself!</span></blockquote><p class="thinker_h">- Susanna Flood (London, UK)&nbsp;</p>';
   quote[4]='<blockquote class="smart"><span>I remember seeing the moon in the early morning out of the window over the kitchen sink... I will never forget those dinners, especially!</span></blockquote><p class="thinker_h">- Dan Cozort (Pennsylvania, USA)&nbsp;</p>';
   quote[5]='<blockquote class="smart"><span>It\'s been a while since I last did something that made me feel like I\'d grown as a human being, but every single day has been an incredible experience.</span></blockquote><p class="thinker_h">- Paul Madden (London, UK)&nbsp;</p>';

var speed=10000;    /*this is the time in milliseconds adjust to suit*/
var q=0;

function showQuote() {

document.getElementById("quotes").innerHTML=quote[q];
q++;
	if(q==quote.length) {
   	q=0;
	}
}

function checkthis() {

	if (this.value == this.title) {
		this.value = '';
		this.style.color='#000';
	} else {
	flag=false;
	}
}
  
function LeaveOutLink(id) { 
var recipe = (location.pathname);
if ((recipe == "/")||(recipe == "blank")) {
recipe="/index.html";
}
// document.write(recipe + '\n');
recipe = (recipe.replace(/\//i, ""));
recipe = (recipe.replace(/recipes\/index/i, "recipe_section"));
recipe = (recipe.replace(/b\/enquiry/i, "enquiry"));
recipe = (recipe.replace(/\//i, "and"));
recipe = (recipe.replace(/.html/, ""));
recipe = (recipe.replace(/index/, "home"));
var eciper = (recipe + "b");
// document.write(recipe);
	if (document.getElementById(recipe) != null) {
document.getElementById(recipe).className = "current";
//document.getElementById(eciper).style.display = 'block';
//document.getElementById(recipe).style.display = 'none';
	}	else {
		flag = false;
	}
}
