if(location.href.indexOf("www.nightlifeagency.com")!=-1)
    var siteurl="http://www.nightlifeagency.com/";
else
    var siteurl="http://192.168.0.113/nla/";
    
    /**
    * This Js is use only for the event related funcition
    * Auther @deepak
    */
    /**
    * function check rsvp comment on details page
    */
    
    
    /**
     * function to show and hide the start struck fields if admin check the start struck checkbox
     * 
     */
    function showstarstruckfields(chvalue){
       //alert(chvalue);
       if(chvalue==false){
           $("#admin_startstruckdiv").css('display','none')
           
       }else{
         $("#admin_startstruckdiv").css('display','')
       }
        
    }
    function showhideticket_event(chvalue){
       //alert(chvalue);
       if(chvalue==false){
           $("#ticket").css('display','none')
           $("#rsvp").css('display','block')
           
       }else{
         $("#ticket").css('display','')
          $("#rsvp").css('display','none')
       }
        
    }
    
    
    function change_type(val){
        //alert(val)
        location.href=siteurl+"events/index/"+val; 
    }
     
function showinnerPage(url,loginid,fblogin,eventId){
        //alert(url);
        var id='';
        windowheight =  getScrollHeight();
        windowwidth =  getScrollWidth();
          
        centerheight = (windowheight / 10);
        centerwidth = ((windowwidth / 2) - 301);
       
        
        if(url.indexOf('event_rsvp')){
           id="#rsvpbox";
         //  alert(id);
        }else if(url.indexOf('event_table')){
           id="#table";
          // alert(id);
    }else if(url.indexOf('book_artist')){
           id="#book_artist";
    }
           
      
        $(id).ready(function(){
            $.ajax({
                url: siteurl+url,
                success: function(data)  {
                showRsvpCenter(centerwidth,centerheight,'logpoup',data);
                if(fblogin)
                updateGuest(eventId);
                
                showHeight('logpoup');
                    if(data.indexOf("flashMessage")!=-1){ 
                        $(".LoginBox").css('min-height','366px');
                        
                        $(".LoginBoxContent").css('padding-top','22px');
                       
                    }
                   // alert(id);
                    if(id == '#table')    
                        $("#logpoup").css('top','15px');
                    if(id == '#rsvpbox')
                        $("#logpoup").css('top','50px');
					if(id == '#book_artist')    
                        $("#logpoup").css('top','15px');
                    if(loginid==''){
            window.fbAsyncInit = function() {
			FB.init({
			  appId   : '210358048996705',
			  session : null, // don't refetch the session when PHP already has it
			  status  : true, // check login status
			  cookie  : true, // enable cookies to allow the server to access the session
			  xfbml   : true // parse XFBML
			});
	
			// whenever the user logs in, we refresh the page
			FB.Event.subscribe('auth.login', function() {
			  window.location.reload();
			});
		  };
	
		  (function() {
			var e = document.createElement('script');
			e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
			e.async = true;
			document.getElementById('fb-root').appendChild(e);
		  }());
                    }
                }
            });
 		return false;			
 	});
}
/**
     * function to blink the submit button
     * 
     */
function blinker(){
   document.getElementById("btnBlink").style.backgroundImage="url(/nla_new/images/submit_btn.png)";
   //setTimeout("document.getElementById(\"btnBlink\").style.backgroundImage=\"\"", 100);
   //setTimeout("alert('I am displayed after 3 seconds!')", 500);
   setTimeout("document.getElementById('btnBlink').style.backgroundImage='url(/nla_new/images/red_btn.png)'", 500);
   setTimeout("blinker()",1500);
}
/**
     * function to show and hide the add info field
     * 
     */
    
    
function showADDINFOfields(chvalue){
       if(chvalue==false){
           $("#admin_ADDINFOdiv").css('display','none')
           
       }else{
         $("#admin_ADDINFOdiv").css('display','')
       }
        
    }
    
    function showHideEventlogo(chvalue){
       if(chvalue==false){
           $("#event_logo").css('display','none')
           $("#event_logo1").css('display','none')
           
       }else{
         $("#event_logo").css('display','')
         $("#event_logo1").css('display','')
       }
        
    }
