﻿function toggleBlock(blockID, imageID) {
		var blockID = document.getElementById(blockID);
		var imageID = document.getElementById(imageID);

		if(blockID.style.display == '') {
			blockID.style.display = 'none';
			imageID.src = "images/expand.gif";
		} else {
			blockID.style.display = '';
			imageID.src = "images/collapse.gif";
		}
	}



function toggleClock(blockID, imageID) {
		var blockID = document.getElementById(blockID);
		var imageID = document.getElementById(imageID);

		if(blockID.style.display == '') {
			blockID.style.display = 'none';
			imageID.src = "images/button2d.jpg";
		} else {
			blockID.style.display = '';
			imageID.src = "images/button2c.jpg";
		}
	}

function toggleFlock(blockID, imageID) {
		var blockID = document.getElementById(blockID);
		var imageID = document.getElementById(imageID);

		if(blockID.style.display == '') {
			blockID.style.display = 'none';
			imageID.src = "images/details.jpg";
		} else {
			blockID.style.display = '';
			imageID.src = "images/details.jpg";
		}
	}












function FP_preloadImgs() {//v1.0
 var d=document,a=arguments; if(!d.FP_imgs) d.FP_imgs=new Array();
 for(var i=0; i<a.length; i++) { d.FP_imgs[i]=new Image; d.FP_imgs[i].src=a[i]; }
}

function FP_swapImg() {//v1.0
 var doc=document,args=arguments,elm,n; doc.$imgSwaps=new Array(); for(n=2; n<args.length;
 n+=2) { elm=FP_getObjectByID(args[n]); if(elm) { doc.$imgSwaps[doc.$imgSwaps.length]=elm;
 elm.$src=elm.src; elm.src=args[n+1]; } }
}

function FP_getObjectByID(id,o) {//v1.0
 var c,el,els,f,m,n; if(!o)o=document; if(o.getElementById) el=o.getElementById(id);
 else if(o.layers) c=o.layers; else if(o.all) el=o.all[id]; if(el) return el;
 if(o.id==id || o.name==id) return o; if(o.childNodes) c=o.childNodes; if(c)
 for(n=0; n<c.length; n++) { el=FP_getObjectByID(id,c[n]); if(el) return el; }
 f=o.forms; if(f) for(n=0; n<f.length; n++) { els=f[n].elements;
 for(m=0; m<els.length; m++){ el=FP_getObjectByID(id,els[n]); if(el) return el; } }
 return null;
}


window.onload = externalLinks;

function externalLinks()
{
 var objCurrent, objReplacement;

 if (document.getElementsByTagName)
 {
  var objAnchors = document.getElementsByTagName('a');
  for (var iCounter=0; iCounter<objAnchors.length; iCounter++)
  {
   if (objAnchors[iCounter].getAttribute('href') &&objAnchors[iCounter].getAttribute('rel') == 'external')
   {
    objAnchors[iCounter].onclick = function(event){return launchWindow(this, event);}
    objAnchors[iCounter].onkeypress = function(event){return launchWindow(this, event);}
    objAnchors[iCounter].title = (objAnchors[iCounter].title != "") ? objAnchors[iCounter].title+" (opens in a new window)" : "opens in a new window";

    if (document.replaceChild)
    {
     objCurrent = objAnchors[iCounter].firstChild;
     if (objCurrent.nodeType == 3) // Text node
     {
      //objReplacement = document.createTextNode(objCurrent.data + ' (opens in a new window)');
      //objAnchors[iCounter].replaceChild(objReplacement, objCurrent);
     }
     else if (objCurrent.alt) // Current element is an image
     {
      objReplacement = objCurrent;
      objReplacement.alt = objCurrent.alt + ' (opens in a new window)';
      try
      {
       objAnchors[iCounter].replaceChild(objReplacement, objCurrent);
      }
      catch(e){}
     }
    }
   }
  }
 }
}

