// Biblioteka DHTML   
// Copyright by internet ART  1999 - 2003
// All rights reserved
// WEB interface  - Javascript Library 

var _doc_body = document.documentElement ? document.documentElement : document.body ? document.body : null;
var _user_agent = navigator.userAgent.toLowerCase();

var _browser_opera = !!(window.opera && document.getElementById);
var _browser_opera6 = _browser_opera && !document.defaultView;
var _browser_ie = document.all ? true : false; //user_agent.indexOf("msie") != -1 && document.all && !_browser_opera;
var _browser_n4 = (document.layers && typeof document.classes != "undefined");
var _browser_n6 = (document.getElementById && !document.all) ? true : false;;
var _browser_w3c = !_browser_ie && !_browser_n6 && !_browser_opera && document.getElementById;

var id_menu = 0;
var ruch_on = 1;
document.onmousemove=ruch;
newscroll_dir = 1;

// pokazywanie warstwy

function pokaz(warstwa) 
{
	if(_browser_n4) 
	{
		document.layers[warstwa].visibility = "show";
	}
	else if(_browser_ie) 
	{
		document.all[warstwa].style.visibility = "visible";
	}
	else if(_browser_n6)
	{
	    document.getElementById(warstwa).style.visibility = "visible";
	}
} 

function ukryj(warstwa) 
{
	if(_browser_n4) 
	{	
		document.layers[warstwa].visibility = "hide";
	}
	else if(_browser_ie) 
	{
		document.all[warstwa].style.visibility = "hidden";
	}
	else if(_browser_n6)
	{
		document.getElementById(warstwa).style.visibility="hidden";
	}	
}

function przenies(warstwa,x,y) 
{
	if(_browser_n4)
	{
		document.layers[warstwa].left = x;
		document.layers[warstwa].top = y;
	}
	else if(_browser_ie)
	{
		document.all[warstwa].style.left = x;
		document.all[warstwa].style.top = y;
	}
	else if(_browser_n6)
	{	
	    document.getElementById(warstwa).style.left = x+'px';
	    document.getElementById(warstwa).style.top = y+'px';
	}
}

function pisz(warstwa,tresc)
{
	if(_browser_n4)
	{
		document.layers[warstwa].document.open();
		document.layers[warstwa].document.write(tresc);
		document.layers[warstwa].document.close();
	}
	else if(_browser_n6)
	{
		document.getElementById(warstwa).innerHTML=tresc;
	}
	else if(_browser_ie)
	{
		document.all(warstwa).innerHTML=tresc;
	}
} 

function tooltip(id,tresc)
{
	if(id!=id_menu)
	{
		ruch_on = 1;
		id_menu = id;
	}
	if(tresc)
	{
		tresc = '<table id="wi_t" bgcolor="#00488A" cellspacing="0" cellpadding="1" width="300"><tr><td><table bgcolor="#ffffe8" border=0 cellpadding="0" cellspacing="3" width="100%"><tr><td onmouseout=\"hide2_tooltip()\">'+ tresc +'</td></tr></TABLE></td></tr></table>';
//		tresc = '<table id="wi_t" bgcolor="#000000" cellspacing="0" cellpadding="1"><tr><td><table bgcolor="#ffffe8" border=0 cellpadding="0" cellspacing="2"><tr><td>'+ tresc +'</td></tr></TABLE></td></tr></table>';
		pisz("wi",tresc);
		pokaz("wi");
	}	
}

function hide_tooltip()
{
	//if(!on_tooltip())
	{
		hide2_tooltip();
	}
}

function hide2_tooltip()
{
	ukryj("wi");
	pisz("wi", "");
	przenies("wi", -10000, -10000);
}

function on_tooltip()
{
	if(event.x + szerokosc("wi_t") + 30 > szerokosc_body() && event.y + wysokosc("wi_t") + 30 > wysokosc_body())
		return true;
	else
		return false;
}

// -1 down, 1 up, 0 stop
function set_newscroll_dir(dir)
{
	newscroll_dir = dir;
}

function wysokosc(warstwa)
{
	if(_browser_n4)
	{
		return document.layers[warstwa].clip.height;
	}
	else if(_browser_n6)
	{
		return document.getElementById(warstwa).offsetHeight;
//		return document.getElementById(warstwa).style.height;
	}
	else if(_browser_ie)
	{
		return document.all[warstwa].offsetHeight ;
	}
}

function wysokosc_body()
{
	if(_browser_n4)
	{
		return _doc_body.height;
	}
	else if(_browser_n6)
	{
		return _doc_body.offsetHeight;
	}
	else if(_browser_ie)
	{
		return document.body.offsetHeight;
	}
}

function szerokosc(warstwa)
{
	if(_browser_n4)
	{
		return document.layers[warstwa].clip.width;
	}
	else if(_browser_n6)
	{
		return document.getElementById(warstwa).offsetWidth;
//		return document.getElementById(warstwa).style.width;
	}
	else if(_browser_ie)
	{
		return document.all[warstwa].offsetWidth ;
	}
}

function szerokosc_body()
{
	if(_browser_n4)
	{
		return _doc_body.width;
	}
	else if(_browser_n6)
	{
		return _doc_body.offsetWidth;
	}
	else if(_browser_ie)
	{
		return document.body.offsetWidth - 20;
	}
}

function szerokosc_set(warstwa, wartosc)
{
	if(_browser_n4)
	{
		document.layers[warstwa].clip.width = wartosc;
	}
	else if(_browser_n6)
	{
//		document.getElementById(warstwa).offsetWidth = wartosc;
		document.getElementById(warstwa).style.width = wartosc;
	}
	else if(_browser_ie)
	{
		document.all[warstwa].style.width = wartosc;
	}
}

function is_layer(warstwa, wartosc)
{
	if(_browser_n4)
	{
		return document.layers[warstwa];
	}
	else if(_browser_n6)
	{
		return document.getElementById(warstwa);
	}
	else if(_browser_ie)
	{
		return document.all[warstwa];
	}
}

function ruch(e)
{
	if(ruch_on)
	{
		ruch2(e);
	}
}

