// JavaScript Document
	showBang = 0;
	imgprogress = 0;
	
	setGlobals = function (boo) {
		bandCount = boo;
	}
	
	
	//get news
	getSect = function (el,url){
		new Ajax.Updater(el,url,
			{
			method: 'get',
			evalScripts:true, 
			asynchronous:true
		
		});
	}
//	fillNews = function (r) {
//		//eval json response
//		var arr = r.evalJSON();
//
//create the new lists items and insert it into the shell created above
//	for (var i=0; i < arr.recordcount; i++) {
//		
//		alert(arr.recordcount);
//		//build the onclick action
//		//var onclickVar = "alert(this.id);";
//		
//		//build our list element
//		var list = "<div id='note_" + arr.id[i] + "' onclick='" + onclickVar + "'><img src='/MEDIA/IMG/HEADSHOTS/"+arr.memberID[i]+".png' class='news_headshot' border='0'/><h3>"+arr.headline[i]+"</h3><p>"+arr.message[i]+"</p></div>";
//		$('news_loader').update(list);
//	}
//
//	}
	
	
	
	postNews = function (selID){
		//$('news_input').toggle();
		globalLoad('news_input','Working...','Large');
		
		//$('news_input').fade()
		//toggleNews();
		//$("news_loader").update("<b class='gg 16px'>LOADING NEWS ... </b>");
	new Ajax.Request("/cf/admin.cfm?postNews=1&selID="+selID,{
					method:"post",
					postBody:Form.serialize("newsForm"),	  
					 asynchronous:true, 
					 evalScripts:true,
					 onSuccess: function(transport){
							var response = transport.responseText || "no response text";
							//$('newsForm').reset();
							//getSect("news_loader","/cf/admin.cfm?getNews=1");
							new Ajax.Updater("news_loader","/cf/admin.cfm?getNews=1",
								{
								method: 'get',
								evalScripts:true, 
								asynchronous:true,
								 onSuccess: function(){
										$('news_input').toggle();
										$('news_loader').appear();			
					}
							});

							
					}
	
		});
	}
	
		
	editNews = function(params) {
		if(params == '' || params == undefined){
			var params = '?';	
		}
		globalLoad('news_loader','Working...','Large');
		//$('news_loader').toggle();
		//globalLoad('news_loader','Loading...','Large');
		new Ajax.Updater('news_input','/cf/news_input.cfm'+params,
			{
			method: 'get',
			evalScripts:true, 
			asynchronous:true,
			 onSuccess: function(){
					$('news_loader').toggle();
					$('news_input').appear();
					initTiny();
			 }
		
		});
		
		//$('news_loader').fade();
		//$('news_input').appear();
		showBang = 1;
		//} else {
		//	$('news_input').hide();
		//	$('news_loader').show();
		//showBang = 0;
		//}
		
	}
	closeEditNews = function(params) {
		getSect("news_loader","/cf/admin.cfm?getNews=1");
		$('news_input').toggle();
		$('news_loader').appear();
	}
	
	
	deleteNews = function (selID){
		globalLoad('news_loader','Deleting this...','Large');
		new Ajax.Request('/cf/admin.cfm?deleteNews=1&selID='+selID,{
					method:"post",
					 asynchronous:true, 
					 evalScripts:true,
					 onSuccess: function(transport){
							var response = transport.responseText || "no response text";
							getSect('news_loader','/cf/admin.cfm?getNews=1');
							//alert(response);
							
					}
	
		});
	}
	
	
	deleteShows = function (selID){
		globalLoad('shows_loader','Deleting this...','Large');
		new Ajax.Request('/cf/admin.cfm?deleteShows=1&selID='+selID,{
					method:"post",
					 asynchronous:true, 
					 evalScripts:true,
					 onSuccess: function(transport){
							var response = transport.responseText || "no response text";
							getSect('shows_loader','/cf/admin.cfm?getShows=1');
							//alert(response);
							
					}
	
		});
	}
	
	
	postShows = function (selID){
		
		$('showDate').value = $('date').value;
		// init an array of which all band and band links are added to a comma separated list
		arrBandList = new Array();
		arrBandLinks = new Array();
		

		
		// loop through all the segment checkboxes
			for (i=0;i < bandCount;i++) {
				// if this checkbox is marked
				var ghew = i+1;
				var bandName = $('adder_'+ghew).value;
				var bandUrl = $('adderLink_'+ghew).value;
				
				if (bandName == "" || bandName == "add band "+bandCount+" here" || bandName == "add band here" ) {
					arrBandList[arrBandList.length] = "xx";
				} else {
					arrBandList[arrBandList.length] = $('adder_'+ghew).value;
				}
				
				if (bandUrl == "" || bandUrl == "add band link here" || bandUrl == "Add 1st link here" || bandUrl == "http://") {
					arrBandLinks[arrBandLinks.length] = "xx";
				} else {
					arrBandLinks[arrBandLinks.length] = $('adderLink_'+ghew).value;
				}

			}
		// convert the resulting array to a comma-delimited list
		lstBandList = arrBandList.join(",");
		lstBandLinks = arrBandLinks.join(",");
		$('bands').value = lstBandList;
		$('bandLinks').value = lstBandLinks;
		
		//alert($('bands').value + $('bandLinks').value);

		
		//set venueLink to 'xx' if it's blank
		if($('venueLink').value == "" || $('venueLink').value == "add venue link here" || $('venueLink').value == "http://"){
			$('venueLink').value = "xx";
		}
		
		if (selID != "XX") {	
			var address = $('address').value;
			var bandLinks = $('bandLinks').value;
			var bands = $('bands').value;
			var city = $('city').value;
			var state = $('state').value;
			var cover = $('cover').value;
			var showDate = $('date').value;
			var showTime = $('showTime').value;
			var zone = "pm";
			var venue = $('venue').value;
			var venueLink = $('venueLink').value;
			 var urlStr = "&address="+address+"&bandLinks="+bandLinks+"&bands="+bands+"&city="+city+"&state="+state+"&cover="+cover+"&showDate="+showDate+"&showTime="+showTime+"&zone="+zone+"&venue="+venue+"&venueLink="+venueLink+"&";
		}else{
			var urlStr = ""
		}
		//alert($('venueLink').value);
		
		globalLoad('shows_input','Working...','Large');
		new Ajax.Request('/cf/admin.cfm?postShows=1&selID='+selID+urlStr,{
					method:"post",
					postBody:Form.serialize('showsForm'),	  
					 asynchronous:true, 
					 evalScripts:true,
					 onSuccess: function(transport){
							var response = transport.responseText || "no response text";
							bandCount = 1;
							$('showsForm').reset();
							var bandEls = "<div id='band_1' class='bandWrap'><input onfocus='linkFocus(this.id);' type='text' id='adder_1' name='adder_1' style='width:135px;' value='add band here'/>&nbsp;&nbsp;Link:<input onfocus='linkFocus(this.id);' type='text' id='adderLink_1' name='adderLink_1' style='width:135px;' value='add band link here' /></div>";	
	
							new Ajax.Updater("shows_loader","/cf/admin.cfm?getShows=1",
								{
								method: 'get',
								evalScripts:true, 
								asynchronous:true,
								 onSuccess: function(){
										$('shows_input').toggle();
										$('shows_loader').appear();			
					}
							});
							//alert(response);
							
					}
	
		});
	}
	
	
	
	
	
	
	postasffws = function (selID){
		//$('news_input').toggle();
		globalLoad('news_input','Working...','Large');
		
		//$('news_input').fade()
		//toggleNews();
		//$("news_loader").update("<b class='gg 16px'>LOADING NEWS ... </b>");
	new Ajax.Request("/cf/admin.cfm?postNews=1&selID="+selID,{
					method:"post",
					postBody:Form.serialize("newsForm"),	  
					 asynchronous:true, 
					 evalScripts:true,
					 onSuccess: function(transport){
							var response = transport.responseText || "no response text";
							//$('newsForm').reset();
							//getSect("news_loader","/cf/admin.cfm?getNews=1");
							new Ajax.Updater("news_loader","/cf/admin.cfm?getNews=1",
								{
								method: 'get',
								evalScripts:true, 
								asynchronous:true,
								 onSuccess: function(){
										$('news_input').toggle();
										$('news_loader').appear();			
					}
							});

							
					}
	
		});
	}
	
	
	
	
	
	
	
	
	
	
	
	

	
	toggleShows = function(params) {
		if (params == '' || params == undefined){
			var params = '?';	
		}
		getSect('shows_input','/cf/shows_input.cfm'+params);
		$('shows_input').toggle();
		$('shows_updater').toggle();		
	}
	
	editShows = function(params) {
		if(params == '' || params == undefined){
			var params = '?';	
		}
		globalLoad('shows_loader','Working...','Large');
		//$('news_loader').toggle();
		//globalLoad('news_loader','Loading...','Large');
		new Ajax.Updater('shows_input','/cf/shows_input.cfm'+params,
			{
			method: 'get',
			evalScripts:true, 
			asynchronous:true,
			 onSuccess: function(){
					$('shows_loader').toggle();
					$('shows_input').appear();	
			 }
		
		});
		showBang = 1;
	
	}
	
	closeEditShows = function(params) {
		getSect("shows_loader","/cf/admin.cfm?getShows=1");
		$('shows_input').toggle();
		$('shows_loader').appear();
	}
	
	
	addLink = function (){
		var stat = $('adderLink').disabled;
		if (stat == true){
			$('hasLink').checked = true ;
			$('adderLink').disabled = false;
			$('adderLink').style.background = "#ffffff";
			$('adderLink').value = "http://";
		} else {
			$('hasLink').checked = false ;
			$('adderLink').disabled = true;
			$('adderLink').style.background = "#d8d8d8";
			$('adderLink').value = "<- Click Checkbox to Add Band Link";
			
		}
		
		
	}
	
	
	
	
	addVLink = function (){
		var stat = $('adderVLink').disabled;
		if (stat == true){
			$('hasVLink').checked = true ;
			$('adderVLink').disabled = false;
			$('adderVLink').style.background = "#ffffff";
		} else {
			$('hasVLink').checked = false ;
			$('adderVLink').disabled = true;
			$('adderVLink').style.background = "#d8d8d8";
			
		}
		
		
	}
	
	
	addBand = function (){
		
		if ($('adder_'+bandCount).value == "" || $('adder_'+bandCount).value == "add band here") {
			$('adder_'+bandCount).value = "add band here";
			$('adder_'+bandCount).style.border = "1px solid red";
			return;
		}

		bandCount = bandCount + 1;
		var bandEls = "<div id='band_"+bandCount+"' class='bandWrap'><input onfocus='linkFocus(this.id);' type='text' id='adder_"+bandCount+"' name='adder_"+bandCount+"' style='width:135px;' value='add band here'/>&nbsp;&nbsp;Link:<input onfocus='linkFocus(this.id);' type='text' id='adderLink_"+bandCount+"' name='adderLink_"+bandCount+"' style='width:135px;' value='add band link here' /></div>";	
	
		Element.insert($('bandList'),bandEls);
		
		
	}

	
	linkFocus = function(el) {
	if ($(el).value == "" || $(el).value == "add band link here" || $(el).value == "add band here" || $(el).value == "add venue here" || $(el).value == "add venue link here")	
		
		if ($(el).value == "add band here" || $(el).value == "add venue here") {
			$(el).value = "";
		} else if ($(el).value == "add band link here" || $(el).value == "add venue link here") {
			$(el).value = "http://";
		} else if (el == "cover") {
			$(el).value = "$";
		} else if (el == "venueLink") {
			$(el).value = "http://";
		}
	}
	
	
	missinga = 0
	missing2a = 0
	contact = function() {
	
		if (ValidateForm('name')==false){
			$('name').value = ""
			$('name').style.border = "1px #ff0000 solid"
			$('name').focus()
			missinga = 1;
			return false
		}
		//
			if (missinga != 0  && $('nameLabel_b')){
				$('name').style.border = "1px solid #B5B5B5"
				$('nameLabel_b').remove();
			}
		
		if (echeck($F('email'))==false){
			//$('email').value = ""
			$('email').style.border = "1px #ff0000 solid"
			$('email').focus()
			missing2a = 1;
			return false
		}
		//
			if (missing2a != 0 && $('emailLabel_b')){
				$('email').style.border = "1px solid #B5B5B5"
				$('emailLabel_b').remove();
			}
	
	
	
	
	
		globalLoad('contact_loader','Sending...','Large');
	
	
			
		if($('join').checked == true){
			new Ajax.Request('/cf/admin.cfm?postEmail=1',{
					method:"post",
					postBody:Form.serialize('contact_form'),	  
					 asynchronous:true, 
					 evalScripts:true
	
			});	
		}
	
	
		new Ajax.Request('/cf/contact_submit.cfm',{
					method:"post",
					postBody:Form.serialize('contact_form'),	  
					 asynchronous:true, 
					 evalScripts:true,
					 onSuccess: function(transport){
						var status = '<div id="sent" class="sent" style="display:none;" align="center">Your message was sent<br/><br/><a href="##" onclick="clearWin(); return false;">Close This Window</a></div>';
						$('contact_loader').update(status);
						
						$('sent').appear();
							
					}
	
		});
	
	
		
	}
	
	
	
	missing = 0
	missing2 = 0
	emailSubmit = function() {
		
		if (ValidateForm('name')==false){
			$('name').value = ""
			$('name').style.border = "1px #ff0000 solid"
			$('name').focus()
			missing = 1;
			return false
		}
		//
			if (missing != 0  && $('nameLabel_b')){
				$('name').style.border = "1px solid #B5B5B5"
				$('nameLabel_b').remove();
			}
		
		if (echeck($F('email'))==false){
			//$('email').value = ""
			$('email').style.border = "1px #ff0000 solid"
			$('email').focus()
			missing2 = 1;
			return false
		}
		//
			if (missing2 != 0 && $('emailLabel_b')){
				$('email').style.border = "1px solid #B5B5B5"
				$('emailLabel_b').remove();
			}
		
		globalLoad('contact_loader','Signing You Up...','Large');

		
		new Ajax.Request('/cf/admin.cfm?postEmail=1',{
					method:"post",
					postBody:Form.serialize('emailList_form'),	  
					 asynchronous:true, 
					 evalScripts:true,
					 onSuccess: function(transport){
						var status = '<div id="sent" class="sent" style="display:none;" align="center">You have been added to our email list.<br/><br/><a href="##" onclick="clearWin(); return false;">Close This Window</a></div>';
						$('contact_loader').update(status);
						
						$('sent').appear();
							
					}
	
		});	
		
	}


	emailTested = 0;
	echeck = function(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		var list="<b id='emailLabel_b' style='color:#ff0000;'> *Invalid E-mail ID</b>"
		
	
		if (str.indexOf(at)==-1){
			if (emailTested != 1){
				$('emailLabel').insert(list);
			}
			emailTested = 1
			return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   if (emailTested != 1){
				$('emailLabel').insert(list);
			}
		   emailTested = 1
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    if (emailTested != 1){
				$('emailLabel').insert(list);
			}
			emailTested = 1
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		   if (emailTested != 1){
				$('emailLabel').insert(list);
			}
		   emailTested = 1
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    if (emailTested != 1){
				$('emailLabel').insert(list);
			}
			emailTested = 1
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    if (emailTested != 1){
				$('emailLabel').insert(list);
			}
			emailTested = 1
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    if (emailTested != 1){
				$('emailLabel').insert(list);
			}
			emailTested = 1
		    return false
		 }
		
		emailTested = 0;
		//return true					
	}


	fieldsTested = 0;
	ValidateForm = function(el){
		
		var list="<b id='nameLabel_b' style='color:#ff0000;'> *Please provide a "+ el +"</b>"
		
		if (($(el).value=="")){
			if (fieldsTested != 1){
				$(el+'Label').insert(list);
			}
			fieldsTested = 1;
			return false
		}
		
		fieldsTested = 0;

	}
	
	
	
	newsByMember = function(member,archive){
	
	
	//var sfEls = $$('#news_nav a:not([class~=kB])');
	$('news_nav').className = member;

	
	
	
	$('news_loader').setHeight = $('news_loader').getHeight;
	var element = "<div id='news_loader_frame'></div>";
	$('base').insert(element);
	$('news_loader_frame').clonePosition('news_loader');
	globalLoad('news_loader_frame','Loading posts by '+member+'...','Large');
	
	new Ajax.Updater('news_loader','/cf/admin.cfm?getNews=1&fromUser='+member+'&newsArchive='+archive,
			{
			method: 'get',
			evalScripts:true, 
			asynchronous:true,
			onSuccess: function(transport){						
						$('news_loader_frame').fade();
						removeNewsLoader();
						
					}
		
		});
	
	
	}

