function set_hidden(marka)
{
	if (navigator.userAgent.match(/gecko/i))
	{
		document.forms.fast_search_form.elements.xxxx.value=marka;
	}

	else
	{
		document.forms['fast_search_form'].elements['xxxx'].value=marka;
	}
}
function pereschet(value,value2,value3) {
     var req = new JsHttpRequest();
       req.onreadystatechange = function() {
                if (req.readyState == 4) {
                document.getElementById('pereschet').innerHTML = req.responseText;
        }
    }
    req.open(null, 'http://avtoplanet.ru/includes/ajax/pereschet.php', true);
    req.send( {'re_valuta':value, 'valuta':value2, 'adv':value3 } );
}
function graph_advs(value) {
     var req = new JsHttpRequest();
       req.onreadystatechange = function() {
                if (req.readyState == 4) {
                document.getElementById('graph_advs').innerHTML = req.responseText;
        }
    }
    req.open(null, 'http://avtoplanet.ru/includes/ajax/graph_advs.php', true);
    req.send( {'show':value } );
}
function click_begun(value) {
     var req = new JsHttpRequest();
       req.onreadystatechange = function() {
                if (req.readyState == 4) {
                //document.getElementById('click_begun').innerHTML = req.responseText;
        }
    }
    req.open(null, 'http://avtoplanet.ru/includes/ajax/click_begun.php', true);
    req.send( {'user_id':value } );
}
function add_to_basket(value, value2, value3) {
     var req = new JsHttpRequest();
       req.onreadystatechange = function() {
                if (req.readyState == 4) {
                document.getElementById('basket').innerHTML = req.responseText;
        }
    }
    req.open(null, 'http://avtoplanet.ru/includes/ajax/basket.php', true);
    req.send( {'adv':value, 'adv_link':value2, 'what_to_do':value3 } );
}
function mini_chat(value,value2) {
     var req = new JsHttpRequest();
       req.onreadystatechange = function() {
                if (req.readyState == 4) {
                document.getElementById('mini_chat').innerHTML = req.responseText;
        }
    }
    req.open(null, 'http://avtoplanet.ru/includes/ajax/chat.php', true);
    req.send( {'name':value,'text':value2 } );
}
function link_to_friend(value,value2) {
     var req = new JsHttpRequest();
       req.onreadystatechange = function() {
                if (req.readyState == 4) {
                document.getElementById('link_to_friend').innerHTML = req.responseText;
        }
    }
    req.open(null, 'http://avtoplanet.ru/includes/ajax/link_to_friend.php', true);
    req.send( {'id_of_adv':value,'link_of_adv':value2 } );
}
function choose_calendar(value) {
     var req = new JsHttpRequest();

       req.onreadystatechange = function() {
                 if (req.readyState == 4) {
                document.getElementById('choose_calendar').innerHTML = req.responseText;
        }
    }
    req.open(null, 'http://avtoplanet.ru/includes/ajax/choose_calendar.php', true);
    req.send( {'action':value } );
}
function reklam(value, value2, value3) {
     var req = new JsHttpRequest();

       req.onreadystatechange = function() {
                 if (req.readyState == 4) {
                document.getElementById('zakaz_reklam').innerHTML = req.responseText;
        }
    }
    req.open(null, 'http://avtoplanet.ru/includes/ajax/zakaz_reklam.php', true);
    req.send( {'mark':value, 'mark2':value2, 'mark3':value3 } );
}
function avtosalon(value) {
     var req = new JsHttpRequest();

       req.onreadystatechange = function() {
                 if (req.readyState == 4) {
                document.getElementById('avtosalon').innerHTML = req.responseText;
        }
    }
    req.open(null, 'http://avtoplanet.ru/includes/ajax/avtosalon.php', true);
    req.send( {'mark':value } );
}

function fast_model_avto(value) {
     var req = new JsHttpRequest();

       req.onreadystatechange = function() {
                 if (req.readyState == 4) {
                document.getElementById('selection_double_mark').innerHTML = req.responseText;
        }
    }
    req.open(null, 'http://avtoplanet.ru/includes/ajax_fast_search.php', true);
    req.send( {'mark':value } );
}
function jax_full_search(value) {
     var req = new JsHttpRequest();

       req.onreadystatechange = function() {
                 if (req.readyState == 4) {
                document.getElementById('full_search').innerHTML = req.responseText;
        }
    }
    req.open(null, 'http://avtoplanet.ru/includes/full_search.php', true);
    req.send( {'go':value } );
}

function main_vote(value) {
     var req = new JsHttpRequest();

       req.onreadystatechange = function() {
                 if (req.readyState == 4) {
                document.getElementById('your_voice').innerHTML = req.responseText;
                document.getElementById('vote_questions').style.display = 'none';
        }
    }
    req.open(null, 'http://avtoplanet.ru/includes/ajax_main_vote.php', true);
    req.send( {'main_vote_val':value } );
}

