function onSubmitForm() {
	return true;
}

function chkSel(target) {
	var inputter = target.getElementsByTagName("input")[0];
	
	if (inputter.checked ) workshopPriceHash[inputter.name] = inputter.value;
	else delete workshopPriceHash[inputter.name];
	
	var total = Number(0);
	for (var i in workshopPriceHash) {
		total+= Number(workshopPriceHash[i]);
	}
	document.getElementById("cost").innerHTML = "$"+total;
	document.forms[0].elements['totalPayable'].value = total;
}


function displayDetail (parent, id, target) {
	setPanelContent (id);
	
	var isIE6 = navigator.userAgent.toLowerCase().indexOf('msie 6') != -1;
	
	//var targ = getDivByClass("workshopbx_3h", target);
	//targ = targ ?  getDivByClass("boxcontentbottomList", targ) : 0; 
	//if (targ) {
	//	targ.style.visibility = "visible";
	//}
	
	
	//var placement = findPos(parent);
	var p = getPositionedEventCoords(parent)
	var panel = document.getElementById('workshopPanel');
	
	var yScrollAdd = isIE6 ? document.body.scrollTop ||  document.documentElement.scrollTop : 0;
	var cW = f_clientWidth();
	var origX = (p.left + 100);
	var destX;
	destX = origX;
	var bleedX = 405 + destX > cW ? (405 + destX) - cW : 0;
	var diff =  cW > p.left ? cW - p.left : p.left - cW;
	destX -=  bleedX ? bleedX + diff*1.5 : 0;  //(destX + 405 - cW)
	destX = destX < 0 ? 0 : destX;
	panel.style.left = destX  + "px";
	var destY = yScrollAdd +  p.top - 100;
	destY += bleedX ?  0 : 0; //
	panel.style.top = destY + "px";
	panel.style.display = "block";
	panel.style.visibility = "visible";	

}
function getDivByClass(searchClass, node) {
	var tag = 'div';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			return els[i];
		}
	}
}

function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}
function f_clientWidth() {
	return f_filterResults (
		window.innerWidth ? window.innerWidth : 0,
		document.documentElement ? document.documentElement.clientWidth : 0,
		document.body ? document.body.clientWidth : 0
	);
}
function f_clientHeight() {
	return f_filterResults (
		window.innerHeight ? window.innerHeight : 0,
		document.documentElement ? document.documentElement.clientHeight : 0,
		document.body ? document.body.clientHeight : 0
	);
}
function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}
function getPositionedEventCoords(event) {
	var sXY = getScrollXY ();
	var IE = document.all?true:false;
	if (IE) { // grab the x-y pos.s if browser is IE
		tempX = event.clientX + sXY[0];
		tempY = event.clientY - sXY[1];
	} else {  // grab the x-y pos.s if browser is NS
		tempX = event.pageX + sXY[0];
		tempY = event.pageY- sXY[1];
	}  
	var coords = {left:tempX, top:tempY }
	return coords;
}
function getScrollXY() {	
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } 
  return [ scrOfX, scrOfY ];
}
function hideDetail (id, target) {
	document.getElementById('workshopPanel').style.visibility = "hidden";
}

function setPanelContent (id) {
	var infoArray = workshopContent[id];
	var panel = document.getElementById('titlecontent');
	panel.innerHTML  = infoArray[0];
	panel = document.getElementById('datecontent');
	panel.innerHTML  = infoArray[1];
	panel = document.getElementById('timecontent');
	panel.innerHTML  = infoArray[2];
	panel = document.getElementById('pricecontent');
	panel.innerHTML  = infoArray[3];
	panel = document.getElementById('paxcontent');
	panel.innerHTML  = infoArray[4];
	panel = document.getElementById('bodycopycontent');
	panel.innerHTML  = infoArray[5];
	panel = document.getElementById('workshopcontent');
	panel.innerHTML  = infoArray[6];
}


// clear checkbox states on unload/refresh
function clearStates() {
	var i = 0;
	var inputter;
	var total = 0;
	for (i =0; i<workshopContent.length; i++) {
		inputter = document.forms[0].elements['workshopitem'+(i+1)];
		inputter.checked = false;
	}
	//document.getElementById("cost").innerHTML = "$0";
}


var workshopContent = new Array( );
var workshopPriceHash = {};
var firstState = false;


var temp = ['Metamorphosis - The Growth Process Of Your Child', 'Friday - 5th June 2009', '11.30am - 2.30pm', '$25 (Per ticket allows max of 4)', '100', '"Metamorphosis - The Growth Process Of Your Child" is designed to unleash the full creativity and harness the learning curiosity of every child. The objective is to instill in them effective learning strategies and create in them the winner\'s mindset to prepare them for their early years in school and in life.', 'Workshop 1'];
workshopContent[0] = temp;


