function my_ads_confirm_edit_ad(f,el){
	var uid=document.getElementById('my_ads_user_id');
	//alert(uid);
	if(uid==null){
		alert('Неизвестный Автор объявления');
		if(document.getElementById('my_ads_auth_name'))document.getElementById('my_ads_auth_name').focus();
		return false;
	}	
	var passwds=$('my_ads_passwd','my_ads_passwd_');
	if(passwds[0].value!=passwds[1].value){alert('Пароли не совпадают');return false;}
	if(passwds[0].value==''){alert('Пароль не может быть пустым');return false;}
	el.style.display='none';
	my_ads_ajax_f(f);
}
function my_ads_fill_ucontacts(el){
	var uid=document.getElementById('my_ads_user_id');
	if(uid==null){
		alert('Неизвестный Автор объявления');
		if(document.getElementById('my_ads_auth_name'))document.getElementById('my_ads_auth_name').focus();
		return false;
	}
	var ucontacts=document.getElementById('my_ads_ucontacts').value;
	el.parentNode.nextSibling.firstChild.value=ucontacts;
}
function my_ads_show_big_image(path,aid,id,h,w){
	window.open(path+'open_image.php?aid='+aid+'&i='+i,'','Toolbar=0,Location=0,Directories=0,Status=0,Menubar=0,Scrollbars=1,Resizable=1,Width='+w+',Height='+h);
}
/////////////////////////////////////
function my_ads_ajax(value,destination){
	if(typeof destination=='string')destination=document.getElementById(destination);
	//alert(value);
    var req = new JsHttpRequest();
    req.onreadystatechange = function() {
        if (req.readyState == 4) {
            destination.innerHTML=req.responseJS.q;
            document.getElementById('my_ads_debugging').innerHTML = req.responseText;
        }
    }
    req.open(null,'my_ads_files/ajax.php',true);
    req.send( { q: value } );
}
function my_ads_ajax_f(source){
	//alert(my_ads_ajax_f.arguments.length);
	if(typeof source=='string')source=document.getElementById(source);
	if(my_ads_ajax_f.arguments.length==2){
		if(typeof my_ads_ajax_f.arguments[1]=='string')var destination=document.getElementById(my_ads_ajax_f.arguments[1]);
		else var destination=my_ads_ajax_f.arguments[1];
	}
	else var destination=source;
	var req = new JsHttpRequest();
    req.onreadystatechange = function() {
        if (req.readyState == 4) {
            destination.innerHTML = req.responseJS.q;
            document.getElementById('my_ads_debugging').innerHTML = req.responseText;
        }
    }
    req.open(null,'my_ads_files/ajax_f.php', true);
    req.send( { q: source } );
}
function $(){
	var elements = new Array();
	for (var i = 0; i < arguments.length; i++) {
		var element = arguments[i];
		if (typeof element == 'string')element = document.getElementById(element);
		if (arguments.length == 1)return element;
		elements.push(element);
	}
	return elements;
}