function changing_view(value, page, car, model, order, how) {
     var req = new JsHttpRequest();

       req.onreadystatechange = function() {
                 if (req.readyState == 4) {
                document.getElementById('view_mode').innerHTML = req.responseText;
        }
    }
    req.open(null, 'http://avtoplanet.ru/includes/ajax/advs_search_view.php', true);
    req.send( {'view':value, 'stranica':page, 'get_car':car, 'get_model':model, 'get_order':order, 'get_how':how} );
}
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function changing_view_search(value, page, ands, order, how) {
     var req = new JsHttpRequest();

       req.onreadystatechange = function() {
                 if (req.readyState == 4) {
                document.getElementById('view_mode_search').innerHTML = req.responseText;
        }
    }
    req.open(null, 'http://avtoplanet.ru/includes/ajax/advs_search_view_rasw.php', true);
    req.send( {'view':value, 'stranica':page, 'get_ands':ands, 'get_order':order, 'get_how':how} );
}
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function advs_vote(value) {
     var req = new JsHttpRequest();

       req.onreadystatechange = function() {
                 if (req.readyState == 4) {
                document.getElementById('advs_voice').innerHTML = req.responseText;
        }
    }
    req.open(null, 'http://avtoplanet.ru/includes/advs_vote.php', true);
    req.send( {'vote_cat':value } );
}
//==========================================================================================================================================================================================

function catalog_vote(value) {
     var req = new JsHttpRequest();

       req.onreadystatechange = function() {
                 if (req.readyState == 4) {
                document.getElementById('catalog_voice').innerHTML = req.responseText;
        }
    }
    req.open(null, 'http://avtoplanet.ru/includes/catalog_vote.php', true);
    req.send( {'vote_cat':value } );
}

function Small_Photo_to_Big(value, value2, value3, value4) {
     var req = new JsHttpRequest();

       req.onreadystatechange = function() {
                 if (req.readyState == 4) {
                document.getElementById('main_big_photo').innerHTML = req.responseText;
        }
    }
    req.open(null, 'http://avtoplanet.ru/includes/ajax/small_photo_to_big.php', true);
    req.send( {'num_of_da_photo':value , 'get_car':value2 , 'get_model':value3 , 'id_adv':value4 });
}
function Small_Photo_to_Big_moto(value, value2, value3, value4) {
     var req = new JsHttpRequest();

       req.onreadystatechange = function() {
                 if (req.readyState == 4) {
                document.getElementById('main_big_photo').innerHTML = req.responseText;
        }
    }
    req.open(null, 'http://avtoplanet.ru/includes/ajax/small_photo_to_big_moto.php', true);
    req.send( {'num_of_da_photo':value , 'get_car':value2 , 'get_model':value3 , 'id_adv':value4 });
}
function Logo_to_da_Photo(id, id2, width, height){
	var top;
	var left;
	top=(screen.height-height-300)/2;
	left=(screen.width-width)/2;
	info_form=window.open("http://avtoplanet.ru/includes/gd.php?id="+id+"&id2="+id2, id, "top="+top+",left="+left+",width="+width+", height="+height+", status=0, menubar=0, location=0 resizable=0 directories=0 toolbar=0");
	info_form.focus();
}
function Enter(id, width, height){
	var top;
	var left;
	top=(screen.height-height-300)/2;
	left=(screen.width-width)/2;
	info_form=window.open("http://avtoplanet.ru/includes/enter.php?id="+id, id, "top="+top+",left="+left+",width="+width+", height="+height+", status=0, menubar=0, location=0 resizable=0 directories=0 toolbar=0");
	info_form.focus();
}
function first_place(id, idadv, width, height){
	var top;
	var left;
	top=(screen.height-height-300)/2;
	left=(screen.width-width)/2;
	info_form=window.open("http://avtoplanet.ru/includes/first_place.php?id="+id+"&idadv="+idadv, id, "top="+top+",left="+left+",width="+width+", height="+height+", status=0, menubar=0, location=0 resizable=0 directories=0 toolbar=0");
	info_form.focus();
}
function Pda(id, width, height){
	var top;
	var left;
	top=(screen.height-height-300)/2;
	left=(screen.width-width)/2;
	info_form=window.open("http://avtoplanet.ru/pda/help.php?id="+id, id, "top="+top+",left="+left+",width="+width+", height="+height+", status=0, menubar=0, location=0 resizable=0 directories=0 toolbar=0");
	info_form.focus();
}
function AddMorePhoto(id2,id,width,height){
	var top;
	var left;
	top=(screen.height-height-300)/2;
	left=(screen.width-width)/2;
	info_form=window.open("http://avtoplanet.ru/includes/add_more_photo.php?id2="+id2+"&id="+id, id, "top="+top+",left="+left+",width="+width+", height="+height+", status=0, menubar=0, location=0 resizable=0 directories=0 toolbar=0");
	info_form.focus();
}

