/* Javacript News Rotation, based on article by Tom Duffy - http://www.devx.com/getHelpOn/10MinuteSolution/17245/0/page/1 - Thanks Tom! */
function makeNews(c){	this.copy = c;	this.write = writeNews; }
function writeNews(){	var str = '';	str += this.copy;	return str;}
var newsArray = new Array();
newsArray[0] = new makeNews("<u>Integral Yoga Satsang at The Zen Zone</u><br><br>On the first Sunday of each month Integral Yoga Dorset hold a Satsang at The Zen Zone. Come and join us for an inspiring evening of chanting, yoga philosophy and talks. Open to everyone. 18.30 to 20.30. No charge, but donations welcome.<br>").write();
newsArray[1] = new makeNews("<u>Beauty Treatments at The Zen Zone</u><br><br>We are now delighted to be able to offer a full range of beauty treatments for men and women: facials, waxing, eyelash/brow tint and perm, manicures, pedicures. Michelle uses Dermalogica products in all facials and Creative products in hands and feet treatments. To view our price list, please click <a href=\"/beauty/prices.php\">here</a>.").write();
newsArray[2] = new makeNews("<u>The Zen Zone supports Tribe  Worldwear</u><br><br>We are pleased to promote a new range of organic yoga tops by Tribe Worldwear, in eco-fabrics such as luxuriously soft bamboo and Earth Positive cotton, which is not only organic and fairtrade, but also made in factories solely powered by wind and solar power. <br><br>For full details, please see <a href=\"http://www.tribeworldwear.com/\">http://www.tribeworldwear.com/</a>").write();
newsArray[3] = new makeNews("<u>New Kundalini Yoga Class with Joanne</u><br><br>New class starting on Friday 18th June! <br><br>We are pleased to welcome Kundalini Yoga teacher Joanne Budd to The Zen Zone. Joanne will be teaching a drop-in Kundalini class on Fridays 17.30 – 18.45. <br><br>For any information, please contact Joanne on 01202 710 543 or check her website: <a href=\"http://www.kydorset.co.uk/\">www.kydorset.co.uk</a>").write();
newsArray[4] = new makeNews("<u>New Over 50s Class with Josi</u><br><br>Due to popular demand, Josie is offering an additional Yoga class for the over 50s on Friday morning 11.30 – 12.45. This class will start on 18th June. Please contact Josie for further details.").write();
newsArray[5] = new makeNews("<u>New Pregnancy Massage Treatments</u><br><br><u>NEW</u>&nbsp;&nbsp;&nbsp;We are now able to offer Pregnancy Massage to our clients.  A wonderful way to relax and pamper yourself during your pregnancy.  Specifically tailored for women from their 12th week of pregnancy<br><br>Click <a href=\"/therapies/pregmsg.php\">here</a> for more info.").write();
newsArray[6] = new makeNews("<u>New Meditation Class with Sally Tyler</u><br><br>New Meditation Class for General Health and Wellbeing with Sally Tyler. Every Wednesday 10.30 a.m. till 12 noon (changing to Thursdays from 2:30pm to 3:45pm from 12th August). Each week we will be using simple means as well as learning different techniques to help the body and mind relax and unwind. The class is for beginners and caters for adults of all ages who need time out for their selves. Please wear loose clothing.<br><br>Telephone The Zen Zone (01202 741 391) or just turn up. Classes are £7 or £40 for a course of six sessions.").write();
newsArray[7] = new makeNews("<u>Schedule Change</u><br><br>Please note that Sally’s meditation class will be changing to Thursdays at 2.30pm to 3.45pm from 12th August 2010.").write();
newsArray[8] = new makeNews("<u>Schedule Change</u><br><br>Helen McCabe will be taking a short break from teaching. <br><br>Her last class will be on Tuesday 17th August 2010 and she will then be back teaching her usual schedule from Tuesday 7th September 2010.").write();

var nIndex = -1;
var timerOn = 1;
var timerID = null;
var len = newsArray.length;var pp_symbol = "||";
var pp_start = "<a href=\"javascript:prevNews();\" style=\"color: #FFFFFF; text-decoration: none\">&lt;</a> <a href=\"javascript:togglePlay();\" style=\"color: #FFFFFF; text-decoration: none\">"; 
var pp_end = "</a> <a href=\"javascript:nextNews();\" style=\"color: #FFFFFF; text-decoration: none\">&gt;</a>";

function rotateNews(){	
nIndex++;	
if(nIndex >= len)		
nIndex = 0;
document.getElementById('stories').innerHTML = newsArray[nIndex];
document.getElementById('pauseplay').innerHTML = pp_start + pp_symbol + pp_end;
document.getElementById('pagecount').innerHTML = "(" + (nIndex+1) + "/" + (len) + ")";
if(timerOn == 1) 
timerID = setTimeout('rotateNews()',9000);
}
function pauseNews() {	
if (timerID != null) {	
timerOn = 0; 
clearTimeout(timerID);	
timerID = null;	pp_symbol = "Play";
document.getElementById('pauseplay').innerHTML = pp_start + pp_symbol + pp_end;	
} 
}

function playNews() {	
if (timerID == null) 
{
timerOn = 1; 
timerID = 
setTimeout('rotateNews()', 1000);	
}

pp_symbol = "||";	document.getElementById('pauseplay').innerHTML = pp_start + pp_symbol + pp_end; 
}

function nextNews(){	nIndex++;	if(nIndex >= len)		nIndex = 0;
	document.getElementById('stories').innerHTML = newsArray[nIndex];
	document.getElementById('pauseplay').innerHTML = pp_start + pp_symbol + pp_end;
	document.getElementById('pagecount').innerHTML = "(" + (nIndex + 1) + "/" + (len) + ")";
	pauseNews();
}

function prevNews(){
	nIndex--;
	if(nIndex < 0)
		nIndex = len-1;
	document.getElementById('stories').innerHTML = newsArray[nIndex];
	document.getElementById('pauseplay').innerHTML = pp_start + pp_symbol + pp_end;
	document.getElementById('pagecount').innerHTML = "(" + (nIndex + 1) + "/" + (len) + ")";
	pauseNews();
}


function togglePlay(){
	if(timerOn == 1) 
	{
		pauseNews();
	} 
	else 
	{
		playNews();
	}
}
