
 function cmEdit(id,type) {
 	str='editID'+id;
//alert('in cmEdit str='+str+' type='+type);
  xmlhttp=GetXmlHttpObject();
  if (xmlhttp==null) {
//alert ("Browser does not support HTTP Request");
   return;
  }
  var url="cmHandler.php";
  url=url+"?q="+str;
  url=url+"&type="+type;
  url=url+"&id="+id;
//alert(url);
  xmlhttp.onreadystatechange = function() {
    if (xmlhttp.readyState==4) {
      if (xmlhttp.status==200) {
//alert('returning from remote download routine='+str);
//alert(xmlhttp.responseText);
//alert('type='+type);
       if (type=='edit') {
    	  document.getElementById(str).innerHTML=xmlhttp.responseText;
    	  document.getElementById(str).style.display = "inline";
    	 }
       if (type=='delete') {
    	  document.getElementById(str).style.display = "none";
    	 }
      }
    }
  }
  xmlhttp.open("GET",url,true);
  xmlhttp.send(null);
}





function setFocus() {
document.getElementById('playlist').focus();
}

function jumpScroll() {
window.scroll(0,260); // horizontal and vertical scroll targets
}
function tabOff(theID,page,subTab,tabColor,tabCurrent) {
if (page=='current') color=tabCurrent;
else                 color=tabColor;
document.getElementById(theID).style.backgroundColor=color;
if (subTab != null) {
document.getElementById(subTab).style.display="none";
}
} // function tabOff(theID,page) {

function tabOver(theID,page,subTab,tabCurrent,tabHover) {
  //alert('tabColor='+ tabColor + '; tabHover=' + tabHover);
  //alert('tabOver='+theID+' ,'+ page + ' ,'+subTab);
  if (page=='current') color=tabCurrent;
  else                 color=tabHover;
  document.getElementById(theID).style.backgroundColor=color;
  if (subTab != null) {
  //alert('tabOver='+theID+' ,'+ page + ' ,'+subTab);
    document.getElementById(subTab).style.display="block";
  }
} // function tabOver(theID,page) {

function subTabOver(theID) {
//alert('subTabOver='+theID+' ,'+ page)
document.getElementById(theID).style.display=block;
} // function tabOver(theID,page) {

function subTabOff(theID) {
document.getElementById(theID).style.display=none;
} // function


function anyOver(theID,color) {
//alert('anyOver='+theID+' ,'+ color)
document.getElementById(theID).style.backgroundColor=color;
} // function tabOver(theID,page) {

function anyOff(theID,color) {
//alert('anyOff='+theID+' ,'+ color)
document.getElementById(theID).style.backgroundColor=color;
} // function

function imposeMaxLength(Object, MaxLen)
{
textVal = MaxLen-(Object.value.length+1);
 $("#currVal").html(textVal);
//alert('textVal='+textVal);
 return (Object.value.length <= MaxLen);
}




function imposeMaxLength(Object, MaxLen)
{
textVal = MaxLen-(Object.value.length+1);
 $("#currVal").html(textVal);
//alert('textVal='+textVal);
 return (Object.value.length <= MaxLen);
}

function externalTags() {

 }

