/**
 * @author Colin
 * Function List:
 * getHTTPObject(),setOutput(),logIn(),logEnable(),doWork(),setOutputJoinUs(),startUp(),Jvalidate(),confirmEmail(),reenable(),limitText()
 * setOutputSearch(),startUpSearch(),checkDetails(),checkAll(),setOutputDetails(),startUpDetails(),goNext(),goPrev(),goPrint()
 */
var httpObject = null; 
function getHTTPObject(){   
if (window.ActiveXObject) 
 return new ActiveXObject("Microsoft.XMLHTTP");   
 else if (window.XMLHttpRequest) 
 return new XMLHttpRequest();   
 else {      
 alert("Your browser does not support AJAX.");      
 return null;  
 }
} 

function joinUs(){
 document.getElementById("dleftHome").style.display="none";
 document.getElementById("drightHome").style.display="none";
 document.getElementById("dleftJoin").style.display="inline";
 document.getElementById("dleftJoin").style.visibility="visible"; 
 document.getElementById("drightJoin").style.display="inline";
 document.getElementById("drightJoin").style.visibility="visible"; 
 document.getElementById("mainSearch").style.display="none";
 document.getElementById("mainSearch").style.visibility="hidden";
 document.getElementById("contactUs").style.display="none";
 document.getElementById("contactUs").style.visibility="hidden";
 document.getElementById("logMeIn").style.display="none";
 document.getElementById("logMeIn").style.visibility="hidden";
 document.getElementById("regger").fname.focus();
 document.getElementById("myhome").style.borderBottom="thin solid rgb(144,144,144)";
 document.getElementById("mysearch").style.borderBottom="thin solid rgb(144,144,144)";
 document.getElementById("mycontact").style.borderBottom="thin solid rgb(144,144,144)";
 document.getElementById("mylogin").style.borderBottom="thin solid rgb(144,144,144)";
 document.getElementById("myjoin").style.backgroundImage="url(images/tab2white.png)";
 document.getElementById("myjoin").style.backgroundRepeat="no-repeat";
 document.getElementById("myhome").style.backgroundImage="url(images/tab2.png)";
 document.getElementById("myhome").style.backgroundRepeat="no-repeat";
 document.getElementById("mycontact").style.backgroundImage="url(images/tab2.png)";
 document.getElementById("mycontact").style.backgroundRepeat="no-repeat";
 document.getElementById("mylogin").style.backgroundImage="url(images/tab2.png)";
 document.getElementById("mylogin").style.backgroundRepeat="no-repeat";
 document.getElementById("mysearch").style.backgroundImage="url(images/tab2.png)";
 document.getElementById("mysearch").style.backgroundRepeat="no-repeat";
 document.getElementById("myjoin").style.borderBottom="none";
}
function goHome(){
myURL= window.location.href;
 splitName = myURL.split("?")
 var aPosition = splitName[0].indexOf("theDetails.php");
 if (aPosition > 0) {
 	window.location = "index.php"
 } else {
 	document.getElementById("dleftJoin").style.display = "none";
	document.getElementById("dleftJoin").style.visibility="hidden";
	document.getElementById("drightJoin").style.display = "none";
	document.getElementById("drightJoin").style.visibility="hidden";
 	document.getElementById("mainSearch").style.display = "none";
 	document.getElementById("mainSearch").style.visibility = "hidden";
	document.getElementById("contactUs").style.display="none";
    document.getElementById("contactUs").style.visibility="hidden";
 	document.getElementById("logMeIn").style.display = "none";
 	document.getElementById("logMeIn").style.visibility = "hidden";
 	document.getElementById("myjoin").style.borderBottom="thin solid rgb(144,144,144)";
    document.getElementById("mysearch").style.borderBottom="thin solid rgb(144,144,144)";
    document.getElementById("mylogin").style.borderBottom="thin solid rgb(144,144,144)";
	document.getElementById("mycontact").style.borderBottom="thin solid rgb(144,144,144)";
    document.getElementById("myjoin").style.backgroundImage="url(images/tab2.png)";
    document.getElementById("myjoin").style.backgroundRepeat="no-repeat";
    document.getElementById("myhome").style.backgroundImage="url(images/tab2white.png)";
    document.getElementById("myhome").style.backgroundRepeat="no-repeat";
    document.getElementById("mylogin").style.backgroundImage="url(images/tab2.png)";
    document.getElementById("mylogin").style.backgroundRepeat="no-repeat";
    document.getElementById("mysearch").style.backgroundImage="url(images/tab2.png)";
    document.getElementById("mysearch").style.backgroundRepeat="no-repeat";
	document.getElementById("mycontact").style.backgroundImage="url(images/tab2.png)";
    document.getElementById("mycontact").style.backgroundRepeat="no-repeat";
   	document.getElementById("dleftHome").style.display = "inline";
 	document.getElementById("dleftHome").style.visibility = "visible";
	document.getElementById("drightHome").style.display = "inline";
 	document.getElementById("drightHome").style.visibility = "visible";
 	document.getElementById("myhome").style.borderBottom = "none";
  	document.getElementById("dleftHome").focus();
 }
}
function searchUs(){
 document.getElementById("dleftJoin").style.display = "none";
 document.getElementById("drightJoin").style.display = "none";
 document.getElementById("dleftHome").style.display="none";
 document.getElementById("drightHome").style.display="none";
 document.getElementById("logMeIn").style.display="none";
 document.getElementById("contactUs").style.display="none";
 document.getElementById("contactUs").style.visibility="hidden";
 document.getElementById("mainSearch").style.display="inline";
 document.getElementById("mainSearch").style.visibility="visible";
 document.getElementById("myjoin").style.borderBottom="thin solid rgb(144,144,144)";
 document.getElementById("myhome").style.borderBottom="thin solid rgb(144,144,144)";
 document.getElementById("mylogin").style.borderBottom="thin solid rgb(144,144,144)";
 document.getElementById("mycontact").style.borderBottom="thin solid rgb(144,144,144)";
 document.getElementById("myjoin").style.backgroundImage="url(images/tab2.png)";
 document.getElementById("myjoin").style.backgroundRepeat="no-repeat";
 document.getElementById("myhome").style.backgroundImage="url(images/tab2.png)";
 document.getElementById("myhome").style.backgroundRepeat="no-repeat";
 document.getElementById("mylogin").style.backgroundImage="url(images/tab2.png)";
 document.getElementById("mylogin").style.backgroundRepeat="no-repeat";
 document.getElementById("mycontact").style.backgroundImage="url(images/tab2.png)";
 document.getElementById("mycontact").style.backgroundRepeat="no-repeat";
 document.getElementById("mysearch").style.backgroundImage="url(images/tab2white.png)";
 document.getElementById("mysearch").style.backgroundRepeat="no-repeat";
 document.getElementById("mysearch").style.borderBottom="none";
 document.getElementById("slist").focus();
 document.getElementById("slist").hideFocus=true;
}
function showLog(){
 document.getElementById("dleftJoin").style.display = "none";
 document.getElementById("drightJoin").style.display = "none";
 document.getElementById("dleftHome").style.display="none";
 document.getElementById("drightHome").style.display="none";
 document.getElementById("mainSearch").style.display="none";
 document.getElementById("contactUs").style.display="none";
 document.getElementById("contactUs").style.visibility="hidden";
 document.getElementById("logMeIn").style.display="inline";
 document.getElementById("logMeIn").style.visibility="visible";
 document.getElementById("myjoin").style.borderBottom="thin solid rgb(144,144,144)";
 document.getElementById("myhome").style.borderBottom="thin solid rgb(144,144,144)";
 document.getElementById("mysearch").style.borderBottom="thin solid rgb(144,144,144)";
 document.getElementById("mycontact").style.borderBottom="thin solid rgb(144,144,144)";
 document.getElementById("myjoin").style.backgroundImage="url(images/tab2.png)";
 document.getElementById("myjoin").style.backgroundRepeat="no-repeat";
 document.getElementById("myhome").style.backgroundImage="url(images/tab2.png)";
 document.getElementById("myhome").style.backgroundRepeat="no-repeat";
 document.getElementById("mycontact").style.backgroundImage="url(images/tab2.png)";
 document.getElementById("mycontact").style.backgroundRepeat="no-repeat";
 document.getElementById("mylogin").style.backgroundImage="url(images/tab2white.png)";
 document.getElementById("mylogin").style.backgroundRepeat="no-repeat";
 document.getElementById("mylogin").style.borderBottom="none";
 document.getElementById("logger").focus();
}
function contactUs(){
 document.getElementById("dleftJoin").style.display = "none";
 document.getElementById("drightJoin").style.display = "none";
 document.getElementById("dleftHome").style.display="none";
 document.getElementById("drightHome").style.display="none";
 document.getElementById("logMeIn").style.display="none";
 document.getElementById("mainSearch").style.display="none";
 document.getElementById("mainSearch").style.visibility="hidden";
 document.getElementById("contactUs").style.display="inline";
 document.getElementById("contactUs").style.visibility="visible";
 document.getElementById("myjoin").style.borderBottom="thin solid rgb(144,144,144)";
 document.getElementById("myhome").style.borderBottom="thin solid rgb(144,144,144)";
 document.getElementById("mylogin").style.borderBottom="thin solid rgb(144,144,144)";
 document.getElementById("mysearch").style.borderBottom="thin solid rgb(144,144,144)";
 document.getElementById("mysearch").style.backgroundImage="url(images/tab2.png)";
 document.getElementById("mysearch").style.backgroundRepeat="no-repeat";
 document.getElementById("myhome").style.backgroundImage="url(images/tab2.png)";
 document.getElementById("myhome").style.backgroundRepeat="no-repeat";
 document.getElementById("mylogin").style.backgroundImage="url(images/tab2.png)";
 document.getElementById("mylogin").style.backgroundRepeat="no-repeat";
 document.getElementById("myjoin").style.backgroundImage="url(images/tab2.png)";
 document.getElementById("myjoin").style.backgroundRepeat="no-repeat";
 document.getElementById("mycontact").style.backgroundImage="url(images/tab2white.png)";
 document.getElementById("mycontact").style.backgroundRepeat="no-repeat";
 document.getElementById("mycontact").style.borderBottom="none";
 document.getElementById("ntext").focus();
 document.getElementById("ntext").hideFocus=true;
}
function setOutputIndex(){    
 if(httpObject.readyState == 4){ 
  result = httpObject.responseText; 
  if(result=="XX"){
	alert("Invalid Log In Details!");
	document.getElementById('logger').value='';
	document.getElementById('logButton').disabled=true;
  } else {
  	//alert(result);
  	navInner='|| <a href="index.php">Home</a> | <a href="searchAlpha.php">Search </a> | <a href="approvemem.php"> Approve '+
	'</a> | <a href="indexArtists.php"> Check Index </a> | <a href="logOut.php"> Log Out </a>||';
  	document.getElementById("navigation").innerHTML=navInner;
	//window.location="index.php";
  }
 }
}
function logInConnect(){
	var url="sendConnectDetails.php";
	var theLetter=document.getElementById("logger").value;
	var parameters="&password"+"="+theLetter;
	httpObject = getHTTPObject();
    if (httpObject != null) {   
	 httpObject.open("POST",url, true); 
	 httpObject.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
     httpObject.setRequestHeader("Content-length", parameters.length);
     httpObject.setRequestHeader("Connection", "close");
	 httpObject.send(parameters);         
	 httpObject.onreadystatechange = setConnectIndex;    
	}
}
function logIn(){
	document.getElementById("searching").innerHTML = "<img src='images/logginginAction.gif' />";
	var url="sendLogDetails.php";
	var theLetter=document.getElementById("logger").value;
	var parameters="&password"+"="+theLetter;
	httpObject = getHTTPObject();
    if (httpObject != null) {   
	 httpObject.open("POST",url, true); 
	 httpObject.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
     httpObject.setRequestHeader("Content-length", parameters.length);
     httpObject.setRequestHeader("Connection", "close");
	 httpObject.send(parameters);         
	 httpObject.onreadystatechange = setOutputIndex;    
	}
}
function setConnectIndex(){  
 
 	document.getElementById("searching").innerHTML = "<img src='images/ajax-loader-bar.gif' />";
 
 if(httpObject.readyState == 4){ 
  result = httpObject.responseText; 
  if(result=="1"){
  	//alert("connect ok");
  	logIn();
  } else {
    alert(result);
	document.getElementById('logger').value='';
  }
 }
}
function setOutputIndex(){  
  if (httpObject.readyState != 4) {
  	document.getElementById("searching").innerHTML = "<img src='images/ajax-loader-bar.gif' />";
  }
  else {
  	if (httpObject.readyState == 4) {
  		result = httpObject.responseText;
  		if (result == "1") {
  			window.location = "admin/indexadmin.php";
  		}
  		else {
  			alert(result);
  			document.getElementById('logger').value = '';
  		}
  	}
  }
}
function logEnable(){
	document.getElementById("logButton").disabled=false;
}
function doWork(url, parameters, theoutput){  
  httpObject = getHTTPObject();
  if (httpObject != null) {   
	httpObject.open("POST", url, true); 
	httpObject.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    httpObject.setRequestHeader("Content-length", parameters.length);
    httpObject.setRequestHeader("Connection", "close");
	httpObject.send(parameters);         
	httpObject.onreadystatechange = eval(theoutput); //setOutputJoinUs;    
  }
} 
function setOutputJoinUs(){    
 if(httpObject.readyState == 4){        
   result = httpObject.responseText;
   if (result=="0"){
   	alert("This email is already registered - Please use a different one or get in touch with office@scotfolk.org ");
   }
   if (result=="1"){
   	alert("A Problem Was Encountered - Please Try Later");
   }
   if (result=="2"){
	if (confirm("Details Added OK! - Do you want to email your image now?")){
  	 document.location="mailto:office@scotfolk.org";
	}
   } 
   document.getElementById("reset").click(); 
   window.location="index.php"; 
 } 
}
function startUp() {
if (Jvalidate()){
	 var fn=document.getElementById("fname").value;
	 var ln=document.getElementById("lname").value;
	 var bn=document.getElementById("busname").value;
	 var indexedon=fn.substr(0,1)+ln.substr(0,1)+bn.substr(0,1);
	 var poststr = "&fname="+escape(encodeURI(document.getElementById("fname").value))+
                   "&lname="+escape(encodeURI(document.getElementById("lname").value))+
									 "&busname="+escape(encodeURI(document.getElementById("busname").value))+
                                     "&email="+escape(encodeURI(document.getElementById("email").value))+
									 "&web1="+escape(encodeURI(document.getElementById("web1").value))+
									 "&streetnum="+escape(encodeURI(document.getElementById("streetnum").value))+
									 "&town="+escape(encodeURI(document.getElementById("town").value))+
									 "&county="+escape(encodeURI(document.getElementById("county").value))+
                                     "&postcode="+escape(encodeURI(document.getElementById("postcode").value))+
									 "&country="+escape(encodeURI(document.getElementById("country").value))+
									 "&message="+escape(encodeURI(document.getElementById("message").value))+
									 "&pes0="+escape(encodeURI(document.getElementById("pes0").checked))+
									 "&pes1="+escape(encodeURI(document.getElementById("pes1").checked))+
									 "&pes2="+escape(encodeURI(document.getElementById("pes2").checked))+
									 "&pes3="+escape(encodeURI(document.getElementById("pes3").checked))+
									 "&pes4="+escape(encodeURI(document.getElementById("pes4").checked))+
									 "&pes5="+escape(encodeURI(document.getElementById("pes5").checked))+
									 "&pes6="+escape(encodeURI(document.getElementById("pes6").checked))+
									 "&pes7="+escape(encodeURI(document.getElementById("pes7").checked))+
									 "&pes8="+escape(encodeURI(document.getElementById("pes8").checked))+
									 "&pes9="+escape(encodeURI(document.getElementById("pes9").checked))+
									 "&pes10="+escape(encodeURI(document.getElementById("pes10").checked))+
									 "&pes11="+escape(encodeURI(document.getElementById("pes11").checked))+
									 "&pes12="+escape(encodeURI(document.getElementById("pes12").checked))+
									 "&pes13="+escape(encodeURI(document.getElementById("pes13").checked))+
									 "&pes14="+escape(encodeURI(document.getElementById("pes14").checked))+
									 "&pes15="+escape(encodeURI(document.getElementById("pes15").checked))+
									 "&pes16="+escape(encodeURI(document.getElementById("pes16").checked))+
									 "&pes17="+escape(encodeURI(document.getElementById("pes17").checked))+
									 "&pes18="+escape(encodeURI(document.getElementById("pes18").checked))+
									 "&pes19="+escape(encodeURI(document.getElementById("pes19").checked))+
									 "&pes20="+escape(encodeURI(document.getElementById("pes20").checked))+
									 "&pes21="+escape(encodeURI(document.getElementById("pes21").checked))+
									 "&pes22="+escape(encodeURI(document.getElementById("pes22").checked))+
									 "&pes23="+escape(encodeURI(document.getElementById("pes23").checked))+
									 "&pes24="+escape(encodeURI(document.getElementById("pes24").checked))+
									 "&pes25="+escape(encodeURI(document.getElementById("pes25").checked))+
									 "&pes26="+escape(encodeURI(document.getElementById("pes26").checked))+
									 "&pes27="+escape(encodeURI(document.getElementById("pes27").checked))+
									 "&pes28="+escape(encodeURI(document.getElementById("pes28").checked))+
									 "&pes29="+escape(encodeURI(document.getElementById("pes29").checked))+
									 "&pes30="+escape(encodeURI(document.getElementById("pes30").checked))+
									 "&pes31="+escape(encodeURI(document.getElementById("pes31").checked))+
									 "&pes32="+escape(encodeURI(document.getElementById("pes32").checked))+
									 "&pes33="+escape(encodeURI(document.getElementById("pes33").checked))+
									 "&pes34="+escape(encodeURI(document.getElementById("pes34").checked))+
									 "&pes35="+escape(encodeURI(document.getElementById("pes35").checked))+
									 "&indexedon="+indexedon;
									 doWork('sendUserDetails.php', poststr,'setOutputJoinUs');
 }
}
function Jvalidate() {
  var theMessage = "Invalid Details - The following are required: \n-----------------------------------\n";
  var noErrors = true;
  // make sure the first name field is not blank
  if (document.getElementById("regger").fname.value=="") {
      theMessage = theMessage + "\n --> First Name";
      noErrors = false;
	}
	// make sure the last name field is not blank
	 if (document.getElementById("regger").lname.value=="") {
      theMessage = theMessage + "\n --> Last Name";
      noErrors = false;
  }
  // make sure the band name field is not blank
  if (document.getElementById("regger").busname.value=="") {
      theMessage = theMessage + "\n --> Band/Festival/Shop Name";
      noErrors = false;
  }
	 // make sure the email field is not blank
	theEmail=document.getElementById("regger").email.value;
	
  if (theEmail=="") {
    theMessage = theMessage + "\n --> Email";
    noErrors = false;
  } 
  myChoices = document.getElementsByName("pes");
  numChoices = myChoices.length;
	noChoices=true;
	for(i=0;i<numChoices;i++){
	 if (myChoices[i].checked==true){
	  noChoices=false;
		break;
   } 
	}
  if (noChoices){
	 noErrors=false;
	 theMessage = theMessage + "\n --> You must make at least one Category Selection";
	}
// If no errors, submit the form
  if (noErrors) {
      return true;
  } else {
    // errors were found, show alert message
    alert(theMessage);
    return false;
 }
}

