function HoverMenuShow(el){ 		
	if(el) { 
		document.getElementById(el).className = 'hover_menu';
	}
	if(el=='menu_3') ShowSelectMenu(el);
}
function HoverMenuHidden(el2){ 
 	if(el2) { 
		document.getElementById(el2).className = 'dont_hover_menu';
	}
	if(el2=='menu_3') HiddenSelectMenu(el2);
}

function ItemsShow(x){
		if(x) { 
		document.getElementById(x).className = 'hover_items';
	}
}
function ItemsHidden(y){
		if(y) { 
		document.getElementById(y).className = 'hover_items_no';
	}
}


function ShowSelectMenu(m){
	var mm=m
	mm=m+'_show';
	document.getElementById(mm).className = 'show_select_menu';	
}
function HiddenSelectMenu(n){
	var nn=n
	nn=n+'_show';
	document.getElementById(nn).className = '';	
}


function ReloadUrl(val){
	if (val!=='0') window.location=val;
}

function HoverTwoMenu(h){
 	if(h) { 
		document.getElementById(h).className = 'menu_two_hover';
	}
}
function HoverTwoMenuHid(d){
 	if(d) { 
		document.getElementById(d).className = '';
	}
}

/// ADD AJAX
var http = false;
var lastMessage = 0;

if(navigator.appName == "Microsoft Internet Explorer") {
  http = new ActiveXObject("Microsoft.XMLHTTP");
} else {
  http = new XMLHttpRequest();
}

function Save_Subsctibe(nam){ 
 http.abort();
 http.open("GET", "_ajax.php?1&action=save_subscribe&frm_email=" + document.getElementById(nam).value, true);
	http.onreadystatechange=function() {
	    if(http.readyState == 4) {
	        var response2 = http.responseText;
    		var update = new Array();
			//alert(response);
	        if(response2.indexOf('|' != -1)) { 
	            update = response2.split('|');
	             if (update[1]) document.getElementById(update[0]).innerHTML = update[1];
		 	}		
		}
	}
	
	if(window.ActiveXObject) { 
	  http.send();
	} else {
	  http.send(null);
	}		
}

function ShowTab(tab){ 
		if(tab=='tab1') {
			document.getElementById('tab3').style.display= 'none';
			document.getElementById('tab2').style.display= 'none';
			document.getElementById('zakladka2').className='vkladka2';
			document.getElementById('zakladka3').className='vkladka3';
			document.getElementById('zakladka1').className='zakladka1_active';			
		}		
		if(tab=='tab2') {
			document.getElementById('tab1').style.display= 'none';
			document.getElementById('tab3').style.display= 'none';
			document.getElementById('zakladka1').className='zakladka1_not';
			document.getElementById('zakladka3').className='zakladka1_not';
			document.getElementById('zakladka2').className='zakladka2_active';
		}
		if(tab=='tab3') {
			document.getElementById('tab1').style.display= 'none';
			document.getElementById('tab2').style.display= 'none';
			document.getElementById('zakladka1').className='zakladka1_not';
			document.getElementById('zakladka2').className='vkladka2';
			document.getElementById('zakladka3').className='zakladka1_active';			
		}				
		document.getElementById(tab).style.display= 'block';
}

  
function Save_Lostpassword(emailyk){
 http.abort();
 	var url='';
	 url+='&frm_email='+document.getElementById(emailyk).value;
 	 
 http.open("GET", "_ajax.php?1&action=save_lostpassword" + url, true);
	http.onreadystatechange=function() {
	    if(http.readyState == 4) {
	        var response = http.responseText;
    		var update = new Array();
			//alert(response);
	        if(response.indexOf('|' != -1)) { 
	            update = response.split('|');
	         // alert(update[0])
	            if (update[1]) document.getElementById("messages_lost").innerHTML = update[1];

		 	}		
		}
	}
	
	if(window.ActiveXObject) { 
	  http.send();
	} else {
	  http.send(null);
	}
}

 