//    function Rsvpcomment(){
//       
//       if($("#description").val()=='') {
//           alert("Please fill the 'RSVP PROMITION'");
//           return false;
//       }
//        return true;;
//    }
function Tablecomment(form){
       
       var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
       var phoneReg = /^[/\+/][0-9]{1,3}[0-9]{10,11}$/;
      
      if($("#TableGentlemen").val()=='') {
           alert("Please fill the Number of Gents.");
           $("#TableGentlemen").focus();
           return false;
       }
       if(isNaN($("#TableGentlemen").val())) {
           alert("Please fill the only Number.");
             $("#TableGentlemen").focus();
           return false;
       }
       
       if($("#TableLadies").val()=='') {
           alert("Please fill the Number of Ladies.");
             $("#TableLadies").focus();
           return false;
       }
       if(isNaN($("#TableLadies").val())) {
           alert("Please fill the only Number.");
             $("#TableLadies").focus();
           return false;
       }
       
       if($("#TableName").val()=='') {
           alert("Please fill the Contact name.");
           $("#TableName").focus();
           return false;
       }

       if($("#TableEmail").val()=='') {
           alert("Please fill the Contact email.");
             $("#TableEmail").focus();
           return false;
       }
       if(!emailReg.test($("#TableEmail").val())) {
            alert("Please fill valid Contact email.");
             return false;
        }
       if($("#TableInfo").val()=='') {
           alert("Please fill the Additional info.");
             $("#TableInfo").focus();
           return false;
       }
       
        onclickTable('tableform','errorLogin')
        return false;
    }
	function onclickTable(frmName,divID) {
			 var urlva = "events/table_add";
			var frm = "#"+frmName;
			
	$(frm).ready(function(){
        dataString = $(frm).serialize();
		
		//alert(dataString)
		$.ajax({
		type: "POST",
		url: siteurl+urlva+"/",
		data: dataString,
		dataType: "",
                success: function(data) {
                        $("#logpoup").html(data);
                    					}
			});
 		return false;			
 	});

}
	
	
    function Rsvpcomment(fblogin){
       //alert(fblogin);
       if(fblogin==0){
        if($("#MemberId").val()== 0){
            alert("Please login before submitting.");
            errorVal = true;
            return false;
        }
       if($("#description").val()==''){
           alert("Please fill the 'RSVP PROMITION'");
           $("#description").focus();
           errorVal = true;
           return false;
       }
    }
     //alert(eventId);
        
       onclickRsvp('rsvp','errorLogin');        
        
    return false;
}

function onclickRsvp(frmName,divID) {
    //alert(frmName);
    
 	urlva = "events/rsvp_add";
    var eventId=document.getElementById('RsvpIdRsvp').value;
        
 	var frm = "#"+frmName;
 	$(frm).ready(function(){
                
		dataString = $(frm).serialize();
        $.ajax({
		type: "POST",
		url: siteurl+urlva+"/",
		data: dataString,
		dataType: "",
                
		success: function(data) {
                    
                        if(data.indexOf('successful')!=-1){
                            $("#logpoup").html("");
                               //alert(frmName)
                              rsvpSuccessful();
							  if(document.getElementById('AjaxGuestListing'))
							  {
							  updateGuest(eventId);
							  }
							  
							  
			}
  		}
 	});
 		return false;			
 	});

}

function rsvpSuccessful(){
    //alert(val)
    
        urlva = "events/rsvp_facebookshare/";
    
    //alert(siteurl+urlva)
    $.ajax({
                url: siteurl+urlva,
                success: function(data)  {   
                showRsvpCenter(centerwidth,centerheight,'logpoup',data);
                $("#logpoup").css('top','50px');
                    function fbs_click() {u=location.href;t=document.title;window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;}
                

                 }
                })
                
                
    
}
function updateGuest(eventId)
{	url="events/guest_list/"+eventId;	
        $.ajax({
                url: siteurl+url,
                success: function(data)
				 {   
           			 $("#AjaxGuestListing").html(data);
                                 
                }
            });
 				return false;			
 	
	
}
function showzippopup(id,zip,album){
        //alert(zip);
        windowheight =  getScrollHeight();
        windowwidth =  getScrollWidth();
          
        centerheight = (windowheight / 30)
        centerwidth = ((windowwidth / 2) - 340);
        url = "djs/zippopup/"+id+"/"+zip+"/"+album;
        $("#zippopup").ready(function(){
            $.ajax({
                url: siteurl+url,
                success: function(data)  {   
                showRsvpCenter(centerwidth,centerheight,'logpoup',data);
                showHeight('logpoup');
                
                    if(data.indexOf("flashMessage")!=-1){ 
                        $(".LoginBox").css('min-height','366px');
                        $(".logpoup").css('top','70px');
                        $(".LoginBoxContent").css('padding-top','22px');
                       
                    }
                }
            });
 		return false;			
 	});
}
function checkzip(value){
     var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
     if($("#ZipEmail").val()=='') {
           alert("Please fill the email.");
             $("#ZipEmail").focus();
           return false;
       }
       if(!emailReg.test($("#ZipEmail").val())) {
            alert("Please fill valid email.");
             $("#ZipEmail").focus();
             return false;
        }
        
onclickZip('zipform','errorLogin')
        return false;
    }
	function onclickZip(frmName,divID) {
            
			 var urlva = "djs/zippopup/";
			var frm = "#"+frmName;
			
	$(frm).ready(function(){
        dataString = $(frm).serialize();
		
		//alert(dataString)
		$.ajax({
		type: "POST",
		url: siteurl+urlva+"/",
		data: dataString,
		dataType: "",
                success: function(data) {
                        $("#logpoup").html(data);
                    					}
			});
 		return false;			
 	});

}