removeNewsLoader = function(){
	setTimeout(removeEl,1000)	
}

removeEl = function() {
	//alert('Surprise!')
	$('news_loader_frame').remove();	
}





/***************************************
gallery
******/
changeImage = function(photoID,clonee){
	$(fuckmeplease).fade({ duration: .5, from: 1, to: .5 });
	
	fuckmeplease = clonee;
	if(imgprogress == 0){
	imgprogress = 1;
	
	//var cloneMe = $(clonee)
	//var clone = cloneMe.cloneNode(true);
    /*
     deal with duplicate IDs
    */
	//var newID = $(clone).id +'x';
	//$(clone).id = newID;
    // cloneMe.parentNode.insertBefore(clone, cloneMe.nextSibling); 
	//Effect.Puff(clone, { duration: .5 });
	
	
	$('pictureFrame').toggle();
	//$('pictureFrameLoader').clonePosition('photos_right');
	globalLoad('pictureFrameLoader','Getting Image...','Large');
	$('pictureFrameLoader').appear();
	new Ajax.Updater('pictureFrame','/cf/admin.cfm?getPhoto='+photoID,
			{
			method: 'get',
			evalScripts:true, 
			asynchronous:true,
			onSuccess: function(transport){						
						//$('pictureFrameLoader').fade();
						Element.remove($('contentLoader'));
						$('pictureFrame').appear();
						//$('pictureFrame').appear();
						//removeNewsLoader();
						imgprogress = 0;
					}
		
		});	
	
	
	}
}