function confirmEmail(){
 theEmail=document.getElementById("email").value;
 reEmail=prompt("Please confirm your email address: ","");
 while (reEmail != theEmail) {
  theEmail=prompt("Confirmation email - no match, please enter your email: ","");
	reEmail=prompt("Please confirm your email address: ","");
 }
}
function getIndexDetails(i){
  var myID="eMail"+i;
  var myDel="delName"+i;
  poststr="&email"+"="+document.getElementById(myID).innerHTML;
  //alert(poststr);
  if (okeedokee=confirm("Are You Sure You Want to Delete the Selected Entries?")) {
  	doWork('deleteArtistDetails.php', poststr, 'setDeleteApprove');
  } else {
  	//alert(document.getElementById(myDel).checked);
	document.getElementById(myDel).checked=false;
  }
}
function goAllIndexArtist(){
 theTable='<form id="dForm" ><table align="center"><tr><th colspan="4">Search Results</th></tr>'+
           '<tr class="yellow"><td>Contact Name</td><td>Name</td><td>Email</td>'+
           '<td>Indexed On</td></tr>';
  for (i=0;i<numArtists;i++){
   theTable+="<tr><td>"+myArtist.artists[i].busname.replace(regExp,' ')+"</td>"+
             "<td>"+myArtist.artists[i].fname+" "+myArtist.artists[i].lname.replace(regExp,' ')+"</td>"+
		     //"<td id='eMail"+i+"'>"+myArtist.artists[i].email.replace(regExp,' ')+"</td>"+
			 "<td id='eMail"+i+"'>"+myArtist.artists[i].email.replace(regExp,' ')+"</td>"+
			 "<td><input type='text' name='dName' id='dName"+i+"' value='"+myArtist.artists[i].indexedon+"'/></td></tr>";
 }
 theTable+="</table><br /><input type='button' value='Update' onclick='checkDetailsIndexArtist()' />"+
		   "<input type='reset' id='myReset' value='Reset' /></form>";
 document.getElementById("l1").innerHTML=theTable;
 //document.getElementById("all").disabled=true;
}
function reenable(){
 document.getElementById("myButton").disabled=false;
}
function limitText(limitField, limitCount, limitNum) {
	if (limitField.value.length > limitNum) {
		limitField.value = limitField.value.substring(0, limitNum);
	} else {
		limitCount.value = limitNum - limitField.value.length;
	}
}
function setOutputSearch(){  
//alert("setoutput");
 if(httpObject.readyState == 4){ 
  document.getElementById("l1").innerHTML='';
  regExp = /\%20+/g;
  result = httpObject.responseText; 
	if(result=="No Matches Found!"){
	 document.getElementById("hits").innerHTML="<h3>Your Search Returned Zero Entries on <span style='color:blue'>"+theLetter+" </span></h3>";
	} else {	
	//alert(result);
	 myArtist = eval('(' + httpObject.responseText + ')');
	 numArtists=myArtist.artists.length;
	 document.getElementById("hits").innerHTML="<h3>Your Search Returned "+numArtists+" Entries on <span style='color:blue'>"+theLetter+" </span></h3><p>Search Results</p>";
     goAll();
  } 
 }
}
function startUpSearch(letter) {
    var poststr;
    theLetter=letter;
	poststr="&artist"+"="+theLetter;
    doWork('sendSearchDetailsAlpha.php', poststr,'setOutputSearch');
}
function checkDetails(){
 var myStr="";
 var j=0;
 myChoices = document.getElementsByName("dName");
 numChoices = myChoices.length;
 //alert(numChoices);
 noChoices=true;
 for(i=0;i<numChoices;i++){
	if (myChoices[i].checked==true){
	 noChoices=false;
	 myStr+="&eMail"+j+"="+myArtist.artists[i].email;
	 j++;
  } 
 }
 myStr=myStr.substring(1);
 if (noChoices){
 	noErrors=false;
	theMessage = "\n --> You must make at least one Selection!";
  return false;
 } else {
 	//alert(myStr);
 	window.location="theDetails.php?"+myStr+"#"+theLetter;
 }
}
function checkAll(){
 var myStr="";
 var j=0;
 myChoices = document.getElementsByName("dName");
 numChoices = myChoices.length;
 for(i=0;i<numChoices;i++){
	myStr+="&eMail"+i+"="+myArtist.artists[i].email;
 }
 myStr=myStr.substring(1);
  window.location="theDetails.php?"+myStr+"#"+theLetter;
}
function setOutputDetails(){   
 if(httpObject.readyState == 4){ 
  regExp = /\%20+/g;
  result = httpObject.responseText; 
	myArtist = eval('(' + httpObject.responseText + ')');
	numArtists=myArtist.artists.length;
	myArtFirstName=myArtist.artists[0].fname.replace(regExp,' ');
	myArtLastName=myArtist.artists[0].lname.replace(regExp,' ');
	myArtBusName=myArtist.artists[0].busname.replace(regExp,' ');
	myArtEmail=myArtist.artists[0].email.replace(regExp,' ');
	myArtWeb1=myArtist.artists[0].web1.replace(regExp,' ');
	myArtStreetNum=myArtist.artists[0].streetnum.replace(regExp,' ');
	myArtTown=myArtist.artists[0].town.replace(regExp,' ');
	myArtCounty=myArtist.artists[0].county.replace(regExp,' ');
	myArtPostCode=myArtist.artists[0].postcode.replace(regExp,' ');
	myArtCountry=myArtist.artists[0].country.replace(regExp,' ');
	myArtMessage=myArtist.artists[0].message.replace(regExp,' ');
	myArtImage=myArtist.artists[0].imagename.replace(regExp,' ');
	document.getElementById("imagename").value=myArtImage;
	document.getElementById("message").value=unescape(myArtMessage);
	document.getElementById("fname").value=myArtFirstName;
	document.getElementById("lname").value=myArtLastName;
	document.getElementById("busname").value=myArtBusName;
	document.getElementById("email").value=myArtEmail;
	document.getElementById("web1").value=myArtWeb1;
	document.getElementById("streetnum").value=myArtStreetNum;
	document.getElementById("town").value=myArtTown;
	document.getElementById("county").value=myArtCounty;
	document.getElementById("postcode").value=myArtPostCode;
	document.getElementById("country").value=myArtCountry;
	myLength=myArtImage.length;
	if (myLength == 0) {
		inHTML = '<img class="nurgle" src="images/nurgle.png" width="280" height="350" style="border:1px solid" />'+
		'<div id="ntext">Your photograph, CD Cover,Event Leaflet, Business Card etc could go here!<br />'+
	  	'Just email it to <a href="mailto:office@scotfolk.org"><span style="color:blue">office@scotfolk.org</span></a> once you have submitted your details!</div>';
	} else {
		inHTML = '<img class="nurgle" src="images/' + myArtImage + '" width="286" height="171" style="border:1px solid"  />' +
		'<div id="ntext"><h3>'+myArtBusName+'</h3></div>';
	}
	document.getElementById("imagediv").innerHTML=inHTML; //'<img class="nurgle" src=images/"'+myArtImage+'" />';
	document.getElementById("hits").innerHTML="<h3>Viewing 1/"+numArtists+"</h3>";
	if (numArtists>1) {
	 document.getElementById("next").disabled=false;
	} 
 }
}
function startUpDetails(letter) {
 
  var poststr=letter;;
	doWork('myFullDetails.php', poststr, 'setOutputDetails');
}
function goNext(){
 pos=eval(document.getElementById("index").value);
 var num=myArtist.artists.length;
 var regExp = /\%20+/g;
 if (pos<num-1){
  pos+=1;
  document.getElementById("hits").innerHTML="<h3>Viewing "+(pos+1)+"/"+numArtists+"</h3>";
	myArtFirstName=myArtist.artists[pos].fname.replace(regExp,' ');
    myArtLastName=myArtist.artists[pos].lname.replace(regExp,' ');
	myArtBusName=myArtist.artists[pos].busname.replace(regExp,' ');
	myArtEmail=myArtist.artists[pos].email.replace(regExp,' ');
	myArtWeb1=myArtist.artists[pos].web1.replace(regExp,' ');
	myArtStreetNum=myArtist.artists[pos].streetnum.replace(regExp,' ');
	myArtTown=myArtist.artists[pos].town.replace(regExp,' ');
	myArtCounty=myArtist.artists[pos].county.replace(regExp,' ');
	myArtPostCode=myArtist.artists[pos].postcode.replace(regExp,' ');
	myArtCountry=myArtist.artists[pos].country.replace(regExp,' ');
	myArtMessage=myArtist.artists[pos].message.replace(regExp,' ');
	myArtImage=myArtist.artists[pos].imagename.replace(regExp,' ');
	document.getElementById("imagename").value=myArtImage;
	document.getElementById("fname").value=myArtFirstName;
	document.getElementById("lname").value=myArtLastName;
	document.getElementById("busname").value=myArtBusName;
	document.getElementById("email").value=myArtEmail;
	document.getElementById("web1").value=myArtWeb1;
	document.getElementById("streetnum").value=myArtStreetNum;
	document.getElementById("town").value=myArtTown;
	document.getElementById("county").value=myArtCounty;
	document.getElementById("postcode").value=myArtPostCode;
	document.getElementById("country").value=myArtCountry;
	document.getElementById("message").value=unescape(myArtMessage);
	myLength=myArtImage.length;
	if (myLength == 0) {
		inHTML = '<img class="nurgle" src="images/nurgle.png" width="280" height="350" style="border:1px solid" />'+
		'<div id="ntext">Your photograph, CD Cover,Event Leaflet, Business Card etc could go here!<br />'+
	  	'Just email it to <a href="mailto:office@scotfolk.org"><span style="color:blue">office@scotfolk.org</span></a> once you have submitted your details!</div>';

	} else {
		inHTML = '<img class="nurgle" src="images/' + myArtImage + '" width="286" height="171" style="border:1px solid"  />' +
		'<div id="ntext"><h3>'+myArtBusName+'</h3></div>';
	}
	document.getElementById("imagediv").innerHTML=inHTML; //'<img class="nurgle" src=images/"'+myArtImage+'" />';
    document.getElementById("index").value=pos;
	document.getElementById("prev").disabled=false;
	if (pos==num-1){
	 document.getElementById("next").disabled=true;
  }
 }
}
function goPrev(){
 pos=eval(document.getElementById("index").value);
 var num=myArtist.artists.length;
 var regExp = /\%20+/g;
 if (pos>0){  
  pos-=1;
  document.getElementById("hits").innerHTML="<h3>Viewing "+(pos+1)+"/"+numArtists+"</h3>";
	document.getElementById("next").disabled=false;
	myArtFirstName=myArtist.artists[pos].fname.replace(regExp,' ');
    myArtLastName=myArtist.artists[pos].lname.replace(regExp,' ');
	myArtBusName=myArtist.artists[pos].busname.replace(regExp,' ');
	myArtEmail=myArtist.artists[pos].email.replace(regExp,' ');
	myArtWeb1=myArtist.artists[pos].web1.replace(regExp,' ');
	myArtStreetNum=myArtist.artists[pos].streetnum.replace(regExp,' ');
	myArtTown=myArtist.artists[pos].town.replace(regExp,' ');
	myArtCounty=myArtist.artists[pos].county.replace(regExp,' ');
	myArtPostCode=myArtist.artists[pos].postcode.replace(regExp,' ');
	myArtCountry=myArtist.artists[pos].country.replace(regExp,' ');
	myArtMessage=myArtist.artists[pos].message.replace(regExp,' ');
	myArtImage=myArtist.artists[pos].imagename.replace(regExp,' ');
	document.getElementById("imagename").value=myArtImage;
	document.getElementById("message").value=unescape(myArtMessage);
	document.getElementById("fname").value=myArtFirstName;
	document.getElementById("lname").value=myArtLastName;
	document.getElementById("busname").value=myArtBusName;
	document.getElementById("email").value=myArtEmail;
	document.getElementById("web1").value=myArtWeb1;
	document.getElementById("streetnum").value=myArtStreetNum;
	document.getElementById("town").value=myArtTown;
	document.getElementById("county").value=myArtCounty;
	document.getElementById("postcode").value=myArtPostCode;
    document.getElementById("country").value=myArtCountry;
    document.getElementById("index").value=pos;
	myLength=myArtImage.length;
	if (myLength == 0) {
		inHTML = '<img class="nurgle" src="images/nurgle.png" width="280" height="350" style="border:1px solid" />'+
		'<div id="ntext">Your photograph, CD Cover,Event Leaflet, Business Card etc could go here!<br />'+
	  	'Just email it to <a href="mailto:office@scotfolk.org"><span style="color:blue">office@scotfolk.org</span></a> once you have submitted your details!</div>';

	} else {
		inHTML = '<img class="nurgle" src="images/' + myArtImage + '" width="286" height="171" style="border:1px solid"  />' +
		'<div id="ntext"><h3>'+myArtBusName+'</h3></div>';
	}
	document.getElementById("imagediv").innerHTML=inHTML; //'<img class="nurgle" src=images/"'+myArtImage+'" />';
	if (pos==0){
	 document.getElementById("prev").disabled=true;
  }
 }
}
function goPrint(){
 myWin=window.open('','myWin','menubar,scrollbars,left=30px,top=40px,height=400px,width=600px');
  myWin.document.write(myArtFirstName+' '); 
	myWin.document.write(myArtLastName+'<br />');
	myWin.document.write(myArtBusName+'<br />');
	myWin.document.write(myArtEmail+'<br />');
	myWin.document.write(myArtWeb1+'<br />');
	myWin.document.write(myArtStreetNum+'<br />');
	myWin.document.write(myArtTown+'<br />');
	myWin.document.write(myArtPostCode+'<br />');
	myWin.document.write(myArtMessage+'<br />');
	myWin.window.stop()
}
function setOutputUpdateMo(){   
 if (httpObject.readyState == 4) {
 	regExp = /\%20+/g;
 	result = httpObject.responseText;
	if (updated='1'){
     alert("Entries Updated OK!");
	 pos=eval(document.getElementById("index").value);
	 myArtImage=myArtist.artists[pos].imagename.replace(regExp,' ');
	 myLength=myArtImage.length;
	 if (myLength == 0) {
		inHTML = '<img class="nurgle" src="images/nurgle.png" width="280" height="350" style="border:1px solid" />';
	 } else {
		inHTML = '<img class="nurgle" src="images/' + myArtImage + '" width="286" height="171" style="border:1px solid"  />' +
		'<div id="ntext"><h3>'+myArtBusName+'</h3></div>';
	 }
	 document.getElementById("imagediv").innerHTML=inHTML; //'<img class="nurgle" src=images/"'+myArtImage+'" />';
    } else {
     alert("A problem was encountered updating the entries - let Colin know!");
    }
 }
}
function setOutputNoUpdate(){   
//alert("set");
 if(httpObject.readyState == 4){ 
  regExp = /\%20+/g;
  result = httpObject.responseText; 
	myArtist = eval('(' + httpObject.responseText + ')');
	numArtists=myArtist.artists.length;
	myArtFirstName=myArtist.artists[0].fname.replace(regExp,' ');
	myArtLastName=myArtist.artists[0].lname.replace(regExp,' ');
	myArtBusName=myArtist.artists[0].busname.replace(regExp,' ');
	myArtEmail=myArtist.artists[0].email.replace(regExp,' ');
	myArtWeb1=myArtist.artists[0].web1.replace(regExp,' ');
	myArtStreetNum=myArtist.artists[0].streetnum.replace(regExp,' ');
	myArtTown=myArtist.artists[0].town.replace(regExp,' ');
	myArtCounty=myArtist.artists[0].county.replace(regExp,' ');
	myArtPostCode=myArtist.artists[0].postcode.replace(regExp,' ');
	myArtCountry=myArtist.artists[0].country.replace(regExp,' ');
	myArtMessage=myArtist.artists[0].message.replace(regExp,' ');
	myArtImage=myArtist.artists[0].imagename.replace(regExp,' ');
	document.getElementById("message").value=unescape(myArtMessage);
	document.getElementById("fname").value=myArtFirstName;
	document.getElementById("lname").value=myArtLastName;
	document.getElementById("busname").value=myArtBusName;
	document.getElementById("email").value=myArtEmail;
	document.getElementById("web1").value=myArtWeb1;
	document.getElementById("streetnum").value=myArtStreetNum;
	document.getElementById("town").value=myArtTown;
	document.getElementById("county").value=myArtCounty;
	document.getElementById("postcode").value=myArtPostCode;
	document.getElementById("country").value=myArtCountry;
	document.getElementById("imagename").value=myArtImage;
	myLength=myArtImage.length;
	if (myLength == 0) {
		inHTML = '<img class="nurgle" src="images/nurgle.png" width="280" height="350" style="border:1px solid" />';
	} else {
		inHTML = '<img class="nurgle" src="images/' + myArtImage + '" width="286" height="171" style="border:1px solid"  />' +
		'<div id="ntext"><h3>'+myArtBusName+'</h3></div>';
	}
	document.getElementById("imagediv").innerHTML=inHTML; //'<img class="nurgle" src=images/"'+myArtImage+'" />';
	document.getElementById("hits").innerHTML="<h3>Viewing 1/"+numArtists+"</h3>";
	if (numArtists>1) {
	 document.getElementById("next").disabled=false;
	} 
 }
}
function startUpNoUpdate(letter) {
  var poststr=letter;;
  doWork('myFullDetails.php', poststr, 'setOutputNoUpdate');
}
function doUpdate(){
	 //document.getElementById("updating").innerHTML="Updating..."
	 var poststr = "&fname="+escape(encodeURI(document.getElementById("fname").value))+
                   "&lname="+escape(encodeURI(document.getElementById("lname").value))+
				   "&busname="+escape(encodeURI(document.getElementById("busname").value))+
                   "&email="+escape(encodeURI(document.getElementById("email").value))+
				   "&web1="+escape(encodeURI(document.getElementById("web1").value))+
				   "&streetnum="+escape(encodeURI(document.getElementById("streetnum").value))+
				   "&town="+escape(encodeURI(document.getElementById("town").value))+
				   "&county="+escape(encodeURI(document.getElementById("county").value))+
                   "&postcode="+escape(encodeURI(document.getElementById("postcode").value))+
				   "&country="+escape(encodeURI(document.getElementById("country").value))+
				   "&message="+escape(encodeURI(document.getElementById("message").value))+
				   "&imagename="+escape(encodeURI(document.getElementById("imagename").value));
                   doWork('doUpdateAll.php', poststr, 'setOutputUpdateMo');
}
function doUpdateFname(){
	pos=eval(document.getElementById("index").value);
	myArtist.artists[pos].fname=myArtist.artists[pos].fname.replace(myArtFirstName,document.getElementById("searchus").fname.value);
	//alert(myArtist.artists[pos].fname);
}
function doUpdateLname(){
	pos=eval(document.getElementById("index").value);
	myArtist.artists[pos].lname=myArtist.artists[pos].lname.replace(myArtLastName,document.getElementById("searchus").lname.value);
	//alert(myArtist.artists[pos].fname);
}
function doUpdateBusname(){
	pos=eval(document.getElementById("index").value);
	myArtist.artists[pos].busname=myArtist.artists[pos].busname.replace(myArtBusName,document.getElementById("searchus").busname.value);
	//alert(myArtist.artists[pos].fname);
}
function doUpdateEmail(){
	//pos=eval(document.getElementById("index").value);
	//myArtist.artists[pos].email=myArtist.artists[pos].email.replace(myArtFirstEmail,document.getElementById("searchus").email.value);
	//alert(myArtist.artists[pos].fname);
}
function doUpdateWeb1(){
	pos=eval(document.getElementById("index").value);
	myArtist.artists[pos].web1=myArtist.artists[pos].web1.replace(myArtWeb1,document.getElementById("searchus").web1.value);
	//alert(myArtist.artists[pos].fname);
}
function doUpdateStreetNum(){
	pos=eval(document.getElementById("index").value);
	myArtist.artists[pos].streetnum=myArtist.artists[pos].streetnum.replace(myArtStreetNum,document.getElementById("searchus").streetnum.value);
	//alert(myArtist.artists[pos].streetnum);
}
function doUpdateTown(){
	pos=eval(document.getElementById("index").value);
	myArtist.artists[pos].town=myArtist.artists[pos].town.replace(myArtTown,document.getElementById("searchus").town.value);
}
function doUpdateCounty(){
	pos=eval(document.getElementById("index").value);
	myArtist.artists[pos].county=myArtist.artists[pos].county.replace(myArtCounty,document.getElementById("searchus").county.value);
	//alert(myArtist.artists[pos].fname);
}
function doUpdatePostCode(){
	pos=eval(document.getElementById("index").value);
	myArtist.artists[pos].postcode=myArtist.artists[pos].postcode.replace(myArtPostCode,document.getElementById("searchus").postcode.value);
	//alert(myArtist.artists[pos].fname);
}
function doUpdateCountry(){
	pos=eval(document.getElementById("index").value);
	myArtist.artists[pos].country=myArtist.artists[pos].country.replace(myArtCountry,document.getElementById("searchus").country.value);
	setupdate();
}
function doUpdateMessage(){
	pos=eval(document.getElementById("index").value);
	myArtist.artists[pos].message=myArtist.artists[pos].message.replace(myArtMessage,document.getElementById("searchus").message.value);
	//alert(myArtist.artists[pos].fname);
}
function doUpdateImageName(){
	pos=eval(document.getElementById("index").value);
	myArtist.artists[pos].imagename=myArtist.artists[pos].imagename.replace(myArtImage,document.getElementById("imagename").value);
	//alert(myArtist.artists[pos].fname);
}
function preUpdate(){
	alert("pre");
}
function postUpdate(){
	alert("post");
}
function goNextx(){
 pos=eval(document.getElementById("index").value);
 var num=myArtist.artists.length;

 var regExp = /\%20+/g;
 if (pos<num-1){
  pos+=1;
  document.getElementById("hits").innerHTML="<h3>Viewing "+(pos+1)+"/"+numArtists+"</h3>";
	myArtFirstName=myArtist.artists[pos].fname.replace(regExp,' ');
    myArtLastName=myArtist.artists[pos].lname.replace(regExp,' ');
	myArtBusName=myArtist.artists[pos].busname.replace(regExp,' ');
	myArtEmail=myArtist.artists[pos].email.replace(regExp,' ');
	myArtWeb1=myArtist.artists[pos].web1.replace(regExp,' ');
	myArtStreetNum=myArtist.artists[pos].streetnum.replace(regExp,' ');
	myArtTown=myArtist.artists[pos].town.replace(regExp,' ');
	myArtCounty=myArtist.artists[pos].county.replace(regExp,' ');
	myArtPostCode=myArtist.artists[pos].postcode.replace(regExp,' ');
	myArtCountry=myArtist.artists[pos].country.replace(regExp,' ');
	myArtMessage=myArtist.artists[pos].message.replace(regExp,' ');
	myArtImage=myArtist.artists[pos].imagename.replace(regExp,' ');
	document.getElementById("fname").value=myArtFirstName;
	document.getElementById("lname").value=myArtLastName;
	document.getElementById("busname").value=myArtBusName;
	document.getElementById("email").value=myArtEmail;
	document.getElementById("web1").value=myArtWeb1;
	document.getElementById("streetnum").value=myArtStreetNum;
	document.getElementById("town").value=myArtTown;
	document.getElementById("county").value=myArtCounty;
	document.getElementById("postcode").value=myArtPostCode;
	document.getElementById("country").value=myArtCountry;
	document.getElementById("message").value=unescape(myArtMessage);
	document.getElementById("imagename").value=unescape(myArtImage);
    document.getElementById("index").value=pos;
	document.getElementById("prev").disabled=false;
	if (pos==num-1){
	 document.getElementById("next").disabled=true;
    }
	myLength=myArtImage.length;
	if (myLength == 0) {
		inHTML = '<img class="nurgle" src="images/nurgle.png" width="280" height="350" style="border:1px solid" />'+
		'<div id="ntext"><h3>'+myArtBusName+'</h3></div>';
	} else {
		inHTML = '<img class="nurgle" src="images/' + myArtImage + '" width="286" height="171" style="border:1px solid"  />' +
		'<div id="ntext"><h3>'+myArtBusName+'</h3></div>';
	}
	document.getElementById("imagediv").innerHTML=inHTML; //'<img class="nurgle" src=images/"'+myArtImage+'" />';
 }
}
function goPrevx(){
 pos=eval(document.getElementById("index").value);
 var num=myArtist.artists.length;
 var regExp = /\%20+/g;
 if (pos>0){  
  pos-=1;
  document.getElementById("hits").innerHTML="<h3>Viewing "+(pos+1)+"/"+numArtists+"</h3>";
	document.getElementById("next").disabled=false;
	myArtFirstName=myArtist.artists[pos].fname.replace(regExp,' ');
    myArtLastName=myArtist.artists[pos].lname.replace(regExp,' ');
	myArtBusName=myArtist.artists[pos].busname.replace(regExp,' ');
	myArtEmail=myArtist.artists[pos].email.replace(regExp,' ');
	myArtWeb1=myArtist.artists[pos].web1.replace(regExp,' ');
	myArtStreetNum=myArtist.artists[pos].streetnum.replace(regExp,' ');
	myArtTown=myArtist.artists[pos].town.replace(regExp,' ');
	myArtCounty=myArtist.artists[pos].county.replace(regExp,' ');
	myArtPostCode=myArtist.artists[pos].postcode.replace(regExp,' ');
	myArtCountry=myArtist.artists[pos].country.replace(regExp,' ');
	myArtMessage=myArtist.artists[pos].message.replace(regExp,' ');
	myArtImage=myArtist.artists[pos].imagename.replace(regExp,' ');
	document.getElementById("imagename").value=unescape(myArtImage);
	document.getElementById("message").value=unescape(myArtMessage);
	document.getElementById("fname").value=myArtFirstName;
	document.getElementById("lname").value=myArtLastName;
	document.getElementById("busname").value=myArtBusName;
	document.getElementById("email").value=myArtEmail;
	document.getElementById("web1").value=myArtWeb1;
	document.getElementById("streetnum").value=myArtStreetNum;
	document.getElementById("town").value=myArtTown;
	document.getElementById("county").value=myArtCounty;
	document.getElementById("postcode").value=myArtPostCode;
    document.getElementById("country").value=myArtCountry;
	document.getElementById("imagename").value=myArtImage;
    document.getElementById("index").value=pos;
	if (pos==0){
	 document.getElementById("prev").disabled=true;
    }
	myLength=myArtImage.length;
	if (myLength == 0) {
		inHTML = '<img class="nurgle" src="images/nurgle.png" width="280" height="350" style="border:1px solid" />'+
		'<div id="ntext"><h3>'+myArtBusName+'</h3></div>';
	} else {
		inHTML = '<img class="nurgle" src="images/' + myArtImage + '" width="286" height="171" style="border:1px solid"  />' +
		'<div id="ntext"><h3>'+myArtBusName+'</h3></div>';
	}
	document.getElementById("imagediv").innerHTML=inHTML; //'<img class="nurgle" src=images/"'+myArtImage+'" />';
 }
}
function setUpdate(){
	document.getElementById("myUpdate").disabled=false;
}
// *********

