/**
 * $Id: main.js 124 2009-02-23 07:49:20Z gpo_gigapromoters $
 * 
 * This file can not be redistributed to anyone without the permission of Giga Promoters
 * Copyright 2005 - 2008, Giga Promoters
 * 						  608 Aggarwal Cyber Plaza
 *						  Netaji Subhash Place, Delhi - 110034
 *						  www.gigapromoters.com
 * 
 *
 * This is parent of parent class of a controller and should not be edited ever without permission.
 * @version 			$Rev: 124 $
 * @lastModifiedBy		$LastChangedBy: gpo_gigapromoters $
 * @lastChanged			$Date: 2009-02-22 23:49:20 -0800 (Sun, 22 Feb 2009) $
 * @copyright 			Giga Promoters (www.gigapromoters.com)
 * 
 */

// global js file
$(document).ready(function(){
    swapValues = [];
    $(".swap_value").each(function(i){
		$(this).addClass('inactiveSwap');
        swapValues[i] = $(this).val();
        $(this).focus(function(){
			$(this).removeClass('inactiveSwap');
            if ($(this).val() == swapValues[i]) {
                $(this).val("");
            }
        }).blur(function(){
            if ($.trim($(this).val()) == "") {
				$(this).addClass('inactiveSwap');
                $(this).val(swapValues[i]);
            }
        });
    });
	// activate primary ajax indicator
	$("#progressIndicator").ajaxStart(function(){
	   $(this).show();
	 });
	$("#progressIndicator").ajaxStop(function(){
	   $(this).hide();
	 });

	 // secondary ajax indicator(s)
	$(".progressIndicator").ajaxStart(function(){
	   $(this).show();
	 });
	$(".progressIndicator").ajaxStop(function(){
	   $(this).hide();
	 });
});


/*
 * Jonathan Howard
 *
 * jQuery Pause
 * version 0.2
 *
 * Requires: jQuery 1.0 (tested with svn as of 7/20/2006)
 *
 * Feel free to do whatever you'd like with this, just please give credit where
 * credit is do.
 *
 *
 *
 * pause() will hold everything in the queue for a given number of milliseconds,
 * or 1000 milliseconds if none is given.
 *
 *
 *
 * unpause() will clear the queue of everything of a given type, or 'fx' if no
 * type is given.
 */

$.fn.pause = function(milli,type) {
	milli = milli || 1000;
	type = type || "fx";
	return this.queue(type,function(){
		var self = this;
		setTimeout(function(){
			$.dequeue(self);
		},milli);
	});



};

$.fn.clearQueue = $.fn.unpause = function(type) {
	return this.each(function(){
		type = type || "fx";
		if(this.queue && this.queue[type]) {
			this.queue[type].length = 0;
		}
	});
};

// function to toggle selected checkboxes
function toggleCheckboxes(checkboxes)
{
	checkem = false;
	if($('#checkAll').attr("checked"))
	{
		checkem = true;
	}
	checkboxTog = $('#checkAll').attr("checked");
	checkboxes.each( function(){
		$(this).attr("checked",checkem);
	});
	//checkboxTog = !checkboxTog;

}
function redirect(url)
{
	window.location = url;
	return true;
}