var geocoder = new GClientGeocoder();var browserh;var browserw;function notifyme() {		var email = $(".notifyme").val();		atPos = email.indexOf("@");	stopPos = email.lastIndexOf(".");	if (atPos == -1 || stopPos == -1) {		alert("Please enter a valid email address");    	$("#email_address").focus();    	$("#email_address").select();	} else {		$.post("/_inc/func/mailing_list.inc.php", {e:email}, function(data){ 			$('#sign-upbox').html(data);		});	}	}//get special characters out of band urlsvar r={  'special':/[\W]/g,  'quotes':/['\''&'\"']/g,  'notnumbers':/[^\d]/g}function nospecials(o,w){  o.value = o.value.replace(r[w],'');  o.value = o.value.replace("_", "");}function setinput(id) {	$("."+id).attr("value", "");	$("."+id).css({color:'#993300'});}function setinputid(id) {	$("#"+id).attr("value", "");	$("#"+id).css({color:'#993300'});}function init() {	jQuery.ifixpng('/_img/pixel.gif');	jQuery('img, .bgPng').ifixpng();	if (typeof window.scrollHeight != 'undefined') {		browserh = window.scrollHeight;		browserw = window.scrollWidth;		}	if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientHeight != 'undefined' && document.documentElement.clientHeight != 0) {		browserh = document.documentElement.clientHeight;		browserw = document.documentElement.clientWidth;	}	if (navigator.appName.indexOf('Microsoft') != -1) {		browserh = document.documentElement.clientHeight;		browserw = document.documentElement.scrollWidth;	}		$("#map-tools").css({marginLeft:((browserw - 854) /2)+"px"});	$("#add-forms").css({marginLeft:((browserw - 854) /2)+"px"});	$("#map-shadow").css({marginLeft:((browserw - 940) /2)+"px"});	}function init2() {	jQuery.ifixpng('/_img/pixel.gif');	jQuery('img, .bgPng').ifixpng();	if (typeof window.scrollHeight != 'undefined') {		browserh = window.scrollHeight;		browserw = window.scrollWidth;		}	if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientHeight != 'undefined' && document.documentElement.clientHeight != 0) {		browserh = document.documentElement.clientHeight;		browserw = document.documentElement.clientWidth;	}	if (navigator.appName.indexOf('Microsoft') != -1) {		browserh = document.documentElement.clientHeight;		browserw = document.documentElement.scrollWidth;	}		//$("#map-tools").css({marginLeft:((browserw - 854) /2)+"px"});	//$("#add-forms").css({marginLeft:((browserw - 854) /2)+"px"});	$("#map-shadow").css({marginLeft:((browserw - 940) /2)+"px"});}function searchEnter(myfield,e) {	var keycode;	if (window.event) keycode = window.event.keyCode;	else if (e) keycode = e.which;	else return true;	if (keycode == 13) {		doSearch();		return false;	} else {		return true;	}}function hitenter(myfield,e) {	var keycode;	if (window.event) keycode = window.event.keyCode;	else if (e) keycode = e.which;	else return true;	if (keycode == 13) {		checklogin();		return false;	} else {		return true;	}}function checklogin() {	e = $('#user').val();	p = $('#pass').val();	atPos = e.indexOf("@");	stopPos = e.lastIndexOf(".");			if (e == "") {		hideSigninErrors();		document.getElementById("error-email").style.display = "block";		document.getElementById("user").select();		document.getElementById("user").focus();  		return false;	} else if (atPos == -1 || stopPos == -1) {		document.getElementById("error-email").style.display = "block";       	$("#user").focus();    	$("#user").select();	} else if (p == "") {		hideSigninErrors();		document.getElementById("error-pass").style.display = "block";		document.getElementById("pass").select();		document.getElementById("pass").focus();		return false;	} else {		document.signmein.submit();	}	}function hideSigninErrors() {	document.getElementById("error-email").style.display = "none";	document.getElementById("error-pass").style.display = "none";}function loginerror() {	$.post("/_inc/func/login.inc.php", {error:'yes'}, function(data){ 		$('#signin-up').html(data);		$("#signin-up_wrap").css({display:'block'});	});	init2();}function loginerrortwo() {	$.post("/_inc/func/login.inc.php", {error:'yes'}, function(data){ 		$('#signin-up').html(data);		$("#signin-up_wrap").css({display:'block'});	});	init();}function loginerrorthree() {	$.post("/_inc/func/login.inc.php", {error:'yes'}, function(data){ 		$('#signin-up').html(data);		$("#signin-up_wrap").css({display:'block'});	});}function showlogin(dir,type) {		//$("#signin-up_wrap").css({display:'block'});	$.post("/_inc/func/login.inc.php", {error:'no'}, function(data){ 		$('#signin-up').html(data);		$('#signin-up_wrap').show(300);			//$('#signin-up_wrap').animate( { top:"0px" }, "slow","linear",function(){$("#user").focus();});	});}function hidesignup() {	$.post("/_inc/func/login.inc.php", function(data){ 				$('#signin-up').html(data);			});}function checkSignup() {		var band = $("#band_name").val();	var city = $("#city").val();	var state = $("#state").val();	var country = $("#country").val();	var desc = $("#desc").val();	var genre = $("#genre").val();	var link1 = $("#link1").val();	var link2 = $("#link2").val();	var link3 = $("#link3").val();		var email = $("#email_address").val();	var user = $("#user_name").val();	var pass1 = $("#pass1").val();	var pass2 = $("#pass2").val();		if ($('#help_bands:checked').length == 0) { 		help_bands = 0;	} else {		help_bands = 1;	}		if(band.length==0) {		alert("Please enter a band name");    	$("#band_name").focus();    	$("#band_name").select();		return false;    } else if(city.length==0){       alert("Please enter your city");       $("#city").focus();    	$("#city").select();		return false;    } else if(state.length==0){       alert("Please select your state/province");       $("#band_name").focus();    	$("#band_name").select();		return false;    } else if(country.length==0 || country == 0){       alert("Please select your country");       $("#country").focus();    	$("#country").select();		return false;    } else if(desc.length==0){       alert("Please enter a description of your band");       $("#desc").focus();    	$("#desc").select();		return false;    } else if(genre.length==0){       alert("Please select the genre of your band");       $("#genre").focus();    	$("#genre").select();		return false;    } else if(user.length==0){       alert("Please enter a username");       $("#user_name").focus();    	$("#user_name").select();		return false;    } else if(pass1.length==0){       alert("Please enter a password");       $("#pass1").focus();    	$("#pass1").select();		return false;    } else if(pass2.length==0){       alert("Please retype the password you entered");       $("#pass2").focus();    	$("#pass2").select();		return false;    } else if(pass2 != pass1){       alert("The passwords entered do not match.");       $("#pass1").focus();    	$("#pass1").select();		return false;    } else if(email.length==0){       alert("Please enter an email address");       $("#email_address").focus();    	$("#email_address").select();		return false;    } else {				atPos = email.indexOf("@");		stopPos = email.lastIndexOf(".");		if (atPos == -1 || stopPos == -1) {			alert("Please enter a valid email address");       		$("#email_address").focus();    		$("#email_address").select();		} else {						if(user.length > 0) {				// check if user name exists				$.post("/_inc/func/signup_checkuser.inc.php", {user_name:user}, function(data){ 								if(data == "exists") {						alert("The user name entered already exists");    					$("#user_name").attr("value", "");    					$("#user_name").focus();    					$("#user_name").select();						return false;					} else {						 if(band.length > 0) {							// check if band name exists							$.post("/_inc/func/signup_checkband.inc.php", {band_name:band}, function(data){ 											if(data == "exists") {									alert("The band name entered already exists");    								$("#band_name").attr("value", "");    								$("#band_name").focus();    								$("#band_name").select();									return false;								} else {																		fulladdress = city+", "+state+", "+country;										geocoder.getLatLng(									   	fulladdress,									   	function(point) {									     	if (!point) {									    	   	alert(fulladdress + " not found");										    } else {										        lati = point.lat();										        longi = point.lng();	        										        $.post("/_inc/func/signup_add.inc.php", {band_name:band,city:city,state:state,country:country,desc:desc,genre:genre,link1:link1,link2:link2,link3:link3,email:email,u:user,p:pass1,lati:lati,longi:longi,help_bands:help_bands}, function(data){ 															$("#signup").html(data); 												$('#signin-up_wrap').animate( { height:"75px" }, "slow");												});										      }										    }									  );																	}							});    					}					}				});   	 		}				}	}}function confirmShow(id,bandid,where) {	// change show status to 0	$.post("/_inc/func/show-status.inc.php", {type:"confirm",id:id}, function(data){ 		// update map		map.clearOverlays();		var datesKML = "/bands/dates_new.kml.php?id="+bandid; //+"&killcache="+rannum;		var band_dates = new EGeoXml("band_dates", map, datesKML, {nozoom:false,icontype:"style",iwwidth:300,sortbyname:true}); 		band_dates.parse();		if(where == "list") {			window.location.reload();		}	});}function cancelShow(id,bandid,where) {	// change show status to 1	$.post("/_inc/func/show-status.inc.php", {type:"cancel",id:id}, function(data){ 		// update map		map.clearOverlays();		var datesKML = "/bands/dates_new.kml.php?id="+bandid; //+"&killcache="+rannum;		var band_dates = new EGeoXml("band_dates", map, datesKML, {nozoom:false,icontype:"style",iwwidth:300,sortbyname:true}); 		band_dates.parse();		if(where == "list") {			window.location.reload();		}	});}function deleteShow(id,bandid,where) {	// change show status to 1	$.post("/_inc/func/show-status.inc.php", {type:"delete",id:id}, function(data){ 		// update map		map.clearOverlays();		var datesKML = "/bands/dates_new.kml.php?id="+bandid; //+"&killcache="+rannum;		var band_dates = new EGeoXml("band_dates", map, datesKML, {nozoom:false,icontype:"style",iwwidth:300,sortbyname:true}); 		band_dates.parse();		if(where == "list") {			window.location.reload();		}	});}function addform(type,dir) {	if(dir == "down") {		$("#add-forms").css({height:'371px'});		$("#add-forms").css({backgroundImage:'url(/_img/bg-add_form.png)'});		if(type == "venue") {			$.post("/_inc/func/add-venue.inc.php", function(data){ 				$('#add-forms').html(data);				$('#add-forms').show(300);				});		}		if(type == "show") {						// remove code below and add JS code to open thickbox and display add date screens *lookhere*						$.post("/_inc/func/add-show.inc.php", function(data){ 				$('#add-forms').html(data);				$('#add-forms').show(300);				$("#d-date").datepicker({     				dateFormat: "yy-mm-dd",    				showOn: "both",     				 buttonImage: "/_img/date.png",     				buttonImageOnly: true  				});			});		}		if(type == "placeholder") {			$.post("/_inc/func/add-placeholder.inc.php", function(data){ 				$('#add-forms').html(data);				$('#add-forms').show(300);			});			}		if(type == "poi") {			$.post("/_inc/func/add-poi.inc.php", function(data){ 				$('#add-forms').html(data);				$('#add-forms').show(300);				});		}	} else {		$('#add-forms').hide(300);	}}function addVenue() {	var venue = $("#v-name").val();	var contact =	 $("#v-contact").val();	var areacode = $("#v-area_code").val();	var exchange = $("#v-exchange").val();	var phone	= $("#v-phone").val();	var email	= $("#v-email").val();	var address = $("#v-address").val(); 		var city = $("#v-city").val(); 	var state = $("#v-state").val();	var country = $("#v-country").val();	var zip = $("#v-zip").val();	var notes = $("#v-notes").val();	var capacity = $("#v-capacity").val();	var numbers = /^[a-zA-Z]+$/;		if(venue.length==0) {		alert("Please enter a venue name");    	$("#v-name").focus();    	$("#v-name").select();		return false;    } else if(address.length==0) {		alert("Please enter an address for the venue");    	$("#v-contact").focus();    	$("#v-contact").select();		return false;    } else if(state.length==0 && (country == "United States" || country == "Canada")) {		alert("Please select a state for the venue");    	$("#v-state").focus();    	$("#v-state").select();		return false;    } else if(country.length==0 || country == 0) {		alert("Please select a country for the venue");    	$("#v-country").focus();    	$("#v-country").select();		return false;    } else if(capacity.match(numbers)){    	alert("Please use only numbers for the capacity.");    	$("#v-state").focus();    	$("#v-state").select();		return false;    } else {    	    	var fulladdress = address+", "+city+", "+state+", "+country;    	    	geocoder.getLatLng(    	fulladdress,    	function(point) {      	if (!point) {        	alert(fulladdress + " not found");	      } else {	        lati = point.lat();	        longi = point.lng();	        //alert("name: "+name+", lat: "+lati+", long: "+longi);	        $.post("/_inc/func/add-venue_2.inc.php", {venue:venue,contact:contact,areacode:areacode,exchange:exchange,phone:phone,email:email,address:address,city:city,state:state,country:country,zip:zip,notes:notes,lati:lati,longi:longi,capacity:capacity}, function(data){ 				$('#add-forms').html(data);				$("#add-forms").css({height:'100px'});				$("#add-forms").css({backgroundImage:'url(/_img/bg-add_form-green.png)'});								//$('#add-forms').hide(300);				});	      }	    }	  );    	    	    }	}function addPOI() {	var title = $("#poi-title").val();	var desc = $("#poi-description").val();	var address = $("#poi-address").val();	var city = $("#poi-city").val();	var state = $("#poi-state").val();	var country = $("#poi-country").val();	var status = 1;		if ($('#poi-status:checked').length == 0) { 		status = 0;	}	if(title.length==0) {		alert("Please add a title");    	$("#poi-title").focus();    	$("#poi-title").select();		return false;    } else if(desc.length==0) {		alert("Please add a description");    	$("#poi-desc").focus();    	$("#poi-desc").select();		return false;    } else if(address.length==0) {		alert("Please add an address");    	$("#poi-address").focus();    	$("#poi-address").select();		return false;    } else if(city.length==0) {		alert("Please add a city");    	$("#poi-city").focus();    	$("#poi-city").select();		return false;    } else if(state.length==0) {		alert("Please choose a state");    	$("#poi-state").focus();    	$("#poi-state").select();		return false;    } else if(country.length==0 || country == 0) {		alert("Please choose a country");    	$("#poi-country").focus();    	$("#poi-country").select();		return false;    } else {    	    	var fulladdress = address+", "+city+", "+state+", "+country;    	    	geocoder.getLatLng(    	fulladdress,    	function(point) {      	if (!point) {        	alert(fulladdress + " not found");	      } else {	        lati = point.lat();	        longi = point.lng();	        //alert("name: "+name+", lat: "+lati+", long: "+longi);	        $.post("/_inc/func/add-poi_2.inc.php", {title:title,desc:desc,address:address,city:city,state:state,country:country,lati:lati,longi:longi, status:status}, function(data){ 				$('#add-forms').html(data);				$("#add-forms").css({height:'100px'});				$("#add-forms").css({backgroundImage:'url(/_img/bg-add_form-green.png)'});				//$('#add-forms').hide(300);				});	      }	    }	  );    	    	    }}function addDate(bandid) {		// Must have: date, venue, start time	// data from form: date_type, date, venue, description, contact name, phone #, email, load time, notes	var datetype = $("#d-type").val();	var date = $("#d-date").val();	var venue = $("#d-venues").val();	var start_time = $("#d-s-hour").val()+":"+$("#d-s-minute").val()+":00";	var desc = $("#d-desc").val();	var contact_name = $("#d-contact").val();	var contact_phone = $("#d-area_code").val()+"-"+$("#d-exchange").val()+"-"+$("#d-phone").val();	var contact_email = $("#d-email").val();	var load_time = $("#d-l-hour").val()+":"+$("#d-l-minute").val()+":00";	var notes = $("#d-notes").val();	var notes_status = 1;		if ($('#d-notespublic:checked').length == 0) { 		notes_status = 0;	}		if(date.length==0) {		alert("Please select a date");    	$("#d-date").focus();    	$("#d-date").select();		return false;    } else if(datetype == "Show" && venue.length==0) {		alert("Please select a venue");    	$("#d-venues").focus();    	$("#d-venues").select();		return false;    }  else if(datetype == "Show" && start_time == "00:00") {		alert("Please specify a start time");    	$("#d-s-hour").focus();    	$("#d-s-hour").select();		return false;    } else {			$.post("/_inc/func/add-show_2.inc.php", {type:datetype,date:date,venue:venue,start:start_time,desc:desc,contact:contact_name,phone:contact_phone,email:contact_email,load:load_time,notes:notes,status:notes_status}, function(data){ 				$('#add-forms').html(data);				$("#add-forms").css({height:'60px'});				$("#add-forms").css({backgroundImage:'url(/_img/bg-add_form-green.png)'});				//$('#add-forms').hide(300);									var datesKML = "/bands/dates_new.kml.php?id="+bandid; //+"&killcache="+rannum;				var band_dates = new EGeoXml("band_dates", map, datesKML, {nozoom:false,icontype:"style",iwwidth:300,sortbyname:true}); 				band_dates.parse();			});			}	}function editPhoto(dir) {		if(dir == "down") {				$("#signin-up_wrap").show();		$("#signin-up_wrap").css({top:'-130px'});		$("#signin-up_wrap").css({height:'130px'});		$('#signin-up').html('<iframe style="overflow:hidden;" width="928px" height="100px" name="photo-upload" src="/_inc/func/photo-upload-resize.php" frameborder=0 ALLOWTRANSPARENCY="true"></iframe>');		$('#signin-up_wrap').animate( { top:"0px" }, "slow","linear",function(){$("#user").focus();});		} else {			$('#signin-up_wrap').hide();			}}function addmusic(dir) {		if(dir == "down" || dir == undefined) {			$("#signin-up_wrap").show();		$("#signin-up_wrap").css({top:'-140px'});		$("#signin-up_wrap").css({height:'140px'});		$('#signin-up').html('<form name="form" action="" method="POST" enctype="multipart/form-data"><div class="editphoto"><h1>Add an mp3 to your profile</h1>Click \'Browse..\' to select an mp3 and click \'Upload\' to finish (10mb limit). <br /><div id="musicBTNs" style="display: none;">Uploading file (this may take a bit)...<img src="/_img/loader.gif" width="126" height="22" border="0" /></div><div id="uploadFields"><input id="fileToUpload" type="file" size="45" name="fileToUpload" /> <input type="button" id="buttonUpload" onclick="return musicUpload();" value="Upload" /> <input type="button" name="Cancel" value="Cancel" alt="Cancel" onclick="addmusic(\'up\'); return false;" /></div></div></form>');		$('#signin-up_wrap').animate( { top:"0px" }, "slow","linear",function(){$("#user").focus();});		} else {			$('#signin-up_wrap').hide();			}}function homeTown(lati,longi) {		map.setCenter(new GLatLng(lati,longi), 11);	var point = new GLatLng(lati,longi);	//var marker = createMarker(point,'Display Something Here.')	var marker = new GMarker(point);		var baseIcon = new GIcon();    baseIcon.image = "/_img/markers/band.png";    baseIcon.iconSize = new GSize(32, 32);    baseIcon.iconAnchor = new GPoint(9, 32);    baseIcon.infoWindowAnchor = new GPoint(9, 2);	theIcon = { icon:baseIcon };	marker = new GMarker(point, theIcon);	//map.addOverlay(marker);			map.addOverlay(marker);	}function createMarker(point,html) {        var marker = new GMarker(point);        GEvent.addListener(marker, "click", function() {          marker.openInfoWindowHtml(html);        });        return marker;}/* LOAD PAST DATES */function loadPastDates(id,name) {	$.post("/_inc/func/past_dates.inc.php", {id:id,name:name}, function(data){ 					$("#datelist").html(data); 	});}/* Sign up form */// Sign up formfunction doSignup() {	if ($('#terms:checked').val() != null) {			var band = $("#band_name").val();	var bandurl = $("#band_url").val();	var city = $("#city").val();	var zip = $("#zip").val();	var state = $("#state").val();	var country = $("#country").val();	var desc = $("#desc").val();	var genre = $("#genre").val();	var link1 = $("#link1").val();	var link2 = $("#link2").val();	var link3 = $("#link3").val();		var email = $("#email_address").val();	//var user = $("#user_name").val();	var pass1 = $("#pass1").val();	var pass2 = $("#pass2").val();		atPos = email.indexOf("@");	stopPos = email.lastIndexOf(".");		if(state == "State/Province") {		state = " ";	}		if(bandurl == "taken") {		alert("The URL you requested is already taken, please choose another.");       $("#band_url").focus();    	$("#band_url").select();		return false;	} else if(bandurl.length==0) {		alert("You need to add a url for your profile to be accessible.");       $("#band_url").focus();    	$("#band_url").select();		return false;	} else if(email.length==0){       alert("Please enter an email address");       $("#email_address").focus();    	$("#email_address").select();		return false;    } else if (atPos == -1 || stopPos == -1) {		alert("Please enter a valid email address");       	$("#email_address").focus();    	$("#email_address").select();	} /* else if(user.length==0){       alert("Please enter a username");       $("#user_name").focus();    	$("#user_name").select();		return false;    } */ else if(pass1.length==0){       alert("Please enter a password");       $("#pass1").focus();    	$("#pass1").select();		return false;    } else if(pass2.length==0){       alert("Please retype the password you entered");       $("#pass2").focus();    	$("#pass2").select();		return false;    } else if(pass2 != pass1){       alert("The passwords entered do not match.");       $("#pass1").focus();    	$("#pass1").select();		return false;    } else if(band.length==0) {		alert("Please enter a band name");    	$("#band_name").focus();    	$("#band_name").select();		return false;    } else if(city.length==0){       alert("Please enter your city");       $("#city").focus();    	$("#city").select();		return false;    } else if(state.length==0){       alert("Please select your state/province");       $("#zip").focus();    	$("#zip").select();		return false;    } else if(country.length==0 || country == 0){       alert("Please select your country");       $("#country").focus();    	$("#country").select();		return false;    } else if(desc.length==0){       alert("Please enter a description of your band");       $("#desc").focus();    	$("#desc").select();		return false;    } else if(genre.length==0){       alert("Please select the genre of your band");       $("#genre").focus();    	$("#genre").select();		return false;    } else {					$.post("/_inc/func/signup_checkuser.inc.php", {user_name:email}, function(data){ 							if(data == "exists") {					alert("The email address entered already exists");    				$("#email_address").attr("value", "");    				$("#email_address").focus();    				$("#email_address").select();					return false;				} else {					if(band.length > 0) {						// check if band name exists						$.post("/_inc/func/signup_checkband.inc.php", {band_name:band}, function(data){ 										if(data == "exists") {								alert("The band name entered already exists");    							$("#band_name").attr("value", "");    							$("#band_name").focus();    							$("#band_name").select();								return false;							} else {															fulladdress = city+", "+state+", "+country;																geocoder.getLatLng(fulladdress, function(point) {									if (!point) {										alert(fulladdress + " not found");									} else {										$("#lati").attr("value", point.lat());	        							$("#longi").attr("value", point.lng());	        																	document.accountSignup.submit();									}								});							}						});					}				}			});	}} else {	alert("You must agree to the terms and conditions to sign-up");}}function checkURL() {	var url = $("#band_url").val();	var newurl = url.replace("_", "");	$("#band_url").attr("value", newurl);		if(url.length==0) {		alert("Please enter a hotbottle url for your band.");    	$("#band_url").focus();    	$("#band_url").select();		return false;    } else {        	$.post("/_inc/func/signup_checkurl.inc.php", {band_url:newurl}, function(data){    	    		if(data == "exists") {    		    			// disallow    			bandurl = "taken";				$("#band_url").css({backgroundImage:'url(/_img/icons/exclamation.gif)'});				$("#band_url").css({backgroundRepeat:'no-repeat'});				$("#band_url").css({backgroundPostion:'top right'});    			    		} else {    		    			// allowed    			bandurl = "allowed";				$("#band_url").css({backgroundImage:'url(/_img/icons/accept.gif)'});				$("#band_url").css({backgroundRepeat:'no-repeat'});				$("#band_url").css({backgroundPosition:'top right'});    		    		}    	    	});        }	}function doedit(id) {	//edit-show	$('#do-edit-'+id).hide();	$('#edit-show-'+id).show();}