function setOutputApprove(){    
 if(httpObject.readyState == 4){ 
  regExp = /\%20+/g;
  result = httpObject.responseText.replace(regExp,' '); 
  //alert(result);
  var generator=document.open('','name','height=400,width=500,scrollbars=yes');
  
  generator.document.write('<html><head><title>New Member Additional Details</title>');
  generator.document.write('</head><body>');
  generator.document.write('<p id="dets"></p>');
  generator.document.write(unescape(result));
  generator.document.write('<p><a href="javascript:self.close()">Close Window</a></p>');
  generator.document.write('</body></html>');
  generator.document.close();	
   
 }
}
function setDeleteOutputApprove(){    
 if(httpObject.readyState == 4){ 
  regExp = /\%20+/g;
  result = httpObject.responseText; 
  alert(result);
  window.location="approvemem.php"
 }
}
function setDeleteApprove(){    
 if(httpObject.readyState == 4){ 
  regExp = /\%20+/g;
  result = httpObject.responseText; 
  alert(result);
  window.location="indexArtists.php"
 }
}
function getDetails(i){
  var myID="eMail"+i;
  poststr="&email"+"="+document.getElementById(myID).innerHTML;
  //alert(poststr);
  doWork('getArtistDetails.php', poststr,'setOutputApprove');
  
}
function doDelete(){
  if (okeedokee=confirm("Are You Sure You Want to Delete the Selected Entries?")){
  	return true;
  } else {
  	return false;
  }
  
}
function disablebuttons()
{
document.getElementById("memlist").submit.disabled=true;
}
function enableApprove()
{
document.getElementById("submit").disabled=false;
document.getElementById("decline").disabled=false;
}
// ******
function refresh()
{
    window.location.reload( false );
}

