function goFORM(e) {
	var keynum;
	var keychar;
	var numcheck;

	if(window.event) {// IE 
		keynum = e.keyCode
	}
	else if(e.which) {// Netscape/Firefox/Opera
		keynum = e.which
	}
	if (keynum==13) {
		document.myform.submit();
	};
	//keychar = String.fromCharCode(keynum);
//numcheck = /\d/
//return !numcheck.test(keychar)
}

function submitFORM(id) {
	document.id.submit();
}
function pokaz (zdjecie, linke) {
	document.getElementById('link').href = linke;
	document.getElementById('fotka').src = zdjecie;

}
function showw() {
	rr=document.getElementById('konsul').checked;
	if (rr) document.getElementById('telshow').style.display = 'block';
	else document.getElementById('telshow').style.display = 'none';
}
function popup(id, act) {
	document.getElementById(id).style.display = act;
}
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 zmianaceny(cena) {
 alert(cena);
}
function showBan(id) {
	var obj = jQuery("#vip_ban"+id);
	if (jQuery(obj).is(':visible')){
		jQuery(obj).hide(300);
	}
	else {
		jQuery(obj).show(300);
	}	
	//document.getElementById('pole_'+i).style.display='block';
}
function campare(Shop_url, szab_id) {
	var w=800;
	var h=500;
	window.open (Shop_url+'katalog_porownanie.php?szab_id='+szab_id, '','width='+w+', height='+h+', status=yes,toolbar=no, scrollbars=yes,menubar=no,location=no,resizable=yes');
}
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 zamow_register (val) {
	//var id_id=document.getElementById('reg').value;
	var id_id=document.getElementById('RegisterZamDIV');
	if (id_id) {
		if (id_id.style.display=='none') id_id.style.display = 'block';
	}
	LoadSite('login_sm_zam_reg.php?reg='+val,'RegisterZamDIV');
}

function show_fv () {
	var id_id=document.getElementById('reg_fv');
	
	if (id_id) {
		
		var DIVfv = document.getElementById('DIVfv');
		if (id_id.checked==true) DIVfv.style.display = 'block';
		else {DIVfv.style.display = 'none';}
		
	}
}
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() {
		//$(where).innerHTML = "changing ...";
	}
	req.Send(site, where);
}
function submitFORM(){
	if(document.getElementById('termss').checked == false) {
		alert ("Please check box next to Terms and Condition");
		return false;
	}
	else {
		return true;
	}
}
	
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(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 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);
}
	