temp = ['Innovative Healthy Snacks for Children - Health Promotion Board', 'Friday - 5th June 2009', '12.00nn - 2.00pm', 'FREE', '50 Pairs [Parent/Child]', 'Are young children indulging in too many unhealthy snacks? Learn innovative methods to make healthy snacks for them! Watch as our nutritionist demonstrates how to make health snacks that are tasty and appealing to your children.  You will also get to prepare the healthy snacks with your children during the workshop.', 'Workshop 2'];
workshopContent[1] = temp;

temp = ['Keys to Strategic Reading & Writing for English', 'Friday - 5th June 2009', '3.00pm - 6.00pm', '$25 (Per ticket allows max of 4)', '100', 'Reading is, without doubt, the single most important skill in education because the learning of all other subjects depends on  a child\'s reading ability. Teachers in Singapore generally agree that poor readers tend not to do well in other subjects, even Math, because they are able to read the story problems given. This workshop will share with parents "what makes good readers?" and the key components to writing better essays which will boost children\'s academic performance!', 'Workshop 1'];
workshopContent[2] = temp;

temp = ['Mathnasium', 'Saturday - 6th June 2009', '11.30am - 12.30pm', '$8', '40', 'Mathnasium is a programme developed using the Number Sense method that develops a child\'s mind by developing logical, critical thinking and problem solving skills. The workshop aims to inculcate these skills through an interactive parent-child session.', 'Workshop 1'];
workshopContent[3] = temp;

temp = ['Help Your Child Excel in Maths with Norman Tien', 'Saturday - 6th June 2009', '12.45pm - 1.45pm', '$8', '40', 'A child\'s exposure and training during their growing years will greatly impact their grasp of several essential cognitive skills. For example, men generally have a better sense of direction compared to women and this could simply be because of the kind of toys they play during childhood. In this workshop, join speaker, Norman Tien in unveiling the secret and tips to ensure your child develops the essential skill sets which will help them excel in mathematics and in school.', 'Workshop 1'];
workshopContent[4] = temp;

temp = ['Building the Parent-Child Bond through Dance - Health Promotion Board', 'Saturday - 6th June 2009', '2.00pm - 4.00pm', 'FREE', '50 Pairs [Parent/Child]', 'Join our ever enthusiastic and energetic instructors as they talk about the basics of strarting an exercise programme - the benefits of regular exercise, the FITT formula, some safety tips, etc.  The Instructor would also conduct an interactive fun dance/workout whereby both parents and children can participate. Dance to the energetic rhythmic beat and enjoy the fun of engaging in physical activity together with your children!', 'Workshop 2'];
workshopContent[5] = temp;

temp = ['Solve All Your Children Math Problems Within 5 Steps (Dr Peter Yan)', 'Saturday - 6th June 2009', '2.00pm - 5.00pm', '$25 (Per ticket allows max of 4)', '100', 'With the current emphasis on non-routine problems, students are facing an increasingly arduous challenge of using heuristics to solve them.  More than ever before, more students are struggling to cope with the presence of ambiquity in the questions set in exams. In this workshop, Parents and their children (age 7 - 13) will be taken through a series of \'hands-on, minds-on\' activities to experience the explicit infusion of thinking skills in the teaching and learning of Math Mastery courtesy of Adam Khoo Learning Centres and how Math Mastery can help their children to solve all their Math problems within 5 steps!', 'Workshop 1'];
workshopContent[6] = temp;

temp = ['Singapore Brain Development (Unleash the Enstein In Your Child)', 'Saturday - 6th June 2009', '5.15pm - 6.15pm', '$8', '40', 'Your child could be Enstein in the making! <br />In the seminar, you will find out how the root causes of poor cognitive skills or weak foundational learning skills!<br />You will also find out:<br />- How IQs can be changed through the application of modern<br />&nbsp;&nbsp;neurosicence!<br />- How the mind can be changed to unleash its fullest potential.<br />- How training in cognitive skills and thinking strategies will combine to<br />&nbsp;&nbsp;create a peak achiever!<br />- How to achieve this in less time and less effort!', 'Workshop 1'];
workshopContent[7] = temp;

temp = ['Nurturing the Winner & Genius in your child', 'Sunday - 7th June 2009', '11.00am - 2.00pm', '$25 (Per ticket allows max of 4 persons)', '100', 'Designed for pre-teens, this workshop provides the opportunity to explore methods in achieving their peak performance and mind power through experiential games and other fun activities. This workshop will be lead by Leroy Frank Ratnam, a Trainer with Adam Khoo Learning Technologies Group (AKLTG) Pte. Ltd. He specializes in Personal Peak Performance, Communication, Sales and Leadership. He is also a trainer of Neuro-Linguistic Programming (NLPTM).', 'Workshop 2'];
workshopContent[8] = temp;

temp = ['Mathnasium', 'Sunday - 7th June 2009', '11.30am - 12.30pm', '$8', '40', 'Mathnasium is a programme developed using the Number Sense method that develops a child\'s mind by developing logical, critical thinking and problem solving skills. The workshop aims to inculcate these skills through an interactive parent-child session.', 'Workshop 1'];
workshopContent[9] = temp;