function ruch2(e)
{
	if(is_layer("wi") && is_layer("wi_t"))
	{
		var x, y, x0, y0;
		if(!e)
		{
			e = window.event;
		}
		if(!e)
		{
			return;
		}
		if(typeof(e.pageX) == 'number')
		{
			x = e.pageX;
			y = e.pageY;
			x0 = e.pageX;
			y0 = e.pageY;
		}
		else if(typeof(e.clientX) == 'number')
		{
			x = e.clientX;
			y = e.clientY;
			x0 = e.clientX;
			y0 = e.clientY;
			if(document.body && (document.body.scrollLeft || document.body.scrollTop))
			{
				x += document.body.scrollLeft;
				y += document.body.scrollTop;
			}
			else if(document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop))
			{
				x += document.documentElement.scrollLeft;
				y += document.documentElement.scrollTop;
			}
		}
		else
		{
			return;
		}
		
		
		if(x0 + szerokosc("wi_t") + 30 > szerokosc_body())
		{
			if(x - (x0 + szerokosc("wi_t") + 30 - szerokosc_body()) > 0)
				x = x - (x0 + szerokosc("wi_t") + 30 - szerokosc_body())
			else
				x = 0;
		}
		else
			x = x + 10;
	
		/*	
		if(y0 + wysokosc("wi_t") + 30 > wysokosc_body())
		{
			if(y - (y0 + wysokosc("wi_t") + 30 - wysokosc_body()) > 0)
				y = y - (y0 + wysokosc("wi_t") + 30 - wysokosc_body());
			else
				y = 0;
		}
		else
			y = y + 10;
		*/
		
		x = x + 2;
		y = y + 2;
		
		przenies("wi", x, y);
	}
}

var ytotal = 5;
var wysokoscn = 200;

function start()
{
	wysokoscn = wysokosc('newscroll');
	ruch();
}


function polec(lang)
{
	link = "../polec_strone/polec.php?lang_id=" + lang + "&url="+document.location.href;
	window.open(link,"polec","width=350,height=350,scrollbars=1,");
}


var stale="width=530,height=500,toolbar=0,lacation=0,directories=0,status=0,manubar=0,scrollbars=1,resizable=0";

function drukuj()
{
//	if(document.all)
//	{
		tresc=document.body.innerHTML;
		tresc2=tresc.split("<!-- tresc start -->");
		tresc3=tresc2[1].split("<!-- tresc stop -->");
		tresc=tresc3[0];
		reklama=tresc.split("<!-- reklama -->");
		if (reklama.length>1)//jest w srodku reklama to bedzie ja wycinac
		{
		   tresc=reklama[0]+reklama[2];
    }
		wyr_reg=/<a[^>]+>/ig;
		tresc=tresc.replace(wyr_reg,"");
		wyr_reg_2=/<\/a>/ig;
		tresc=tresc.replace(wyr_reg_2,"");
		wyr_reg_3=/edytuj wszystko/ig;
		tresc=tresc.replace(wyr_reg_3,"");
		wyr_reg_4=/usu? wszystko/ig;
		tresc=tresc.replace(wyr_reg_4,"");
//	 }

//	if(document.all)
//	{
		wydruk=window.open("","wydruk",stale);
		wydruk.document.open();
		wydruk.document.clear();
		wydruk.document.write("<html>\n<head>\n<title>"+document.title+ " wydruk :: </title>\n<META HTTP-EQUIV=\"Content-type\" CONTENT=\"text/html; charset=iso-8859-2\">\n<LINK REL=\"stylesheet\" HREF=\"../_css/style_wysiwyg.css\" TYPE=\"text/css\">\n<style></style></head>\n<body bgcolor=\"white\"  onLoad=\"print()\"><table width=\"100%\"><tr><td align=\"left\"><table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\"><tr><td><IMG SRC=\"../_img/_templates/logo.jpg\" WIDTH=\"238\" HEIGHT=\"85\" BORDER=\"0\"></td><td align=\"center\"><B> Comperia.pl </B></td></tr></table></TD></TR><tr><td bgcolor=\"#029ED9\">&nbsp;</TD></TR><tr><td class=\"tresc\">"+document.title+"<BR><BR></TD></TR></table>\n<table width=\"100%\" align=\"left\"><tr><td><span class=\"tresc\">"+tresc+"</td></tr><tr><td class=\"tresc\"><hr noshade><small>Wydruk ze strony: <BR>"+document.location.href+"</small><BR><BR><center><a href=\"javascript:window.close()\" class=\"tresc\">[ zamknij ]</a></center>\n</span></td></tr></table></body></html>");
		wydruk.document.close();
		wydruk.focus();
//	}
//	else
//	{
//		 print();
//	}
}

function drukuj_en()
{
	if(document.all)
	{
		tresc=document.body.innerHTML;
		tresc2=tresc.split("<!-- tresc start -->");
		tresc3=tresc2[1].split("<!-- tresc stop -->");
		tresc=tresc3[0];
		wyr_reg=/<a[^>]+>/ig;
		tresc=tresc.replace(wyr_reg,"");
		wyr_reg_2=/<\/a>/ig;
		tresc=tresc.replace(wyr_reg_2,"");
		wyr_reg_3=/edytuj wszystko/ig;
		tresc=tresc.replace(wyr_reg_3,"");
		wyr_reg_4=/usu? wszystko/ig;
		tresc=tresc.replace(wyr_reg_4,"");
	 }

	if(document.all)
	{
		wydruk=window.open("","wydruk",stale);
		wydruk.document.open();
		wydruk.document.clear();
		wydruk.document.write("<html>\n<head>\n<title>"+document.title+ " print version :: </title>\n<META HTTP-EQUIV=\"Content-type\" CONTENT=\"text/html; charset=iso-8859-2\">\n<LINK REL=\"stylesheet\" HREF=\"../_css/style.css\" TYPE=\"text/css\">\n</head>\n<body bgcolor=\"white\"  onLoad=\"print()\"><table width=\"100%\"><tr><td align=\"left\"><table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\"><tr><td><IMG SRC=\"../_img/_templates/logo_druk.gif\" WIDTH=\"50\" HEIGHT=\"42\" BORDER=\"0\"></td><td align=\"center\"><B> Polish Information and Foreign Investment Agency </B></td></tr></table></TD></TR><tr><td bgcolor=\"#FB0B0B\">&nbsp;</TD></TR><tr><td class=\"tresc\">"+document.title+"<BR><BR></TD></TR></table>\n<table width=\"100%\" align=\"left\"><tr><td><span class=\"tresc\">"+tresc+"</td></tr><tr><td class=\"tresc\"><hr noshade><small>printed from site: <BR>"+document.location.href+"</small><BR><BR><center><a href=\"javascript:window.close()\" class=\"tresc\">[ close ]</a></center>\n</span></td></tr></table></body></html>");
		wydruk.document.close();
		wydruk.focus();
	}
	else
	{
		 print();
	}
}


// funkcje do zamykania warstw

function wezwarstwe(id)
{
        var x = false;
        if(document.getElementById)
		{              // w3
            x = document.getElementById(id);
		}
        else if(document.all)                    //Opera + IE
		{
            x = document.all[id];
		}
        else if(document.layers)                 // IE
		{
           x = document.layers[id];
		}
        return x;
}

function rozwijanie(id)
{
        x = wezwarstwe(id);
        if(!x)
        { 
            return false;
		}
        if(x.style.display == 'none')
        {
            x.style.display = '';
		}
        else
        {
            x.style.display = 'none';
		}
}

function zwijanie(id)
{
        x = wezwarstwe(id);
        if(!x)
        { 
            return false;
		}

        x.style.display = 'none';
}

