newsstring=new Array("Friday 10th September 2010 at 9.00pm|| <The Robin Hood> ||Sandhurst Rd, Tunbridge Wells","Saturday 11th September 2010 at 9.00pm|| <The Good Intent> ||John St, Rochester,Kent","Friday 17th September 2010 at 9.00pm|| <The Jolly Sailor Inn> ||Princes Square, Looe","Saturday 2nd October 2010 at 9.00pm|| <The Rising Sun> ||Kingsand Torpoint","Friday 8th October 2010 at 9.00pm|| <The Crumplehorn> ||Polperro.","Saturday 9th October 2010 at 9.00pm|| <The Jolly Sailor Inn> ||Princes Square, Looe","Friday 15th October 2010 at 9.00pm|| <The Wig and Pen> ||Truro.||The Start of the October/November tour of the reformed ( but not too reformed )THE DIVIDE featuring myself and the very talented Mr Vince Martyn. One that I'm looking forward to in a big way. ","Saturday 16th October 2010 at 9.00pm|| <The Bird In Hand> ||Hayle||THE DIVIDE","Thursday 21st October 2010 at 9.00pm|| <The Crumplehorn> ||Polperro.||THE DIVIDE","Friday 22nd October 2010 at 9.00pm|| <The Featherstone Hotel> ||Featherstone nr Pontefract||THE DIVIDE","Tuesday 26th October 2010 at 9.00pm|| <Azur> ||Marina Pavillions Hastings||THE DIVIDE","Wednesday 27th October 2010 at 9.00pm|| <The Man Of  Kent> ||6/8 John St, Rochester, Kent||THE DIVIDE","Thursday 28th October 2010 at 9.00pm|| <The Astor Comunity Theatre.> ||Stanhope Rd, Deal, Kent.||THE DIVIDE","Friday 29th October 2010 at 9.00pm|| <The Robin Hood> ||Sandhurst Rd, Tunbridge Wells||THE DIVIDE")
//max lines on display
lineheight=9
//max characters for width of display (must never exceed width! - always use courier type font with equal character spacing)
charwidth=50
//ticker cursor
//tickertypeon="<font color='#FFFF00'><strong>&gt;</strong></font>"
tickertypeon="<span style='background:800000'>&nbsp;</span>"
tickertypeoff="&nbsp;"
//cursor flash speed
tickertypeflash=20
//ticker speed
tickerspeed=2
//pause between articles
tickerpause=150
//the more link name (not longer than char width (above) - 5
themorelink="<view Gig List for full details>"
//IN-HOUSE VARIABLES
//amount of news articles
newsarticleamount=newsstring.length
//get first news article ready
newsarticlecount=-1
currentarticle=""
getnextarticle()
//the news article so far
newspartial=""
//the character position of the next letter within the original string
newschar=0
//ticker type flash count
tickertypecount=0
//ticker type toggle
tickertypetoggle=0
//ticker type character display
tickertypedisplay=tickertypeon
//tickerspeed count
tickerspeedcount=0
//tickerpause count
tickerpausecount=0
//special character variables
addhtmlbefore=""
temphtmlafter=""
addhtmlafter=""
aftercursor=""
//characterwidthcount
charwidthcount=0
//where we break the next line
charwidthbreak=0
//line number on display count
lineheightcount=1
//get first char width count
getnextcharwidth()
//TICKER FUNCTION
function newsticker() {
	//flash cursor
	tickertypecount++
	if (tickertypecount>tickertypeflash) {
		tickertypecount=0
		if (tickertypetoggle==0) {
			tickertypetoggle=1
			tickertypedisplay=tickertypeoff
		} else {
			tickertypetoggle=0
			tickertypedisplay=tickertypeon
		}
	}
	//is it time to display the next character of the news article?
	if (tickerspeedcount>tickerspeed) {
		tickerspeedcount=0
		//new line invoked
		while (currentarticle.charCodeAt(newschar)==124) {
			addhtmlbefore+="<br>";lineheightinc()
			charwidthcount=0
			newschar++
			getnextcharwidth()
		}
		//if less than sign
		if (currentarticle.charCodeAt(newschar)==60) {
			addhtmlbefore+="<span class='newsbold'>"
			temphtmlafter+="</span>"
			newschar++
			charwidthcount++
		} else if (currentarticle.charCodeAt(newschar)==62) {
		//if greater than sign
			addhtmlafter+="</span>"
			newschar++
			charwidthcount++
		}
		//new line invoked
		while (currentarticle.charCodeAt(newschar)==124) {
			addhtmlbefore+="<br>";lineheightinc()
			charwidthcount=0
			newschar++
			getnextcharwidth()
		}
		//has line come to end of charater width setting
		if (charwidthcount>=charwidthbreak & newschar<newscharmax) {
			charwidthcount=0
			addhtmlbefore+="<br>";lineheightinc()
			getnextcharwidth()
		}
		//finished displaying news but have'nt reached total lines yet
		if (newschar>=newscharmax & lineheightcount<lineheight) {
			lineheightcount++
			aftercursor+="<br>&nbsp;";
		}
		//display article with cursor
		chartoaddhere=currentarticle.substr(newschar,1)
		newspartial=newspartial+addhtmlbefore+chartoaddhere+addhtmlafter
		result.innerHTML=newspartial+temphtmlafter+tickertypedisplay+aftercursor
		//increase char width count
		charwidthcount++
		//reset special character variables
		addhtmlbefore=""
		temphtmlafter=""
		addhtmlafter=""
		//have we reached the end of this particular article
		if (newschar<newscharmax) {
			newschar++
		//wait for pause before moving onto next article
		} else {
			tickerpausecount++
			//next article
			if (tickerpausecount>tickerpause) {
				tickerpausecount=0
				newspartial=""
				newschar=0
				charwidthcount=0
				aftercursor=""
				lineheightcount=1
				//get next article
				getnextarticle();
				//get first line break point
				getnextcharwidth();
			}
		}
	}
	tickerspeedcount++
	setTimeout("newsticker()", 1)
}
//work out where to break the next line
function getnextcharwidth() {
	charwidthbreak=charwidth
	thisloopend=newschar+charwidth
	if (thisloopend<newscharmax) {
		for (i=newschar;i<thisloopend;i++) {
			if (currentarticle.substr(i,1)=="|") {
				thisloopend=i //stop loop because we found line break
				charwidthbreak=charwidth
			}
			if (currentarticle.substr(i,1)==" ") {
				charwidthbreak=i-newschar
			}
		}
	}
}
//line height increase - stop news if hit bottom
function lineheightinc() {
	lineheightcount++
	if (lineheightcount>=lineheight) {
		if (addhtmlbefore.length>4){
			addhtmlbefore=addhtmlbefore.substr(0,addhtmlbefore.length-4)
			lineheightcount--
		}
		//change text to create link thus fooling ticker
		currentarticle=currentarticle.substr(newschar,charwidth-6-(themorelink.length))+"... "+themorelink
		newscharmax=currentarticle.length
		newschar=0
		charwidthcount=0
		charwidthbreak=charwidth
	}
}
function getnextarticle () {
	newsarticlecount++
	//choose first article once more
	if (newsarticlecount>=newsarticleamount) {
		newsarticlecount=0
	}
	//get length of this article
	currentarticle=newsstring[newsarticlecount]
	newscharmax=currentarticle.length
}