
function enabled_div(id){
    document.getElementById(id).style.display="inline";
}
function disabled_div(id){
    document.getElementById(id).style.display="none";
}

function eloszamla_ablak( url, width, height){
    map = window.open(url,'eloszamla','toolbar=no,location=no,directories=no,menubar=yes,resizable=no,status=no,scrollbars=yes,top=0,left=30,width='+width+',height='+height+'');
    map.focus();
}

function pop_up( url, width, height){
    map = window.open(url,'kozlemeny','toolbar=no,location=no,directories=no,menubar=no,resizable=no,status=no,scrollbars=yes,top=0,left=30,width='+width+',height='+height+'');
    map.focus();
}
function felni_szimulator( url, width, height){
    map = window.open(url,'felni_szimulator','toolbar=no,location=no,directories=no,menubar=no,resizable=no,status=no,scrollbars=yes,top=0,left=30,width='+width+',height='+height+'');
    map.focus();
}
function gumi_parkolo (gumi_id){
 gumi_idk = getCookie("gumi");
 next_id =  gumi_idk + "," + gumi_id;
 setCookie("gumi",next_id); 
}

//gumi_parkolo_dell();
function gumi_parkolo_dell(){
 setCookie("gumi",''); 
}


function getCookie(Name){
  var search = Name + "=";
  if (document.cookie.length > 0){
    offset = document.cookie.indexOf(search);
    if (offset != -1){
      offset += search.length;
      end = document.cookie.indexOf(";", offset);
      if (end == -1) end = document.cookie.length;
      return unescape(document.cookie.substring(offset, end));
    }
  }
}

function setCookie(name, value) {
  expDate = new Date();
  expDate.setTime(expDate.getTime() + (365*24*60*60*1000));
  document.cookie = name + "=" + escape(value)
  + ((expDate == null) ? "" : ("; expires=" + expDate.toGMTString()))
}


function focus1(I,to,lenght){
  var lengthCheck = document.getElementById(I).value  
  if (lengthCheck.length > lenght-1) {
   document.getElementById(to).focus();   
  }
 }

function activity(gowest){

if(confirm("Biztos törölni szeretnéd?"))
{
  document.URL=gowest; 
 }

}
function ablakUrl( url, width, height){
    map = window.open(url,'galeria','toolbar=no,location=no,directories=no,menubar=no,resizable=no,status=no,scrollbars=yes,top=10,left=10,width='+width+',height='+height+'');
    map.focus();
} 
function ablakUrl_2(url){
    map = window.open(url,'galeria','toolbar=no,location=no,directories=no,menubar=yes,resizable=no,status=no,scrollbars=yes,top=10,left=10');
    map.focus();
}
function ablakUrl_tos( url, width, height){
    map = window.open(url,'tos','toolbar=no,location=no,directories=no,menubar=no,resizable=no,status=no,scrollbars=yes,top=0,left=30,width='+width+',height='+height+'');
    map.focus();
}
function ablakUrl_akh( url, width, height){
    map = window.open(url,'akh','toolbar=no,location=no,directories=no,menubar=no,resizable=no,status=no,scrollbars=yes,top=0,left=30,width='+width+',height='+height+'');
    map.focus();
} 

function ablakUrl_lariva( url, width, height){
    map = window.open(url,'lariva','toolbar=no,location=no,directories=no,menubar=no,resizable=no,status=no,scrollbars=yes,top=0,left=30,width='+width+',height='+height+'');
    map.focus();
} 

function ablakUrl_snowfox( url, width, height){
    map = window.open(url,'snowfox','toolbar=no,location=no,directories=no,menubar=no,resizable=no,status=no,scrollbars=yes,top=0,left=30,width='+width+',height='+height+'');
    map.focus();
} 

function activ_color(id,szin){
    document.getElementById(id).bgColor= szin ;
}

function in_activ_color(id,szin){
    document.getElementById(id).bgColor= szin;
}

function getRandomNum(lbound, ubound) {
    return (Math.floor(Math.random() * (ubound - lbound)) + lbound);
}

function getPassword(length) {
    var rc = "";
    if (length > 0)
        for (var idx = 0; idx < length; ++idx) {
            charSet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
            rc = rc +charSet.charAt(getRandomNum(0, charSet.length));
        }
    return rc;
}

function add_feladat(id){
    document.getElementById(id).style.visibility="visible";
    none_feladat();
}


function div_inline(id){
    document.getElementById(id).style.display="inline";
}

function div_none(id){
    document.getElementById(id).style.display="none";
}

var elozo;
function div_inline_too(id,id1){
    if(id != elozo){
      if(elozo != undefined){
      document.getElementById(elozo).style.display="none";    
      }
	  elozo = id;	
	}
    document.getElementById(id).style.display="inline";
    document.getElementById(id1).style.display="inline";
}
function div_none_too(id){
    document.getElementById(id).style.display="none";
    document.getElementById(id1).style.display="none";    
}
function t_gumi_submit(){
  	document.t_gumi_keres.submit();
}
function t_felni_submit(){
  	document.t_felni_keres.submit();
}

function r_k_submit(){
  	document.r_k_s.submit();
}
function view_div (id1,id2){

 if(document.getElementById(id1).checked == true){
	div_inline(id2);
 }else{
	div_none(id2); 
 }

}

 function div_visit (id){
  if (id == 1){
   div_inline("osszeg_id");
  }else{
   div_none("osszeg_id");
  }
 }
 
function Calculator()
{

a1 = document.MeretCalc.W1.value;
a2 = document.MeretCalc.W2.value;
 
b1 = document.MeretCalc.R1.value;
b2 = document.MeretCalc.R2.value;

c1 = document.MeretCalc.H1.value;
c2 = document.MeretCalc.H2.value;

 
 
var Rezultat1, Rezultat2, ostatyk, Razlika, Razlika2, znak, Procent, S1, Cl1, Vs1, S2, Cl2, Vs2;
 S1=a1; 
 S2=a2;  
 Cl1=b1;  
 Cl2=b2;  
 Vs1=c1;  
 Vs2=c2;
 

 
  
 Rezultat1=Cl1*25.4+2*(Vs1*(S1/100));
 Rezultat2=Cl2*25.4+2*(Vs2*(S2/100));
 
 
 
 var dopusk = (Rezultat1*3)/100;

	ostatyk = (Rezultat2-Rezultat1);

	if (Math.abs(ostatyk) > dopusk) {
		document.MeretCalc.textfield1.style.borderColor = "#CD0131";
	    document.MeretCalc.textfield1.style.backgroundColor = "#FFB9B9";
	} else {
		document.MeretCalc.textfield1.style.borderColor = "#006600";
	    document.MeretCalc.textfield1.style.backgroundColor = "#BADCAB";
	}
	
	if(Rezultat1==null&&Rezultat2==null) {
		Razlika=0+"mm";
		Razlika2=0+"km";
	}
	else {
		if (ostatyk>0) {
			znak="+";
			}
		else  {
			znak="";
			}
		Razlika=ostatyk;	
		Procent = (ostatyk*100)/Rezultat1;
		Razlika2=(100-Procent);
		}

document.MeretCalc.textfield1.value=znak + String(Math.round(Razlika));
document.MeretCalc.textfield2.value=Math.round(Razlika2);
document.MeretCalc.textfield3.value=Math.round(Rezultat1);
document.MeretCalc.textfield4.value=Math.round(Rezultat2);

}
 