function rozwijanie2(id)
{
        x = wezwarstwe(id);
        if(!x)
        { 
            return false;
		}

        x.style.display = '';

}

function rozwinwszystko() 
{
	tag='DIV';
	element=document.getElementsByTagName(tag);
     
    for (i=0;i<element.length;i++)
    {
		if(element[i].className=="iA")
    	{
	 		element[i].style.display =   "" ;
     		//element[i].style.display =  "none";
   		}
    }
}

function zwinwszystko() 
{
	tag='DIV';
	element=document.getElementsByTagName(tag);
     
    for (i=0;i<element.length;i++)
    {
		if(element[i].className=="iA")
    	{
	 		//element[i].style.display =   "" ;
     		element[i].style.display =  "none";
   		}
    }
}
		
function sprawdz_test(id_oferty,max,ten)
{
	ilosc_pol = document.form_oferty.elements.length;
			
	szukany_str = "porownaj_";
	zaznaczone = 0;
	for(i=0;i<ilosc_pol;i++)
	{
		nazwa_pola = document.form_oferty.elements[i].name;
		if(nazwa_pola.search(szukany_str)!=-1)
		{
			if(document.form_oferty.elements[i].checked)
			{
				zaznaczone++;
			}
		}
	}
	if(zaznaczone == max)
	{
		document.form_oferty.submit();
	}
	else if(zaznaczone > max)
	{
		alert("Mo?na zaznaczy? tylko " + max + " oferty!");	
		ten.checked = false;
	}
}
			
function odznacz_all()
{	
				
	ilosc_pol = document.form_oferty.elements.length;
	szukany_str = "porownaj_";

	for(i=0;i<ilosc_pol;i++)
	{
		nazwa_pola = document.form_oferty.elements[i].name;
		if(nazwa_pola.search(szukany_str)!=-1)
		{
			document.form_oferty.elements[i].checked = false;							
		}
	}
}	
		
function plusminuschange(id,act){
/*w formularzu wyszukiwania w kontach bankowych do obslugi plusikow i minusikow*/     
            var field=document.getElementById(id);           
            var num=parseInt(field.value);
            if (isNaN(num)) {num=0;}
            num=num+act;
            if (num<0){num=0;}
            field.value=num;
}
/*walidacje formularzy i ich obsluga w porownywarce*/
function change_form_KH(){
/*funckja odpowiednio dostosowuje pola formularza w zaleznosci od wybranego typu
*/
  nr=document.f1.typ_.value;
  if ((nr==0)||(nr==3))//wybierz.. lub pozyczka
  {
    document.getElementById("rynek_item").style.display="none";
    document.getElementById("rynek_item_sep").style.display="none";
    document.getElementById("przedmiot_item").style.display="";
    document.getElementById("przedmiot_item_sep").style.display="";
    document.getElementById("przedmiot_pytaj").style.paddingTop="4px";
    document.getElementById("przedmiot_select").style.paddingTop="2px";
    document.getElementById("przedmiot_text").style.paddingTop="0px";
    document.getElementById("przedmiot_text").style.lineHeight="13px";
    document.getElementById("przedmiot_text").innerHTML="przedmiot zabezpieczenia";
    document.getElementById("kkk_item").style.display="none";
    document.getElementById("kkk_item_sep").style.display="none";
  }
  else if ((nr==1)||(nr==2))//zakup lub refinansowanie
  {
  if (nr==1){
    document.getElementById("rynek_item").style.display="";
    document.getElementById("rynek_item_sep").style.display="";
    document.f1.rynek_.value=2;
    }
    else{
      document.getElementById("rynek_item").style.display="none";
    document.getElementById("rynek_item_sep").style.display="none";
        document.getElementById("przedmiot_item").style.display="none";
    document.getElementById("przedmiot_item_sep").style.display="none";
    }
    document.getElementById("przedmiot_item").style.display="";
    document.getElementById("przedmiot_item_sep").style.display="";
    document.getElementById("przedmiot_pytaj").style.paddingTop="2px";
    document.getElementById("przedmiot_select").style.paddingTop="0px";
    document.getElementById("przedmiot_text").style.lineHeight="normal";
    document.getElementById("przedmiot_text").style.paddingTop="3px";
    document.getElementById("przedmiot_text").innerHTML="przedmiot zakupu";
    document.getElementById("kkk_item").style.display="none";
    document.getElementById("kkk_item_sep").style.display="none";
  }
  else if(nr==4){//budowa domu
    document.getElementById("rynek_item").style.display="none";
    document.getElementById("rynek_item_sep").style.display="none";
    document.getElementById("przedmiot_item").style.display="none";
    document.getElementById("przedmiot_item_sep").style.display="none";
    document.getElementById("kkk_item").style.display="none";
    document.getElementById("kkk_item_sep").style.display="none";
  }
  else if (nr==5)//konsolidacja
  {
    document.getElementById("rynek_item").style.display="";
    document.getElementById("rynek_item_sep").style.display="";
    document.f1.rynek_.value=2;
    document.getElementById("przedmiot_item").style.display="";
    document.getElementById("przedmiot_item_sep").style.display="";
    document.getElementById("przedmiot_pytaj").style.paddingTop="2px";
    document.getElementById("przedmiot_select").style.paddingTop="0px";
    document.getElementById("przedmiot_text").style.lineHeight="normal";
    document.getElementById("przedmiot_text").style.paddingTop="3px";
    document.getElementById("przedmiot_text").innerHTML="przedmiot zakupu";
    document.getElementById("kkk_item").style.display="";
    document.getElementById("kkk_item_sep").style.display="";
  }
}