fuckmeplease = "IMG_1";
thumbAction = function() {

	var sfEls = $$('img.thumbs');///*td:not([class~=noHover])*/td with class=noHover will not be added
	for (var i=0; i<sfEls.length; i++) {
		$(sfEls[i].id).fade({ duration: 0, from: 1.0, to: .5 });
		sfEls[i].onmouseover=function() {
			if(this.id != fuckmeplease){
				$(this.id).appear({ duration: .5, from: .5, to: 1 });
			}
		}
		sfEls[i].onmouseout=function() {
			if(this.id != fuckmeplease){
				$(this.id).fade({ duration: .5, from: 1, to: .5 });
			}
		}

	}	
}

overDrop = 0;
overLink = 0;
albumBtnAction = function() {

	var sfEls = $$('a.picker');///*td:not([class~=noHover])*/td with class=noHover will not be added
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
				overLink = 1;
				$(this.id+'-drop').appear();
				toFade = $(this.id+'-drop');
		}
		sfEls[i].onmouseout=function() {
			setTimeout ( "fadeOutDrop()", 2000 );
			overLink = 0;
		}
	}	
	
	var sfAls = $$('div.drop-down');///*td:not([class~=noHover])*/td with class=noHover will not be added
	for (var i=0; i<sfAls.length; i++) {
		sfAls[i].onmouseover=function() {
			overDrop = 1;
		}
		sfAls[i].onmouseout=function() {
			setTimeout ( "fadeOutDrop2()", 2000 );
			overDrop = 0;
		}
	}	
	
	
	
}