function setOutputSearchIndex(){   
 if(httpObject.readyState == 4){ 
  document.getElementById("l1").innerHTML='';
  regExp = /\%20+/g;
  result = httpObject.responseText; 
  result = result.replace(/^\s+|\s+$/g, '') ;
  if(result=="XX"){
	document.getElementById("hits").innerHTML="<h3>Your Search Returned Zero Entries</h3>";
	//alert("No Matches Found!");
  } else {	
    //alert(result);
	myArtist = eval('(' + httpObject.responseText + ')');
	numArtists=myArtist.artists.length;
	document.getElementById("hits").innerHTML="<h3>Your Search Returned "+numArtists+" Entries</h3><p>Search Results</p>";
    goAllIndexArtist();
  } 
 }
}
function goBack(){
	//alert(window.location.href);
	myURL= window.location.href;
    var pos = myURL.indexOf("#");
    if (pos>0){
     urlSplit=theURL.split("#");
   	 window.location='index.php?'+urlSplit[1];
    }
}
function goAll(){
	   theTable='<form id="dForm" ><table class="search" align="center"><tr><th class="search" colspan="5">Search Results</th></tr><tr class="yellow"><td class="search">Contact Name</td><td class="search">Name</td><td class="search">Email</td>'+
		         '<td class="search">Location</td><td class="search">Full Details</td></tr>';
	   for (i=0;i<numArtists;i++){
		  theTable+="<tr><td class='search'>"+myArtist.artists[i].busname.replace(regExp,' ')+"</td><td class='search'>"+myArtist.artists[i].fname.replace(regExp,' ')+" "+myArtist.artists[i].lname.replace(regExp,' ')+
		           "</td><td class='search'>"+myArtist.artists[i].email.replace(regExp,' ')+"</td><td class='search'>"+myArtist.artists[i].town.replace(regExp,' ')+
							 "</td><td class='search'><input type='checkbox' name='dName'/></td></tr>";
	   }
		 theTable+="</table><br /><input type='button' value='Get Selected' onclick='checkDetails()' />"+
		            "<input type='button' value='Select All' onclick='checkAll()' /></form>";
		 document.getElementById("l1").innerHTML=theTable;
		 
	  }