function check_form_KH(){
/*walidacja czy formularz jest poprawnie wypelniony*/

//wybranie produktu
  if (document.f1.typ_.value==0)//nie wybrano 
  {
    alert("Proszę wybrać cel kredytu");
    return false;
  }

  //wybranie rynku ewentualnie przedmiotu
  if ((document.f1.typ_.value==1)||(document.f1.typ_.value==2)||(document.f1.typ_.value==5))//wybrano zakup lub refinansowanie lub konsolidacje - widoczny jest rynek
  {
  
      if (document.f1.rynek_.value==0){//nie wybrano rynku
        alert("Proszę wybrać rynek");return false;
      }
      if ((document.f1.rynek_.value!=1)&&(document.f1.przedmiot_.value==0)){//wybrano rynek inny niz pierwotny i nie wybrano przedmiotu
        alert("Proszę wybrać przedmiot zakupu");return false;
      }
      
  }

  else if (document.f1.typ_.value==3)//pozyczka
  {
        if (document.f1.przedmiot_.value==0){//nie wybrano przedmiotu
        alert("Proszę wybrać przedmiot zabezpieczenia");return false;
      }
  }
  
  var strmatch="^[1-9][0-9]*$";
  //wpisanie wartosci nieruchomosci
  if (!document.f1.wartosc_.value.match(strmatch)){
    alert("Niepoprawny format wartosci nieruchomosci");return false;
  }
  //wpisanie kwoty kredytu
  if (!document.f1.kwota_kredytu_.value.match(strmatch)){
    alert("Niepoprawny format kwoty kredytu");return false;
  }
 if (document.f1.typ_.value==5){//konsolidacja
  if ((document.f1.kwota_kredytu_.value!="")&&(!document.f1.kwota_kredytu_.value.match(strmatch))){
  alert("Niepoprawny format sumy kredytów konsumpcyjnych");return false;
  }
  }
   //wybranie waluty 
  if (document.f1.waluta_.value==0){//nie wybrano waluty
        alert("Proszę wybrać walutę");return false;
  }
  //wybranie rodzaju rat
  if (document.f1.raty_.value==0){//nie wybrano raty
        alert("Proszę wybrać rodzaj raty");return false;
  }
  //wpisanie okresu kredytu
    if (!document.f1.okres_kredytu_.value.match(strmatch)){
    alert("Niepoprawny format okresu kredytu");return false;
  }
  //wpisanie wieku najstarszego kredytobiorcy
  if (!document.f1.wiek_.value.match(strmatch)){
    alert("Niepoprawny format wieku najstarszego kredytobiorcy");return false;
  }
  //wpisano cos w wartosc rata od
 if ((document.f1.rataod_.value!="")&&(!document.f1.rataod_.value.match(strmatch))){
    alert("Niepoprawny format raty miesięcznej od");return false;
  }
    //wpisano cos w wartosc rata do
  if ((document.f1.ratado_.value!="")&&(!document.f1.ratado_.value.match(strmatch))){
    alert("Niepoprawny format raty miesięcznej do");return false;
  }

  document.f1.submit();//walidacja poprawna 
}


function check_form_KG(){

  var strmatch="^[1-9][0-9]*$";

  //wpisanie kwoty kredytu
  if (!document.f1.kwota_kredytu_.value.match(strmatch)){
    alert("Niepoprawny format kwoty kredytu");return false;
  }
  //wybranie rodzaju rat
  if (document.f1.raty_.value==0){//nie wybrano raty
        alert("Proszę wybrać rodzaj raty");return false;
  }  
  //wybranie waluty 
  if (document.f1.waluta_.value==0){//nie wybrano waluty
        alert("Proszę wybrać walutę");return false;
  }

  //wpisanie okresu kredytowania
    if (!document.f1.okres_kredytu_.value.match(strmatch)){
    alert("Niepoprawny format okresu kredytu");return false;
  }
      //wpisano cos w wartosc rata od
  if ((document.f1.rataod_.value!="")&&(!document.f1.rataod_.value.match(strmatch))){
    alert("Niepoprawny format raty miesięcznej od");return false;
  }
    //wpisano cos w wartosc rata do
  if ((document.f1.ratado_.value!="")&&(!document.f1.ratado_.value.match(strmatch))){
    alert("Niepoprawny format raty miesięcznej do");return false;
  }
  document.f1.submit();//walidacja poprawna 
}


function check_form_KS(){
/*walidacja czy formularz jest poprawnie wypelniony*/

//wybranie celu kredytu
  if (document.f1.cel_.value==0)//nie wybrano 
  {
    alert("Proszę wybrać cel kredytu");
    return false;
  }
  
 var strmatch="^[1-9][0-9]*$";
  //wybranie roku produkcji o ile nie wybrano ze nowy
  if (document.f1.cel_.value==1){
  var d = new Date();
  var curr_year = d.getFullYear();
  document.f1.rok_produkcji_.value=curr_year;
  }

  if ((document.f1.cel_.value!=1)&&(!document.f1.rok_produkcji_.value.match(strmatch)))
  {
       alert("Niepoprawny format roku produkcji");return false;
   
  }

//cena samochodu
  if (!document.f1.cena_samochodu_.value.match(strmatch)){
    alert("Niepoprawny format ceny samochodu");return false;
  }
  //wpisanie kwoty kredytu
  if (!document.f1.kwota_kredytu_.value.match(strmatch)){
    alert("Niepoprawny format kwoty kredytu");return false;
  }

  //wybranie waluty 
  if (document.f1.waluta_.value==0){//nie wybrano waluty
        alert("Proszę wybrać walutę");return false;
  }
  //wybranie rodzaju rat
  if (document.f1.raty_.value==0){//nie wybrano raty
        alert("Proszę wybrać rodzaj raty");return false;
  }
  //wpisanie okresu kredytu
    if (!document.f1.okres_kredytu_.value.match(strmatch)){
    alert("Niepoprawny format okresu kredytu");return false;
  }
    //wpisano cos w wartosc rata od
  if ((document.f1.rataod_.value!="")&&(!document.f1.rataod_.value.match(strmatch))){
    alert("Niepoprawny format raty miesięcznej od");return false;
  }
    //wpisano cos w wartosc rata do
  if ((document.f1.ratado_.value!="")&&(!document.f1.ratado_.value.match(strmatch))){
    alert("Niepoprawny format raty miesięcznej do");return false;
  }


  document.f1.submit();//walidacja poprawna 
}

function check_form_LB(){
/*walidacja czy formularz jest poprawnie wypelniony*/

  var strmatch="^[1-9][0-9]*$";
  //wpisanie kwoty lokaty
  if (!document.f1.kwota_.value.match(strmatch)){
    alert("Niepoprawny format wysokości lokaty");return false;
  }
  //wybranie oprocenrowanie
 /* if (document.f1.typ_.value==0)//nie wybrano 
  {
    alert("Proszę wybrać rodzaj oprocentowania");
    return false;
  }
  */
//waluta
  if (document.f1.waluta_.value==0){//nie wybrano waluty
        alert("Proszę wybrać walutę");return false;
  }
  //okres lokaty
  if (document.f1.okres_.value==0){//nie wybrano waluty
        alert("Proszę wybrać okres trwania lokaty");return false;
  }


  document.f1.submit();//walidacja poprawna 
}

function check_form_LBS(){
/*walidacja czy formularz jest poprawnie wypelniony*/

  var strmatch="^[1-9][0-9]*$";
  //wpisanie kwoty lokaty
  if (!document.f1.kwota_.value.match(strmatch)){
    alert("Niepoprawny format wysokości lokaty");return false;
  }
  
//waluta
  if (document.f1.waluta_.value==0){//nie wybrano waluty
        alert("Proszę wybrać walutę");return false;
  }
  
  //okres lokaty
 /* if (document.f1.okres_.value==0){//nie wybrano waluty
        alert("Proszę wybrać okres trwania lokaty");return false;
  }
*/

  document.f1.submit();//walidacja poprawna 
}