function hidediv(divId) {
  var arr = document.getElementById(divId);
// alert(arr.innerHTML);
  if ( arr!= null ) {
    arr.style.display = (arr.style.display == 'none')? 'block':'none';
  }
 }

 function downloadShow(str,memberID,showID,type) {
//alert('in downloadShow:'+str+"--"+memberID+"--"+showID+"--"+type);
  xmlhttp=GetXmlHttpObject();
  if (xmlhttp==null) {
   alert ("Browser does not support HTTP Request");
   return;
  }
  var url="remote.php";
  url=url+"?type="+type;
  url=url+"&mid="+memberID;
  url=url+"&sid="+showID;
  //url=url+"?q="+str;
  //url=url+"&type="+type;
  xmlhttp.onreadystatechange = function() {
    if (xmlhttp.readyState==4) {
//alert('waiting='+xmlhttp.status);
      if (xmlhttp.status==200) {
//alert('returning from remote download routine='+str);
//alert(xmlhttp.responseText);
//document.getElementById(str).innerHTML=xmlhttp.responseText;
//document.getElementById(str).style.display = "inline";
      } // if (xmlhttp.status==200) {
    } // if (xmlhttp.readyState==4) {
//Else alert('readyState='+xmlhttp.readyState);
  } // xmlhttp.onreadystatechange = function() {
//alert('url string='+url);
  xmlhttp.open("GET",url,true);
  xmlhttp.send(null);

 } // function downloadShow(str,memberID,showID,type) {

 function playlistTwitterPost(twitterMsg) {
// alert('I am here');
// alert($("#textarea").val());
  textVal = twitterMsg;
// alert('textVal='+textVal);
// alert('textVal length='+textVal.length);
  $.post("twitterAPI.php",
    { name: textVal,
     	caller: 'playlist' },
    	function(data){
// alert("Data Loaded: " + data);
      }
   );
 } // function playlistTwitterPost(twitterMsg) {


 function joinMessage(status) {
  arr = document.getElementById("joinMsg");
  if (status==0) arr.style.visibility="visible";
  if (status==1) arr.style.visibility="hidden";
 }

 function processData() {
  output = null;
 	if (document.contactUs.reason.value.length < 1) {
 	 output = "Please select a reason for contacting FCC";
 	 document.contactUs.reason.focus();
 	}

 	if (document.contactUs.returnEmail.value.length < 1) {
   output = null;
 	 output = "Please fill in the Email field";
 	 document.contactUs.returnEmail.focus();
 	}
	else {
// alert('testing email');
// alert('in displayPicture');
   xmlhttp=GetXmlHttpObject();
   if (xmlhttp==null) {
// alert ("Browser does not support HTTP Request");
    return;
   }
   output = null;
   emailFld = document.contactUs.returnEmail.value;
// alert ('emailFld ='+emailFld);
   var url="checkEmail.php";
   url=url+"?q="+emailFld;

// alert(url);
   xmlhttp.onreadystatechange = function() {
    if (xmlhttp.readyState==4) {
     if (xmlhttp.status==200) {
// alert('responseText ='+xmlhttp.responseText);
     	if (xmlhttp.responseText == 'OK');
     	else {
     	 output = "Email format is not valid, please fix.";
     	 document.contactUs.returnEmail.focus();
     	}
     }
    }
   } // xmlhttp.onreadystatechange = function() {
   xmlhttp.open("GET",url,true);
   xmlhttp.send(null);
  } // else {

 	if (document.contactUs.firstName.value.length < 1) {
   output = null;
 	 output = "Please fill in the First Name field";
 	 document.contactUs.firstName.focus();
 	}
 	if (document.contactUs.lastName.value.length < 1) {
   output = null;
 	 output = "Please fill in the Last Name field";
 	 document.contactUs.lastName.focus();
 	}
 	if (document.contactUs.message.value.length < 1) {
   output = null;
 	 output = "Please add a Comment for contacting FCC";
 	 document.contactUs.message.focus();
 	}

 	if (output == null) return true;
 	 else {
 	  alert(output);
 	 	return false;
 	 }
 }

function calImgOver() {
  $('#message2').fadeIn('slow').addClass('alert').html('Click here to choose a date from the popup calendar.');
  // ### below accesses the document properties to set display properties
  document.getElementById("message2").style.backgroundColor="#FFAA7B";
  document.getElementById("message2").style.width="250px";
 }
// ### below function removes above display on mouse off
 function calImgOut() {
  $('#message2').fadeIn('slow').addClass('alert').html('');
  document.getElementById("message2").style.backgroundColor="";
  document.getElementById("message2").style.display="none";
 }

 function current() {
  document.queryForm.eventDate.value = "";
 // document.queryForm.company_info_end.value = "";
  document.getElementById("custom_start_link").style.visibility = "hidden";
 // document.getElementById("custom_end_link").style.visibility = "hidden";
 }

 function prior() {
  document.queryForm.eventDate.value = "";
 //	document.queryForm.company_info_end.value = "";
  document.getElementById("custom_start_link").style.visibility = "hidden";
 //	document.getElementById("custom_end_link").style.visibility = "hidden";
 }

 function custom() {
  document.getElementById("custom_start_link").style.visibility = "visible";
 //	document.getElementById("custom_end_link").style.visibility = "visible";
 }

 function closeShow(id) {
  divId='pl'+id;
 //alert('divId ='+divId);
  document.getElementById(divId).style.display = "none";
  //document.getElementById(divId).style.backgroundColor="#5A7194";
 }


 //function imposeMaxLength(Object, MaxLen) {
 // return (Object.value.length <= MaxLen);
