// JavaScript Document
(function ($) {
    
    
    	jQuery.fn.eDelay = function(time){
     return this.each(function() {
		var i = $(this);
		i.queue(function(){
			setTimeout(function(){
				i.dequeue();
			}, time);
		});
	});
};

       jQuery.fn.jEvent = function(opt, event_id, event_title, event_start, event) {
        
        
        
        if(opt=='renderEvent' || opt=='updateEvent'){
            
            
        }else{
      
     
        }
   				var originalEventObject = $(this).data('eventObject');
				
				// we need to copy it, so that multiple events don't have a reference to the same object
				var copiedEventObject = $.extend({}, originalEventObject);
                copiedEventObject.title = event_title;
                copiedEventObject.start = event_start;
     
                 return this.each(function() {
					$('#calendar').fullCalendar(opt, copiedEventObject, true);
                                       
				
	//	$(this).fullCalendar('unselect');
                });
                };

$.fn.vtxt = function () {

return this.each(function() {
    var default_value = this.value;
    $(this).focus(function() {
        if(this.value == default_value) {
            this.value = '';
        }
    });
    $(this).blur(function() {
        if(this.value == '') {
            this.value = default_value;
        }
    });
});
};


$.fn.dbox = function (msg) {     
  return this.each(function() {
       //Get the screen height and width  
	   var mydomain=window.location.hostname; 
        var maskHeight = $(document).height();   
        var maskWidth  = $(window).width();   
        //Set height and width to mask to fill up the whole screen   
       $('#mask').css({'height':maskHeight+'px'});   
       $('#mask').css({'display': 'block'}); 
       $('#mask').css({'background': 'transparent url(http://bustripticket.com/images/b.png)  repeat'}); 
       //transition effect 
       $('#mask').show();       
         

    
        var pos  = $(this).offset();  
        var winW = $(window).width();
         
       width =  winW/2-$(this).width()/2
   
                 
        //Set the popup window to center   
        $(this).css({"left":width + "px", "top":(pos.top)+100 + "px"});   
        $(this).css({'background': 'url(http://bustripticket.com/images/b.png) repeat'});
        $(this).css({'clear': 'both'});

     
        
        
        //transition effect   $popup->css('background','url(images/b.png)');
        $(this).fadeIn(500);    
        $(this).html(msg);
        
   
       
    //if close button is clicked   
    $('.window .close').click(function () {   
        //Cancel the link behavior   
   
        $('#mask .window').hide();   
    });        
       
    var name = $('#mask').attr('class');  	
    //if mask is clicked   
    $('#mask').click(function () {  
    	 
       
        $('.window').html('').hide();
    	$('#mask').hide();	
  
           
    });            
       
});
};

 $.fn.jRedirect = function(location) {  
	 return this.each(function() {  
	   window.location = location; 
	 });  
 } 
 


})(jQuery)
