function showHidePole(idd, alll) {
	for (var i = 1; i<=alll; i++) {
		if (document.getElementById('pole_'+i)) {
			if (i==idd){
				document.getElementById('pole_'+i).style.display='block';
				document.getElementById('przyc_pole_'+i).style.backgroundColor='#D1D1D1';
			}
			else {
				document.getElementById('pole_'+i).style.display='none';
				document.getElementById('przyc_pole_'+i).style.backgroundColor='#DDDDDD';
			}
		}
	}
}

function top_on(id){
	var id_id=document.getElementById(id);
	if (id_id) id_id.src="gfx/nap_"+id+"_on.jpg";
}
function top_off(id){
	var id_id=document.getElementById(id);
	if (id_id) id_id.src="gfx/nap_"+id+"_off.jpg";
}
function checkDomain(form){
			
		var domena=document.getElementById(form).value; //.toLowerCase();
	    var text='The domain name is incorrect.\n Name of domain can consist exclusively of small letters, digits and the sign \"-\" only!. \n The domain name cannot begin and end with the sign \"-\" and cannot contain or use the space bar.';
	        
		var first=domena.substring(0,1);
		var last=domena.substring(domena.length-1,domena.length);
		if (domena == "" || first=="-" || last=="-"||first=="." || domena.indexOf("--")!=-1 || domena.length>63){
			alert(text);
			document.getElementById(form).focus();
		   	return false;
		}
	        
		for(i=0;i<domena.length;i++){
			var znak = domena.substring(i,i+1);
			if (znak=="-" || znak!="." && ( (znak>="0" && znak<="9") || (znak>="a" && znak<="z") || idn.indexOf(znak)>=0 )) {}
			else {
				document.getElementById(form).focus();
				return false;
			}
		}
	}
	
	function ShowHide(id){
	var objectt = document.getElementById(id);
	   if (objectt) {
	   	if (objectt.style.display=='none') objectt.style.display='block';
	   	else objectt.style.display='none';
	   }
	
	}
	
function printt(URLsite, typee, zam_id, fv_id, user_id) {
	   if (typee && zam_id) {
	      strona_do_wyswietlenia = URLsite+"print.php?type=" + typee + "&zam_id=" + zam_id + "&fv_id=" +fv_id+"&user_id=" + user_id;
	      window.open (strona_do_wyswietlenia, '','width=800, height=600, status=no,toolbar=yes,menubar=yes,location=no,resizable=yes');
	   }
	
}
	
function LoadSite(site, where, param) {
	alert (site);
	var req = mint.Request();
	req.OnSuccess = function() {
	    }
	req.OnLoading = function() {
		//$(where).innerHTML = "changing ...";
	}
	req.Send(site, where);
}

function ReloadBasket() {
	LoadSite("menu_basket.php?add=on", "DIVbasket");
}
function LoadSite2(site, where, param) {
	var req = mint.Request();
	req.OnSuccess = function() {
		if (param) ReloadBasket();
	}
	req.OnLoading = function() {
		//$(where).innerHTML = "changing ...";
	}
	req.Send(site, where);
}

function SendRequest(where, what, ans, param, param2) {
	var req = mint.Request();
	req.OnSuccess = function() {
		$(ans).innerHTML = this.responseText;
	}
	if (param || param2) {
		req.SendForm(what, where+"?par1="+param+"&par2="+param2);
	}
	else {
		req.SendForm(what, where);
	}
}

function CheckProductAddToBasket (check,where, what, ans, loading) {
	var tested = 'ok';
	var tocheck = new Array();
	var tocheck = check.split(",");
	for (x=0; x<tocheck.length; x++ ) {
		var temp = document.getElementById("check_"+tocheck[x]);
		if (temp) {
			if (temp.value=='_' || temp.value=='') {
				alert ("Wybierz "+tocheck[x]);
				tested = 'bad';
				break;
			}
		}
	}
	if (tested == 'ok') SendRequest(where, what, ans, loading);
}	
	
function CheckForm(site, where, frm_id) {
   	 var req = mint.Request();
   	 req.OnSuccess = function() {
   	 	document.getElementById(frm_id).disabled = false;
   	 	if (this.responseText.length<=2 ) {
   	 		document.getElementById(frm_id).style.borderColor='#808080';
   	 		document.getElementById(frm_id).style.backgroundColor='#F0EFF0';
   	 	}
   	 	else {
   	 		document.getElementById(frm_id).style.borderColor='#D88B7E';
   	 		document.getElementById(frm_id).style.backgroundColor='#FEE8E8';
   	 	}
	    }
	    req.OnLoading = function() {
	    	$(where).innerHTML = "checking ...";
	    	document.getElementById(frm_id).disabled = true;
	    }
	    if (frm_id=='cpass') {req.Send(site+"="+frm_id+"&data2="+document.getElementById('pass').value, where);}
	    else if (frm_id=='username' || frm_id=='email') {req.Send(site+"="+frm_id, where); }
	    else {req.Send(site+"="+frm_id, where);}
}	
	 
function ChangeFormColor(id) {
	alert('ok'+id);
}
	