function launchWindow(objAnchor, objEvent)
{
var iKeyCode;

if (objEvent && objEvent.type == 'keypress')
{
 if (objEvent.keyCode)
  iKeyCode = objEvent.keyCode;
 else if (objEvent.which)
  iKeyCode = objEvent.which;

 if (iKeyCode != 13 && iKeyCode != 32)
  return true;
}

return !window.open(objAnchor);
}

function toggle(obj) {
	var divState = document.getElementById('caption' + obj);
	divState .style.display = (divState .style.display != 'none' ? 'none' : '' );
	var divState = document.getElementById('caption' + obj + 'a');
	divState .style.display = (divState .style.display != 'block' ? 'block' : '' );
	return;
}
function toggleQuote(obj) {
	document.getElementById('quote1').style.display = ( obj != "1" ? "" : "block" );
	document.getElementById('quote2').style.display = ( obj != "2" ? "" : "block" );
	document.getElementById('quote3').style.display = ( obj != "3" ? "" : "block" );
	document.getElementById('quote4').style.display = ( obj != "4" ? "" : "block" );
	document.getElementById('quote5').style.display = ( obj != "5" ? "" : "block" );
	document.getElementById('quote6').style.display = ( obj != "6" ? "" : "block" );
}


function toggleLayer( whichLayer ){  var elem, vis;  if( document.getElementById ) // this is the way the standards work    
elem = document.getElementById( whichLayer );  else if( document.all ) // this is the way old msie versions work      
elem = document.all[whichLayer];  else if( document.layers ) // this is the way nn4 works    
elem = document.layers[whichLayer];  vis = elem.style;  // if the style.display value is blank we try to figure it out here  
if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)    
vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';  
vis.display = (vis.display==''||vis.display=='block')?'none':'block';}





var pausecontent=new Array()
pausecontent[0]='<i>\"80 minutes of superb acting, superb staging and direction...the standing ovation received at the end was well deserved\".</i><br><br><strong>Cllr. Albert Richardson, Preston</strong><br><br>\"The Ballad of Andrew Ryding\"'
pausecontent[1]='<i>\"Certain Curtain Theatre play a blinder...You simply shouldn\'t miss this sparkler\"</i><br><br><strong>Lancashire Evening Post</strong><br><br>LEGEND - The Tom Finney story'
pausecontent[2]='<i>\"Excellent production. Puts the message across in an original way. Makes it so refreshing, and keeps the audience interested. Would strongly recommend others to experience it\"</i><br><br><strong>Pat Ashforth, Burnley</strong><br><br>Wonderstuff'
pausecontent[3]='<i>\“Excellent performance, superbly written play - all aspects of domestic abuse were covered - Well done\”</i><br><br><strong>Victim Support, Preston</strong><br><br>The Lady in Red'
pausecontent[3]='<i>\“Yet again a brilliant interpretation of the issues, illustrating a whole abuse scenario and transporting the audience into it - Really powerful and moving\”</i><br><br><strong>Helen, Burnley Women\'s Refuge</strong><br><br>Life Sentence'


var pausecontent2=new Array()
pausecontent2[0]=''
pausecontent2[1]=''
pausecontent2[2]=''

function pausescroller(content, divId, divClass, delay){
this.content=content //message array content
this.tickerid=divId //ID of ticker div to display information
this.delay=delay //Delay between msg change, in miliseconds.
this.mouseoverBol=0 //Boolean to indicate whether mouse is currently over scroller (and pause it if it is)
this.hiddendivpointer=1 //index of message array for hidden div
document.write('<div id="'+divId+'" class="'+divClass+'" style="position: relative; overflow: hidden"><div class="innerDiv" style="position: absolute; width: 100%" id="'+divId+'1">'+content[0]+'</div><div class="innerDiv" style="position: absolute; width: 100%; visibility: hidden" id="'+divId+'2">'+content[1]+'</div></div>')
var scrollerinstance=this
if (window.addEventListener) //run onload in DOM2 browsers
window.addEventListener("load", function(){scrollerinstance.initialize()}, false)
else if (window.attachEvent) //run onload in IE5.5+
window.attachEvent("onload", function(){scrollerinstance.initialize()})
else if (document.getElementById) //if legacy DOM browsers, just start scroller after 0.5 sec
setTimeout(function(){scrollerinstance.initialize()}, 500)
}


