$(document).ready(function() {
	
	$(".tab_click").click(function() {
		var cl = $(this).attr("class");
		var pos = cl.indexOf("tab_c_");
		if (pos > 0) {
			var tab = cl.substr(pos, 8);
			tab = tab.replace("_c_", "_");
			
			$(this).parents(".tab_box").find(".tabs > li").removeClass("active");
			$(this).parent().addClass("active");
			
			$(this).parents(".tab_box").find(".tab").hide();
			$(this).parents(".tab_box").find("." + tab).show();
		}
	});
	
	/*** Moving active 2 level category to the top ***/
	var act_element = ($("#nav_left > .act_link").html()) ? "act_link" : "sel_link";
	var html = $("#nav_left > ." + act_element).html();
	if (html) {
		$("#nav_left > ."+act_element).remove();
		$("#nav_left > .first").removeClass("first");
		$("#nav_left").prepend('<li class="first '+act_element+'">'+html+'</li>');
		$('.close_category').click(function() {
			$(this).parents('.first').removeClass('active');
			$(this).remove();
		});
	}
	
	$(".tab_click").click(function() {
		var cl = $(this).attr("class");
		var pos = cl.indexOf("tab_c_");
		if (pos > 0) {
			var tab = cl.substr(pos, 8);
			tab = tab.replace("_c_", "_");
			
			$(this).parents(".tab_box").find(".tabs > li").removeClass("active");
			$(this).parent().addClass("active");
			
			$(this).parents(".tab_box").find(".tab").hide();
			$(this).parents(".tab_box").find("." + tab).show();
		}
	});
});
	
/*
// JavaScript Document
var selected;
var submitter = null;

function submitFunction() {
    submitter = 1;
}
function popupWindow(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
}  

function selectRowEffect(object, buttonSelect) {
  if (!selected) {
    if (document.getElementById) {
      selected = document.getElementById('defaultSelected');
    } else {
      selected = document.all['defaultSelected'];
    }
  }

  if (selected) selected.className = 'moduleRow';
  object.className = 'moduleRowSelected';
  selected = object;

// one button is not an array
  if (document.getElementById('payment'[0])) {
    document.getElementById('payment'[buttonSelect]).checked=true;
  } else {
    //document.getElementById('payment'[selected]).checked=true;
  }
}

function rowOverEffect(object) {
  if (object.className == 'moduleRow') object.className = 'moduleRowOver';
}

function rowOutEffect(object) {
  if (object.className == 'moduleRowOver') object.className = 'moduleRow';
}

function popupImageWindow(url) {
  window.open(url,'popupImageWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
}

*/