function setOutputUpdate(){   
 if (httpObject.readyState == 4) {
 	document.getElementById("l1").innerHTML = '';
 	regExp = /\%20+/g;
 	result = httpObject.responseText;
	if (updated='1'){
     alert("Entries Updated OK!");
	 document.getElementById("hits").innerHTML="";
    } else {
     alert("A problem was encountered updating the entries - let Colin know!");
	 document.getElementById("hits").innerHTML="<h3>Error Encountered - Not All Updated Will Have Been Successfull</h3>";
    }
 	//alert(result);
 }
}
function startUpSearchIndex(letter) {
  var poststr;
	var theLetter=letter;
	poststr="&artist"+"="+theLetter;
	//alert(poststr);
   doWork('sendSearchDetailsUpdate.php', poststr,'setOutputSearchIndex');
}

function reenableIndexArtist(){
 document.getElementById("searchus").myButton.disabled=false;
}

function checkDetailsIndexArtist(){
 var myStr="";
 var j=0;
 for (i = 0; i < numArtists; i++) {
 	myStr += "&eMail" + i + "=" + myArtist.artists[i].email + "&indexedOn" + i + "=" + document.getElementById("dName"+i).value;
 }
 //alert(myStr)
 doWork('doUpdate.php', myStr,'setOutputUpdate');
}