pausescroller.prototype.initialize=function(){
this.tickerdiv=document.getElementById(this.tickerid)
this.visiblediv=document.getElementById(this.tickerid+"1")
this.hiddendiv=document.getElementById(this.tickerid+"2")
this.visibledivtop=parseInt(pausescroller.getCSSpadding(this.tickerdiv))
//set width of inner DIVs to outer DIV's width minus padding (padding assumed to be top padding x 2)
this.visiblediv.style.width=this.hiddendiv.style.width=this.tickerdiv.offsetWidth-(this.visibledivtop*2)+"px"
this.getinline(this.visiblediv, this.hiddendiv)
this.hiddendiv.style.visibility="visible"
var scrollerinstance=this
document.getElementById(this.tickerid).onmouseover=function(){scrollerinstance.mouseoverBol=1}
document.getElementById(this.tickerid).onmouseout=function(){scrollerinstance.mouseoverBol=0}
if (window.attachEvent) //Clean up loose references in IE
window.attachEvent("onunload", function(){scrollerinstance.tickerdiv.onmouseover=scrollerinstance.tickerdiv.onmouseout=null})
setTimeout(function(){scrollerinstance.animateup()}, this.delay)
}


// -------------------------------------------------------------------
// animateup()- Move the two inner divs of the scroller up and in sync
// -------------------------------------------------------------------

pausescroller.prototype.animateup=function(){
var scrollerinstance=this
if (parseInt(this.hiddendiv.style.top)>(this.visibledivtop+5)){
this.visiblediv.style.top=parseInt(this.visiblediv.style.top)-5+"px"
this.hiddendiv.style.top=parseInt(this.hiddendiv.style.top)-5+"px"
setTimeout(function(){scrollerinstance.animateup()}, 50)
}
else{
this.getinline(this.hiddendiv, this.visiblediv)
this.swapdivs()
setTimeout(function(){scrollerinstance.setmessage()}, this.delay)
}
}

// -------------------------------------------------------------------
// swapdivs()- Swap between which is the visible and which is the hidden div
// -------------------------------------------------------------------

pausescroller.prototype.swapdivs=function(){
var tempcontainer=this.visiblediv
this.visiblediv=this.hiddendiv
this.hiddendiv=tempcontainer
}

pausescroller.prototype.getinline=function(div1, div2){
div1.style.top=this.visibledivtop+"px"
div2.style.top=Math.max(div1.parentNode.offsetHeight, div1.offsetHeight)+"px"
}

// -------------------------------------------------------------------
// setmessage()- Populate the hidden div with the next message before it's visible
// -------------------------------------------------------------------

pausescroller.prototype.setmessage=function(){
var scrollerinstance=this
if (this.mouseoverBol==1) //if mouse is currently over scoller, do nothing (pause it)
setTimeout(function(){scrollerinstance.setmessage()}, 100)
else{
var i=this.hiddendivpointer
var ceiling=this.content.length
this.hiddendivpointer=(i+1>ceiling-1)? 0 : i+1
this.hiddendiv.innerHTML=this.content[this.hiddendivpointer]
this.animateup()
}
}

pausescroller.getCSSpadding=function(tickerobj){ //get CSS padding value, if any
if (tickerobj.currentStyle)
return tickerobj.currentStyle["paddingTop"]
else if (window.getComputedStyle) //if DOM2
return window.getComputedStyle(tickerobj, "").getPropertyValue("padding-top")
else
return 0
}