function check_form_KK(){
/*walidacja czy formularz jest poprawnie wypelniony*/
  var strmatch="^[1-9][0-9]*$";
  //limit karty
  if (!document.f1.wysokosc_limitu_.value.match(strmatch)){
    alert("Niepoprawny format wysokości limitu karty");return false;
  }
  document.f1.submit();//walidacja poprawna 
}
function check_form_FI(){
/*walidacja czy formularz jest poprawnie wypelniony*/
  var strmatch="^[1-9][0-9]*$";
  //limit karty
 if (document.f1.kwota_.value==""){
    alert("Pole kwota do zainwestowania jest obowiązkowe");return false;
  }
  if (!document.f1.kwota_.value.match(strmatch)){
    alert("Niepoprawny format kwoty do zainwestowania");return false;
  }
  if (document.f1.stopa_zwrotu_.value==0){
    alert("Wybierz stopę zwrotu");return false;
  }
  if ((!document.f1.waluta_PLN_.checked)&&(!document.f1.waluta_EUR_.checked)&&(!document.f1.waluta_USD_.checked)){
    alert("Przynajmniej jedna waluta wyceny musi być zaznaczona");return false;
  }
  document.f1.submit();//walidacja poprawna 
}
function check_form_KO(){

/*walidacja czy formularz jest poprawnie wypelniony*/

  var strmatch="^[1-9][0-9]*$";
  var strmatch2="^[0-9][0-9]*$";
  //wpisanie kwoty lokaty
  if (!document.f1.saldo_.value.match(strmatch)){
    alert("Niepoprawny format średniego salda rachunku");return false;
  }
  if((document.f1.ilosc_p_w_o_.value!=="")&&(!document.f1.ilosc_p_w_o_.value.match(strmatch2))){
  alert("Niepoprawny format ilości wykonywanych transakcji wewnętrznych w oddziale");return false;
  }
  if((document.f1.ilosc_p_w_i_.value!=="")&&(!document.f1.ilosc_p_w_i_.value.match(strmatch2))){
  alert("Niepoprawny format ilości wykonywanych transakcji wewnętrznych internetowych");return false;
  }
  if((document.f1.ilosc_p_w_t_.value!=="")&&(!document.f1.ilosc_p_w_t_.value.match(strmatch2))){
  alert("Niepoprawny format ilości wykonywanych transakcji wewnętrznych telefonicznych");return false;
  }
  if((document.f1.ilosc_p_z_o_.value!=="")&&(!document.f1.ilosc_p_z_o_.value.match(strmatch2))){
  alert("Niepoprawny format ilości wykonywanych transakcji zewnętrznych w oddziale");return false;
  }
  if((document.f1.ilosc_p_z_i_.value!=="")&&(!document.f1.ilosc_p_z_i_.value.match(strmatch2))){
  alert("Niepoprawny format ilości wykonywanych transakcji zewnętrznych internetowych");return false;
  }
  if((document.f1.ilosc_p_z_t_.value!=="")&&(!document.f1.ilosc_p_z_t_.value.match(strmatch2))){
  alert("Niepoprawny format ilości wykonywanych transakcji zewnętrznych telefonicznych");return false;
  }
  if((document.f1.stale_zlecenia_z_.value!=="")&&(!document.f1.stale_zlecenia_z_.value.match(strmatch2))){
  alert("Niepoprawny format ilości stałych zleceń zewnętrznych");return false;
  }
  if((document.f1.stale_zlecenia_w_.value!=="")&&(!document.f1.stale_zlecenia_z_.value.match(strmatch2))){
  alert("Niepoprawny format ilości stałych zleceń wewnętrznych");return false;
  }
  if ((document.f1.liczba_kart_platniczych_.value!=="")&&(!document.f1.liczba_kart_platniczych_.value.match(strmatch2))){
  alert("Niepoprawny format liczby kart płatniczych");return false;
  }
  if((document.f1.ilosc_wyplat_bankomatow_w_.value!=="")&&(!document.f1.ilosc_wyplat_bankomatow_w_.value.match(strmatch2))){
  alert("Niepoprawny format ilości wypłat z bankomatu własnych Banku");return false;
  }
  if((document.f1.ilosc_wyplat_bankomatow_w_.value!=="")&&(!document.f1.ilosc_wyplat_bankomatow_w_.value.match(strmatch2))){
  alert("Niepoprawny format ilości wypłat z bankomatu innych Bankomatów");return false;
  }
  if((document.f1.ilosc_wyplat_bankomatow_s_.value!=="")&&(!document.f1.ilosc_wyplat_bankomatow_s_.match(strmatch2))){
  alert("Niepoprawny format ilości wypłat z bankomatów za granicą");return false;
  }

  document.f1.submit();//walidacja poprawna 

}


