var actq_head;var actq_tail;function action_add(action){if(actq_head){actq_tail.next=action;actq_tail=action}else{actq_head=action;actq_tail=action;action.next=null;action_start()}}function action_start(){var done=true;while(done&&actq_head){var action=actq_head;done=action.go();if(done){actq_head=actq_head.next;if(!actq_head){actq_tail=null}}}}function action_current(){return actq_head}function action_next(){actq_head=actq_head.next;if(!actq_head){actq_tail=null}action_start()}function action_flush(){actq_head.next=null;actq_tail=actq_head}var intervalID;function doFade(){var action=action_current();var percent=Math.floor((new Date().getTime()-action.startTime)/10);if(percent>=100){if(action.direction>0){action.element.style.display='block'}else{action.element.style.display='none'}action.element.style.opacity=1;action.element.style.filter='';clearInterval(intervalID);intervalID=null;action.onFadeDone();return}if(action.direction<0){percent=100-percent}action.element.style.display='block';action.element.style.opacity=percent/100;action.element.style.filter='alpha(opacity='+percent+')'}function doSlide(){var action=action_current();var delta=new Date().getTime()-action.startTime;if(delta>=1000){action.element.style.left=action.endX+'px';clearInterval(intervalID);intervalID=null;action.onSlideDone();return}var loc=action.startX+Math.floor((action.endX-action.startX)*delta/1000);action.element.style.left=loc+'px'}function doMulSlide(){var action=action_current();var delta=new Date().getTime()-action.startTime;if(delta>=1000){for(var i=0;i<action.toSlide.length;i++){action.toSlide[i].element.style.left=action.toSlide[i].endX+'px'}clearInterval(intervalID);intervalID=null;action.onSlideDone();return}for(var i=0;i<action.toSlide.length;i++){var sd=action.toSlide[i];var loc=sd.startX+Math.floor((sd.endX-sd.startX)*delta/1000);sd.element.style.left=loc+'px'}}function currentLeft(elm){var left=parseInt(elm.style.left);if(isNaN(left)){if(elm.computedStyle){left=parseInt(elm.computedStyle.left)}else if(window.getComputedStyle){left=parseInt(window.getComputedStyle(elm,'').getPropertyValue('left'))}}if(isNaN(left)){left=0}return left}var menuColorIntv;var activeMenu;var menuColors=['#ffffff','#fcfcf7','#fcfbf2','#faf8eb','#faf8e6','#f7f5df','#f5f2d7','#f5f1d0','#f2eec9','#f2eec4','#f0ebbd','#f0eab6','#ede7af','#ebe4a9','#ebe3a4','#e8e09e','#e8e097','#e6dd91','#e3da8a','#e3d986','#e0d67f'];function doMenuColor(){var action=action_current();var delta=new Date().getTime()-action.startTime;if(delta>500){delta=500}delta=Math.round(delta/25);if(action.menuActive){action.menuActive.style.backgroundColor=menuColors[20-delta]}if(action.menuInactive){action.menuInactive.style.backgroundColor=menuColors[delta]}if(delta==20){clearInterval(menuColorIntv);menuColorIntv=null;action.onMenuColorDone()}}function actNewFull(name,pane,formdata){action_add({name:name,pane:pane,formdata:formdata,go:function(){document.getElementById('backarrow').style.display='none';return getPage(this)},onPageLoaded:function(){setPageTitle(this.div);var page=document.getElementById('page');this.toRemove=[];for(var i=0;i<page.childNodes.length;i++){page.childNodes[i].style.zIndex-=100;this.toRemove[i]=page.childNodes[i]}var outerdiv=document.createElement('div');outerdiv.className=this.pane;outerdiv.appendChild(this.div);this.div.className=this.pane+'2';outerdiv.style.zIndex=1000;outerdiv.style.display='none';page.appendChild(outerdiv);this.element=outerdiv;this.startTime=new Date().getTime();this.direction=+1;intervalID=setInterval("doFade()",50);this.fadeDone=false;this.menuActive=getMenuForPage(this.div);this.menuInactive=activeMenu;if(this.menuActive!=this.menuInactive){menuColorIntv=setInterval("doMenuColor()",25);this.menuColorDone=false}else{this.menuColorDone=true}if(name=='home'){onHomePageLoad()}if(name=='valorder4'){onValOrder4Load()}},onFadeDone:function(){for(var i=0;i<this.toRemove.length;i++){this.toRemove[i].parentNode.removeChild(this.toRemove[i])}if(this.menuColorDone){action_next()}else{this.fadeDone=true}},onMenuColorDone:function(){activeMenu=this.menuActive;if(this.fadeDone){action_next()}else{this.menuColorDone=true}}});if(name=='about'){actNewSplit('aboutimg','right')}}function actShiftFull(name){action_add({name:name,go:function(){return getPage(this)},onPageLoaded:function(){setPageTitle(this.div);var page=document.getElementById('page');for(var i=0;i<page.childNodes.length;i++){page.childNodes[i].style.zIndex=500}var outerdiv=document.createElement('div');outerdiv.className='full';outerdiv.appendChild(this.div);this.div.className='full2';outerdiv.style.left='740px';outerdiv.style.zIndex=1000;page.appendChild(outerdiv);this.element=outerdiv;this.startTime=new Date().getTime();this.startX=740;this.endX=0;intervalID=setInterval("doSlide()",50)},onSlideDone:function(){document.getElementById('backarrow').style.display='block';action_next()}})}function actUnshiftFull(){action_add({go:function(){document.getElementById('backarrow').style.display='none';var page=document.getElementById('page');setPageTitle(page.firstChild);var outerdiv=page.lastChild;this.element=page.lastChild;this.startTime=new Date().getTime();this.startX=0;this.endX=740;intervalID=setInterval("doSlide()",50)},onSlideDone:function(){var page=document.getElementById('page');page.removeChild(page.lastChild);action_next()}})}function actNewSplit(name){action_add({name:name,go:function(){document.getElementById('backarrow').style.display='none';return getPage(this)},onPageLoaded:function(){var page=document.getElementById('page');this.toRemove=[];for(var i=0;i<page.childNodes.length;i++){if(page.childNodes[i].className=='right'){page.childNodes[i].style.zIndex-=100;this.toRemove[this.toRemove.length]=page.childNodes[i]}}var outerdiv=document.createElement('div');outerdiv.className='right';outerdiv.appendChild(this.div);this.div.className='right2';outerdiv.style.left='740px';outerdiv.style.zIndex=1000;page.appendChild(outerdiv);this.element=outerdiv;this.startTime=new Date().getTime();this.startX=740;this.endX=405;intervalID=setInterval("doSlide()",50)},onSlideDone:function(){for(var i=0;i<this.toRemove.length;i++){this.toRemove[i].parentNode.removeChild(this.toRemove[i])}action_next()}})}function actNewThird(name){action_add({name:name,go:function(){return getPage(this)},onPageLoaded:function(){var page=document.getElementById('page');this.toSlide=[];for(var i=0;i<page.childNodes.length;i++){var elm=page.childNodes[i];var x=currentLeft(elm);if(isNaN(x)){x=0}this.toSlide[i]={element:elm,startX:x,endX:x-340}}var outerdiv=document.createElement('div');outerdiv.className='right';outerdiv.appendChild(this.div);this.div.className='right2';outerdiv.style.left='740px';page.appendChild(outerdiv);this.toSlide[this.toSlide.length]={element:outerdiv,startX:740,endX:405};this.startTime=new Date().getTime();intervalID=setInterval("doMulSlide()",50)},onSlideDone:function(){document.getElementById('backarrow').style.display='block';action_next()}})}function actReplaceThird(name){action_add({name:name,go:function(){return getPage(this)},onPageLoaded:function(){var page=document.getElementById('page');this.toRemove=page.lastChild;var outerdiv=document.createElement('div');outerdiv.className='right';outerdiv.appendChild(this.div);this.div.className='right2';outerdiv.style.left='740px';page.appendChild(outerdiv);this.startTime=new Date().getTime();this.element=outerdiv;this.startX=740;this.endX=405;intervalID=setInterval("doSlide()",50)},onSlideDone:function(){this.toRemove.parentNode.removeChild(this.toRemove);action_next()}})}function actUnshiftThird(){action_add({name:name,go:function(){document.getElementById('backarrow').style.display='none';var page=document.getElementById('page');this.toSlide=[];for(var i=0;i<page.childNodes.length;i++){var elm=page.childNodes[i];var x=currentLeft(elm);if(isNaN(x)){x=0}this.toSlide[i]={element:elm,startX:x,endX:x+340}}this.startTime=new Date().getTime();intervalID=setInterval("doMulSlide()",50)},onSlideDone:function(){var page=document.getElementById('page');page.removeChild(page.lastChild);action_next()}})}function getPage(action){var request;try{request=new XMLHttpRequest()}catch(t){try{request=new ActiveXObject("Msxml2.XMLHTTP")}catch(t2){try{request=new ActiveXObject("Microsoft.XMLHTTP")}catch(t3){alert("Could not create XML-HTTP request.");action_flush();return true}}}var url=location.href;url=url.substr(0,url.lastIndexOf('/'))+'/inner.php';request.onreadystatechange=function(){onRSC(request,action)};if(action.formdata){request.open("POST",url,true);request.setRequestHeader("Content-Type",'application/x-www-form-urlencoded');request.send('page='+action.name+'&'+action.formdata)}else{request.open("GET",url+'?page='+action.name,true);request.send(null)}return false}function onRSC(request,action){if(request.readyState!=4){return}if(request.status!=200){alert("XML HTTP request returned "+request.status);action_flush();action_next()}else{pageTracker._trackPageview('/'+action.name+'.html');var div=document.createElement('div');div.innerHTML=request.responseText;scanTree(div);action.div=div;action.onPageLoaded()}}function onHyperlink(evt,atag){evt=(evt)?evt:event;var anchor=evt.target?evt.target:evt.srcElement;if(atag){anchor=atag}while(anchor.tagName.toLowerCase()!='a'){anchor=anchor.parentNode}if(anchor.href.substr(0,11)=='javascript:'){return}var pane=anchor.getAttribute('pane');if(!pane){pane='full'}var parts=anchor.href.match(/([^\/]*)\.html/);var page=parts[1];showPage(page,pane);if(evt.returnValue){evt.returnValue=false}if(evt.preventDefault){evt.preventDefault()}return false}var unshift;function showPage(page,pane){switch(pane){default:actNewFull(page,pane);unshift=null;break;case'shfull':actShiftFull(page);unshift='full';break;case'split':actNewSplit(page);unshift=null;break;case'third':if(unshift=='third'){actReplaceThird(page)}else{actNewThird(page)}unshift='third';break}}function ajaxFormSubmit(form){var parts=form.action.match(/([^\/]*)\.html/);var page=parts[1];var formdata='';var sep='';for(var i=0;i<form.elements.length;i++){switch(form.elements[i].tagName){case'INPUT':if(form.elements[i].type=='radio'||form.elements[i].type=='checkbox'){if(!form.elements[i].checked){continue}}case'TEXTAREA':formdata+=sep+escape(form.elements[i].name)+'='+escape(form.elements[i].value);break;case'SELECT':for(var j=0;j<form.elements[i].length;j++){if(form.elements[i].options[j].selected){formdata+=sep+escape(form.elements[i].name)+'='+escape(form.elements[i].options[j].value);sep='&'}}break;default:alert('Unknown form element '+form.elements[i].tagName);return}sep='&'}actNewFull(page,'full',formdata)}function onBackArrow(){switch(unshift){case'full':actUnshiftFull();break;case'third':actUnshiftThird();break}unshift=null}var menus=[];function menuInit(){var tds=document.getElementsByTagName('td');for(var i=0;i<tds.length;i++){if(tds[i].className!='menuitem'){continue}var newmenu={elm:tds[i],interval:null,startY:0,destY:0,startTime:0};menus[menus.length]=newmenu;tds[i].onmouseover=onMenuMOver;tds[i].onmouseout=onMenuMOut;tds[i].onclick=onMenuClick;if(tds[i].style.backgroundColor){activeMenu=tds[i]}tds[i].firstChild.style.visibility='hidden'}}function onMenuMOver(evt){onMenuMMove(evt,0,-400)}function onMenuMOut(evt){onMenuMMove(evt,-400,0)}function onMenuMMove(evt,from,to){evt=(evt)?evt:event;var elm=evt.target?evt.target:evt.srcElement;if(elm.tagName.toLowerCase()=='a'){elm=elm.parentNode}for(var i=0;i<menus.length;i++){if(menus[i].elm==elm){break}}var menu=menus[i];if(menu.destY!=to){if(menu.interval){var now=new Date().getTime();var elapsed=now-menu.startTime;if(elapsed>500){elapsed=500}menu.startTime=now-500+elapsed;menu.startY=menu.destY;menu.destY=to}else{menu.destY=to;menu.startY=from;menu.startTime=new Date().getTime();menu.interval=setInterval('onMenuInterval('+i+');',25)}}}function onMenuClick(evt){evt=(evt)?evt:event;var elm=evt.target?evt.target:evt.srcElement;if(elm.tagName.toLowerCase()=='a'){return}onHyperlink(evt,elm.firstChild)}function onMenuInterval(id){var menu=menus[id];var elapsed=new Date().getTime()-menu.startTime;if(elapsed>500){elapsed=500}var newY=menu.startY+(menu.destY-menu.startY)*(elapsed/500);newY=20*Math.round(newY/20);menu.elm.style.backgroundPosition='0px '+newY+'px';if(elapsed>=500){clearInterval(menu.interval);menu.interval=null}}function setPageTitle(div){var pagedata=div.getElementsByTagName('input')[0].value.split(':');if(pagedata[0]!=''){document.title='Voices in Harmony - '+pagedata[0]}}function getMenuForPage(div){var pagedata=div.getElementsByTagName('input')[0].value.split(':');var menuname=pagedata[1];var menuelm=document.getElementById('menu:'+menuname);return menuelm}function scanTree(root){var anchors=root.getElementsByTagName('a');for(var i=0;i<anchors.length;i++){if(anchors[i].href&&!anchors[i].target){anchors[i].onclick=onHyperlink}}anchors=root.getElementsByTagName('area');for(var i=0;i<anchors.length;i++){if(anchors[i].href&&!anchors[i].target){anchors[i].onclick=onHyperlink}}}function onWindowLoad(){scanTree(document);menuInit()}window.onload=onWindowLoad;function onCDSub(){var value=parseInt(document.cdform.quantity.value);if(isNaN(value)||value<=0){alert('Please specify the number of CDs you want to purchase.');return false}return true}function onSTixSub(){var value=parseInt(document.stixform.qty.value);if(isNaN(value)||value<=0){alert('Please specify the number of season tickets you want to purchase.');return false}return true}function onDonSub(){if(document.donform.method[2].checked){alert('Please make your check payable to "Voices in Harmony",\nand mail it to:\n\nVoices in Harmony\nP.O. Box 7447\nSan Jose, CA  95155\n\nThank you for your donation!');return false}if(!document.donform.level[0].checked&&!document.donform.level[1].checked&&!document.donform.level[2].checked&&!document.donform.level[3].checked&&!document.donform.level[4].checked){alert('Please specify your donation level.');return false}if(document.donform.level[4].checked){var value=parseInt(document.donform.amount.value);if(isNaN(value)||value<=0){alert('Please specify your donation amount.');return false}}return true}function viewPastPerf(){var vis=document.getElementById('performances');if(vis.firstChild.tagName.toLowerCase()=='tbody'){vis=vis.firstChild}var invis=document.getElementById('pastperf');if(invis.firstChild.tagName.toLowerCase()=='tbody'){invis=invis.firstChild}vis.removeChild(vis.firstChild);while(invis.childNodes.length){var row=invis.lastChild;invis.removeChild(row);vis.insertBefore(row,vis.firstChild)}}var vihListener={onInit:function(){},onUpdate:function(){}};function play(track){var flash=document.getElementById('playembed');flash.SetVariable("method:setUrl",'media/cd-excerpt/'+track+'.mp3?'+new Date().getTime());flash.SetVariable("method:setPosition",0);flash.SetVariable("method:setVolume",50);flash.SetVariable("method:play",'');flash.SetVariable("enabled",'true')}function endPlay(){document.getElementById('playembed').innerHTML=''}function onSingValSub(){ajaxFormSubmit(document.singvalform);return false}function onSingValService1(){document.singvalform.nextbut.disabled=false}function onSingValSub1(){ajaxFormSubmit(document.singvalform);return false}function onInputHintFocus(evt){evt=(evt)?evt:event;var input=evt.target?evt.target:evt.srcElement;if(input.className=='hint'){input.className='';input.value=''}}function onSingValSub2(){ajaxFormSubmit(document.singvalform);return false}function onSingValSub3(){var bad=false;if(document.singvalform.date.selectedIndex<=0){document.singvalform.date.style.border="thick solid red";bad=true}if(document.singvalform.roughtime&&document.singvalform.roughtime.selectedIndex<=0){document.singvalform.roughtime.style.border="thick solid red";bad=true}if(document.singvalform.exacttime&&document.singvalform.exacttime.selectedIndex<=0){document.singvalform.exacttime.style.border="thick solid red";bad=true}if(document.singvalform.phone_deliver&&document.singvalform.phone_deliver.value==""){document.singvalform.phone_deliver.style.border="thick solid red";bad=true}if(document.singvalform.email_deliver&&document.singvalform.email_deliver.value==""){document.singvalform.email_deliver.style.border="thick solid red";bad=true}if(document.singvalform.inperson_deliver&&document.singvalform.inperson_deliver.value==""){document.singvalform.inperson_deliver.style.border="thick solid red";bad=true}if(document.singvalform.recipient.value==""){document.singvalform.recipient.style.border="thick solid red";bad=true}if(document.singvalform.phone_dayof.value==""){document.singvalform.phone_dayof.style.border="thick solid red";bad=true}if(bad){return false}ajaxFormSubmit(document.singvalform);return false}function onValOrder4Load(){setTimeout("document.singvalform.submit();",3000)}var topreload=['perf_top','0_1','0_2','perf_bot','1_1','1_2'];var preloaded=[];function onHomePageLoad(){if(document.images){for(var i=0;i<topreload.length;i++){preloaded[i]=new Image();preloaded[i].src='img/home/over_'+topreload[i]+'.gif'}}var homeimgs=document.getElementsByTagName('img');for(var i=0;i<homeimgs.length;i++){if(homeimgs[i].className=='homeimg'){homeimgs[i].onmouseover=onHomeImgMouseOver;homeimgs[i].onmouseout=onHomeImgMouseOut}}}function onHomeImgMouseOver(evt){evt=(evt)?evt:event;var img=evt.target?evt.target:evt.srcElement;img.src=img.src.replace(/slice/,'over')}function onHomeImgMouseOut(evt){evt=(evt)?evt:event;var img=evt.target?evt.target:evt.srcElement;img.src=img.src.replace(/over/,'slice')}function playerReady(obj){var player=document.getElementById('joinusplayer');if(player){player.addModelListener('STATE','onJoinUsPlayerState')}}function onJoinUsPlayerState(obj){if(obj.newstate=='IDLE'||obj.newstate=='COMPLETED'||obj.newstate=='PAUSED'){showPage('join','full')}}