function check_count(id)
{
	var pop=$('#reg_'+id).attr('checked');
	if(pop==true)
	{
		var n = $("input:checked").length;
		if(n>2)
		{
			var alert_str=$('#you_cant').html();
			jAlert(alert_str);
			$('#reg_'+id).attr('checked','');
		}

	}
}

function pressmykey()
{
	$('#LoginName').keypress(function(e) {
	      if(e.which == 13) {
	    	  document.forms['LoginForm'].submit();
	        }
	    });
	$('#password').keypress(function(e) {
		if(e.which == 13) {
			document.forms['LoginForm'].submit();
		}
	});
}

function import_ajax(id,source)
{
	$('#'+id).load(source);
	return false;
}
function reload_img()
{
	$('#kcaptcha_img').attr("src","kcaptcha/index.php?"+Math.random(1000));
	$('#kt_input').attr("value","");
}
function insert_multiple(id)
 {
 	var values='';
 	
  	var sep='';
	$.each($("input[@name='check_"+id+"arr[]']:checked"), function() {
		if($(this).val()!='on')
		{
			sep='*';
			values+=sep+$(this).val();
	  	}
	  	
	});
	$.post("engine.php", {'act':'add_items', 'id_str':values,'id':id,'xp':xp},
		function(data){
				 $('#banks_tb_'+id+'').html(data);
				 $('#import_'+id).html("");
				 
			 }, "json");
			 return false;
  

 }
 function empty_import(id)
 {
 	$('#import_'+id).html("");
 }
 function delete_item(p_id,it_id)
 {
 	$.post("engine.php", {'act':'del_items', 'p_id':p_id,'it_id':it_id,'xp':xp},
		function(data)
			{
				$('#tr_'+it_id+'').html('');
			 }, "json");
			 return false;
 }
function close_pop_up()
{
	$('#errordiv').addClass('hidden');
}
function close_pop_up_ok()
{
	$('#ok').addClass('hidden');
}
function drawTooltip(id)
{

	$('#tool_'+id).removeClass('hidden');
}
function hideTooltip()
{
	$('div.tooltip').addClass('hidden');

}
 function ghover(id,src)
 {
 	$('.img_marging').removeClass('gsel');
 	$('.img_marging').addClass('gunsel');
 	$('#small_'+id).removeClass('gunsel');
 	$('#small_'+id).addClass('gsel');
 	$('.big_image').removeClass('gshow');
 	$('.big_image').addClass('ghide');
 	$('#big_'+id).removeClass('ghide');
 	$('#big_'+id).addClass('gshow');
 	$('#front_title').text(gtitles[id]);
 	$('#front_text').text(gshorts[id]);
 	return false;
 }
function dispatchLinker(src)
 {
  	window.open(src, 777 , 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=800,height=600,left = 600,top = 500');
 }
function select(tabid,menu_left,menu_right){

	$(".tab").addClass('hidden');
	$("#"+tabid).removeClass('hidden');
	
	$(".tab_left").removeClass('left_a');
	$(".tab_left").addClass('left_p');
	$("#"+menu_left).removeClass('left_p');
	$("#"+menu_left).addClass('left_a');
	
	$(".tab_right").removeClass('right_a');
	$(".tab_right").addClass('right_p');
	$("#"+menu_right).removeClass('right_p');
	$("#"+menu_right).addClass('right_a');
	
	

	return false;

}
function open_menu(id,pid){

	document.getElementById(id).className='show';
	document.getElementById(pid).className='leftmenu_a';
	return false;

}

function close_div(id){	

	document.getElementById(id).className='hide';

	return false;

}
function navigate(url)

	{window.location=url;}
	
function redirect(el)

	{window.location=el.value;}

	

function open_div(id){

	document.getElementById(id).className='show';

	return false;

}
function open_headdiv(id,id1){

	document.getElementById(id).className='show';
	document.getElementById(id1).className='menu_sub_hover';

	return false;

}
function close_headdiv(id,id1){

	document.getElementById(id).className='hide';
	document.getElementById(id1).className='menu_sub';

	return false;

}

	

function open_divv(id){

	document.getElementById(id).className='show';

}

function close_div(id){	

	document.getElementById(id).className='hide';

	return false;

}

function close_divv(id){	

	document.getElementById(id).className='hide';

}



function show_div(id){	

	document.getElementById(id).className='showblock';

}


function hide_div(id){	

	document.getElementById(id).className='hidden';

}



function toggle(name)

{
  $('#'+name).toggleClass('hidden');
  return false;
}



function swtabz(rtab,uid)

{



  tohide = $("#tabbodycontainer_"+uid+" > *");

  toshow = $('#tabbody_'+rtab+'_'+uid);

 

  tohide.addClass('tabbody');

  tohide.removeClass('currenttabbody');

  toshow.addClass('currenttabbody');

  toshow.removeClass('tabbody');



  tohide = $("#tabcontainer_"+uid+" > div");

  toshow = $('#tab_'+rtab+'_'+uid);

 

  tohide.addClass('tab');

  tohide.removeClass('currenttab');

  toshow.addClass('currenttab');

  toshow.removeClass('tab');
}
  
 function popUp(URL,pwidth,pheight)
 {
   window.open(URL, 777 , 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width='+pwidth+',height='+pheight+',left = 600,top = 500');
   return false;          
 }

 function ghover(id,src)
 {
 	$('.img_marging').removeClass('gsel');
 	$('.img_marging').addClass('gunsel');
 	$('#small_'+id).removeClass('gunsel');
 	$('#small_'+id).addClass('gsel');
 	
 	$('.big_image').removeClass('gshow');
 	$('.big_image').addClass('ghide');
 	$('#big_'+id).removeClass('ghide');
 	$('#big_'+id).addClass('gshow');

 	$('#front_title').text(gtitles[id]);
 	$('#front_text').text(gshorts[id]);
 	
 	return false;
 }
 
function addproduct(id)
{
	$('#addproduct_'+id).load('engine.php?act=addproduct&id='+id+'&xp='+xp);
	return false;
}
function open_head(){
 
 	curmargin = $("#SearchForm_top").css("marginTop");
	curmargin = curmargin.replace("px","");
	curmargin = parseInt(curmargin);
 	if(curmargin>=0)
 	{
 		$('#login_abs').removeClass('abs1');
 		$('#login_abs').addClass('abs2');
 	}
 	else 
 	{
 		$('#login_abs').removeClass('abs2');
 		$('#login_abs').addClass('abs1');
 	}
 	var prev = (curmargin>=0)?'top':'bottom';
 	var now = (curmargin>=0)?'bottom':'top';
 	curmargin = (-1)*(curmargin+72);
 	
	$('#SearchForm_top').animate({"marginTop":curmargin+"px"},'1000');
	$('#login_span').removeClass('s_'+prev);
	$('#login_span').addClass('s_'+now);
}

