var dv1;
var oft;
function ajax_uniqueCmsField(fvalue,fname,colname,tabname) {
  
  targetDiv = 'div_'+fname;
     advAJAX.post({ url: "/cms/scripts/script.parts/ajax_unique.php?fvalue="+fvalue+"&colname="+colname+"&tabname="+tabname,
       // onLoading : function(obj) {document.getElementById(targetDiv).innerHTML = "<div class=\"comm_status\">Trwa ładowanie danych<br><img src=\"/images/lightbox-ico-loading.gif\" alt=\"\" border=\"0\"></div>";}, 
	onSuccess : function(obj) { document.getElementById(targetDiv).innerHTML = obj.responseText; }
       
	// onError : function(obj) { alert("Error: " + obj.status); }
    });
  
  //advAJAX.download('div_'+fname, '/cms/scripts/script.parts/ajax_unique.php?fvalue='+fvalue+'&colname='+colname+'&tabname='+tabname);
}

function OpenImage(file)
{
	window.open("/cms/openimage.php?id="+file, "obrazek", "toolbar=no , menubar=0, status=no, top=250, left=225" );
}
function get_akt(id,title){
	window.open('/cms/mod_news/aktualnosci_popup.php?path='+id, 'title'+id, 'height=540, width=660, status=no, toolbar=no, menubar=yes, location=no, scrollbars=yes');
}
function get_content(id,title){
	window.open('/cms/mod_content/content_popup.php?path='+id, 'title'+id, 'height=540, width=660, status=no, toolbar=no, menubar=no, location=no, scrollbars=yes');
}
function swap(dv) {
	var d = document.getElementById(dv);
	if (dv=="libraries") {
		var b = document.getElementById('tdlibs');
		
	}
	

	
	if (d.style.display=="none") {
		d.style.display = "block";
		if (dv=="libraries") {		
			b.style.height="200";
		}	
		foldifr.location.href="_actions/setfold.php?code=" + dv + "&foldtype=show";
	} else {
		if (dv=="libraries") {	
			b.style.height="0";
		}	
		d.style.display = "none";
		foldifr.location.href="_actions/setfold.php?code=" + dv + "&foldtype=hide";
	}
}	

function show(dv) {
	var d = document.getElementById(dv);
		if (dv=="libraries") {
		var b = document.getElementById('tdlibs');		
	}	
	d.style.display = "block";
		if (dv=="libraries") {		
		b.style.height="200";
	}	
		
	
}
function hide(dv) {
	var d = document.getElementById(dv);
		if (dv=="libraries") {
		var b = document.getElementById('tdlibs');		
	}	
	d.style.display = "none";
		if (dv=="libraries") {		
		b.style.height="0";
	}		
}


function set(dv, val) {
	if (val=="1") {
		show(dv);
	} else {
		hide(dv);
	}
}

function ONWHelp(Url, nazwa, wys, szer) {
   window.open(Url, nazwa, "height=" + wys + ",width=" + szer + ",status=no,resizable=no,scrollbars=yes,menubar=no,location=no");
}

function HideSearch(){
	parent.document.getElementById('cms-wyszuk').style.display='none';
}
function HideStats(){
	parent.document.getElementById('cms-stats').style.display='none';
}

//funkcja do ustawiania praw dostepu
function swapbtns(id) {

	var vl = document.getElementById('cms-rights-value-'+id);

	
	if (vl.value==1) {
		newval = 3;
	} else if (vl.value==2) {
		newval = 2;
	} else if (vl.value==3) {
		newval=1;
	}
	
	var im = document.getElementById('cms-rights-image-'+id);
	
	im.src='/cms/pix/ico.rights.'+newval+'.gif';
	vl.value = newval;

}

function swapbtnswv(id,val) {

	var vl = document.getElementById('cms-rights-value-'+id);

	if (vl.value!=2) {
		newval = val;
		
	
	
	var im = document.getElementById('cms-rights-image-'+id);
	
	im.src='/cms/pix/ico.rights.'+newval+'.gif';
	vl.value = newval;
	}

}

function ONWGal(Url, nazwa, wys, szer) {
   window.open(Url, nazwa, "height=" + wys + ",width=" + szer + ",status=no,resizable=no,scrollbars=yes,menubar=no,location=no");
}
function set_cars_od_ilosc(val) {
	f = document.getElementById('select_cars');				
	f.target='ifr_cars';
	f.action='cms/_actions/select_cars.php';
	f.od_ilosc.value=val;	
	f.submit();
}
function set_cars_orderby(val) {
	f = document.getElementById('select_cars');				
	f.target='ifr_cars';
	f.action='cms/_actions/select_cars.php';
	f.orderby.value=val;
	f.submit();
}
function set_cars_desc(val) {
	f = document.getElementById('select_cars');				
	f.target='ifr_cars';
	f.action='cms/_actions/select_cars.php';
	f.desc.value=val;
	f.submit();
}
function set_cars_sort(val) {
	f = document.getElementById('select_cars');				
	f.target='ifr_cars';
	f.action='cms/_actions/select_cars.php';
	f.sort.value=val;
	f.submit();
}
function set_cars_demo(val) {
	f = document.getElementById('select_cars');				
	f.target='ifr_cars';
	f.action='cms/_actions/select_cars.php';
	f.demo.value=val;
	f.submit();
}
function updateSubCat(tag,mark) {
	advAJAX.download(tag, 'cms/_actions/cars_model.php?mark='+mark);
}

function checkEmail(myForm) {
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(myForm.newsletterEmail.value)){
return (true)
}
alert("Niepoprawny adres e-mail.Proszę wpisac ponownie")
return (false)
}


/*
function checkEmail(email) 
{ 
var re = /^[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)*@([a-zA-Z0-9_-]+)(\.[a-zA-Z0-9_-]+)*(\.[a-zA-Z]{2,4})$/i; 
if(email.match(re) == null) {
alert("Niepoprawny adres e-mail.Proszę wpisać ponownie")
return (false)
}else {
return (true)
}
} 


function sprawdzanie (form) {

	f = document.getElementById('newsletterEmail');
	email = f.value;

	if (checkEmail(email) == true) {

		var url='/actions/newsletter_check.php?email='+email;
		newwindow=window.open(url);
		if (window.focus) {
			newwindow.focus();
		}
	} else{
	return false;
	}
	
}
*/

