﻿function setGridDeleteScripts()
{    
    var deleters = $(".delete_link");  
      
    deleters.click(function () {     
        
        $deleter = $(this).next();
        
        var parentEls = $(this).parents();
        //$table = $(this).parents(".delete_table");  //$(parentEls[2]); // or $(parentEls[1]) $(this).parents("table");        
        $table = $(parentEls[2]);
        
        $deleter.height($table.height());
        $deleter.width($table.width());
        //$deleter.height($(".delete_grid").height());
        //$deleter.width($(".delete_grid").width());        
       
        /* $table.css("display","block"); */
        $table.css("position","relative");
        
        $deleter.show();  
      
        $mb = $deleter.find(".dc_mb");       
        $mb.centerInClient({ container: $table });
         
    });       
       
    var cancelDeletes = $(".delete_cancel_link");
    cancelDeletes.click(function () {
        
        $(".dc").hide();  
        $("#progress").hide();
        $(".dc_mb_modal").hide();
    });   
    
    // for modal deletions
    var modal_deleters = $(".delete_link_modal");
    
    modal_deleters.click(function () {     
        
        $deleter = $(this).next();
        $.scrollTo(0);
        
        $("#progress").height($(document).height());
        $("#progress").show();
        $deleter.show();
        //$(".dc_mb_modal").show();
        $deleter.centerInClient({ container: window, forceAbsolute: true });  // requires jquery.center.js
        
    });       
    
    $(".yes_link").click(function () {
        
        $(this).prev().show();  
        $(this).next().hide();  
        $(this).hide();         
        
    });   
      
}
  
function displayFadeMessage(msg,type,fadeOut,modalBg,redirect,bck,brdr,allowClose)
{    
    
    $(document).ready(function() {      
    
        var options = {
          type: type,
          fadeOut: fadeOut,
          bg: modalBg,
          redirect: redirect,
          backgroundcolor: bck,
          bordercolor: brdr,
          allowClose: allowClose
        }
        
        $("body").fadeMessage(msg,options);    
        //$("#blackout").show();
        
     });   
     
}

function fadeMessage()
{
    //alert('fadeMessage');
    $(document).ready(function() {      
        $("body").fadeMessage('this is my test');       

     });  
}

/** * Written by Rob Schmitt, The Web Developer's Blog * http://webdeveloper.beforeseven.com/ */
/** * The following variables may be adjusted */
var active_color = '#000'; // Colour of user provided text
var inactive_color = '#8f8f8f'; // Colour of default text
/** * No need to modify anything below this line */
$(document).ready(function() 
{  
    $("input.default-value").css("color", inactive_color); 
    //$("input.default-value").addClass("searchwatermark"); 
     
    var default_values = new Array();  
    
    $("input.default-value").focus(function() {    
    
        if (!default_values[this.id]) {      
            default_values[this.id] = this.value;    
        }    
        if (this.value == default_values[this.id]) {      
            this.value = '';      
            this.style.color = active_color;    
            //this.css("fontStyle","normal");            
        }    
        
        $(this).blur(function() {      
            if (this.value == '') {        
                this.style.color = inactive_color;        
                this.value = default_values[this.id]; 
                //this.removeClass(".norm_font");    
            }    
        });  
        
    });    
   
});

//http://www.mattfarina.com/2007/02/01/preloading_images_with_jquery
jQuery.preloadImages = function(imgs)
{
  for(var i = 0; i<imgs.length; i++)
  {
    jQuery("<img>").attr("src", imgs[i]);
    //alert(imgs[i]);
  }
}






