//From the Classroom Training page - links from the Select Locatioin drop-down box to the correct location page
//The 'Courses' pages use the queryString to determin the location selected
function trainingLocation() {
	var locationURL = document.worldTraining.CourseLocation.value;
	var locationTo = "";
	if(locationURL != "none") {
		switch (locationURL) {
			case 'Midlands' :
				locationTo = "../Courses/UK_Midlands.html";
				break;
			case 'London' :
				locationTo = "../Courses/UK_London.html";
				break;
			case 'Germany' :
				locationTo = "../Courses/Germany.html";
				break;
			case 'France' :
				locationTo = "http://www.wygwam.com";
				break;
			case 'Holland' :
				locationTo = "../Courses/Holland.html";
				break;
			case 'Luxembourg' :
				locationTo = "../Courses/Luxembourg.html";
				break;
			case 'Denmark' :
				locationTo = "../Courses/Denmark.html";
				break;
			case 'Australia' :
				locationTo = "http://www.combined-knowledge.com.au";
				break;
			case 'USA' :
				locationTo = "http://www.mindsharp.com/Default.aspx?top=TRAINING";
				break;
		}
		MM_goToURL('parent',locationTo);return document.MM_returnValue
	}
}

//used on the courses pages to set the location selected
function loc() {
	var querystring = (window.location.search.substring(1));
	document.getElementById("Midlands").style.display = "none";
	document.getElementById("London").style.display = "none";
	document.getElementById("Germany").style.display = "none";
	document.getElementById("France").style.display = "none";
	document.getElementById("Holland").style.display = "none";
	document.getElementById("Luxembourg").style.display = "none";
	document.getElementById("Denmark").style.display = "none";
	
	
	if (document.getElementById("Midlands2")) {
		var Midlands2 = document.getElementById("Midlands2");
		Midlands2.style.display = "none";
	}
	if(querystring != ""){
		switch (querystring) {
			case 'Midlands': 
				document.getElementById("Midlands").style.display = "";
				if (Midlands2) {Midlands2.style.display = "";}
				break;
			case 'London': 
				document.getElementById("London").style.display = "";
				break;
			case 'Germany': 
				document.getElementById("Germany").style.display = "";
				break;
			case 'France': 
				document.getElementById("France").style.display = "";
				break;
			case 'Holland': 
				document.getElementById("Holland").style.display = "";
				break;
			case 'Luxembourg': 
				document.getElementById("Luxembourg").style.display = "";
				break;
			case 'Denmark': 
				document.getElementById("Denmark").style.display = "";
				break;
			case 'showAll':
				showAllLocationDates();
				break;
			case 'showUK':
				showUKOnly();
				break;
		}
	}
	else {
		showUKOnly();
	}
}

function showUKOnly() {
	document.getElementById("Midlands").style.display = "";
	if (document.getElementById("Midlands2")) {document.getElementById("Midlands2").style.display = "";}
//	document.getElementById("London").style.display = "";
	if (document.getElementById("London2")) {document.getElementById("London2").style.display = "";}
	document.getElementById("Germany").style.display = "none";
	document.getElementById("France").style.display = "none";
	document.getElementById("Holland").style.display = "none";
	document.getElementById("Luxembourg").style.display = "none";
	document.getElementById("Denmark").style.display = "none";
	document.getElementById("showAllDates").style.display = "";
}


//after clicking the 'show dates for all location'
function showAllLocationDates() {
	document.getElementById("Midlands").style.display = "";
	if (document.getElementById("Midlands2")) {document.getElementById("Midlands2").style.display = "";}
	document.getElementById("London").style.display = "";
	document.getElementById("Germany").style.display = "";
	document.getElementById("France").style.display = "";
	document.getElementById("Holland").style.display = "";
	document.getElementById("Luxembourg").style.display = "";
	document.getElementById("Denmark").style.display = "";
	document.getElementById("showAllDates").style.display = "none";
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}


//Set div's to the same height
function P7_colH2(){ //v2.1.0 by PVII-www.projectseven.com
	var i,oh,h=0,tg,el,np,dA=document.p7eqc,an=document.p7eqa;if(dA&&dA.length){
	for(i=1;i<dA.length;i+=2){dA[i+1].style.paddingBottom='';}for(i=1;i<dA.length;i+=2){
	oh=dA[i].offsetHeight;h=(oh>h)?oh:h;}for(i=1;i<dA.length;i+=2){oh=dA[i].offsetHeight;
	if(oh<h){np=h-oh;if(!an&&dA[0]==1){P7_eqA2(dA[i+1].id,0,np);}else{
	dA[i+1].style.paddingBottom=np+"px";}}}document.p7eqa=1;
	document.p7eqth=document.body.offsetHeight;
	document.p7eqtw=document.body.offsetWidth;}
}
function P7_eqT2(){ //v2.1.0 by PVII-www.projectseven.com
	if(document.p7eqth!=document.body.offsetHeight||document.p7eqtw!=document.body.offsetWidth){P7_colH2();}
}
function P7_equalCols2(){ //v2.1.0 by PVII-www.projectseven.com
	var c,e,el;if(document.getElementById){document.p7eqc=new Array();
	document.p7eqc[0]=arguments[0];for(i=1;i<arguments.length;i+=2){el=null;
	c=document.getElementById(arguments[i]);if(c){e=c.getElementsByTagName(arguments[i+1]);
	if(e){el=e[e.length-1];if(!el.id){el.id="p7eq"+i;}}}if(c&&el){
	document.p7eqc[document.p7eqc.length]=c;document.p7eqc[document.p7eqc.length]=el}}
	setInterval("P7_eqT2()",10);}
}
function P7_eqA2(el,p,pt){ //v2.1.0 by PVII-www.projectseven.com
	var sp=10,inc=20,g=document.getElementById(el);np=(p>=pt)?pt:p;
	g.style.paddingBottom=np+"px";if(np<pt){np+=inc;
	setTimeout("P7_eqA2('"+el+"',"+np+","+pt+")",sp);}
}

//Clears input form elements
function clearme(formItem, keyword)
{
    if (formItem.value == keyword) formItem.value = ''; 
}

//make iFrames resize in relation to src (only works for src pages in the current site)
function frm_onload(frmname)  { 
	frmname.frameElement.height = frmname.document.body.scrollHeight+20; 
}
