
function ShowHidekoszt () {
	var tmp=document.getElementById('ukryj');
	var tmp2=document.getElementById('DIVtaryfy');
	if (tmp && tmp2) {
		if (!tmp.checked) tmp2.style.display='none';
		else tmp2.style.display='block';
	}
	//DIVtaryfy
}
function clearform(oForm){
	var frm_elements = oForm.elements;
  for (i = 0; i < frm_elements.length; i++) {
    field_type = frm_elements[i].type.toLowerCase();
    switch (field_type) {
    	case "text":
    	case "password":
    	case "textarea":
    	case "hidden":
        frm_elements[i].value = "";
        break;
   	case "radio":
    	case "checkbox":
        if (frm_elements[i].checked)frm_elements[i].checked = false;
        break;
    	case "select-one":
    	case "select-multi":
        frm_elements[i].selectedIndex = -1;
        break;
    	default:
        break;
    }
	}
}
function vote(id) {
	for (x=1; x<=id; x++) {
		document.getElementById('star'+x).src = "gfx/!ico_star_on.png";
	}
	if (id != 6) {
	   for (xx=x; xx<=6; xx++) {
	      document.getElementById('star'+xx).src = "gfx/!ico_star_off.png";
	   }
	}
}

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 LoadSiteAndConfirm(site, where, com) {
	
	 		var sprawdz = window.confirm(com);
	 		if (sprawdz == true) {
	         var req = mint.Request();
	         req.OnSuccess = function() {
	             }
	         req.OnLoading = function() {
					if (where=='miasta') alert ('miasta');
	            $(where).innerHTML = "changing ...";
	         }
	         req.Send(site, where);
	      }
} 

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) {
	var req = mint.Request();
	req.OnSuccess = function() {
	    }
	req.OnLoading = function() {
		if (where=='miasta' || where=='inne_termi') {
			$(where).innerHTML = "<div style='width:100%;text-align:center'><img src='gfx/8.gif'></div>";
		}
	}
	req.Send(site, where);
}

function LoadSiteAnim(site, where, param) {
	
	var req = mint.Request();
	req.OnSuccess = function() {
	    }
	req.OnLoading = function() {
		$(param).innerHTML = "<div style='position:absolute;z-index:999999;width:780px;height:100%;background:url(gfx/blank.png) repeat'><div style='text-align:center;font-size:18px;padding:10px;margin-top:50px;color:#145EB2'><b>Wczytywanie ofert</b></div><div style='text-align:center;font-size:16px;padding:10px;'><img src='gfx/loader3.gif'></div></div>";
	}
	req.Send(site, where);
}

function ReloadBasket() {
	LoadSite("menu_basket.php?add=on", "DIVbasket");
}
function LoadSite2(site, where, param, param1) {
	var req = mint.Request();
	if (param && param1){
		wartosc = document.getElementById(param).value
		if (param1=='1') wartosc++;
		else if (param1=='-1')wartosc--;
		if (wartosc<0) wartosc=0;
		site = site+wartosc;
	}
	req.OnSuccess = function() {
		if (param) ReloadBasket();
	}
	req.OnLoading = function() {
		//$(where).innerHTML = "changing ...";
	}
	
	req.Send(site, where);
}

function SendRequest(where, what, ans, tiny)
{
	    var req = mint.Request();
	    req.OnSuccess = function() {
	        $(ans).innerHTML = this.responseText;
	        //if (where=='menu_basket.php') ReloadBasket();
	    }
	    req.OnLoading = function() {
	    }
		req.SendForm(what, where);
}
function SendRequestPARM (site, FORMname, DIVname, param,param_value)
{
	    var req = mint.Request();
	    req.OnSuccess = function() {
	        $(DIVname).innerHTML = this.responseText;
	        //if (where=='menu_basket.php') ReloadBasket();
	    }
	    req.OnLoading = function() {
	    }
		if (param) {
			req.AddParam(param, param_value);
		}
		req.SendForm(FORMname, site);
}
	
	function CheckForm(site, where, frm_id) {
   	 var req = mint.Request();
   	 req.OnSuccess = function() {
   	 	document.getElementById(frm_id).disabled = false;
   	 	if (this.responseText && frm_id!='country') {
    	 		document.getElementById(frm_id).style.borderColor='#FF0000';
 		
   	 	} 	
   	 	else if (this.responseText && frm_id=='country') {
   	 		document.getElementById(frm_id).style.borderColor='#B5CEE7';
   	 	}
   	 	else {
   	 		document.getElementById(frm_id).style.borderColor='#B5CEE7';
   	 	}
	    }
	    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 setscolor(kolor) {
		document.getElementById('kolor-naklejki').value=kolor;
	}
	