function check_form_KOSZ(){
/*walidacja czy formularz jest poprawnie wypelniony*/

  var strmatch="^[1-9][0-9]*$";
  var strmatch2="^[0-9][0-9]*$";
  //wpisanie kwoty lokaty
  if (!document.f1.saldo_.value.match(strmatch)){
    alert("Niepoprawny format średniego salda rachunku");return false;
  }
  if (!document.f1.okres_.value.match(strmatch)){
    alert("Niepoprawny format okresu oszczędzania");return false;
  }
  if((document.f1.ilosc_p_w_o_.value!=="")&&(!document.f1.ilosc_p_w_o_.value.match(strmatch2))){
  alert("Niepoprawny format ilości wykonywanych transakcji wewnętrznych w oddziale");return false;
  }
  if((document.f1.ilosc_p_w_i_.value!=="")&&(!document.f1.ilosc_p_w_i_.value.match(strmatch2))){
  alert("Niepoprawny format ilości wykonywanych transakcji wewnętrznych internetowych");return false;
  }
  if((document.f1.ilosc_p_w_t_.value!=="")&&(!document.f1.ilosc_p_w_t_.value.match(strmatch2))){
  alert("Niepoprawny format ilości wykonywanych transakcji wewnętrznych telefonicznych");return false;
  }
  if((document.f1.ilosc_p_z_o_.value!=="")&&(!document.f1.ilosc_p_z_o_.value.match(strmatch2))){
  alert("Niepoprawny format ilości wykonywanych transakcji zewnętrznych w oddziale");return false;
  }
  if((document.f1.ilosc_p_z_i_.value!=="")&&(!document.f1.ilosc_p_z_i_.value.match(strmatch2))){
  alert("Niepoprawny format ilości wykonywanych transakcji zewnętrznych internetowych");return false;
  }
  if((document.f1.ilosc_p_z_t_.value!=="")&&(!document.f1.ilosc_p_z_t_.value.match(strmatch2))){
  alert("Niepoprawny format ilości wykonywanych transakcji zewnętrznych telefonicznych");return false;
  }
  document.f1.submit();//walidacja poprawna 
}
/*obsluga najczesciej czytanych artykulow*/
function change_naj_art(lg,limit,period,bg1,bg2,und)
/*lg - jezyk, limit - ograniczenie ile ma zwrocic wynikow, period - okres 'd'-dzien t-tydzien
bg1-kolor tla,bg2-kolor tla, und-czy pisac podkreslenie oddzielajace*/
{
  var req = mint.Request();
  req.AddParam("lg", lg);
  req.AddParam("limit", limit);      
  req.AddParam("period", period);
  req.AddParam("bg1", bg1);      
  req.AddParam("bg2", bg2);
  req.AddParam("und", und);

  req.OnSuccess = function() {
    var l=document.getElementById("art_naj_list");
    if (period==='d'){
      l.parentNode.firstChild.childNodes[0].className="art_dol";
      l.parentNode.firstChild.childNodes[2].className="art_dol_on";
   }else{
     l.parentNode.firstChild.childNodes[0].className="art_dol_on";
      l.parentNode.firstChild.childNodes[2].className="art_dol";
   }
   l.innerHTML=this.responseText;
  }
  req.Send("../_inc/change_naj_art.php");
}
//-------------------------------------------KALKULATORY--------------------------------------
/* walidacja formularzy w kalkulatorach */
//kalkulator KH - zdolnosc kredytowa
function validate_oblicz_zdolnosc(){
  var strmatch="^[0-9][0-9]*$";
  //wpisanie kwoty lokaty
  if (!document.f1.osoby_.value.match(strmatch)){
    alert("Niepoprawny format liczby osób w gospodarstwie domowym");return false;
  }
  if (!document.f1.dochod_.value.match(strmatch)){
    alert("Niepoprawny format średniomiesięcznego dochodu netto gospodarstwa domowego");return false;
  }
  if (!document.f1.raty_.value.match(strmatch)){
  alert("Niepoprawny format sumy wysokości miesięcznych rat kredytowych gospodarstwa domowego");return false;
  }
  if (!document.f1.karty_.value.match(strmatch)){
  alert("Niepoprawny format sumy wysokości limitów kart kredytowych wszystkich kredytobiorców");return false;
  }
   if (!document.f1.limity_.value.match(strmatch)){
  alert("Niepoprawny format sumy wysokości dostępnych limitów w rachunkach bieżących wszystkich kredytobiorców");return false;
  }
   if (!document.f1.inne_.value.match(strmatch)){
  alert("Niepoprawny format sumy wysokości innych miesięcznych zobowiązań kredytobiorców o charakterze stałym");return false;
  }
   if (!document.f1.okres_.value.match(strmatch)){
  alert("Niepoprawny format okresu kredytowania");return false;
  }
  document.f1.submit();//walidacja poprawna 
}
//kalkulator KH - opoznienia w splatach kredytu
function validate_oblicz_opoznienia(){
opoznieniaSelected=false;
 for (i = 0;  i < document.f1.opoznienia.length;  i++)
  {
    if (document.f1.opoznienia[i].checked)
    {
      opoznieniaSelected = true; 
      break;//wyjdz z petli for
    }
   
  }
  if (!opoznieniaSelected)
  {
    alert("Proszę odpowiedzieć na pytanie - 'Czy występowały opóźnienia w spłatach kredytu ?'");
    return (false);
  }
  document.f1.submit();//walidacja poprawna 
}
//kalkulator KH - źródło dochodu
function validate_zrodlo_dochodu(){

dochodSelected=false;
 for (i = 0;  i < document.f1.dochod.length;  i++)
  {
    if (document.f1.dochod[i].checked)
    {
      dochodSelected = true;
      break;//wyjdz z petli for
    }
    
  }
  if (!dochodSelected)
  {
    alert("Proszę wybrać źródło dochodu");
    return (false);
  }
  document.f1.submit();//walidacja poprawna 
}
//kalkulator KH - twoj cel kredytowania
function validate_cel_kredytu(){
  if (document.f1.typ_.value==0){
  alert("Proszę wybrać cel kredytu");
  return (false);
 }
  if ((document.f1.typ_.value==1)&&(document.f1.rynek_[0].checked==false)&&(document.f1.rynek_[1].checked==false)){//wybrano zakup i nie znaznaczono czy rynek wtorny czy pierwotny 
  alert("Proszę wybrać rynek zakupu");
  return (false);
 }
   if ((document.f1.typ_.value==1)&&(document.f1.rynek_[1].checked==true)&&(document.f1.przedmiot_[0].checked==false)&&(document.f1.przedmiot_[1].checked==false)){//wybrano zakup i nie znaznaczono czy zakup dzialki czy mieszkania i wybrano rynek pierwotny
  alert("Proszę wybrać przedmiot zakupu");
  return (false);
 }
    if (((document.f1.typ_.value==2)||(document.f1.typ_.value==3)||(document.f1.typ_.value==5))&&(document.f1.przedmiot_[0].checked==false)&&(document.f1.przedmiot_[1].checked==false)){//wybrano refinansowanie, pozyczke lub konsolidacje i nie wybrano przedmiotu zabezpieczenia
  alert("Proszę wybrać przedmiot zabezpieczenia");
  return (false);
 }
  document.f1.submit();//walidacja poprawna 
}
function show_map(id_p,level,lang,img_plus){
//wyswietla dla strony jej dzieci
  var children=document.getElementById("childof_"+id_p);//divka z dziecmi strony
  if (children!=null) {
    children.style.display='';
  }
  else{//nie istnieje trzeba stworzyć
    var curr_div=document.getElementById("pagetree_"+id_p);//divka ktorej dzieci chcemy znaleźć
    curr_div.innerHTML=curr_div.innerHTML+"<div id='childof_"+id_p+"'></div>";
    children=document.getElementById("childof_"+id_p);//divka z dziecmi strony
    children.style.display='none';
    var req = mint.Request();
    req.AddParam("level", level);
    req.AddParam("id", id_p); 
    req.AddParam("lang_id", lang); 
    req.OnSuccess = function() {
      document.getElementById(img_plus).src="../_img/minus_tree.gif";
      document.getElementById(img_plus).onclick=function(){hide_map(id_p,level,lang,img_plus);};
      children.innerHTML=this.responseText;
      children.style.display='';
   }
  }
  req.Send("../site_map/get_page_children.php");
}
function hide_map(id_p,level,lang,img_minus){
      var children=document.getElementById("childof_"+id_p);//divka z dziecmi strony
      children.style.display='none';
      document.getElementById(img_minus).src="../_img/plus_tree.gif";
      document.getElementById(img_minus).onclick=function(){show_map(id_p,level,lang,img_minus);};
}
function polec_newsletter(){
/*walidacja formularza w newsletterze - polec znajomemu newsletter*/
if (document.form_polec_newsletter.imie_polecajacy.value==""){
  alert('Proszę uzupełnić imię osoby polecającej');
  return false;
}
if (document.form_polec_newsletter.email_polecajacy.value==""){
  alert('Proszę uzupełnić adres email osoby polecającej');
  return false;
}
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
var address = document.form_polec_newsletter.email_polecajacy.value;
if(reg.test(address) == false) {
      alert('Niepoprawny format adresu email osoby polecającej');
      return false;
}

if (document.form_polec_newsletter.email_znajomy.value==""){
  alert('Proszę uzupełnić adres email znajomego');
  return false;
}
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
var address = document.form_polec_newsletter.email_znajomy.value;
if(reg.test(address) == false) {
      alert('Niepoprawny format adresu email znajomego');
      return false;
}

if (document.form_polec_newsletter.imie_znajomy.value==""){
  alert('Proszę uzupełnić imię znajomego');
  return false;
}
  if (document.form_polec_newsletter.otrzymywanie.checked==false){
  alert('Proszę zaznaczyć akceptację regulaminu');
  return false;
}
  var req = mint.Request();
  req.AddParam("captcha_val", document.form_polec_newsletter.kod.value);


req.OnSuccess = function() {
                  if(this.responseText=="-1"){
                  alert('Wpisz poprawny kod.');
                  return false;
                  }
                  else{
document.form_polec_newsletter.submit();               
                  }

                }

   req.Send("../_inc/check_captcha.php");


}
function showNlRegulamin(reg){
document.getElementById(reg).style.display='block';
document.getElementById(reg).style.position='absolute';
document.getElementById(reg).style.top="300px";
document.getElementById(reg).style.left="350px";
}

