var mgToggle = function() {
	 	   $(this).parent().find(".gridPanel").toggle();
	          $(this).find("li.close").toggleClass("open");
		   $(this).find("li.open2").toggleClass("close2");
		   return false;
		 }

var addToggle = function() {
                  $(".gridToggle").unbind("click", addToggle);
                  $(".gridToggle").bind("click", mgToggle);
		  } 

$(document).ready(function() {
	$(".gridContainer.closed .gridPanel").hide();/* Hide panels which are marked as closed */
	$(".gridContainer.opened .gridPanel").show();/* Show panels which are marked as opened */
	
	$(".subContainer.closed .gridSubPanel").hide();/* Hide panels which are marked as closed */
	$(".subContainer.opened .gridSubPanel").show();/* Show panels which are marked as opened */
	
	/* Grid section panels */
	$(".gridToggle .closeSec").click(function(){
		$(this).parent().find("li").toggle();
		$(this).parent().parent().parent().parent().parent().find(".gridContainerPanel").hide();
		return false;
	});
	$(".gridToggle .openSec").click(function(){
		$(this).parent().find("li").toggle();
		$(this).parent().parent().parent().parent().parent().find(".gridContainerPanel").show();
		return false;
	});
		
	/* Main grid panels
	$(".gridToggle").click(function(){
		$(this).parent().find(".gridPanel").toggle();
		$(this).find("li.close").toggleClass("open");
		$(this).find("li.open2").toggleClass("close2");
		return false;
	});*/

	$(".gridToggle").click(mgToggle);

	
	/* Sub-grid panels */
	$(".gridSubToggle").click(function(){
		$(this).parent().find(".gridSubPanel").toggle();
		$(this).find("li").toggleClass("open");
		$(this).find("li.open2").toggleClass("close2");
		return false;
	});						   
});


       function slet_gemte(url,e) {
		var answer = confirm(e.title);

		$(".gridToggle").unbind("click", mgToggle);
		if (answer){
			window.location = url
		} else {
			$(".gridToggle").bind("click", addToggle);
		}
		return false;
	}    

