function change_block(first_block,sec_block)
{
	$("#"+first_block).addClass('hidden');
	$("#"+sec_block).removeClass('hidden');
	$.post("engine.php", { act: "change_block", current: sec_block ,'xp':xp} );
	
}
function swich_number(box_width,name_id,number_id,select_name)
{
	 ind = $('#'+name_id).get(0).value;
	 $.post("engine.php", {'act':'load_number','parent':ind,'width':box_width,'select_name':select_name,'xp':xp},
	 function(data){
	 $('#number_id').html(data);
	 }, "json");
	return false;
}
function change_color(name,id,cla)
{ 
	$("#"+name+id).addClass(cla);
}
function change_color2(name,id,cla)
{ 
	$("#"+name+id).removeClass(cla);
}
function CommentActions(id,actval)
{
	if(actval == 2)
	{
		$(".comtr_"+id).hide();
	}
	else
	{
		var classname= $("#span_action_"+id).attr('class');
		if (classname == "span_action_0")
		{
			$("#span_action_"+id).removeClass("span_action_0");
			$("#span_action_"+id).addClass("span_action_1");
			actval = 1;
		}
		else if (classname == "span_action_1")
		{
			$("#span_action_"+id).removeClass("span_action_1");
			$("#span_action_"+id).addClass("span_action_0");
			actval = 0;
		}
	}
		
	
	$.post("engine.php", {'act':'CommentActions','id':id,'actval':actval,'xp':xp},
	 function(data){
	 }, "json");
	return false;
}
function Fanclub()
{
	var strEmail = new RegExp("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.([a-z]){2,4})$");
	var name = $("#fanclub_name").attr('value');
	var email = $("#fanclub_email").attr('value');
	var text = $("#fanclub_text").attr('value');
	validmail =  strEmail.exec(email);
	berror = false;
	$('#fanclub_name').css("border","1px solid #A7A6AA");
	$('#fanclub_text').css("border","1px solid #A7A6AA");
	$('#fanclub_email').css("border","1px solid #A7A6AA");
	if (name==undefined || name=="")
  	{
  		$('#fanclub_name').css("border","1px solid red");
			berror = true;
	}
	if (text==undefined || text=="")
	{
		$('#fanclub_text').css("border","1px solid red");
		berror = true;
	}
  	if (email==undefined || email=="" || !validmail)
  	{
  		$('#fanclub_email').css("border","1px solid red");
  		berror = true;
	}
	if (!berror)
	{
		//document.forms['fanclubform'].submit();
		$("#errors").hide();
		$.post("engine.php", {'act':'Fanclubadd','name':name,'email':email,'text':text,'xp':xp},
		 function(data){
			
			$("#commentfirst_tr").after(data);
		 }, "json");
	}
	else 
		$("#errors").show();
	return false;
}

function curent_img(id)
{
	$('.img_div').removeClass('tab_act');
	$('#short_'+id).addClass('tab_act');
	$('.slid_div').addClass('hidden');
	$('#slid_'+id).removeClass('hidden');
}
function close_pop_up()
{
	$('#errordiv').addClass('hidden');
}
function close_pop_up_ok()
{
	$('#ok').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;
}