function check_fast_add_nl(){

if ((document.form_short_add_nl.imie.value=="")||(document.form_short_add_nl.imie.value=="Twoje imię")){
  alert('Proszę uzupełnić imię');
  return false;
}
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
var address = document.form_short_add_nl.email.value;
if(reg.test(address) == false) {
      alert('Niepoprawny format adresu email');
      return false;
}

  var req = mint.Request();
  req.AddParam("imie", document.form_short_add_nl.imie.value);
  req.AddParam("email", document.form_short_add_nl.email.value);      


  req.OnSuccess = function() {
  var box=document.getElementById("dodaj_nl_content");
   box.innerHTML=this.responseText;
  }
  req.Send("../register/short_register.php");
}

function set_reg_box(){
  var content='<div class="dodaj_nl_head1">Porady nie od parady,</div>';
  content=content+'<div class="dodaj_nl_head2">bez nich nie dasz rady!</div><div><div class="nl_box_list"><div class="nl_box_list_item">Codziennie gorące na Twoją skrzynkę!</div>';
  content=content+'<div class="nl_box_list_item">Nikt już nie nabije Cię w butelkę!</div><div class="nl_box_list_item">Przetestuj - to nic nie kosztuje!</div></div></div>';
  content=content+'<div class="nl_box_form"><form method="get" name="form_short_add_nl"><input type="text" name="imie" class="nl_box_input" value="Twoje imię" onClick="javascript:if (this.value==\'Twoje imię\'){this.value=\'\';}"/>';
  content=content+'<input type="text" name="email" class="nl_box_input" value="Wpisz adres e-mail i gotowe" onClick="javascript:if (this.value==\'Wpisz adres e-mail i gotowe\'){this.value=\'\';}"/>';
  content=content+'<input type="button" name="dodaj_do_nl" class="nl_box_button" value="zapisz" onClick="javascript:check_fast_add_nl();void null;" /></form></div>';
  var box=document.getElementById("dodaj_nl_content");
   box.innerHTML=content;
}
function validate_doradca_pomoc_box(f){

var form=document.getElementById(f);
var error="";
var was_error=false;
var tekst = /^\D*$/;
var email = /^[^@]+@([a-z0-9\-]+\.)+[a-z]{2,4}$/;
var	tel_kier=/^0[1-9][0-9]{8}$/; //numer poprzedzony zerem
var	tel=/^[1-9][0-9]{8}$/;//numer nieporzedzony zerem
var kwota=/^[1-9][0-9]*$/;//kwota kredytu
if ((form.imie_.value=="Twoje imię")||(form.imie_.value=="")){
error+="Uzupełnij swoje imię \n";
was_error=true;
}
else if (!tekst.test(form.imie_.value)){
error+="Niepoprawny format pola imię \n";
was_error=true;
}
if ((form.nazwisko_.value=="Twoje nazwisko")||(form.nazwisko_.value=="")){
error+="Uzupełnij swoje nazwisko \n";
was_error=true;
}
else if (!tekst.test(form.nazwisko_.value)){
error+="Niepoprawny format pola nazwisko \n";
was_error=true;
}
if ((form.telefon_.value=="Twój telefon")||(form.telefon_.value=="")){
error+="Uzupełnij swój telefon \n";
was_error=true;
}
else if((!tel_kier.test(form.telefon_.value))&&(!tel.test(form.telefon_.value))){
error+="Niepoprawny format pola telefon \n";
was_error=true;
}
if ((form.email_.value=="Adres e-mail")||(form.email_.value=="")){
error+="Uzupełnij swój e-mail \n";
was_error=true;
}
else if(!email.test(form.email_.value)){
error+="Niepoprawny format pola email \n";
was_error=true;
}
if ((form.kwota_.value=="Kwota kredytu")||(form.kwota_.value=="")){
error+="Uzupełnij kwotę kredytu \n";
was_error=true;
}
else if (!kwota.test(form.kwota_.value)){
error+="Niepoprawny format pola kwota kredytu \n";
was_error=true;
}
if ((form.miasto_.value=="Twoje miasto")||(form.miasto_.value=="")){
error+="Uzupełnij swoje miasto \n";
was_error=true;
}
else if (!tekst.test(form.miasto_.value)){
error+="Niepoprawny format pola miasto \n";
was_error=true;
}
if (form.wojewodztwo_.value==17){
error+="Wybierz województwo \n";
was_error=true;
}
if (!document.getElementById('akceptacja_dane_').checked){
error+="Wyrażenie zgody na przetwarzanie danych osobowych jest obowiązkowe  \n";
was_error=true;
}
if (was_error){
  alert(error);
}
if (!was_error){//wyslij formularz

  var req = mint.Request();
  req.AddParam("action", 2);
  if (document.getElementById('akceptacja_dane_').checked){ dane=1;} else {dane=0;}
  if (document.getElementById('akceptacja_newsletter_').checked){ news=1;} else {news=0;}
  req.AddParam("akceptacja_dane_", dane);
  req.AddParam("akceptacja_newsletter_", news);
  req.AddParam("imie_", form.imie_.value);
  req.AddParam("imie_", form.imie_.value);
  req.AddParam("nazwisko_", form.nazwisko_.value);      
  req.AddParam("telefon_", form.telefon_.value);
  req.AddParam("email_", form.email_.value);      
  req.AddParam("kwota_", form.kwota_.value);
  req.AddParam("miasto_", form.miasto_.value);
  req.AddParam("wojewodztwo_", form.wojewodztwo_.value);
  req.AddParam("id_bank", form.pomoc_id_bank.value);
  req.AddParam("id_oferty", form.pomoc_id_oferty.value);
  req.AddParam("id_podz", form.pomoc_id_podz.value);
  req.AddParam("id_rodzaj", form.pomoc_id_rodzaj.value);
  req.AddParam("prefix", form.pomoc_prefix.value);
  req.OnSuccess = function() {
      if (this.responseText==-2){
        alert('Formularz został nieprawidłowo wypełniony');
      }
      else if (this.responseText!=-1){
        document.getElementById('doradca_pomoc_box_div').innerHTML=this.responseText;
        document.getElementById('doradca_pomoc_box_div').style.display='block';
      }
      else {
          alert('Wystąpił nieoczekiwany błąd. Prosimy spróbować później');
      }
  }
  req.Send("../_inc/pomoc_doradca_box.php");
  }
return false;
}

