
﻿
function Global(){$(document).ready(function(){$(":button, :submit, :reset, #signuplink, .gpButton").not(".notButton").addClass("gpButton ui-state-default ui-priority-primary").hover(function(){$(this).addClass("ui-state-hover");},function(){$(this).removeClass("ui-state-hover");}).mousedown(function(){$(this).addClass("ui-state-active");}).mouseup(function(){$(this).removeClass("ui-state-active");}).filter(".secondary").addClass("ui-priority-secondary")
$("#searchBar").keydown(function(event){if((event.which&&event.which==13)||(event.keyCode&&event.keyCode==13)){var query=$(this).val();if(query!=""){window.location="/search/q-"+Global.urlEncode(query);}
return false;}});$(".commentCount").click(function(){var gigId=$(this).attr("id");gigId=gigId.substring(1);Gigpig.Services.Forum.Forum.GetTop5(gigId,function(result){$("#miniComment"+gigId+" .miniCommentList .comment").remove();var comments=eval('('+result+')');for(i=0;i<comments.list.length;i++){var comment=parseTemplate(miniCommentTemplate,comments.list[i]);$("#miniComment"+gigId+" .miniCommentList").prepend(comment);}
$("#miniComment"+gigId+" .miniCommentList").prepend("<div class='comment firstComment'><strong>"+comments.count+" comments</strong></div>");});$("#miniComment"+gigId).toggle();});$(".advancedFilter").click(function(){$(".advanced").toggle();});$(".datepicker").datepicker({dateFormat:'d M yy'});});this.PromoteGig=function(GigID){Gigpig.Services.Gig.Vote(GigID,1,true,function(result){if(result==""){$("#gig"+GigID+" .response").text("You must be logged in to vote").stop(true,true).effect("highlight",{mode:"hide"},5000);}
else{var gigVote=eval('('+result+')');if(gigVote.voted){$("#gig"+GigID+" .response").text("You have already promoted this gig").stop(true,true).effect("highlight",{mode:"hide"},5000);}
else{$("#gig"+GigID+" .stats .box .reliabilityPercentage").text(gigVote.promotes-gigVote.buries);$("#gig"+GigID+" .stats .totalVotes").text((gigVote.promotes+gigVote.buries)+" Votes");$("#gig"+GigID+" .stats .box").stop(true,true).effect("highlight",{color:"#bef50c"},5000);}}},Global.onFailedWS);}
this.BuryGig=function(GigID){Gigpig.Services.Gig.Vote(GigID,-1,false,function(result){if(result==""){$("#gig"+GigID+" .response").text("You must be logged in to vote").stop(true,true).effect("highlight",{mode:"hide"},5000);}
else{var gigVote=eval('('+result+')');if(gigVote.voted){$("#gig"+GigID+" .response").text("You have already buried this gig").stop(true,true).effect("highlight",{mode:"hide"},5000);}
else{$("#gig"+GigID+" .stats .box .reliabilityPercentage").text(gigVote.promotes-gigVote.buries);$("#gig"+GigID+" .stats .totalVotes").text((gigVote.promotes+gigVote.buries)+" Votes");$("#gig"+GigID+" .stats .box").stop(true,true).effect("highlight",{color:"#ef3b3b"},5000);}}},Global.onFailedWS);}
this.FocusText=function(txtControl,rspControl,strText){$(txtControl).focus(function(){if($(rspControl).css("width")=="0px"){$(rspControl).html(strText);$(rspControl).removeClass();$(rspControl).addClass("response grey");$(rspControl).animate({width:"250px"},"fast");}});$(txtControl).blur(function(){if($(txtControl).val()==""){$(rspControl).animate({width:"0px"},"fast",null,function(){$(rspControl).removeClass();$(rspControl).html("");});}});}
this.AJAXFail=function(error){var errorHtml="<div class='error'>A server error has occured. If this persists please email us your problem at <a href='mailto:support@gigpig.fm'>support@gigpig.fm</a></div>";var adminHtml="<div style='display:none;'>"+error.get_message()+"<br />"+error.get_stackTrace()+"</div>";$("#content").prepend(errorHtml+adminHtml);}
this.onFailedWS=function(error){Global.AJAXFail(error);}
this.showAchievement=function(header,body){$.jGrowl(body,{header:header,life:18000});}
this.__GetServerElementById=function(id){return document.getElementById(__BaseName+id);}
this.showAchievement=function(header,body){$.jGrowl(body,{header:header,life:18000});}
this.urlEncode=function(clearString){var output='';var x=0;clearString=clearString.toString();var regex=/(^[a-zA-Z0-9_.]*)/;while(x<clearString.length){var match=regex.exec(clearString.substr(x));if(match!=null&&match.length>1&&match[1]!=''){output+=match[1];x+=match[1].length;}else{if(clearString[x]==' ')
output+='-';else{var charCode=clearString.charCodeAt(x);var hexVal=charCode.toString(16);output+='%'+(hexVal.length<2?'0':'')+hexVal.toUpperCase();}
x++;}}
return output;}
var miniCommentTemplate='<div class="comment"><div class="top"><a href="/User/<#= nickname #>"><#= nickname #></a> <span class="date"><#= date #></span></div><#= post #></div>';this.postComment=function(gigId){var text=$("#tar"+gigId).val();if(text.length>=3){Gigpig.Services.Forum.Forum.submitForumPost(text,gigId,function(result){if(result=="0"){$("#miniComment"+gigId+" .miniCommentList .firstComment").after("<div>You need to be logged in to do that</div>");$("#tar"+gigId).val("");}
else{var details=eval('('+result+')');var comment=parseTemplate(miniCommentTemplate,details);$("#miniComment"+gigId+" .miniCommentList .firstComment").after(comment);$("#tar"+gigId).val("");}});}}
this.keyDownComment=function(event,gigId){if((event.which&&event.which==13)||(event.keyCode&&event.keyCode==13)){Global.postComment(gigId);return false;}}
Array.prototype.remove=function(from,to){var rest=this.slice((to||from)+1||this.length);this.length=from<0?this.length+from:from;return this.push.apply(this,rest);};}
var Global=new Global();﻿function BandAdd(){var valid=false;$(document).ready(function(){$(Global.__GetServerElementById("txtBandName")).change(function(){if($("#extBandName").height()>0)
$("#extBandName").slideUp();if($(Global.__GetServerElementById("txtBandName")).val()==""){$("#rspBandName").removeClass();$("#rspBandName").addClass("response grey");$("#rspBandName").html("");}
else{var re=new RegExp("^[a-zA-Z0-9][a-zA-Z0-9_\\-\\s]{0,49}$");if(re.test($(Global.__GetServerElementById("txtBandName")).val())){$("#rspBandName").removeClass();$("#rspBandName").addClass("response grey");$("#rspBandName").html("<img src='/images/loader.gif' /> <div>checking availability</div>");Gigpig.Services.Band.GetSimilarBands($(Global.__GetServerElementById("txtBandName")).val(),bandNameCALLBACK,AJAXFail)}
else{$("#rspBandName").removeClass();$("#rspBandName").addClass("response red");$("#rspBandName").html("Must be 1 to 50 chars and alphanumeric, spaces allowed");valid=false;}}});Global.FocusText(Global.__GetServerElementById("txtBandName"),"#rspBandName","Enter the Band's Name");$("#txtTags").fcbkcomplete({json_url:"/_Tags/TagAutocomplete.aspx",newel:true});});function bandNameCALLBACK(result){var extBandName=$("#extBandName");var similarBands=eval('('+result+')');if(similarBands.length>0){$("#rspBandName").removeClass();$("#rspBandName").html("Ok, but similar bands found");$("#rspBandName").addClass("response yellow");valid=true;var output="";$("#divSimilarBands").html("");for(i=0;i<similarBands.length;i++){output="<div id='divSimilarBand"+i+"' class='similarBand'>";output+="<div class='info'>";output+="<div class='icon ui-icon ui-icon-star'></div>";output+="<a href='/band/"+similarBands[i].ID+"/"+similarBands[i].Name+"' class='name'>"+similarBands[i].Name+"</a> ";output+="</div>";output+="<div style='clear:both;'></div>";output+="</div>";$("#divSimilarBands").html($("#divSimilarBands").html()+output);}
var newHeight=42+(similarBands.length*22);extBandName.height(newHeight).slideDown();}
else{if(extBandName.height()>0)
extBandName.slideUp();$("#rspBandName").removeClass();$("#rspBandName").html("Ok");$("#rspBandName").addClass("response green");valid=true;}}
function AJAXFail(error){alert("AJAX Error! Details: "+error.get_message()+"\n"+error.get_stackTrace());}}﻿function BandEdit(){$(document).ready(function(){$("#txtTags").fcbkcomplete({json_url:"/_Tags/TagAutocomplete.aspx",newel:true});});}﻿function BandList(){var delayed=null;$(document).ready(function(){$("#txtBandname").keypress(function(){$("#loading").fadeIn();clearTimeout(delayed);delayed=setTimeout(function(){var query=$("#txtBandname").val();Gigpig.Services.Band.SearchBands(query,function(result){$("#loading").fadeOut();var response=eval('('+result+')');var bands=response[1];var output="";$("#searchBandList").html("");if(bands.length==0){$("#searchBandList").html("<div class='sorry'>Sorry, no bands matched your query.</div>");}
for(i=0;i<bands.length;i++){output+="<a class='band' href='/band/"+bands[i].BandID+"/"+bands[i].BandName+"'>"+bands[i].AccentBand+"</a>";$("#searchBandList").html($("#searchBandList").html()+output);}},function(error){alert(error.get_message());});},300);});});}﻿
function Forum(gigId){var template='<li id="post<#= postid #>" style="display: block;"><div class="commentWrap"><div class="commentLeft"><img src="<#= gravatar #>" alt="gravatar" class="commentGrav"></div><div class="commentRight"><div class="commentTop"><div class="user left"><a href="/User/<#= nickname #>"><#= nickname #></a><span class="quiet"> said...</span></div><div class="right quiet"><#= date #></div></div><div class="commentText"><#= post #></div></div><div class="clear"></div></div></li>';var mySettings={previewParserPath:'',markupSet:[{name:'Bold',key:'B',openWith:'[b]',closeWith:'[/b]'},{name:'Italic',key:'I',openWith:'[i]',closeWith:'[/i]'},{name:'Underline',key:'U',openWith:'[u]',closeWith:'[/u]'},{separator:'---------------'},{name:'Picture',key:'P',replaceWith:'[img][![Url]!][/img]'},{name:'Link',key:'L',openWith:'[url=[![Url]!]]',closeWith:'[/url]',placeHolder:'Your text to link here...'},{separator:'---------------'},{name:'Preview',className:"preview",call:'preview'}]};function submitPost(){$("#btnSubmitPost").addClass("ui-state-disabled").attr("disabled",true);$("#loadinggif").fadeIn("slow");var strPost=$("#tarPost").val();if(strPost.length>=5){Gigpig.Services.Forum.Forum.submitForumPost(strPost,gigId,function(result){if(result=="0"){$('#divMessage').html("You need to be logged in to Post a Reply.");$('#divMessage').fadeIn("slow");$("#loadinggif").fadeOut("slow");$("#btnSubmitPost").removeClass("ui-state-disabled").attr("disabled",false);}
else{$('#divForumPost').fadeOut("slow");$("#loadinggif").fadeOut("slow");$("#tarPost").val("");var details=eval('('+result+')');var comment=parseTemplate(template,details);$(".commentList").prepend(comment);$("#post"+details.postid).slideDown();$('#divMessage').html("Post successful.");$('#divMessage').fadeIn("slow");$(".sorry").fadeOut("slow");}},submitPostFAIL);}
else{$('#divMessage').html("The message you have entered is too short.");$('#divMessage').fadeIn("slow");$("#loadinggif").fadeOut("slow");$("#btnSubmitPost").removeClass("ui-state-disabled").attr("disabled",false);}}
function submitPostFAIL(error){$('#divMessage').html("Post unsuccessful.");$('#divMessage').fadeIn("slow");}
$(document).ready(function(){$("#btnSubmitPost").click(function(){submitPost();});$("#tarPost").markItUp(mySettings);});}﻿function GigAdd(){var Tickets=new Array();var TicketIDCount=0;var BandsPlaying=new Array();var amountOfFields=5;var AddGigValid=[amountOfFields];for(i=0;i<amountOfFields;i++)
AddGigValid[i]=false;var valid=false;var VenueList={};var venueid=0;var AutoCompleteVenueID=0;var AutoCompleteBandID=0;var NewVenueObject;var map;this.GigID=0;this.EditMode=false;var Statuses={hidden:{message:"",statusClass:"",showAlways:false,valid:false},info:{message:"This is a required field",statusClass:"grey",showAlways:false,valid:false},loading:{message:"loading...",statusClass:"grey",showAlways:true,valid:false},success:{message:"Ok",statusClass:"green",showAlways:true,valid:true},error:{message:"Please remove invalid characters",statusClass:"red",showAlways:true,valid:false},similarGigs:{message:"Ok, but similar gigs found",statusClass:"yellow",showAlways:true,valid:true},venueNotFound:{message:"Venue not found, please add it below",statusClass:"yellow",showAlways:true,valid:false},bandNotFound:{message:"Band not found, please add it below",statusClass:"yellow",showAlways:true,valid:false},addMoreBands:{message:"Please add at least one band",statusClass:"yellow",showAlways:true,valid:false}}
this.AddBand=function(newBand){var i=0;var valid=true;for(i=0;i<BandsPlaying.length;i++){if(BandsPlaying[i]==newBand.ID)
valid=false;}
if(valid){BandsPlaying[BandsPlaying.length]=newBand.ID;DrawBand(newBand);}
else{var errorHtml="<div class='error fadeResponse' style='display:none;'>That band has already been added to this gig</div>";$("#content").prepend(errorHtml);$(".fadeResponse").effect("highlight",{color:"#ffff99"},5000).fadeOut("slow");}}
function RemoveBand(id){var i;i=0;while(i<BandsPlaying.length){if(BandsPlaying[i]==id){BandsPlaying.remove(i);return true;}else{i++;}}
return true;}
function checkVenueGigs(){var date=$(Global.__GetServerElementById("txtDate")).val();if(venueid>0&&date!=""){Gigpig.Services.Gig.GetVenueGigs(venueid,date,GigNameCALLBACK,Global.AJAXFail);}}
function alertBands(){var output="";output="BandCount: "+BandsPlaying.length+"\n";var i;for(i=0;i<BandsPlaying.length;i++){output+=BandsPlaying[i]+"\n";}
alert(output);}
this.AddTicket=function(type,price){var currentId=Tickets.length;DrawTicket(TicketIDCount,type,price);Tickets[currentId]=new Array();Tickets[currentId]["ID"]=TicketIDCount;Tickets[currentId]["Name"]=type;Tickets[currentId]["Price"]=price;TicketIDCount++;}
this.RemoveTicket=function(id){var i;i=0;while(i<Tickets.length){if(Tickets[i]["ID"]==id){Tickets.remove(i);return true;}else{i++;}}
return true;}
this.alertTickets=function(){var output="";output="TicketCount: "+Tickets.length+"\n";output+="TicketIDCount: "+TicketIDCount+"\n";var i;for(i=0;i<Tickets.length;i++){output+=Tickets[i]["ID"]+": "+Tickets[i]["Name"]+" - "+Tickets[i]["Price"]+"\n";}
alert(output);}
this.ToggleTickets=function(){var extPrice=$("#extPrice");var divPriceWrap=$("#divPriceWrap");if(extPrice.css("display")!="none"){divPriceWrap.slideDown("normal");extPrice.slideUp("normal");$(Global.__GetServerElementById("txtPrice")).focus();}
else{extPrice.slideDown("normal");divPriceWrap.slideUp("normal");if($(Global.__GetServerElementById("txtPrice")).val()!=""&&validatePrice($(Global.__GetServerElementById("txtPrice")).val())){$(Global.__GetServerElementById("txtExtraTicketType")).val("General Admission");$(Global.__GetServerElementById("txtExtraTicketPrice")).val($(Global.__GetServerElementById("txtPrice")).val());}
checkValid();}}
function CheckTicketsValid(){if($("#extPrice").css("display")!="none"){if(Tickets.length>0){$("#divExtraTicketResponse2").slideDown();return true;}
else{$("#divExtraTicketResponse2").slideUp();return false;}}
return true;}
function DrawTicket(ID,Type,Price){var output="<div id='divTicket"+ID+"' class='newTicket'>";output+="<div class='ticket'></div>";output+="<div class='info'>";output+="<span class='type'>"+Type+"</span> - <span class='price'>$"+Price+"</span>";output+="</div>";output+="<div class='remove' onclick='GigAdd.btnRemoveTicket_Click("+ID+")'></div>";output+="<div style='clear:both;'></div>";output+="</div>";$("#divExtraTickets").html($("#divExtraTickets").html()+output);}
this.btnAddTicket_Click=function(sender){var txtType=$(Global.__GetServerElementById("txtExtraTicketType"));var txtPrice=$(Global.__GetServerElementById("txtExtraTicketPrice"));txtPrice.formatCurrency({symbol:""});if(validateType(txtType.val())){if(validatePrice(txtPrice.val())){var newPrice=txtPrice.val();GigAdd.AddTicket(txtType.val(),newPrice);$("#divExtraTickets").children(".newTicket").slideDown();$(Global.__GetServerElementById("txtPrice")).val(newPrice);$(Global.__GetServerElementById("txtPrice")).inputResponse("UpdateResponse",false);txtType.val("");txtPrice.val("");$(Global.__GetServerElementById("txtExtraTicketType")).focus();}
else{$("#divExtraTicketResponse").text("Please enter a valid ticket price").slideDown("normal",function(){setTimeout(function(){$('#divExtraTicketResponse').slideUp();$("#extPrice").slideDown("normal");},5000)});}}
else{$("#divExtraTicketResponse").text("Please enter a valid ticket type").slideDown("fast",function(){setTimeout(function(){$('#divExtraTicketResponse').fadeOut('slow');$("#extPrice").slideDown("normal");},5000)});}
checkValid();return false;}
this.btnRemoveTicket_Click=function(id){GigAdd.RemoveTicket(id);$("#divTicket"+id).slideUp('normal',function(){$(this).remove()});checkValid();}
function validateType(type){var re=new RegExp("^[a-zA-Z0-9][a-zA-Z0-9_\\-\\?\\'\\\"&\\s]{0,49}$");if(type=="")
return false;else if(!re.test(type))
return false;return true;}
function validatePrice(price){var re=new RegExp("^\\$?[0-9][0-9]{0,3}(,[0-9]{3})*(\\.[0-9]{1,2})?$");return re.test(price);}
function GigNameCALLBACK(result,eventArgs){var extGigName=$("#extGigName");var similarGigs=eval('('+result+')');GigAdd.test2=similarGigs;if(similarGigs!=null){if(similarGigs.length==1&&similarGigs[0].GigID==GigAdd.GigID){if(extGigName.height()>0)
extGigName.slideUp();$(Global.__GetServerElementById("txtGigName")).inputResponse("UpdateStatus",$(Global.__GetServerElementById("txtGigName")).inputResponse("Statuses").success);}
else{$(Global.__GetServerElementById("txtGigName")).inputResponse("UpdateStatus",$(Global.__GetServerElementById("txtGigName")).inputResponse("Statuses").similarGigs);var output="";$("#divSimilarGigs").html("");for(i=0;i<similarGigs.length;i++){if(similarGigs[i].ID!=GigAdd.GigID){output="<div id='divSimilarGig"+i+"' class='similarGig'>";output+="<div class='info'>";output+="<div class='icon'></div>";output+="<a href='"+similarGigs[i].Link+"' class='name'>"+similarGigs[i].AccentGig+"</a> @ <a href='"+similarGigs[i].Venue.Link+"' class='venue'>"+similarGigs[i].Venue.VenueName+"</a> - <span class='date'>"+similarGigs[i].DateString+"</span>";output+="</div>";output+="<div style='clear:both;'></div>";output+="</div>";$("#divSimilarGigs").html($("#divSimilarGigs").html()+output);}}
var newHeight=42+(similarGigs.length*22);extGigName.height(newHeight).slideDown();}}
else{if(extGigName.height()>0)
extGigName.slideUp();$(Global.__GetServerElementById("txtGigName")).inputResponse("UpdateStatus",$(Global.__GetServerElementById("txtGigName")).inputResponse("Statuses").success);}
checkValid();}
function CheckBandsValid(){if(BandsPlaying.length>0){return true;}
else{return false;}}
function BandCALLBACK(result,eventArgs){AutoCompleteBandID=0;if(result=="BandNotFound"){$(Global.__GetServerElementById("txtBands")).inputResponse("UpdateStatus",$(Global.__GetServerElementById("txtBands")).inputResponse("Statuses").bandNotFound);if($(Global.__GetServerElementById("txtBands")).val()!="")
$("#extNewBand").slideDown("normal");}
else if(result=="AddBandError"){alert("Add Band Failed");}
else{var newBand=eval('('+result+')');GigAdd.AddBand(newBand[0]);$("#divNewBands").children(".newBand").slideDown();$(Global.__GetServerElementById("txtBands")).val("").focus();$("#extNewBand").slideUp("normal");$("#txtTags").fcbkcomplete.removeAll();$(Global.__GetServerElementById("txtBands")).inputResponse("UpdateStatus",$(Global.__GetServerElementById("txtBands")).inputResponse("Statuses").success);}
checkValid();$(Global.__GetServerElementById("txtBands")).inputResponse("UpdateResponse",false);}
function DrawBand(newBand){var output="<div class='newBand' id='divNewBand"+newBand.ID+"'>";output+="<div class='details'>";output+="<div class='name'><a href='"+newBand.Link+"' target='blank'>"+newBand.AccentBand+"</a></div>";output+="<div class='remove'><a href='' onclick='GigAdd.btnRemoveBand_Click("+newBand.ID+"); return false;'>Remove</a></div>";output+="<div class='tagList'>";for(i=0;i<newBand.Tags.length;i++){output+="<a href='"+newBand.Tags[i].Link+"' target='blank'>"+newBand.Tags[i].Name+"</a>";}
output+="</div>";output+="</div>";output+="</div>";$("#divNewBands").html(output+$("#divNewBands").html());}
this.AddNewBand=function(){if($(Global.__GetServerElementById("txtBands")).val()!=""){var re=new RegExp("^[a-zA-Z0-9][a-zA-Z0-9_\\-\\?\\'\\\"&\\s]{0,99}$");if(re.test($(Global.__GetServerElementById("txtBands")).val())){$(Global.__GetServerElementById("txtBands")).inputResponse("UpdateStatus",$(Global.__GetServerElementById("txtBands")).inputResponse("Statuses").loading);var tagString="";if($("#txtTags").val()!=null)
{tagString=$("#txtTags").val().join(",");}
Gigpig.Services.Band.AddNewBand($(Global.__GetServerElementById("txtBands")).val(),tagString,BandCALLBACK,Global.AJAXFail);}
else{$(Global.__GetServerElementById("txtBands")).inputResponse("UpdateStatus",$(Global.__GetServerElementById("txtBands")).inputResponse("Statuses").error);}}}
this.btnRemoveBand_Click=function(id){RemoveBand(id);$("#divNewBand"+id).slideUp('normal',function(){$(this).remove()});if(!CheckBandsValid())
$(Global.__GetServerElementById("txtBands")).inputResponse("UpdateStatus",$(Global.__GetServerElementById("txtBands")).inputResponse("Statuses").addMoreBands);checkValid();$(Global.__GetServerElementById("txtBands")).inputResponse("UpdateResponse",false);}
function checkValid(){valid=true
$(".validate").each(function(){if(!$(this).inputResponse("Valid")){valid=false;}});if(!CheckTicketsValid())
valid=false;if(valid){if(GigAdd.EditMode)
$("#btnAddGig").removeClass("ui-state-disabled").val("Update Gig");else
$("#btnAddGig").removeClass("ui-state-disabled").val("Create Gig");}
else{if(GigAdd.EditMode)
$("#btnAddGig").addClass("ui-state-disabled").val("Update Gig (Please Complete All Fields)");else
$("#btnAddGig").addClass("ui-state-disabled").val("Create Gig (Please Complete All Fields)");}
return valid;}
function VenueCALLBACK(result,eventArgs){AutoCompleteVenueID=0;if(result=="VenueNotFound"){$(Global.__GetServerElementById("txtVenue")).inputResponse("UpdateStatus",$(Global.__GetServerElementById("txtVenue")).inputResponse("Statuses").venueNotFound);$("#txtNewVenue").val($("#venue").val());$("#lblVenue").text("Add Venue");$("#extNewVenue").slideDown("normal");}
else{$("#lblVenue").text("Venue");$("#extNewVenue").slideUp("normal");$(Global.__GetServerElementById("txtVenue")).inputResponse("UpdateStatus",$(Global.__GetServerElementById("txtVenue")).inputResponse("Statuses").success);var Result=eval('('+result+')');venueid=Result.Venues[0].ID;var mapString="http://maps.google.com/staticmap?center=";mapString+=Result.Venues[0].Latitude+","+Result.Venues[0].Longitude;mapString+="&zoom=14&size=75x75";mapString+="&markers="+Result.Venues[0].Latitude+","+Result.Venues[0].Longitude;mapString+="&key="+Result.MapKey;$("#extVenue").children(".map").html("<img src='"+mapString+"' alt='' />");$("#extVenue").children(".details").children(".name").text(Result.Venues[0].AccentVenue);$("#extVenue").children(".details").children(".city").text(Result.Venues[0].AccentCity);var strAddress=Result.Venues[0].StreetAddress+" "+Result.Venues[0].City.AccentCity+"<br/>";strAddress+=Result.Venues[0].City.RegionName+", "+Result.Venues[0].City.CountryName;$("#extVenue").children(".details").children(".address").html(strAddress);$("#extVenue").slideDown("normal");checkVenueGigs();}}
$(document).ready(function(){$(Global.__GetServerElementById("txtGigName")).inputResponse({responseClass:"response",status:Statuses,validateFunction:function(value,focused,showing,currentStatus,previousValue){if(focused){if(!showing){return $(Global.__GetServerElementById("txtGigName")).inputResponse("Statuses").info;}
else{return currentStatus;}}
else{if(value!=previousValue){if(value==""){$("#extGigName").slideUp();return $(Global.__GetServerElementById("txtGigName")).inputResponse("Statuses").hidden;}
else{var re=new RegExp("^[a-zA-Z0-9][a-zA-Z0-9_\\-\\?\\'\\\"&\\s]{0,49}$");if(re.test(value)){Gigpig.Services.Gig.GetSimilarGigs(value,GigNameCALLBACK,Global.AJAXFail);return $(Global.__GetServerElementById("txtGigName")).inputResponse("Statuses").loading;}
else{return $(Global.__GetServerElementById("txtGigName")).inputResponse("Statuses").error;}}}
else{return currentStatus;}}}});$(Global.__GetServerElementById("txtDate")).inputResponse({responseClass:"response",status:Statuses,validateFunction:function(value,focused,showing,currentStatus,previousValue){if(focused){if(!showing){return $(Global.__GetServerElementById("txtDate")).inputResponse("Statuses").info;}
else{return currentStatus;}}
else{if(value!=previousValue){if(value==""){return $(Global.__GetServerElementById("txtDate")).inputResponse("Statuses").hidden;}
else{if(/^((31(?! (Feb|Apr|Jun|Sep|Nov)))|((30|29)(?! Feb))|(29(?= Feb (((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)))))|(0?[1-9])|1\d|2[0-8]) (Jan|Feb|Mar|May|Apr|Jul|Jun|Aug|Oct|Sep|Nov|Dec) ((1[6-9]|[2-9]\d)\d{2})$/.test(value)){checkVenueGigs();return $(Global.__GetServerElementById("txtDate")).inputResponse("Statuses").success;}
else{return $(Global.__GetServerElementById("txtDate")).inputResponse("Statuses").error;}}}
else{return currentStatus;}}}});$(Global.__GetServerElementById("txtPrice")).inputResponse({responseClass:"response",status:Statuses,validateFunction:function(value,focused,showing,currentStatus,previousValue){if(focused){if(!showing){return $(Global.__GetServerElementById("txtPrice")).inputResponse("Statuses").info;}
else{return currentStatus;}}
else{if(value!=previousValue){if(value==""){return $(Global.__GetServerElementById("txtPrice")).inputResponse("Statuses").hidden;}
else{if(value=="Free"||value=="free"){return $(Global.__GetServerElementById("txtPrice")).inputResponse("Statuses").success;}
else if(value=="Unknown"||value=="unknown"){return $(Global.__GetServerElementById("txtPrice")).inputResponse("Statuses").success;}
else{if(validatePrice(value)){return $(Global.__GetServerElementById("txtPrice")).inputResponse("Statuses").success;}
else{return $(Global.__GetServerElementById("txtPrice")).inputResponse("Statuses").error;}}}}
else{return currentStatus;}}}});$(Global.__GetServerElementById("txtPrice")).bind("inputResponsepreUpdate",function(){if($(this).val()!=""&&$(this).val().toLowerCase()!="free"&&$(this).val().toLowerCase()!="unknown"){$(this).formatCurrency({symbol:""});}});$("#hplFree").click(function(){$(Global.__GetServerElementById("txtPrice")).val("Free");$(Global.__GetServerElementById("txtPrice")).inputResponse("UpdateResponse",false);});$("#hplUnknown").click(function(){$(Global.__GetServerElementById("txtPrice")).val("Unknown");$(Global.__GetServerElementById("txtPrice")).inputResponse("UpdateResponse",false);});$(Global.__GetServerElementById("txtVenue")).inputResponse({responseClass:"response",status:Statuses,validateFunction:function(value,focused,showing,currentStatus,previousValue){if(focused){if(!showing){return $(Global.__GetServerElementById("txtVenue")).inputResponse("Statuses").info;}
else{return currentStatus;}}
else{if(value!=previousValue){$("#extNewVenue").slideUp();$("#extVenue").slideUp();if(value==""){return $(Global.__GetServerElementById("txtVenue")).inputResponse("Statuses").hidden;}
else{var re=new RegExp("^[a-zA-Z0-9][a-zA-Z0-9_\\-\\?\\'\\\"&\\s]{0,99}$");if(re.test(value)){setTimeout(function(){if(AutoCompleteVenueID>0){Gigpig.Services.Venue.GetVenueJSON(AutoCompleteVenueID,VenueCALLBACK,Global.AJAXFail);}
else{Gigpig.Services.Venue.SearchVenuesByExactName($(Global.__GetServerElementById("txtVenue")).val(),$(Global.__GetServerElementById("ddlCountries")).val(),VenueCALLBACK,Global.AJAXFail);}},400);return $(Global.__GetServerElementById("txtVenue")).inputResponse("Statuses").loading;}
else{return $(Global.__GetServerElementById("txtVenue")).inputResponse("Statuses").error;}}}
else{return currentStatus;}}}});$(Global.__GetServerElementById("txtBands")).inputResponse({responseClass:"response",status:Statuses,validateFunction:function(value,focused,showing,currentStatus,previousValue){if(focused){if(!showing){return $(Global.__GetServerElementById("txtBands")).inputResponse("Statuses").info;}
else{return currentStatus;}}
else{if(value!=previousValue){$("#extNewBand").slideUp();if(value==""){if(CheckBandsValid())
return $(Global.__GetServerElementById("txtBands")).inputResponse("Statuses").success;return $(Global.__GetServerElementById("txtBands")).inputResponse("Statuses").hidden;}
else{var re=new RegExp("^[a-zA-Z0-9][a-zA-Z0-9_\\-\\?\\'\\\"&\\s]{0,99}$");if(re.test(value)){setTimeout(function(){if(AutoCompleteBandID>0){Gigpig.Services.Band.GetBandJSON(AutoCompleteBandID,BandCALLBACK,Global.AJAXFail);}
else{Gigpig.Services.Band.SearchBandsByExactName($(Global.__GetServerElementById("txtBands")).val(),BandCALLBACK,Global.AJAXFail);}},400);return $(Global.__GetServerElementById("txtBands")).inputResponse("Statuses").loading;}
else{return $(Global.__GetServerElementById("txtBands")).inputResponse("Statuses").error;}}}
else{return currentStatus;}}},animationSettings:{show:{width:"230px",opacity:1},hide:{width:"0px",opacity:0}}});$(Global.__GetServerElementById("txtVenue")).bind("inputResponsepostUpdate",function(focused,value){checkValid();});$(Global.__GetServerElementById("txtDate")).bind("inputResponsepostUpdate",function(focused,value){checkValid();});$(Global.__GetServerElementById("txtPrice")).bind("inputResponsepostUpdate",function(focused,value){checkValid();});$(Global.__GetServerElementById("txtGigName")).bind("inputResponsepostUpdate",function(focused,value){checkValid();});$(Global.__GetServerElementById("txtBands")).bind("inputResponsepostUpdate",function(focused,value){checkValid();});$(Global.__GetServerElementById("txtExtraTicketType")).keydown(function(event){if((event.which&&event.which==13)||(event.keyCode&&event.keyCode==13)){GigAdd.btnAddTicket_Click();return false;}});$(Global.__GetServerElementById("txtExtraTicketPrice")).keydown(function(event){if((event.which&&event.which==13)||(event.keyCode&&event.keyCode==13)){GigAdd.btnAddTicket_Click();return false;}});$(Global.__GetServerElementById("txtDate")).datepicker({dateFormat:'d M yy',onClose:function(){$(Global.__GetServerElementById("txtDate")).inputResponse("UpdateResponse",false);},minDate:0});$(Global.__GetServerElementById("txtVenue")).autocomplete("/_venues/VenueAutocomplete.aspx",{minChars:3,width:310,extraParams:{countryCode:$(Global.__GetServerElementById("ddlCountries")).val()},matchContains:true,autoFill:false,formatItem:function(row){return row[1];},formatResult:function(row){return row[2];}});$(Global.__GetServerElementById("ddlCountries")).change(function(){$(Global.__GetServerElementById("txtVenue")).setOptions({extraParams:{countryCode:$(Global.__GetServerElementById("ddlCountries")).val()}});$(Global.__GetServerElementById("txtVenue")).flushCache();$(Global.__GetServerElementById("txtVenue")).focus();});$(Global.__GetServerElementById("txtVenue")).result(function(event,data,formatted){AutoCompleteVenueID=data[0];$(Global.__GetServerElementById("txtVenue")).blur();});$(Global.__GetServerElementById("txtBands")).autocomplete("/_bands/BandAutocomplete.aspx",{minChars:3,width:310,matchContains:true,autoFill:false,formatItem:function(row){return row[1];},formatResult:function(row){return row[2];}});$(Global.__GetServerElementById("txtBands")).result(function(event,data,formatted){AutoCompleteBandID=data[0];$(Global.__GetServerElementById("txtBands")).blur();});checkValid();$("#txtTags").fcbkcomplete({json_url:"/_Tags/TagAutocomplete.aspx",newel:true,complete_text:"Eg. Genre, Nationality, etc..."});});this.UpdateGig=function(){if(!checkValid())
return;var GigName=$(Global.__GetServerElementById("txtGigName")).val();var GigDate=$(Global.__GetServerElementById("txtDate")).val();if($("#extPrice").css("display")=="none"){Tickets=new Array();Tickets[0]=new Array();Tickets[0]["ID"]=0;Tickets[0]["Name"]="General Admission";if($(Global.__GetServerElementById("txtPrice")).val().toLowerCase()=="free")
Tickets[0]["Price"]=0;else if($(Global.__GetServerElementById("txtPrice")).val().toLowerCase()=="unknown")
Tickets[0]["Price"]=-1;else
Tickets[0]["Price"]=$(Global.__GetServerElementById("txtPrice")).val();}
JSONifyTickets();Gigpig.Services.Gig.UpdateGig(GigAdd.GigID,GigName,GigDate,JSON.stringify(Tickets),venueid,BandsPlaying,gigAddedCallBack,Global.AJAXFail);}
this.CreateGig=function(){if(!checkValid())
return;var GigName=$(Global.__GetServerElementById("txtGigName")).val();var GigDate=$(Global.__GetServerElementById("txtDate")).val();if($("#extPrice").css("display")=="none"){Tickets=new Array();Tickets[0]=new Array();Tickets[0]["ID"]=0;Tickets[0]["Name"]="General Admission";if($(Global.__GetServerElementById("txtPrice")).val().toLowerCase()=="free")
Tickets[0]["Price"]=0;else if($(Global.__GetServerElementById("txtPrice")).val().toLowerCase()=="unknown")
Tickets[0]["Price"]=-1;else
Tickets[0]["Price"]=$(Global.__GetServerElementById("txtPrice")).val();}
JSONifyTickets();Gigpig.Services.Gig.CreateGig(GigName,GigDate,JSON.stringify(Tickets),venueid,BandsPlaying,gigAddedCallBack,Global.AJAXFail);}
function gigAddedCallBack(result){if(result.substr(0,5)=="ERROR"){var errorHtml="<div class='error'>A server error has occured. If this persists please email us your problem at <a href='mailto:support@gigpig.fm'>support@gigpig.fm</a></div>";var adminHtml="<div style='display:none;'>"+error.get_message()+"<br />"+error.get_stackTrace()+"</div>";$("#content").prepend(errorHtml+adminHtml);}
else{var Result=eval('('+result+')');window.location="/gig/"+Result.ID+"/"+Result.Name.replace(" ","-");}}
function JSONifyTickets(){for(i=0;i<Tickets.length;i++){Tickets[i]={"Name":Tickets[i]["Name"],"Price":Tickets[i]["Price"]}}}
this.clearVenue=function(){venueid=0;AutoCompleteVenueID=0;$(Global.__GetServerElementById("txtVenue")).val("").blur();}
this.clearNewBand=function(){AutoCompleteBandID=0;$(Global.__GetServerElementById("txtBands")).val("").blur();}
this.testVenue="";this.codeVenueAddress=function(){$("#divVenueResponse").slideUp();var address=$("#txtAddress").val()+" "+$(Global.__GetServerElementById("ddlCountries")).val();if(Location.geocoder){Location.geocoder.geocode({'address':address},function(results,status){if(status==google.maps.GeocoderStatus.OK||status==google.maps.GeocoderStatus.ZERO_RESULTS){if(status!=google.maps.GeocoderStatus.ZERO_RESULTS){var city;var country;var countrycode;var latlng;var address;var streetnum="";GigAdd.testVenue=results;for(i=0;i<results[0].address_components.length;i++){if(results[0].address_components[i].types[0]=="subpremise")
streetnum+=results[0].address_components[i].long_name+"/";if(results[0].address_components[i].types[0]=="street_number")
streetnum+=results[0].address_components[i].long_name;if(results[0].address_components[i].types[0]=="street_address")
address=results[0].address_components[i].long_name;if(results[0].address_components[i].types[0]=="route")
address=results[0].address_components[i].long_name;if(results[0].address_components[i].types[0]=="neighborhood")
city=results[0].address_components[i].long_name;if(results[0].address_components[i].types[0]=="locality")
city=results[0].address_components[i].long_name;if(results[0].address_components[i].types[0]=="country"){countrycode=results[0].address_components[i].short_name;country=results[0].address_components[i].long_name;}}
if(city!=null&&city!=""){latlng=results[0].geometry.location;var map=Map.CreateMap(document.getElementById("divFindVenueMap"),latlng.lat(),latlng.lng());Map.CreateMarker(latlng.lat(),latlng.lng(),map,$(Global.__GetServerElementById("txtVenue")).val());$("#txtAddress").val(results[0].formatted_address);$("#divAddressFind").slideDown();var streetAdr="";if(streetnum==null){streetAdr=address;}
else{streetAdr=streetnum+" "+address;}
if(address==null){streetAdr="";}
NewVenueObject={VenueName:$(Global.__GetServerElementById("txtVenue")).val(),StreetAddress:streetAdr,Latitude:latlng.lat(),Longitude:latlng.lng(),City:city,Country:country,CountryCode:countrycode}
if(results.length>1){var suggestListHTML="<div class='header'>Other Suggestions</div>";suggestListHTML+="<ul>";for(var i=1;i<results.length;i++){suggestListHTML+="<li>";suggestListHTML+="<a onclick='GigAdd.SwapAddress(\""+results[i].formatted_address+"\")'>"+results[i].formatted_address+"</a>";suggestListHTML+="</li>";}
suggestListHTML+="</ul>";$("#divMapSuggestions").html(suggestListHTML).slideDown();}
else{$("#divMapSuggestions").slideUp();}}
else{$("#divVenueResponse").text("Please enter a more detailed address").slideDown();$("#divAddressFind").slideUp();}}
else{$("#divVenueResponse").text("No results were found, please try again").slideDown();$("#divAddressFind").slideUp();}}
else{$("#divVenueResponse").text("Google Error: "+status).slideDown();$("#divAddressFind").slideUp();}});}}
this.SwapAddress=function(newAddress){$("#txtAddress").val(newAddress);GigAdd.codeVenueAddress();$("#divVenueResponse").slideUp();}
this.AddVenue=function(){if(NewVenueObject.VenueName!=""){Gigpig.Services.Venue.AddVenue(NewVenueObject.VenueName,NewVenueObject.StreetAddress,NewVenueObject.Latitude,NewVenueObject.Longitude,NewVenueObject.City,NewVenueObject.Country,NewVenueObject.CountryCode,function(result){var NewVenueResult=eval('('+result+')');$("#hidVenueId").val(NewVenueResult.ID);Gigpig.Services.Venue.GetVenueJSON(NewVenueResult.ID,VenueCALLBACK,Global.AJAXFail);},Global.AJAXFail);}}}﻿function GigView(gigid,lat,lng,venuename)
{function voteReliability(vote,id,reliablility)
{Gigpig.Services.Gig.Vote(id,vote,reliablility,function(result){voteResponse(result);if(vote<0){if(reliablility){$(".popularityButton").removeClass("selected");$("#fake .popularityButton").addClass("selected");}
else{$(".popularityButton").removeClass("selected");$("#bury .popularityButton").addClass("selected");}}
else{$(".popularityButton").removeClass("selected");$("#promote .popularityButton").addClass("selected");}},Global.onFailedWS);}
function voteResponse(result){if(result==""){$("#notSignedIn").show();}
else{$("#notSignedIn").hide();var status=eval('('+result+')');$("#promote a").html(status.promotes);$("#bury a").html(status.buries);$("#fake a").html(status.fakes);$("#totalVotes").html((parseInt(status.promotes)+parseInt(status.buries))+" total votes");}}
$(document).ready(function(){venuemap=Map.CreateMap(document.getElementById("map"),lat,lng);Map.CreateMarker(lat,lng,venuemap,venuename);$("#promote").click(function(){voteReliability(1,gigid,true);});$("#bury").click(function(){voteReliability(-1,gigid,false);});$("#fake").click(function(){voteReliability(-1,gigid,true);});$("#promote").hover(function(){$("#promote .type").css("visibility","visible");},function(){$("#promote .type").css("visibility","hidden");});$("#bury").hover(function(){$("#bury .type").css("visibility","visible");},function(){$("#bury .type").css("visibility","hidden");});$("#fake").hover(function(){$("#fake .type").css("visibility","visible");},function(){$("#fake .type").css("visibility","hidden");});$("#noSource").click(function(){$(".sources .list").slideToggle();});});}
jQuery(function($){$.fn.fcbkcomplete=function(opt){return this.each(function(){function init(){createFCBK();preSet();addInput(0);}
function createFCBK(){element.hide();element.attr("multiple","multiple");if(element.attr("name").indexOf("[]")==-1){element.attr("name",element.attr("name")+"[]");}
holder=$(document.createElement("ul"));holder.attr("class","holder");element.after(holder);complete=$(document.createElement("div"));complete.addClass("facebook-auto");complete.append('<div class="default">'+options.complete_text+"</div>");if(browser_msie){complete.append('<iframe class="ie6fix" scrolling="no" frameborder="0"></iframe>');browser_msie_frame=complete.children('.ie6fix');}
feed=$(document.createElement("ul"));feed.attr("id",elemid+"_feed");complete.prepend(feed);holder.after(complete);feed.css("width",complete.width());}
function preSet(){element.children("option").each(function(i,option){option=$(option);if(option.hasClass("selected")){addItem(option.text(),option.val(),true);option.attr("selected","selected");}
else{option.removeAttr("selected");}
cache.push({caption:option.text(),value:option.val()});search_string+=""+(cache.length-1)+":"+option.text()+";";});}
this.addItem=function(title,value){addItem(title,value);}
$.fn.fcbkcomplete.removeAll=function(){element.empty();$(".bit-box").remove();$("#txtTags_feed li").remove();}
function addItem(title,value,preadded){var li=document.createElement("li");var txt=document.createTextNode(title);var aclose=document.createElement("a");$(li).attr({"class":"bit-box","rel":value});$(li).prepend(txt);$(aclose).attr({"class":"closebutton","href":"#"});li.appendChild(aclose);holder.append(li);$(aclose).click(function(){$(this).parent("li").fadeOut("fast",function(){removeItem($(this));});return false;});if(!preadded){$("#"+elemid+"_annoninput").remove();var _item;addInput(1);if(element.children("option[value="+value+"]").length){_item=element.children("option[value="+value+"]");_item.get(0).setAttribute("selected","selected");if(!_item.hasClass("selected")){_item.addClass("selected");}}
else{var _item=$(document.createElement("option"));_item.attr("value",value).get(0).setAttribute("selected","selected");_item.attr("value",value).addClass("selected");_item.text(title);element.append(_item);}
if(options.onselect.length){funCall(options.onselect,_item)}}
holder.children("li.bit-box.deleted").removeClass("deleted");feed.hide();browser_msie?browser_msie_frame.hide():'';}
function removeItem(item){if(options.onremove.length){var _item=element.children("option[value="+item.attr("rel")+"]");funCall(options.onremove,_item)}
element.children("option[value="+item.attr("rel")+"]").removeAttr("selected");element.children("option[value="+item.attr("rel")+"]").removeClass("selected");item.remove();deleting=0;}
function addInput(focusme){var li=$(document.createElement("li"));var input=$(document.createElement("input"));li.attr({"class":"bit-input","id":elemid+"_annoninput"});input.attr({"type":"text","class":"maininput","size":"1"});holder.append(li.append(input));input.focus(function(){complete.fadeIn("fast");});input.blur(function(){complete.fadeOut("fast");});holder.click(function(){input.focus();if(feed.length&&input.val().length){feed.show();}
else{feed.hide();browser_msie?browser_msie_frame.hide():'';complete.children(".default").show();}});input.keypress(function(event){if(event.keyCode==13){return false;}
input.attr("size",input.val().length+1);});input.keydown(function(event){if(event.keyCode==191){event.preventDefault();return false;}});input.keyup(function(event){var etext=xssPrevent(input.val());if(event.keyCode==8&&etext.length==0){feed.hide();browser_msie?browser_msie_frame.hide():'';if(holder.children("li.bit-box.deleted").length==0){holder.children("li.bit-box:last").addClass("deleted");return false;}
else{if(deleting){return;}
deleting=1;holder.children("li.bit-box.deleted").fadeOut("fast",function(){removeItem($(this));return false;});}}
if(event.keyCode!=40&&event.keyCode!=38&&etext.length!=0){counter=0;if(options.json_url){if(options.cache&&json_cache){addMembers(etext);bindEvents();}
else{$.getJSON(options.json_url+"?tag="+etext,null,function(data){addMembers(etext,data);json_cache=true;bindEvents();});}}
else{addMembers(etext);bindEvents();}
complete.children(".default").hide();feed.show();}});if(focusme){setTimeout(function(){input.focus();complete.children(".default").show();},1);}}
function addMembers(etext,data){feed.html('');if(!options.cache){cache=new Array();search_string="";}
addTextItem(etext);if(data!=null&&data.length){$.each(data,function(i,val){cache.push({caption:val.caption,value:val.value});search_string+=""+(cache.length-1)+":"+val.caption+";";});}
var maximum=options.maxshownitems<cache.length?options.maxshownitems:cache.length;var filter="i";if(options.filter_case){filter="";}
var myregexp,match;try{myregexp=eval('/(?:^|;)\\s*(\\d+)\\s*:[^;]*?'+etext+'[^;]*/g'+filter);match=myregexp.exec(search_string);}catch(ex){};var content='';while(match!=null&&maximum>0){var id=match[1];var object=cache[id];if(options.filter_selected&&element.children("option[value="+object.value+"]").hasClass("selected")){}
else{content+='<li rel="'+object.value+'">'+itemIllumination(object.caption,etext)+'</li>';counter++;maximum--;}
match=myregexp.exec(search_string);}
feed.append(content);if(options.firstselected){focuson=feed.children("li:visible:first");focuson.addClass("auto-focus");}
if(counter>options.height){feed.css({"height":(options.height*24)+"px","overflow":"auto"});if(browser_msie){browser_msie_frame.css({"height":(options.height*24)+"px","width":feed.width()+"px"}).show();}}
else{feed.css("height","auto");if(browser_msie){browser_msie_frame.css({"height":feed.height()+"px","width":feed.width()+"px"}).show();}}}
function itemIllumination(text,etext){if(options.filter_case){try{eval("var text = text.replace(/(.*)("+etext+")(.*)/gi,'$1<em>$2</em>$3');");}catch(ex){};}
else{try{eval("var text = text.replace(/(.*)("+etext.toLowerCase()+")(.*)/gi,'$1<em>$2</em>$3');");}catch(ex){};}
return text;}
function bindFeedEvent(){feed.children("li").mouseover(function(){feed.children("li").removeClass("auto-focus");$(this).addClass("auto-focus");focuson=$(this);});feed.children("li").mouseout(function(){$(this).removeClass("auto-focus");focuson=null;});}
function removeFeedEvent(){feed.children("li").unbind("mouseover");feed.children("li").unbind("mouseout");feed.mousemove(function(){bindFeedEvent();feed.unbind("mousemove");});}
function bindEvents(){var maininput=$("#"+elemid+"_annoninput").children(".maininput");bindFeedEvent();feed.children("li").unbind("mousedown");feed.children("li").mousedown(function(){var option=$(this);addItem(option.text(),option.attr("rel"));feed.hide();browser_msie?browser_msie_frame.hide():'';complete.hide();});maininput.unbind("keydown");maininput.keydown(function(event){if(event.keyCode==191){event.preventDefault();return false;}
if(event.keyCode!=8){holder.children("li.bit-box.deleted").removeClass("deleted");}
if(event.keyCode==13&&checkFocusOn()){var option=focuson;addItem(option.text(),option.attr("rel"));complete.hide();event.preventDefault();focuson=null;return false;}
if(event.keyCode==13&&!checkFocusOn()){if(options.newel){var value=xssPrevent($(this).val());addItem(value,value);complete.hide();event.preventDefault();focuson=null;}
return false;}
if(event.keyCode==40){removeFeedEvent();if(focuson==null||focuson.length==0){focuson=feed.children("li:visible:first");feed.get(0).scrollTop=0;}
else{focuson.removeClass("auto-focus");focuson=focuson.nextAll("li:visible:first");var prev=parseInt(focuson.prevAll("li:visible").length,10);var next=parseInt(focuson.nextAll("li:visible").length,10);if((prev>Math.round(options.height/2)||next<=Math.round(options.height/2))&&typeof(focuson.get(0))!="undefined"){feed.get(0).scrollTop=parseInt(focuson.get(0).scrollHeight,10)*(prev-Math.round(options.height/2));}}
feed.children("li").removeClass("auto-focus");focuson.addClass("auto-focus");}
if(event.keyCode==38){removeFeedEvent();if(focuson==null||focuson.length==0){focuson=feed.children("li:visible:last");feed.get(0).scrollTop=parseInt(focuson.get(0).scrollHeight,10)*(parseInt(feed.children("li:visible").length,10)-Math.round(options.height/2));}
else{focuson.removeClass("auto-focus");focuson=focuson.prevAll("li:visible:first");var prev=parseInt(focuson.prevAll("li:visible").length,10);var next=parseInt(focuson.nextAll("li:visible").length,10);if((next>Math.round(options.height/2)||prev<=Math.round(options.height/2))&&typeof(focuson.get(0))!="undefined"){feed.get(0).scrollTop=parseInt(focuson.get(0).scrollHeight,10)*(prev-Math.round(options.height/2));}}
feed.children("li").removeClass("auto-focus");focuson.addClass("auto-focus");}});}
function addTextItem(value){if(options.newel){feed.children("li[fckb=1]").remove();if(value.length==0){return;}
var li=$(document.createElement("li"));li.attr({"rel":value,"fckb":"1"}).html(value);feed.prepend(li);counter++;}else{return;}}
function funCall(func,item){var _object="";for(i=0;i<item.get(0).attributes.length;i++){if(item.get(0).attributes[i].nodeValue!=null){_object+="\"_"+item.get(0).attributes[i].nodeName+"\": \""+item.get(0).attributes[i].nodeValue+"\",";}}
_object="{"+_object+" notinuse: 0}";try{eval(func+"("+_object+")");}catch(ex){};}
function checkFocusOn(){if(focuson==null){return false;}
if(focuson.length==0){return false;}
return true;}
function xssPrevent(string){string=string.replace(/[\"\'][\s]*javascript:(.*)[\"\']/g,"\"\"");string=string.replace(/script(.*)/g,"");string=string.replace(/eval\((.*)\)/g,"");string=string.replace('/([\x00-\x08,\x0b-\x0c,\x0e-\x19])/','');return string;}
var options=$.extend({json_url:null,cache:false,height:"10",newel:false,firstselected:false,filter_case:false,filter_hide:false,complete_text:"Start to type...",maxshownitems:30,onselect:"",onremove:""},opt);var holder=null;var feed=null;var complete=null;var counter=0;var cache=new Array();var json_cache=false;var search_string="";var focuson=null;var deleting=0;var browser_msie="\v"=="v";var browser_msie_frame;var element=$(this);var elemid=element.attr("id");init();return this;});};});﻿
var inputResponse={_init:function(){this.element.after("<div id='"+this.element.attr("id")+this._getData("responseIdSuffix")+"' class='"+this._getData("responseClass")+"'></div>");this.element.addClass("validate");this._setData("ResponseDiv","#"+this.element.attr("id")+this._getData("responseIdSuffix"));this._setData("Focused",false);this._setData("Showing",false);this._setData("CurrentStatus",this._getData("status").hidden);this._setData("PreviousValue","");this.element.bind("focus",function(){$(this).inputResponse("UpdateResponse",true);});this.element.bind("blur",function(){$(this).inputResponse("UpdateResponse",false);});},UpdateResponse:function(focused){this._trigger('preUpdate',focused,this.element.val());var currentStatus=this._validate(focused);this._setData("CurrentStatus",currentStatus);objResponse=$(this._getData("ResponseDiv"));objResponse.html(currentStatus.message);objResponse.removeClass();objResponse.addClass(this._getData("responseClass"));objResponse.addClass(currentStatus.statusClass);$(".test").text(this.element.attr("id")+" ~ Focused: "+focused+" ~ Showing: "+this._getData("Showing")+" ~ CurrentStatus: "+currentStatus.statusClass);if(focused){this._debug("update: Focused");if(this._getData("Showing")){this._debug("update: Focused - Showing");}
else{this._debug("update: Focused - Not Showing");this._showResponse(objResponse);this._setData("Showing",true);}}
else{this._debug("update: Not Focused");if(this._getData("Showing")){this._debug("update: Not Focused - Showing");if(!currentStatus.showAlways){this._hideResponse(objResponse);this._setData("Showing",false);}}
else{this._debug("update: Not Focused - Not Showing");if(currentStatus.showAlways){this._showResponse(objResponse);this._setData("Showing",true);}}}
this._setData("PreviousValue",this.element.val());this._trigger('postUpdate',focused,this.element.val());},_showResponse:function(obj){this._debug("showResponse");obj.animate(this._getData("animationSettings").show);},_hideResponse:function(obj){this._debug("hideResponse");obj.animate(this._getData("animationSettings").hide);},Test:function(text){alert(text);},_debug:function(text){if(window.console&&window.console.log)
window.console.log(text);},_validate:function(focused){if(this._getData("validateFunction")!=null){this._debug("using given validate function");return this._getData("validateFunction")(this.element.val(),focused,this._getData("Showing"),this._getData("CurrentStatus"),this._getData("PreviousValue"));}
else{this._debug("default validate");return this._defaultValidate(focused);}},_defaultValidate:function(focused){if(focused){if(this.element.val()==""){return this._getData("status").empty;}
else{return this._getData("status").success;}}
else{if(this.element.val()==""){return this._getData("status").hidden;}
else{return this._getData("status").success;}}},Valid:function(){return this._getData("CurrentStatus").valid;},Statuses:function(){return this._getData("status");},ExtendStatuses:function(moreStatus){status=this._getData("status");$.extend(status,moreStatus);this._setData("status",status);},UpdateStatus:function(newStatus){this._setData("CurrentStatus",newStatus);this.UpdateResponse(false);}};$.widget("ui.inputResponse",inputResponse);$.extend($.ui.inputResponse,{getter:"getFunction Valid Statuses",defaults:{text:"Default",status:{hidden:{message:"",statusClass:"ui-state-disabled",showAlways:false,valid:false},empty:{message:"Please Enter a Value",statusClass:"ui-state-active",showAlways:false,valid:false},success:{message:"Ok",statusClass:"ui-state-highlight",showAlways:true,valid:true},error:{message:"An error has occured",statusClass:"ui-state-error",showAlways:true,valid:false}},animationSettings:{show:{width:"280px",opacity:1},hide:{width:"0px",opacity:0}},responseClass:"ui-widget-container rspDefault",responseIdSuffix:"_Response"}});﻿function Location(){var closeLocationBox=true;this.geocoder=null;function LoadLocationsControl(){$("#changeLocationForm").slideDown();var Locations=GetRecentLocations();$("#recentLocations").html("<a href=\"\" onclick=\"Location.ChangeLocation('','','',0,0,''); return false;\">Worldwide</a>\n");if(Locations!=null){var i=0;for(i=0;i<Locations.length;i++){var outputHTML="";if(jQuery.trim($(".userLocation").text())==Locations[i].City+" "+Locations[i].Country){outputHTML="<div class='ui-icon ui-icon-triangle-1-e'></div><div class='recentSelected'>"+Locations[i].City+" "+Locations[i].Country+"</div>";}
else{outputHTML="<a href=\"\" onclick=\"Location.ChangeLocation('"+Locations[i].Country+"', '"+Locations[i].CountryCode+"', '"+Locations[i].City+"', '"+Locations[i].Latitude+"', '"+Locations[i].Longitude+"', '"+Locations[i].Region+"'); return false;\">"+Locations[i].City+" "+Locations[i].Country+"</a>\n";}
$("#recentLocations").html(outputHTML+$("#recentLocations").html());}}}
this.ChangeLocation=function(country,countrycode,city,latitude,longitude,region){$(".locationLoader").fadeIn();Location.AddLocationToCookie(country,countrycode,city,latitude,longitude,region);Gigpig.Services.Location.ChangeLocation(country,countrycode,city,latitude,longitude,region,function(result){if(result=="worldwide"){$(".userLocation").html("Worldwide");}
else{$(".userLocation").html("<img src='/images/flags/"+countrycode+".gif' />"+city+" "+country);}
$(".locationLoader").fadeOut();$("#geoAddress").val("");$("#changeLocationForm").slideUp();RefreshPage();},Global.AJAXFail);}
function RefreshPage(){if((window.location.pathname.substr(0,5)=="/gigs")||(window.location.pathname.substr(0,5)=="/")){location.reload(true);}}
function GetRecentLocations(){var locationsCookie=$.cookie("recent_locations");if(locationsCookie!=null){var locData=locationsCookie.split(",");var Locations=new Array();for(i=0;i<locData.length;i++){var loc=locData[i].split("|");Locations[i]={"Country":loc[0],"CountryCode":loc[1],"City":loc[2],"Latitude":loc[3],"Longitude":loc[4],"Region":loc[5]}}
return Locations;}
return null;}
this.AddLocationToCookie=function(country,countrycode,city,latitude,longitude,region){if(country!=""){var locationsCookie=$.cookie("recent_locations");if(locationsCookie!=null){var i=0;var add=true;var Locations=locationsCookie.split(",");for(i=0;i<Locations.length;i++){var loc=Locations[i].split("|");if((loc[0]==country)&&(loc[5]==region)&&(loc[2]==city))
add=false;}
if(add){locationsCookie+=","+country+"|"+countrycode+"|"+city+"|"+latitude+"|"+longitude+"|"+region;}}
else{locationsCookie=country+"|"+countrycode+"|"+city+"|"+latitude+"|"+longitude+"|"+region;}
$.cookie("recent_locations",locationsCookie);}}
function codeAddress(address){if(Location.geocoder){Location.geocoder.geocode({'address':address},function(results,status){if(status==google.maps.GeocoderStatus.OK){if(status!=google.maps.GeocoderStatus.ZERO_RESULTS){var city="";var region="";var country="";var countrycode="";var latlng;resultChangeAddress=results;var i=0;for(i=0;i<results[0].address_components.length;i++){if(results[0].address_components[i].types[0]=="locality"){city=results[0].address_components[i].long_name;}
if(results[0].address_components[i].types[0]=="administrative_area_level_1"){region=results[0].address_components[i].short_name;}
if(results[0].address_components[i].types[0]=="administrative_area_level_2"){region=results[0].address_components[i].short_name;}
if(results[0].address_components[i].types[0]=="country"){countrycode=results[0].address_components[i].short_name;country=results[0].address_components[i].long_name;}}
if((city=="")||(region=="")||(countrycode=="")||(country=="")){alert("Not enough detail, please provide a city and a country");return false;}
latlng=results[0].geometry.location;Location.ChangeLocation(country,countrycode,city,latlng.lat(),latlng.lng(),region);}else{alert("No results found");}}else{alert("Geocode was not successful for the following reason: "+status);}});}}
$(document).ready(function(){Location.geocoder=new google.maps.Geocoder();$("#locationControl").click(function(){if($("#changeLocationForm").css("display")=="none"){setTimeout(function(){LoadLocationsControl();},150);}});$("#geocode").click(function(){codeAddress($("#geoAddress").val());});$("#geoAddress").keydown(function(event){if((event.which&&event.which==13)||(event.keyCode&&event.keyCode==13)){$("#geocode").click();return false;}});$("#changeLocationForm").mousedown(function(){closeLocationBox=false;});$(document).mousedown(function(){setTimeout(function(){if(closeLocationBox)
$("#changeLocationForm").slideUp();closeLocationBox=true;},50);});});}
var Location=new Location();﻿function Map(){var resultChangeAddress;var prevMarker;this.CreateMarker=function(MapLat,MapLng,map,title){var GoogleLatLng=new google.maps.LatLng(MapLat,MapLng);var marker=new google.maps.Marker({position:GoogleLatLng,map:map,title:title});if(prevMarker){prevMarker.set_map(null);};prevMarker=marker;google.maps.event.addListener(marker,"click",function(){map.set_center(GoogleLatLng);});}
this.CreateMap=function(MapControl,MapLat,MapLng){var venuelatlng=new google.maps.LatLng(MapLat,MapLng);var options={zoom:14,center:venuelatlng,mapTypeId:google.maps.MapTypeId.ROADMAP,scrollwheel:false}
var map=new google.maps.Map(MapControl,options);return map;}}
var Map=new Map();﻿
function Uploader(){this.fileQueueError=function(fileObj,error_code,message){try{var error_name="";switch(error_code){case SWFUpload.ERROR_CODE_QUEUE_LIMIT_EXCEEDED:error_name="You have attempted to queue too many files.";break;}
if(error_name!==""){alert(error_name);return;}
switch(error_code){case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:image_name="zerobyte.gif";break;case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:image_name="toobig.gif";break;case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:default:alert(message);image_name="error.gif";break;}
AddImage("images/"+image_name);}catch(ex){this.debug(ex);}}
this.fileDialogComplete=function(num_files_queued){try{if(num_files_queued>0){this.startUpload();}}catch(ex){this.debug(ex);}}
this.uploadProgress=function(fileObj,bytesLoaded){try{var percent=Math.ceil((bytesLoaded/fileObj.size)*100)
$("#divProgressBar").progressbar('option','value',percent);}catch(ex){this.debug(ex);}}
this.uploadComplete=function(fileObj,server_data){try{AddImage("thumbnail.php?id="+server_data);var progress=new FileProgress(fileObj,this.customSettings.upload_target);progress.SetStatus("Thumbnail Created.");progress.ToggleCancel(false);}catch(ex){this.debug(ex);}}
this.uploadSuccess=function(fileObj,server_data){try{$(".thumbnail").html("<img src='"+server_data+"' alt='thumbnail' />");}catch(ex){this.debug(ex);}}
this.fileComplete=function(fileObj){try{if(this.getStats().files_queued>0){this.startUpload();}else{var progress=new FileProgress(fileObj,this.customSettings.upload_target);progress.SetComplete();progress.SetStatus("All images received.");progress.ToggleCancel(false);}}catch(ex){this.debug(ex);}}
this.uploadError=function(fileObj,error_code,message){try{switch(error_code){case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:try{var progress=new FileProgress(fileObj,this.customSettings.upload_target);progress.SetCancelled();progress.SetStatus("Cancelled");progress.ToggleCancel(false);}
catch(ex){this.debug(ex);}
break;case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:try{var progress=new FileProgress(fileObj,this.customSettings.upload_target);progress.SetCancelled();progress.SetStatus("Stopped");progress.ToggleCancel(true);}
catch(ex){this.debug(ex);}
case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:image_name="uploadlimit.gif";break;default:alert(message);image_name="error.gif";break;}}catch(ex){this.debug(ex);}}};﻿
function UserEdit(email)
{var currentEmail=email;function EmailCALLBACK(result,eventArgs){if(result>0){$("#rspEmail").removeClass();$("#rspEmail").html("Ok");$("#rspEmail").addClass("response green");}
else{$("#rspEmail").removeClass();$("#rspEmail").html("Email address already used");$("#rspEmail").addClass("response red");}}
function validate(){var valid=true;if($(__GetServerElementById("txtPassword")).val()!=$(__GetServerElementById("txtPassword2")).val()){valid=false;}
return valid;}
$(document).ready(function(){$(Global.__GetServerElementById("btnSignUp")).click(function(){var valid=true;if($(Global.__GetServerElementById("txtPassword")).val()!=$(Global.__GetServerElementById("txtPassword2")).val()){valid=false;}
if(valid)
$("#aspnetForm").submit();else
return false;});$(Global.__GetServerElementById("txtEmail")).change(function(){if($(Global.__GetServerElementById("txtEmail")).val()==""){$("#rspEmail").removeClass();$("#rspEmail").addClass("response grey");$("#rspEmail").html("");}
else{var re=new RegExp("^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}$");if(re.test($(Global.__GetServerElementById("txtEmail")).val())){if(currentEmail){if($(Global.__GetServerElementById("txtEmail")).val()==currentEmail){EmailCALLBACK(1,null);return false;}}
$("#rspEmail").removeClass();$("#rspEmail").addClass("response grey");$("#rspEmail").html("<img src='../images/loader.gif' /> <div>checking availability</div>");Gigpig.Services.User.EmailAvailable($(Global.__GetServerElementById("txtEmail")).val(),EmailCALLBACK,Global.AJAXFail)}
else{$("#rspEmail").removeClass();$("#rspEmail").addClass("response red");$("#rspEmail").html("Must be a valid email address");}}});$(Global.__GetServerElementById("txtPassword")).change(function(){if($(Global.__GetServerElementById("txtPassword")).val()==""){$("#rspPassword").removeClass();$("#rspPassword").addClass("response grey");$("#rspPassword").html("");}
else{var re=new RegExp(".{6,20}");if(re.test($(Global.__GetServerElementById("txtPassword")).val())){$("#rspPassword").removeClass();$("#rspPassword").html("Ok");$("#rspPassword").addClass("response green");}
else{$("#rspPassword").removeClass();$("#rspPassword").addClass("response red");$("#rspPassword").html("Must be 6 to 20 chars");}}
checkValid();});$(Global.__GetServerElementById("txtPassword2")).change(function(){if($(Global.__GetServerElementById("txtPassword2")).val()==""){$("#rspPassword2").removeClass();$("#rspPassword2").addClass("response grey");$("#rspPassword2").html("");}
else{if($(Global.__GetServerElementById("txtPassword")).val()==$(Global.__GetServerElementById("txtPassword2")).val()){$("#rspPassword2").removeClass();$("#rspPassword2").html("Ok");$("#rspPassword2").addClass("response green");}
else{$("#rspPassword2").removeClass();$("#rspPassword2").addClass("response red");$("#rspPassword2").html("Passwords do not match");}}
checkValid();});Global.FocusText(Global.__GetServerElementById("txtPassword"),"#rspPassword","Leave blank for no change");Global.FocusText(Global.__GetServerElementById("txtPassword2"),"#rspPassword2","Retype Password");Global.FocusText(Global.__GetServerElementById("txtEmail"),"#rspEmail","Your email address");Global.FocusText(Global.__GetServerElementById("txtLocation"),"#rspLocation","Displayed with name");});}﻿function UserList(){var delayed;$(document).ready(function(){$("#txtNickname").keypress(function(){$("#loading").fadeIn();clearTimeout(delayed);delayed=setTimeout(function(){var query=$("#txtNickname").val();Gigpig.Services.User.SearchUsers(query,function(result){$("#loading").fadeOut();var response=eval('('+result+')');var users=response[1];var output="";$("#userList").html("");if(users.length==0){$("#userList").html("<div class='sorry'>Sorry, no users matched your query.</div>");}
for(i=0;i<users.length;i++){output="<li>";output+="<img src='"+users[i].gravatar+"' />";output+="<a href='/user/"+users[i].Nickname+"'>"+users[i].Nickname+"</a>";output+="<span class='reliability'>"+users[i].Reliability+"</span>";output+="</li>";$("#userList").html($("#userList").html()+output);}},function(error){alert(error.get_message());});},300);});});}﻿function Signup(facebook){var facebook=facebook;var RecaptchaOptions={theme:'white',lang:'en',custom_theme_widget:'recaptcha_widget'};var amountOfFields=4;var SignUpValid=[amountOfFields];for(i=0;i<amountOfFields;i++)
SignUpValid[i]=false;var valid=false;function ToggleRecaptcha(divShow,divHide){$(divHide).slideUp('normal',function(){$(divShow).slideDown('normal');});}
function UsernameCALLBACK(result,eventArgs){if(result>0){$("#rspUsername").removeClass();$("#rspUsername").html("Ok");$("#rspUsername").addClass("response green");SignUpValid[0]=true;}
else{$("#rspUsername").removeClass();$("#rspUsername").html("Username taken");$("#rspUsername").addClass("response red");SignUpValid[0]=false;}
checkValid();}
function EmailCALLBACK(result,eventArgs){if(result>0){$("#rspEmail").removeClass();$("#rspEmail").html("Ok");$("#rspEmail").addClass("response green");SignUpValid[3]=true;}
else{$("#rspEmail").removeClass();$("#rspEmail").html("Email address already used");$("#rspEmail").addClass("response red");SignUpValid[3]=false;}
checkValid();}
function checkValid(){valid=true;if(facebook){if(!SignUpValid[0]||!SignUpValid[3]){valid=false;}}
else{for(i=0;i<amountOfFields;i++){if(!SignUpValid[i])
valid=false;}}
if(valid){$(Global.__GetServerElementById("btnSignUp")).removeClass("ui-state-disabled").val("Create My Account");}
else{$(Global.__GetServerElementById("btnSignUp")).addClass("ui-state-disabled").val("Create My Account (Please Complete All Fields)");}}
$(document).ready(function(){Global.FocusText(Global.__GetServerElementById("txtUsername"),"#rspUsername","Enter a unique username");Global.FocusText(Global.__GetServerElementById("txtPassword"),"#rspPassword","Enter a password");Global.FocusText(Global.__GetServerElementById("txtPassword2"),"#rspPassword2","Retype your password");Global.FocusText(Global.__GetServerElementById("txtEmail"),"#rspEmail","Enter an email address");$(Global.__GetServerElementById("txtUsername")).change(function(){if($(Global.__GetServerElementById("txtUsername")).val()==""){$("#rspUsername").removeClass();$("#rspUsername").addClass("response grey");$("#rspUsername").html("");SignUpValid[0]=false;}
else{var re=new RegExp("^([a-zA-Z0-9])[a-zA-Z0-9_-]{1,19}$");if(re.test($(Global.__GetServerElementById("txtUsername")).val())){$("#rspUsername").removeClass();$("#rspUsername").addClass("response grey");$("#rspUsername").html("<img src='/images/loader.gif' /> <div>checking availability</div>");Gigpig.Services.User.UsernameAvailable($(Global.__GetServerElementById("txtUsername")).val(),UsernameCALLBACK,Global.AJAXFail)
SignUpValid[0]=false;}
else{$("#rspUsername").removeClass();$("#rspUsername").addClass("response red");$("#rspUsername").html("Must be 2 to 20 chars and alphanumeric");SignUpValid[0]=false;}}
checkValid();});$(Global.__GetServerElementById("txtPassword")).change(function(){if($(Global.__GetServerElementById("txtPassword")).val()==""){$("#rspPassword").removeClass();$("#rspPassword").addClass("response grey");$("#rspPassword").html("");SignUpValid[1]=false;}
else{var re=new RegExp(".{6,20}");if(re.test($(Global.__GetServerElementById("txtPassword")).val())){$("#rspPassword").removeClass();$("#rspPassword").html("Ok");$("#rspPassword").addClass("response green");SignUpValid[1]=true;}
else{$("#rspPassword").removeClass();$("#rspPassword").addClass("response red");$("#rspPassword").html("Must be 6 to 20 chars");SignUpValid[1]=false;}}
checkValid();});$(Global.__GetServerElementById("txtPassword2")).change(function(){if($(Global.__GetServerElementById("txtPassword2")).val()==""){$("#rspPassword2").removeClass();$("#rspPassword2").addClass("response grey");$("#rspPassword2").html("");SignUpValid[2]=false;}
else{if($(Global.__GetServerElementById("txtPassword")).val()==$(Global.__GetServerElementById("txtPassword2")).val()){$("#rspPassword2").removeClass();$("#rspPassword2").html("Ok");$("#rspPassword2").addClass("response green");SignUpValid[2]=true;}
else{$("#rspPassword2").removeClass();$("#rspPassword2").addClass("response red");$("#rspPassword2").html("Passwords do not match");SignUpValid[2]=false;}}
checkValid();});$(Global.__GetServerElementById("txtEmail")).change(function(){if($(Global.__GetServerElementById("txtEmail")).val()==""){$("#rspEmail").removeClass();$("#rspEmail").addClass("response grey");$("#rspEmail").html("");SignUpValid[3]=false;}
else{var re=new RegExp("^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}$");if(re.test($(Global.__GetServerElementById("txtEmail")).val())){$("#rspEmail").removeClass();$("#rspEmail").addClass("response grey");$("#rspEmail").html("<img src='/images/loader.gif' /> <div>checking availability</div>");Gigpig.Services.User.EmailAvailable($(Global.__GetServerElementById("txtEmail")).val(),EmailCALLBACK,Global.AJAXFail)
SignUpValid[3]=false;}
else{$("#rspEmail").removeClass();$("#rspEmail").addClass("response red");$("#rspEmail").html("Must be a valid email address");SignUpValid[3]=false;}}
checkValid();});$(Global.__GetServerElementById("btnSignUp")).click(function(){checkValid();if(!valid)
return false;});checkValid();$("#aspnetForm").submit(function(){$(Global.__GetServerElementById("btnSignUp")).addClass("ui-state-disabled");});$("#recaptcha_response_field").attr("onkeydown","if ((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13)) {document.getElementById('"+Global.__GetServerElementById("btnSignUp").id+"').click();return false;} else return true;");if($(Global.__GetServerElementById("txtUsername")).val()==""){$(Global.__GetServerElementById("txtUsername")).focus();}
else{$(Global.__GetServerElementById('txtEmail')).change();$(Global.__GetServerElementById("txtEmail")).focus();$(Global.__GetServerElementById("txtUsername")).change();$(Global.__GetServerElementById("txtUsername")).focus();}});}﻿function VenueEdit(lat,lng,venuename,countryname){var venuemap;var geocoder;function initialize(){geocoder=new google.maps.Geocoder();}
function codeVenueAddress(){var address=$(Global.__GetServerElementById("txtAddress")).val()+countryname;if(geocoder){geocoder.geocode({'address':address},function(results,status){if(status==google.maps.GeocoderStatus.OK||status==google.maps.GeocoderStatus.ZERO_RESULTS){if(status!=google.maps.GeocoderStatus.ZERO_RESULTS){var city;var country;var countrycode;var latlng;var address;var streetnum;if(results[0].types[0]=="street_address"){streetnum=results[0].address_components[0].long_name;address=results[0].address_components[1].long_name;city=results[0].address_components[2].long_name;countrycode=results[0].address_components[4].short_name;country=results[0].address_components[4].long_name;latlng=results[0].geometry.location;Map.CreateMarker(latlng.lat(),latlng.lng(),venuemap,$(Global.__GetServerElementById("txtVenueName")).val());venuemap.set_center(latlng);$(Global.__GetServerElementById("txtAddress")).val(streetnum+" "+address);$(Global.__GetServerElementById("hidLatitude")).val(latlng.lat());$(Global.__GetServerElementById("hidLongitude")).val(latlng.lng());$(Global.__GetServerElementById("hidCity")).val(city);$(Global.__GetServerElementById("hidCountry")).val(country);if(results.length>1){var suggestListHTML="<div class='header'>Other Suggestions</div>";suggestListHTML+="<ul>";for(var i=1;i<results.length;i++){suggestListHTML+="<li>";suggestListHTML+="<a onclick='SwapAddress(\""+results[i].formatted_address+"\")'>"+results[i].formatted_address+"</a>";suggestListHTML+="</li>";}
suggestListHTML+="</ul>";$("#divMapSuggestions").html(suggestListHTML).slideDown();}
else{$("#divMapSuggestions").slideUp();}}
else{$("#divVenueResponse").text("Please enter a street address").slideDown();}}
else{$("#divVenueResponse").text("No results were found, please try again").slideDown();}}
else{$("#divVenueResponse").text("Google Error: "+status).slideDown();}});}}
$(document).ready(function(){venuemap=Map.CreateMap(document.getElementById("map"),lat,lng);Map.CreateMarker(lat,lng,venuemap,venuename);$(Global.__GetServerElementById("txtAddress")).change(function(){codeVenueAddress();});initialize();});}﻿function MiniVenue(lat,lng,venuename){$(document).ready(function(){var venuemap=Map.CreateMap(document.getElementById("map"),lat,lng);Map.CreateMarker(lat,lng,venuemap,venuename);});}