﻿$(document).ready(function() {
	var sPath = window.location.pathname;
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1, sPath.lastIndexOf('.'));
	var sId = '';
	if (sPage.indexOf('_') != -1) {
	sId = sPage.substring(0, sPage.indexOf('_'));
	} else {
	sId = sPage;
	}
	if (sId.length > 1) {
	sId = '#' + sId;
		switch (sId) {			
			case '#enrol':
				$(sId).removeClass('vmenu')
				$(sId).addClass('vmenusel')
				break;
			case '#buttweld':
				$(sId).removeClass('vmenu')
				$(sId).addClass('vmenusel')
				break;
			case '#electrofusion':
				$(sId).removeClass('vmenu')
				$(sId).addClass('vmenusel')
				break;	
			case '#csgelectrofusion':
				$(sId).removeClass('vmenu')
				$(sId).addClass('vmenusel')
				break;	
			case '#qcaservices':
				$(sId).removeClass('vmenu')
				$(sId).addClass('vmenusel')
				break;
			case '#calendar':
				$(sId).removeClass('vmenu')
				$(sId).addClass('vmenusel')
				break;
			case '#resources':
				$(sId).removeClass('vmenu')
				$(sId).addClass('vmenusel')
				break;
			case '#links':
				$(sId).removeClass('vmenu')
				$(sId).addClass('vmenusel')
				break;
			case '#contact':
				$(sId).removeClass('vmenu')
				$(sId).addClass('vmenusel')
				break;
			default:
				$(sId).addClass('selected');
		}
	} else {
		sId = '#index';
		$(sId).addClass('selected');
	}
});

function encodedEmail() {
	nmLink = String.fromCharCode(105,110,102,111)
	nmLink += String.fromCharCode(64)
	nmLink += String.fromCharCode(112,111,108,121,115,109,97,114,116,46,99,111,109,46,97,117);
	nmE = "<a href='mailto:" + nmLink + "'>"
	nmE += nmLink + "</a>";
	document.write(nmE);
}

function encodedEmailBtn() {
	nmLink = String.fromCharCode(115,97,108,101,115)
	nmLink += String.fromCharCode(64)
	nmLink += String.fromCharCode(112,111,108,121,115,109,97,114,116,46,99,111,109,46,97,117);
	nmbtn = '<img src=' + '"' + 'graphics/price.gif' + '" ' + 'alt=' + '"' + 'Get a quote' + '" ' + 'width=' + '"' + '100' + '" ' + 'height=' + '"' + '30' + '" ' + 'hspace=' + '"' + '60' + '" ' + 'border=' + '"' + '0' + '" ' + 'align=' + '"' + 'right' + '" ' + '/>';
	nmSubject = '&subject=Polysmart%20Training%20Price%20Enquiry';
	nmE = "<a href='mailto:" + nmLink + nmSubject + "'>"
	nmE += nmbtn + "</a>";
	document.write(nmE);
}

function NM_CopyrightYr() {
	document.write(new Date().getFullYear());
}

function getCourse() {
	var course = '';
	for (var i=0; i < document.form1.course.length; i++)
		{
			if (document.form1.course[i].checked) {
			course = course + document.form1.course[i].value + ", ";	
			}
		}
	document.form1.courseval.value = course;
}