function set_doradca_pomoc_inputs(clicked,clicked_text, f1,t1,f2,t2,f3,t3){
//clicked - klikniete pole (imie lub nazwisko lub telefon lub email)
//jesli jest wypelnione domyslnie to jest czyszczone
//reszta f1,f2,f3 - inne pola ktore akurat nie sa klikniete
//jesli ktore z nich jest puste jest wypelniane wartosciami domyslbnymi t1,t2,t3
//zeby uzytkownik wiedzial co tam tzreba wpisac
  if (document.getElementById(clicked).value==clicked_text){
    document.getElementById(clicked).value="";
  }
  if (document.getElementById(f1).value==""){
    document.getElementById(f1).value=t1;
  }
  if (document.getElementById(f2).value==""){
    document.getElementById(f2).value=t2;
  }
  if (document.getElementById(f3).value==""){
    document.getElementById(f3).value=t3;
  }
}
function set_doradca_pomoc_inputs_default(id, default_text){
  if (document.getElementById(id).value==""){
    document.getElementById(id).value=default_text;
  }
}
function set_doradca_pomoc_inputs_clear(id, default_text){
  if (document.getElementById(id).value==default_text){
    document.getElementById(id).value="";
  }
}
function load_doradca_pomoc_box(prefix,id_rodzaj,id_bank,id_oferty){
  var req = mint.Request();
  req.AddParam("action", 1);
  req.AddParam("id", id_rodzaj);
  req.AddParam("id_bank", id_bank);
  req.AddParam("id_oferty", id_oferty);
  req.AddParam("prefix", prefix);
  req.OnSuccess = function() {
    if (this.responseText!=-1){
      response=this.responseText.split("@#@");
      document.getElementById('doradca_pomoc_box_div').innerHTML=response[1];
      if ((response[0]!="") &&(response[0]!=0))
      {
        document.getElementById('pomoc_id_bank').value=response[0];
      }
      else 
      {
        document.getElementById('pomoc_id_bank').value=id_bank;//id banku
      }
      document.getElementById('pomoc_id_podz').value=response[2];//rodzaj podziekowania
      document.getElementById('pomoc_id_oferty').value=id_oferty;//rodzaj oferty
      document.getElementById('pomoc_id_rodzaj').value=id_rodzaj;//rodzaj boxa
      document.getElementById('pomoc_prefix').value=response[4];//prefix produktu
      document.getElementById('doradca_pomoc_reg_tresc').innerHTML=response[3];
      document.getElementById('doradca_pomoc_reg_tresc').style.clear='both';
      document.getElementById('doradca_pomoc_box_div').style.display='block';
    
    }
  }
  req.Send("../_inc/pomoc_doradca_box.php");
}

function przejdz_do(a)
{
			window.open('http://'+a,'window',' left=100, top=100, width=780, height=500, resizable=1, scrollbars=yes, status=yes, toolbar=yes, directories=yes, location=yes');
}
/*funckja obslugi opinii o kontakcie*/

function wyraz_opinie(id_kontakt, time, opinia)
/*lg - jezyk, limit - ograniczenie ile ma zwrocic wynikow, period - okres 'd'-dzien t-tydzien
bg1-kolor tla,bg2-kolor tla, und-czy pisac podkreslenie oddzielajace*/
{
  document.getElementById('kontakt_opinia_error').style.display='none';
  document.getElementById('kontakt_opinia_error2').style.display='none';
  document.getElementById('kontakt_opinia_nie').style.display='none';
  document.getElementById('kontakt_opinia_tak').style.display='none';
  var req = mint.Request();
  req.AddParam("id_kontakt", id_kontakt);
  req.AddParam("time", time);      
  req.AddParam("opinia", opinia); 
  req.AddParam("action",1); 
  req.OnSuccess = function() {
  var odp=this.responseText;
  //alert(this.responseText);
    var l=document.getElementById("art_naj_list");
    if (odp==-1){
    document.getElementById('kontakt_opinia_error').style.display='block';
    }
    else if (odp==-2){
        //wyswietl odpowiednie okno
        document.getElementById('kontakt_opinia_error2').style.display='block';
   }
    else{
        //wyswietl odpowiednie okno
        document.getElementById('kontakt_opinia_'+opinia).style.display='block';
   }
   
  }
  req.Send("../doradca/wyraz_opinie.php");
}
/* -------- FUNDUSZE INWESTYCYJNE -----------------*/
	function stopa_zwrotu_s(x)
	{
		var y=document.getElementById("stopa_zwrotu");
		
		z = eval(y.value);
		
		if(z>=10)
		{
			if(x=="p")
			{
				z = 1;	
			}
			else
			{
				z = 9;
			}
			
		}
		else if(z<=1)
		{
			if(x=="p")
			{
				z = 2;	
			}
			else
			{
				z = 10;
			}
		}
		else
		{
			if(x=="p")
			{
				z = z + 1;
			}
			else
			{
				z = z - 1;
			}
			
		}
		
		var id_stopy_zwrotu = 0;
		var dlugosc = document.sort_oferty.elements.length;
		for(var i = 0; i<dlugosc; i++)
		{
			if(document.sort_oferty.elements[i].name=="stopa_zwrotu")
			{
				id_stopy_zwrotu = i;
			}
		}
		
		//alert(z);
		document.sort_oferty.elements[1].value = '2';
		document.sort_oferty.elements[id_stopy_zwrotu].value = z;
		document.sort_oferty.submit();
	}
function pokaz_info_wskaznik()
//pokazuje informacje dotyczaca wskaznika
{

  if (document.getElementById('wskaznik_info').innerHTML==""){  

      var req = mint.Request();
      req.AddParam("p", 1);
      req.OnSuccess = function() {
          if (this.responseText!=-1){
            document.getElementById('wskaznik_info').innerHTML=this.responseText;
            document.getElementById('wskaznik_info').style.display='block';
          }
        }
      req.Send("../fundusze_inwestycyjne/wskaznik_ryzyka.php");
  }
  else{
  document.getElementById('wskaznik_info').style.display='block';
  }

}