function GenericFieldsForm(amound_f, cen_f, id_old) { 
	var div_all='';
    var div_all_='';
 	
	if(document.getElementById("descriptions_f") && amound_f.length){	
		for(x=0;x<amound_f.length;x++) {
			var min_random = 0;	var max_random = 1000;	max_random++;	var range = max_random - min_random;	var nyes=Math.floor(Math.random()*range) + min_random+'1';
			div_all+='<div class="padd_ingr" id="padd_ingr'+nyes+'"><table cellspacing="0" cellpadding="1"><tr><td><input type="text" name="frm_desc[]" id="descriptions_f" value="'+amound_f[x].value+'"></td><td> <input type="text" name="frm_cen[]" id="ceny_f" value="'+cen_f[x].value+'">  <input type="hidden" name="frm_id_old[]" id="id_old"  value="'+id_old[x].value+'"></td><td id="middle_al"><img src="imgs/deleteshop.gif" OnClick="DeleteFieldsForm(\'padd_ingr'+nyes+'\');" style="cursor:pointer;" alt="Delete"></td></tr></table></div>'; //\'fram'+id+'\'
		}
	}
	if(document.getElementById("descriptions_f") && !amound_f.length){	
			var min_random = 1001;	var max_random = 2000;	max_random++;	var range = max_random - min_random;	var tw=Math.floor(Math.random()*range) + min_random+'2';
			div_all+='<div class="padd_ingr" id="padd_ingr'+tw+'"><table cellspacing="0" cellpadding="1"><tr><td><input type="text" name="frm_desc[]" id="descriptions_f" value="'+amound_f.value+'"></td><td> <input type="text" name="frm_cen[]" id="ceny_f" value="'+cen_f.value+'">  <input type="hidden" name="frm_id_old[]" id="id_old"  value="'+id_old.value+'"></td><td id="middle_al"><img src="imgs/deleteshop.gif" OnClick="DeleteFieldsForm(\'padd_ingr'+tw+'\');" style="cursor:pointer;" alt="Delete"></td></tr></table></div>'; //\'fram'+id+'\'
		
	}	
	
 	var min_random = 2001;	var max_random = 3000;	max_random++;	var range = max_random - min_random;	var n=Math.floor(Math.random()*range) + min_random+'3';
	div_all+='<div class="padd_ingr" id="padd_ingr'+n+'"><table cellspacing="0" cellpadding="1"><tr><td><input type="text" name="frm_desc[]" id="descriptions_f"></td><td> <input type="text" name="frm_cen[]" id="ceny_f"> <input type="hidden" name="frm_id_old[]" id="id_old"></td><td id="middle_al"><img src="imgs/deleteshop.gif" OnClick="DeleteFieldsForm(\'padd_ingr'+n+'\');" style="cursor:pointer;" alt="Delete"></td></tr></table></div>'; //\'fram'+id+'\'
	document.getElementById("list_tr").innerHTML ='';
	 
	 
	document.getElementById("list_tr").innerHTML +=div_all;
 
}

function DeleteFieldsForm(del){ 
	 var xx=document.getElementById(del);
	 xx.parentNode.removeChild(xx);
}

function wopen(url,w,h){  
	eval('opened=window.open("","none","top=100, left=300, width="+w+", height="+h+", resizable=0","replace=yes")');  
	opened.document.open();  
	opened.document.write('<body leftmargin=0 topmargin=0 align="center"><img src="'+url+'"></body>');  
	opened.document.close();   
}  

function ShowTextImages(img){
	document.getElementById(img).style.display='block';
}
function HiddenTextImages(img){
	document.getElementById(img).style.display='none';
}


function alertWindow(newpr,pr_id,pr_name){ 
	document.getElementById(newpr).style.display = 'block'; 
	if(pr_id) document.getElementById('prod_id').value= pr_id; 
	if(pr_name) document.getElementById('name_pr').innerHTML= 'Добавить продукт '+pr_name; 
}

function ShowButton(){
	//document.getElementById("but_send").style.display = 'block';
}
function alertWindowHidden(){
	document.getElementById("alert_window").style.display='none';
}

function SelectUrl(val, rer){    
		if (val!=='0') window.location=rer+val;
}