function GenericFieldsForm(field_name, amound_f, serving_f) {
	var div_all_='';
	var div_all='';
	var all_input='';
	if(document.getElementById("amound_f")){ 
	  	if(amound_f.length){	
	  		for(i=0;i<amound_f.length;i++) {
	  			var min_random = 0;	var max_random = 1000;	max_random++;	var range = max_random - min_random;	var nw=Math.floor(Math.random()*range) + min_random+'1';
				var amound_html='<input type="text" name="amound_fields[]" id="amound_f"  class="login2" value="'+amound_f[i].value+'">';

				var select_servings_html='';
				select_servings_html+='<select name="select_servings[]" id="servings_f" class="login2">';
				select_servings_html+='<option value="">--</option>';
					
			  	for(j=0;j<servings.length;j++) {
			  		 var sel_='';
			  		 if(servings[j][0]==serving_f[i].value)  sel_='selected';
					 select_servings_html+='<option value="'+servings[j][0]+'" '+sel_+'>'+servings[j][1]+'</option>';
				}
				select_servings_html+='</select>';
				
				div_all_+='<div class="list_pok_tab" id="line_'+nw+'"><table cellspacing="0" cellpadding="1" align="center" border="0" class="poker_tab"><tr><td>Покер-рум: &nbsp;</td><td align="left"> '+ select_servings_html+'</td><td>&nbsp; &nbsp;Логин: &nbsp;</td><td align="left"> '+amound_html+'</td><td id="middle_al"> <img src="imgs/admin/dete_ico.png" OnClick="DeleteFieldsForm(\'line_'+nw+'\');" style="cursor:pointer;" alt="Delete"></td></tr><tr><td colspan="2"></td><td id="testa'+nw+'"></td><td></td></tr></table></div>'; //\'fram'+id+'\'
			}
			
			//alert(div_all);
		}
		if(!amound_f.length && document.getElementById("amound_f")){	  
			 
			var min_random = 2001;	var max_random = 3000;	max_random++;	var range = max_random - min_random;	var ns=Math.floor(Math.random()*range) + min_random+'2';
			var amound_html='<input type="text" name="amound_fields[]" id="amound_f" value="'+amound_f.value+'"  class="login2">';
			
			var select_servings_html2='';
			select_servings_html2+='<select name="select_servings[]" id="servings_f"  class="login2">';
			select_servings_html2+='<option value="">--</option>';
				
		  	for(f=0;f<servings.length;f++) {
		  		 var sel_='';
		  		 if(servings[f][0]==serving_f.value)  sel_='selected';
				 select_servings_html2+='<option value="'+servings[f][0]+'" '+sel_+'>'+servings[f][1]+'</option>';
			}
			select_servings_html2+='</select>';
			
			all_input = amound_html + select_servings_html2;
			if(all_input) div_all_+='<div class="list_pok_tab" id="line_'+ns+'"><table cellspacing="0" cellpadding="1" align="center" border="0" class="poker_tab"><tr><td>Покер-рум: &nbsp;</td><td align="left"> '+ select_servings_html2+'</td><td>&nbsp; &nbsp;Логин: &nbsp;</td><td align="left"> '+amound_html+'</td><td id="middle_al"> <img src="imgs/admin/dete_ico.png" OnClick="DeleteFieldsForm(\'line_'+nw+'\');" style="cursor:pointer;" alt="Delete"></td></tr><tr><td colspan="2"></td><td id="testa'+ns+'"></td><td></td></tr></table></div>'; //\'fram'+id+'\'
			//if(all_input) div_all+='<div class="list_pok_tab" id="line_'+ns+'"><table cellspacing="0" cellpadding="1" align="center" border="0" class="poker_tab"><tr><td>Покер-рум: &nbsp;</td><td align="left"> '+select_servings_html2+'</td><td>&nbsp; &nbsp;Логин: &nbsp;</td><td align="left" '+ amound_html +'</td><td id="middle_al"><img src="imgs/admin/dete_ico.png" OnClick="DeleteFieldsForm(\'line_'+ns+'\');" style="cursor:pointer;" alt="Delete"></td></tr><tr><td colspan="2"></td><td id="testa'+ns+'" class="testa"></td><td></td></tr></table></div>'; //\'fram'+id+'\'
			//alert(all_input);
		}	
		
	}
	

	var select_servings='';
	select_servings+='<select name="select_servings[]" id="servings_f"  class="login2">';
	select_servings+='<option value="">--</option>';
		
  	for(s=0;s<servings.length;s++) { 
		 select_servings+='<option value="'+servings[s][0]+'">'+servings[s][1]+'</option>'; 
	}
	select_servings+='</select>';
	 
	var min_random = 1001;	var max_random = 2000;	max_random++;	var range = max_random - min_random;	var n=Math.floor(Math.random()*range) + min_random+'3';
	
		
	 document.getElementById("poker_list").innerHTML ='';
	
	
	if(div_all_) div_all+=div_all_;
	 
	div_all+='<div class="list_pok_tab" id="line_'+n+'"><table cellspacing="0" cellpadding="1" align="center" border="0" class="poker_tab"><tr><td>Покер-рум: &nbsp;</td><td align="left"> '+select_servings+'</td>  <td>&nbsp; &nbsp;Логин: &nbsp;</td><td align="left"><input type="text" class="login2" name="amound_fields[]" id="amound_f"></td><td id="middle_al"><img src="imgs/admin/dete_ico.png" OnClick="DeleteFieldsForm(\'line_'+n+'\');" style="cursor:pointer;" alt="Delete"></td></tr><tr><td colspan="2"></td><td id="testa'+n+'" class="testa"></td><td></td></tr></table></div>'; //\'fram'+id+'\'
	
	document.getElementById("poker_list").innerHTML +=div_all;
	
	//
}



function DeleteFieldsForm(del){ 
	 var xx=document.getElementById(del);
	 xx.parentNode.removeChild(xx);
}

 