var myHtml = '<h5>CIRCLE OF MISSE</h5><h6>Poitiers &nbsp;&nbsp;&nbsp;- 1 hour&nbsp;&nbsp;&nbsp;Tours &nbsp;- 1&frac12; hours<br />La Rochelle - 2 hours&nbsp;&nbsp;Nantes - 2 &nbsp;hours<br />Bordeaux &nbsp;&nbsp;&nbsp;- 3 hours&nbsp;&nbsp;Paris &nbsp;- 3&frac12; 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>';

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 whichMeasure = getCookie("theCourse");

	if (whichMeasure == "write") {

		location.href = "#fragment-2";

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

		location.href = "#fragment-3";

	} else {

	}
*/

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.email_add.value == 'Email Address' || document.form1.email_add.value == '') {
		alert("Please enter a valid email address to proceed"); 
	return false; 
	}
	if(document.form1.enq_questions.value == 'Enter your question/s' || document.form1.enq_questions.value == '') {
		alert("Please enter a question or questions");
	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; 
	}
*/
//
	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>More than enjoyable. Your cookery course on 19 August 2011 was sensational and I can\'t wait to try the recipes on my West Australian friends. Thank you Aaron!</span></blockquote><p class="thinker_h">- Margaret Patrikeos (Perth, WA)&nbsp;</p>';
   quote[1]='<blockquote class="smart"><span>A remarkable 10 days. I ate and drank like a duchess and what is more under Wayne\'s expert and unintrusive hand I got what I came for and more. The end of my memoir is in sight.</span></blockquote><p class="thinker_h">- Eithne (London, UK)&nbsp;</p>';
   quote[2]='<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[3]='<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>';
   quote[4]='<blockquote class="smart"><span>Thank you so much for (yet another!) fantastic week. It is such an inspiring environment at Missé, full of warmth, encouragement and warm-cooked comfortable goodness.</span></blockquote><p class="thinker_h">- Kathryn (Amsterdam, NL)&nbsp;</p>';

var quotespeed=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;
	}
}

/* Start Google Analytics */
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-11014582-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
/* End Google Analytics */

function hide_content() {

document.getElementById('cdm').style.display = 'none';
document.getElementById('titles.h1').style.display = 'none';
document.getElementById('navbar').style.display = 'none';
document.getElementById('bottom-box_home').style.display = 'none';

}

function show_content() {

document.getElementById('cdm').style.display = 'block';
document.getElementById('col-1').style.display = 'block';
document.getElementById('col-2home').style.display = 'block';
document.getElementById('bottom-box_home').style.display = 'block';

}

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(/cooking\//i, ""));
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;
	}
}

function externalLinks() {   
 if (!document.getElementsByTagName) return;   
 var anchors = document.getElementsByTagName("a");   
 for (var i=0; i<anchors.length; i++) {   
   var anchor = anchors[i];   
   if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external")
		anchor.target = "_blank";   
	}   
}   
window.onload = externalLinks;