function Delete_adv(id, width, height){
	var top;
	var left;
	top=(screen.height-height-300)/2;
	left=(screen.width-width)/2;
	info_form=window.open("http://avtoplanet.ru/includes/delete_adv.php?id="+id, id, "top="+top+",left="+left+",width="+width+", height="+height+", status=0, menubar=0, location=0 resizable=0 directories=0 toolbar=0");
	info_form.focus();
}
function Change_Pass(id, width, height){
	var top;
	var left;
	top=(screen.height-height-300)/2;
	left=(screen.width-width)/2;
	info_form=window.open("http://avtoplanet.ru/includes/change_pass.php?id="+id, id, "top="+top+",left="+left+",width="+width+", height="+height+", status=0, menubar=0, location=0 resizable=0 directories=0 toolbar=0");
	info_form.focus();
}
function karta_probki(id, width, height){
	var top;
	var left;
	top=(screen.height-height-300)/2;
	left=(screen.width-width)/2;
	info_form=window.open("http://avtoplanet.ru/includes/karta_probki.php?id="+id, id, "top="+top+",left="+left+",width="+width+", height="+height+", status=0, menubar=0, location=0 resizable=0 directories=0 toolbar=0");
	info_form.focus();
}
function price_online(id, width, height){
	var top;
	var left;
	top=(screen.height-height-300)/2;
	left=(screen.width-width)/2;
	info_form=window.open("http://avtoplanet.ru/includes/price_online.php?id="+id, id, "top="+top+",left="+left+",width="+width+", height="+height+", status=0, menubar=0, location=0 resizable=0 directories=0 toolbar=0");
	info_form.focus();
}
//---------------------------------
function showphoto(d) 
{
	if (d.style.display=='none')
	{
		d.style.display = 'inline'; 
	}

} 
function Colors(id, width, height){
	var top;
	var left;
	top=(screen.height-height-300)/2;
	left=(screen.width-width)/2;
	info_form=window.open("http://avtoplanet.ru/includes/colors_frame.php?id="+id, id, "top="+top+",left="+left+",width="+width+", height="+height+", status=0, menubar=0, location=0, resizable=0, directories=0, toolbar=0");
	info_form.focus();
}
function click_baners(id, width, height){
	var top;
	var left;
	top=(screen.height-height-300)/2;
	left=(screen.width-width)/2;
	info_form=window.open("http://avtoplanet.ru/includes/click_baners.php?id="+id, id, "top="+top+",left="+left+",width="+width+", height="+height+", status=0, menubar=0, location=0, resizable=0, directories=0, toolbar=0");
	info_form.focus();
}
function Intelect_Enter(value, pole) {
     var req = new JsHttpRequest();

       req.onreadystatechange = function() {
                if (req.readyState == 4) {

		if (pole==28)
		{
                	document.getElementById('area_'+pole).innerHTML = req.responseText;
		}

	fields = new Array('cena','probeg', 'obem_dvig', 'mail_reg', 'kod_reg', 'left_login', 'forgoten_pass', 'mail_to_friend');

		if (pole==3)
		{
			if (!document.getElementById(fields[pole]).value.match (/^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+\.[a-zA-Z]+$/)){document.getElementById(fields[pole]).style.background='pink';}
			else{document.getElementById(fields[pole]).style.background='#FFFFFF';}
		}
		if(pole==4)
		{
			if (!document.getElementById(fields[pole]).value.match (/^[0-9]*$/)){document.getElementById(fields[pole]).style.background='pink';}
			else{document.getElementById(fields[pole]).style.background='#FFFFFF';}
		}
		if (pole==5)
		{
			if (!document.getElementById(fields[pole]).value.match (/^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+\.[a-zA-Z]+$/)){document.getElementById(fields[pole]).style.background='pink'; document.forms.left_join.elements.left_sub.disabled='true';}
			else{document.getElementById(fields[pole]).style.background='#FFFFFF'; document.forms.left_join.elements.left_sub.disabled='';}
		}
		if (pole==6)
		{
			if (!document.getElementById(fields[pole]).value.match (/^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+\.[a-zA-Z]+$/)){document.getElementById(fields[pole]).style.background='pink'; document.forms.left_forgoten.elements.left_sub_forgoten.disabled='true';}
			else{document.getElementById(fields[pole]).style.background='#FFFFFF'; document.forms.left_forgoten.elements.left_sub_forgoten.disabled='';}
		}
		if (pole==7)
		{
			if (!document.getElementById(fields[pole]).value.match (/^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+\.[a-zA-Z]+$/)){document.getElementById(fields[pole]).style.background='pink'; document.linkyem_frienda.elements.go_friend.disabled='true';}
			else{document.getElementById(fields[pole]).style.background='#FFFFFF'; document.forms.linkyem_frienda.elements.go_friend.disabled='';}
		}
        }
    }
    req.open(null, 'http://avtoplanet.ru/includes/ajax/intelect_enter.php', true);
    req.send( {'valid':value , 'area': pole} );
}

function addBookmark(url, title)
{
  if (!url) url = location.href;
  if (!title) title = document.title;
  
  //Gecko
  if ((typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function")) window.sidebar.addPanel (title, url, "");
  //IE4+
  else if (typeof window.external == "object") window.external.AddFavorite(url, title);
  //Opera7+
  else if (window.opera && document.createElement)
  {
    var a = document.createElement('A');
    if (!a) return false; //IF Opera 6
    a.setAttribute('rel','sidebar');
    a.setAttribute('href',url);
    a.setAttribute('title',title);
    a.click();
  }
  else return false;
  
  return true;
}
