function hovermen(iddiv) {
	
	document.getElementById(iddiv).className = 'menkonta';
	//document.getElementById(iddiv + 'a').className = 'lewa';
	//document.getElementById(iddiv + 'b').className = 'prawa';
}

function outmen(iddiv) {
	
	document.getElementById(iddiv).className = 'menkontaH';
	//document.getElementById(iddiv + 'a').className = 'lewaH';
	//document.getElementById(iddiv + 'b').className = 'prawaH';
}


function showfotoupl(id,idban,div, width, height){
var Win = window.open('foto.baner.php?id='+ id +'&idban='+ idban+'&div='+div,"displayWindow",'width=' + width + ',height=' + height +  ',resizable=0,scrollbars=yes,menubar=no' );
}



function dellnewfoto(id,file,target) {
 advAJAX.post({
  url: file,
	parameters : {
    "dellnewfoto" : id,
    "target":target,
    "tryb":'new'
  },
  onSuccess : function(obj) { 
  	document.getElementById(target).innerHTML = obj.responseText;
  	//alert(obj.responseText);
  },
  onError : function(obj) { 
    alert("Error: " + obj.status); 
  }
});   	
}


function delleditfoto(id,idkat,file,target) {
 advAJAX.post({
  url: file,
	parameters : {
    "dell" : id,
    "par":idkat,
    "target" : target
  },
  onSuccess : function(obj) { 
  	document.getElementById(target).innerHTML = obj.responseText;
  },
  onLoading : function(obj) {
document.getElementById(target).innerHTML= "<img src=\"img/loading.gif\"/>";
}, 
  onError : function(obj) { 
    alert("Error: " + obj.status); 
  }
});   	
}



function windowpopup(iddiv) {
	readfile('','','ajax/popupkat.php','katinc')
	document.getElementById(iddiv).style.display='inline';
	bh=document.body.clientHeight;
	bw=document.body.clientWidth;
	pw=document.getElementById(iddiv).clientWidth;
	ph=document.getElementById(iddiv).clientHeight;
	document.getElementById(iddiv).style.left=((bw-pw)/2)+'px';
	document.getElementById(iddiv).style.top='50px';
	
}

function Setkat(kat,str){
dodajelement(str,kat);
document.getElementById('popupkat').style.display='none';

}















function ceny(x){
var x;	

	x.value = x.value.replace(',','.');
	
		x.value = x.value.replace(/[^\d\.\,]+/g, '')
}


function liczby(x){
var x;	

	x.value = x.value.replace(',','.');
	
		x.value = x.value.replace(/[^\d\.\,]+/g, '')
}

//sprawdz czy wolny login


function CheckMail(e,target){
	
	var email = e.value;
	

		
		if(!email_validate(email)){
			
			document.getElementById(target).innerHTML = 'Adres email jest nie prawidłowy!!!'
			
		}else{
			
		readfile(email,'','ajax/checkeditmail.php',target);	
			
			
		}


}



function email_validate(src) 
{
  var regex = /^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/;
  return regex.test(src);
}

















	
function dellpoz(val,id,file,target){
advAJAX.get({
  url: file,
	parameters : {
    "dell" : val,
    "idpojazd" : id
  },
  onSuccess : function(obj) { 
  	document.getElementById(target).innerHTML = obj.responseText;
  },
 onLoading : function(obj) {
document.getElementById(target).innerHTML= "<img src=\"img/loading.gif\"/>";
}, 
  onError : function(obj) { 
    alert("Error: " + obj.status); 
  }
});
}


function dellbaner(idwpis,id,file,target){
advAJAX.post({
  url: file,
	parameters : {
	"par": idwpis,
    "dell" : id  
	},
  onSuccess : function(obj) { 
  	document.getElementById(target).innerHTML = obj.responseText;
  },
 onLoading : function(obj) {
document.getElementById(target).innerHTML= "<img src=\"img/loading.gif\"/>";
}, 
  onError : function(obj) { 
    alert("Error: " + obj.status); 
  }
});
}


function readfile(val,val1,file,target){
advAJAX.get({
  url: file,
	parameters : {
    "par" : val,
    "par1" : val1
  },
  onSuccess : function(obj) { 
  	document.getElementById(target).innerHTML = obj.responseText;
  },
onLoading : function(obj) {
document.getElementById(target).innerHTML= '<img src="img/loading.gif"/>';
},
  onError : function(obj) { 
    alert("Error: " + obj.status); 
  }
});
}


function readfilepost(val,val1,file,target){
advAJAX.post({
  url: file,
	parameters : {
    "par" : val,
    "par1" : val1
  },
  onSuccess : function(obj) { 
  	document.getElementById(target).innerHTML = obj.responseText;
  },
onLoading : function(obj) {
document.getElementById(target).innerHTML= "<img src=\"img/loading.gif\"/>";
},
  onError : function(obj) { 
    alert("Error: " + obj.status); 
  }
});
}


function postsenddata(forma,file,target){
advAJAX.submit(document.getElementById(forma), 
  {
  	url: file,
    onSuccess : function(obj) { 
      document.getElementById(target).innerHTML = obj.responseText;
    },
    

onLoading : function(obj) {
document.getElementById(target).innerHTML= "<img src=\"img/loading.gif\"/>";
},
    onError : function(obj) { 
      alert("Error: " + obj.status);
    }
  }
);	
}








function show_hiden_div(identyfikator,stan) { 
	
if(stan == "h"){
	
document.getElementById(identyfikator).style.display = "none";
	
}else{
	
document.getElementById(identyfikator).style.display = "inline";
	
}
}


function showhiden(identyfikator) { 
	
if(document.getElementById(identyfikator).style.display == "none"){
	
document.getElementById(identyfikator).style.display = "inline";
	
}else{
	
document.getElementById(identyfikator).style.display = "none";
	
}
}



function check_file(){

if(document.form_file.upl.value==0)
{
alert('Brak pliku');
return false;
}

return true;
}









// menu
var menuOtw=false;
function close_menu(num)
{
	if (document.getElementById('menu_cat_'+num))
		document.getElementById('menu_cat_'+num).className='menu1_off';
}

function menu_cat_change(num) {
	if (menuOtw==num){
    close_menu(menuOtw);
    menuOtw=false;
  } else {  
    if (menuOtw!=false) close_menu(menuOtw);			
   
    if (document.getElementById('menu_cat_'+num))
      document.getElementById('menu_cat_'+num).className='menu1_on';      
	menuOtw=num;
  }
  return false;  
}

function MenuStart(dId) {
  menu_cat_change(dId);
}


function error_nul(element) {
	
document.getElementById(element).className = 'error_null';

        }

function ok_elemnt(element) {
	
document.getElementById(element).className = 'SELECT';

        } 