// }

 var xmlhttp;
 function dshows(str) {
  xmlhttp=GetXmlHttpObject();
  if (xmlhttp==null) {
   alert ("Browser does not support HTTP Request");
   return;
  }
  var url="remote.php";
  url=url+"?type="+str;
  //url=url+"?q="+str;
  //url=url+"&type="+type;
  xmlhttp.onreadystatechange=DstateChanged;
  xmlhttp.open("GET",url,true);
  xmlhttp.send(null);
 }

 function sendRequest() {
  alert('starting sendRequest');
  new Ajax.Request("test.php",
    {
    method: 'post',
    postBody: 'name='+ $F('twitter'),
    onComplete: showResponse
    });
    alert('returning from sendRequest');
  }

 function showResponse(req){
 	$('show').innerHTML= req.responseText;
 }

 function PrTwitterMsg() {
//   alert('I am here');
//   alert($("#textarea").val());
   textVal =$("#textarea").val();
//   alert('textVal='+textVal);
   $.post("twitterAPI.php",
     { name: textVal },
    	 function(data){
//    	 	alert("Data Loaded: " + data);
    	 	$("#showmsg").html(data);
       }
   );
   $("#textarea").val("");
} // function PrTwitterMsg()

 function twitterhideMsg() {
 $("#twittermsg").hide();
// $("#twittermsg").hide("slow");
} // function twitterMsg()

 function picHideMsg() {
document.getElementById('picDisplay').style.visibility="hidden";
} // function picHideMsg()

 function twitterMsg() {
   textVal =$("#twittermsg").html();
// alert('textVal='+textVal);
   $.post("twitterMsg.php",
    	 function(data){
// alert("Data Loaded: " + data);
    	 	$("#twittermsg").html(data);
    	 	$("#twittermsg").show();
       }
   );
} // function twitterMsg()

 function emeritushideMsg() {
 $("#emeritusMsg").hide();
// $("#twittermsg").hide("slow");
} // function emeritushideMsg()


 function emeritusMsg() {
//alert('in membernameMsg');
textVal =$("#emeritusMsg").html();
//alert(textVal);
//alert('textVal='+textVal);
   $.post("emeritusMsg.php",
    	 function(data){
// alert("Data Loaded: " + data);
    	 	$("#emeritusMsg").html(data);
    	 	$("#emeritusMsg").show();
       }
   );
} // function emeritusMsg()

 function emailhideMsg() {
 $("#emailMsg").hide();
// $("#twittermsg").hide("slow");
} // function membernamehideMsg()


 function emailMsg() {
//alert('in membernameMsg');
   textVal =$("#emailMsg").html();
// alert(textVal);
// alert('textVal='+textVal);
   $.post("emailMsg.php",
    	 function(data){
// alert("Data Loaded: " + data);
    	 	$("#emailMsg").html(data);
    	 	$("#emailMsg").show();
       }
   );
} // function membernameMsg()
// function displayPicture() {
//   textVal =$("#picDisplay").html();
// alert('textVal='+textVal);
//   $.post("picdisplay.php",
//    	 function(data){
//  	 	alert("Data Loaded: " + data);
//    	 	$("#picDisplay").html(data);
//    	 	$("#picDisplay").show();
//       }
//   );
//}
//
 function displayPicture(picName) {
//alert('in displayPicture');
  xmlhttp=GetXmlHttpObject();
  if (xmlhttp==null) {
//alert ("Browser does not support HTTP Request");
   return;
  }
  var url="picdisplay.php";
  url=url+"?q="+picName;
  //alert(url);
  xmlhttp.onreadystatechange = function() {
    if (xmlhttp.readyState==4) {
      if (xmlhttp.status==200) {
//alert(xmlhttp.responseText);
    	 document.getElementById('picDisplay').innerHTML=xmlhttp.responseText;
    	 document.getElementById('picDisplay').style.visibility="visible";
      }
    }
  }
  xmlhttp.open("GET",url,true);
  xmlhttp.send(null);
} // function displayPicture(picName) {

 function adjustPage(adjust,EID,SIZE,attrib)  {
//alert('adjustment ='+adjust+'-EID ='+EID+'-SIZE ='+SIZE+'-attrib ='+attrib);
  EIDHeight=document.getElementById(EID).style.height;
  newLen= SIZE+"px"; // set as default. If appropriate this will be reset.
  if (EIDHeight=="") {
//alert("empty string");
   if (EID=='page')	newLen="4500px";
// else             newLen= SIZE+"px";
//alert('newLen='+newLen);
 }
  else {
   if (EID != 'yahooPipes') {
//alert('EIDHeight='+EIDHeight);
   ph=EIDHeight.search(/px/i);
//alert('ph='+ph);
   if (adjust=="smaller") EIDHeight=Number(EIDHeight.substr(0,ph))- SIZE;
   if (adjust=="larger")  EIDHeight=Number(EIDHeight.substr(0,ph))+ SIZE;
//alert('new EIDHeight='+EIDHeight);
   newLen=String(EIDHeight)+"px";
   } // if (EID != 'yahooPipes') {
  } // else {
//alert('updating new page length='+newLen);
//alert(EID+' height ='+newLen);
  if (attrib=='height') document.getElementById(EID).style.height=newLen;
  if (attrib=='top')    document.getElementById(EID).style.top=newLen;
  if (attrib=='bottom') {
//alert(EID+' bottom ='+newLen);
//alert('old bottom ='+document.getElementById(EID).style.bottom);
      document.getElementById(EID).style.bottom=newLen;
//alert('new bottom ='+document.getElementById(EID).style.bottom);
  } // if (attrib=='bottom') {
 }

 function swapImage(type,id) {
 x   = false;
 str = type+id;
 //alert('swapImage-str='+str);
 if (type=='itimg') {
  divId     = 'itunes'+id;
 }
 else divId     = id;
 //alert('swapImage-divId='+divId);
  var minus = '../proxyfiles/images/minus.gif';
  var plus  = '../proxyfiles/images/plus.gif';
  if (document.getElementById(divId).style.display=="inline") {
//  alert("inline");
   var img = document.getElementById(str);
   img.setAttribute("src",plus);
   document.getElementById(divId).style.display = "none";
   adjustSize="smaller";
  }
  else {
   x = true;
   var img = document.getElementById(str);
   img.setAttribute("src",minus);
 	 document.getElementById(divId).style.display = "inline";
 	 adjustSize="larger";
  }
 // adjustPage=larger/smaller, EID=ID to find and alter, SIZE=How much to alter;
  EID="page";
  SIZE=2500; // adjustSize only handles pixel increase/decrease for now.
  adjustPage(adjustSize,EID,SIZE,'height');
  return(x);
 }

 function PLshows(str,type) {
 	x=swapImage('plimg',str);
 	// only call when +  clicked [not on -]
 	if (!x) return;
  xmlhttp=GetXmlHttpObject();
  if (xmlhttp==null) {
   alert ("Browser does not support HTTP Request");
   return;
  }
  var url="remote.php";
  url=url+"?q="+str;
  url=url+"&type="+type;
//alert(url);
  xmlhttp.onreadystatechange = function() {
    if (xmlhttp.readyState==4) {
      if (xmlhttp.status==200) {
//alert('returning from remote download routine='+str);
//alert(xmlhttp.responseText);
    	 document.getElementById(str).innerHTML=xmlhttp.responseText;
      }
    }
  }
  xmlhttp.open("GET",url,true);
  xmlhttp.send(null);
}

 function iTunesPr(id,song,artist) {
//alert('in iTunesPr='+song+' and '+artist);
  divId='itunes'+id;
  x=swapImage('itimg',id);
  // only call when +  clicked [not on -]
  if (!x) return;
//  alert('called swapImage');
  xmlhttp=GetXmlHttpObject();
  if (xmlhttp==null) {
//   alert ("Browser does not support HTTP Request");
   return;
  }
  var url="iTunesproxy.php";
  url=url+"?song="+song;
  url=url+"&artist="+artist;
// alert('url='+url);
  xmlhttp.onreadystatechange = function() {
    if (xmlhttp.readyState==4) {
    	if (xmlhttp.status==200) {
//alert('divId='+divId);
//alert('xmlhttp.responseText='+xmlhttp.responseText);
    	 document.getElementById(divId).innerHTML=xmlhttp.responseText;
      }
    }
  }
  xmlhttp.open("GET",url,true);
  xmlhttp.send(null);
}

 function DstateChanged() {
  if (xmlhttp.readyState==4) {
// alert(xmlhttp.responseText);
   document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
  }
 }

 function showIT(id) {
 	   if (document.getElementById(id).style.display == "none")
 	   	document.getElementById(id).style.display = "block";
     else	document.getElementById(id).style.display = "none";
 }
 
 function GetXmlHttpObject() {
  if (window.XMLHttpRequest) {
   // code for IE7+, Firefox, Chrome, Opera, Safari
   return new XMLHttpRequest();
  }
  if (window.ActiveXObject) {
   // code for IE6, IE5
   return new ActiveXObject("Microsoft.XMLHTTP");
  }
  return null;
 }

 function showVal(name,value) {
  alert(name+'='+value);
 }