fadeOutDrop = function (){
	if (overDrop == 0){
		toFade.fade();
	}	
}
fadeOutDrop2 = function (){
	if (overLink == 0){
		toFade.fade();
	}
}


checkPlayerStat = function (blah){
	if($(blah).value == "1"){
		$(blah).value = "0";
		setStat = 0;
	}else{
		$(blah).value = "1";
		setStat = 1;
	}
	updateSong(blah);
}


updateSong = function (blah){
		//$('news_input').toggle();
		//$('songsWrap').fade();
		//globalLoad('content','Working...','Large');
		
		//$('news_input').fade()
		//toggleNews();
		//$("news_loader").update("<b class='gg 16px'>LOADING NEWS ... </b>");
	new Ajax.Request("/cf/admin.cfm?updateSongs=1&setStat="+setStat,{
					method:"post",
					postBody:Form.serialize("songsForm"+blah),	  
					 asynchronous:true, 
					 evalScripts:true
	
		});
	}
	
	
	
getAlbum = function(type,typeID){
	//$(fuckmeplease).fade({ duration: .5, from: 1, to: .5 });
	
	if(imgprogress == 0){
	imgprogress = 1;
	
	//var cloneMe = $(clonee)
	//var clone = cloneMe.cloneNode(true);
    /*
     deal with duplicate IDs
    */
	//var newID = $(clone).id +'x';
	//$(clone).id = newID;
    // cloneMe.parentNode.insertBefore(clone, cloneMe.nextSibling); 
	//Effect.Puff(clone, { duration: .5 });
	
	
	$('albumLoaderDisplay').hide();
	//$('pictureFrameLoader').clonePosition('photos_right');
	globalLoad('albumLoader','Getting Album...','Large');
	new Ajax.Updater('albumLoaderDisplay','/cf/admin.cfm?getAlbum=1&'+type+'='+typeID,
			{
			method: 'get',
			evalScripts:true, 
			asynchronous:true,
			onSuccess: function(transport){	
						//$('pictureFrameLoader').fade();
		$('contentLoader').remove();
						$('albumLoaderDisplay').appear();
						//$('pictureFrame').appear();
						//removeNewsLoader();
						imgprogress = 0;
					}
		
		});	
	
	
	}
}