temp = ['Maths Heuristics - A Guide to scoring in PSLE Mathematics', 'Sunday - 7th June 2009', '12.45pm - 1.45pm', '$8', '40', 'Want to make sure your child aces his/her PSLE Mathematics? This informative workshop will be conducted with the aim of equipping parents with the knowledge to maximize their children\'s potential in PSLE Mathematics. The Unit Transfer Method and some increasing common heuristics in solving challenging problems will be discussed and shown. The speaker will use the actual past School exams problems to explain the different abilities that your child is expected to demonstrate in these PSLE Mathematics problems.', 'Workshop 1'];
workshopContent[10] = temp;

temp = ['I-Genius - Improving your child\'s concentration span', 'Sunday - 7th June 2009', '2.00pm - 3.00pm', '$8', '40', 'How to increase your child\'s concentration from 10mins to 70mins?  Normally children could only concentrate for 10mins in class. A child\'s concentration can be improved through a series of training that develops a child\'s right brain. Increasing a child\'s concentration increased their memory capacity as well as creativity.', 'Workshop 1'];
workshopContent[11] = temp;

temp = ['Building the Parent-Child Bond through Play - Health Promotion Board', 'Sunday - 7th June 2009', '3.00pm - 5.00pm', 'FREE', '25 Pairs [Parent/Child]', 'Speciall for children under 6 years of age, Playtime is an interactive workshop for parent-toddler pairs. It aims to provide a safe, happy and healthy environment for young children to play, learn and interact; and at the same time, extends support for parents of these young children. These groups are an excellent and unique platform that engage parents and toddlers together and teach them how to use play to enhance learning and parent-child bonding. In this session, children will learn about manners through the activities. For parents of young infants and toddlers, this all rounded workshop packs in all you need to know to keep your child happy, healthy and active. Workshop focuses on interactive family activities, physical education and balanced nutrition.', 'Workshop 2'];
workshopContent[12] = temp;

temp = ['From Average to Exceptional with Norman Tien - How to Ace your PSLE in 3 months', 'Sunday - 7th June 2009', '3.15pm - 4.15pm', '$8', '40', 'Learn Norman Tien\'s proprietary proven techniques in exceling in PSLE mathematics and help your child dramatically improve their mathematic results. Teach your children simple strategies to cope with the PSLE and help them identify and solve the problems with a sound logic mind.', 'Workshop 1'];
workshopContent[13] = temp;

temp = ['Singapore Brain Development (Motivational Breakthrough - Life Keys to your Child\'s Success)', 'Sunday - 7th June 2009', '4.30pm - 5.30pm', '$8', '40', 'Learn to develop the "X factor" that will set the foundation for your child success academically, socially and professionally. By developing your child\'s intelligence through sharping innate skills like social and emotional intelligence, independence, confidence and self-esteem, you can put your child ahead in society. This workshop also includes practical tips for both parents and caregivers.', 'Workshop 1'];
workshopContent[14] = temp;

temp = ['Building the Parent-Child Bond through Play - Health Promotion Board', 'Friday - 5th June 2009', '12.00nn - 2.00pm', 'FREE', '25 Pairs [Parent/Child]', 'Specially for children under 6 years of age, Playtime is an interactive workshop for parent-toddler pairs. It aims to provide a safe, happy and healthy environment for young children to play, learn and interact; and at the same time, extends support for parents of these young children. These groups are an excellent and unique platform that engage parents and toddlers together and teach them how to use play to enhance learning and parent-child bonding. In this session, children will learn about manners through the activities. for parents of young infants and toddlers, this all rounded workshop packs in all you need to know to keep your child happy, healthy and active. Workshop focuses on interactive family activities, physical education and balanced nutrition.', 'Workshop 2'];
workshopContent[15] = temp;

temp = ['Innovative Healthy Snacks for Children - Health Promotion Board', 'Sunday - 7th June 2009', '4.30pm - 5.30pm', 'FREE', '50 Pairs [Parent/Child]', 'Are young children indulging in too many unhealthy snacks? Learn innovative methods to make healthy snacks for them! Watch as our nutritionist demonstrates how to make health snacks that are tasty and appealing to your children.  You will also get to prepare the healthy snacks with your children during the workshop.', 'Workshop 2'];
workshopContent[16] = temp;

temp = ['Building the Parent-Child Bond through Dance - Health Promotion Board', 'Sunday - 7th June 2009', '4.30pm - 5.30pm', 'FREE', '50 Pairs [Parent/Child]', 'Join our ever enthusiastic and energetic instructors as they talk about the basics of strarting an exercise programme - the benefits of regular exercise, the FITT formula, some safety tips, etc.  The Instructor would also conduct an interactive fun dance/workout whereby both parents and children can participate. Dance to the energetic rhythmic beat and enjoy the fun of engaging in physical activity together with your children!', 'Workshop 2'];
workshopContent[17] = temp;
