function tab_switch(name)
{
	var news_tab = document.getElementById("news_tab");
	var news_text = document.getElementById("news_text");
	var news_link = document.getElementById("news_link");
	var about_tab = document.getElementById("about_tab");
	var about_text = document.getElementById("about_text");
	var about_link = document.getElementById("about_link");

	if(name=="news")
	{
		news_tab.className =  "rounded_header_right";
		about_tab.className = "noactive_left";
		news_text.style.display = "block";
		about_text.style.display = "none";
		news_link.className = "not_dashed_link";
		about_link.className = "dashed_link";
	}else if(name=="about")
	{
		about_tab.className = "rounded_header_left";
		news_tab.className =  "noactive_right";
		news_text.style.display = "none";
		about_text.style.display = "block";
		news_link.className = "dashed_link";
		about_link.className = "not_dashed_link";
	}
}

function posts_switch(name)
{
	var buy = document.getElementById("buy");
	var buy_link = document.getElementById("buy_link");
	var sell = document.getElementById("sell");
	var sell_link = document.getElementById("sell_link");

	if(name=="buy")
	{
		sell.style.display = "none";
		buy.style.display = "block";
		sell_link.innerHTML = '<a href="#" class="dashed_link" onclick="posts_switch(\'sell\');return false;">продажа</a>';
		buy_link.innerHTML = '<b class="c_l_t" id="buy_tab">&nbsp;</b><b class="c_r_t">&nbsp;</b>покупка';
		sell_link.className = '';
		buy_link.className = 'current';
	}else if(name=="sell")
	{
		sell.style.display = "block";
		buy.style.display = "none";
		sell_link.innerHTML = '<b class="c_l_t" id="buy_tab">&nbsp;</b><b class="c_r_t">&nbsp;</b>продажа';
		buy_link.innerHTML = '<a href="#" class="dashed_link" onclick="posts_switch(\'buy\');return false;">покупка</a>';
		sell_link.className = 'current';
		buy_link.className = '';
	}
	
}

function contacts_link_switcher(link)
{
	elm_l = document.getElementById("contacts_link_left_span");
	elm_r = document.getElementById("contacts_link_right_span");
	if(elm_l.className=="t t_bottom t_left")
	{
		elm_l.className = "t t_top t_left";
		elm_r.className = "t t_top t_right";
		link.innerHTML = 'Свернуть форму обратной связи';
	}else
	{
		elm_l.className = "t t_bottom t_left";
		elm_r.className = "t t_bottom t_right";
 		link.innerHTML = 'Появился вопрос? Задайте его, открыв форму';
	}
} 

/* COLLAPSE */

function collapseBox(id,_44, dopen, dclose){
var box=$(id);
if(!box){
return;
}
var _46=$("list_"+id);
var c=document.getElementsByClassName("c",box);
if(c.length>0&&!c[0].blinding){
c[0].blinding=true;
if(c[0].style.display=="none"){
Effect.BlindDown(c[0],{afterFinish:function(){
c[0].blinding=false;
},duration:dopen});


}else{
Effect.BlindUp(c[0],{afterFinish:function(){
c[0].blinding=false; },duration:dclose});


}
}
return false;
}

function quickReply(id, dopen, dclose, foca){
var box=$(id);

if(!box){
return;
}
var c=document.getElementsByClassName("r",box);
if(c.length>0&&!c[0].blinding){
c[0].blinding=true;
if(c[0].style.display=="none"){
Effect.BlindDown(c[0],{afterFinish:function(){
c[0].blinding=false;
setTimeout('ge("reply_field").focus();', 100);
},duration:dopen});
}else{
Effect.BlindUp(c[0],{afterFinish:function(){
c[0].blinding=false; },duration:dclose});
}
}
}


function blind_p()
{	
	new Effect.Opacity('product_image', {duration:2.0, from:0.0, to:1.0});
}

function popular_product()
{	
	var aj_rand = Math.round(Math.random() * 100000);
	new Ajax.Updater('product_image','/ajax.php?mode=popular_product&'+aj_rand,{asynchronous:true});
	return false;	
}