function printPage()
{
   var options = "menubar=yes,toolbar=yes,scrollbars=yes,resizable=yes,width=630,height=460;"
   url = top.location.href;
   if (url.indexOf("#")>0) url = url.substring(0, url.indexOf("#"));
   if (url.indexOf("?")>0) url = url + "&print=yes";
   else url = url + "?print=yes";
   printWindow=window.open(url,"_blank",options);
}

function printPageEn()
{
   var options = "menubar=yes,toolbar=yes,scrollbars=yes,resizable=yes,width=630,height=460;"
   url = top.location.href;
   if (url.indexOf("#")>0) url = url.substring(0, url.indexOf("#"));
   if (url.indexOf("?")>0) url = url + "&print=yes&eng=yes";
   else url = url + "?print=yes&eng=yes";
   printWindow=window.open(url,"_blank",options);
}

function popup(url, width, height)
{
      var options = "toolbar=no,scrollbars=no,resizable=no,width="+width+",height="+height+";"
      popupWindow=window.open(url,"_blank",options);
}

function wjPopup(url, width, height)
{
      var options = "toolbar=no,scrollbars=yes,resizable=yes,width="+width+",height="+height+";"
      popupWindow=window.open(url,"_blank",options);
}

function popup2(url)
{
	var options = "toolbar=yes,scrollbars=yes,resizable=yes,location=no,directories=no,status=yes";
	popupWindow=window.open(url,"_blank",options);
}

function popupHTTPS(url)
{
	popupWindow=window.open("https://www.ing.cz"+url,"_blank");
}

var oldDivId;
oldDivId = "";
function openClose(divId)
{
   if(document.getElementById)
   {
		if (oldDivId == "") {
			document.getElementById(divId).style.display="block";
	    	oldDivId = divId;
		} else {
		  	if (oldDivId == divId) {
				document.getElementById(oldDivId).style.display="none";
				oldDivId = "";
			} else {
				document.getElementById(oldDivId).style.display="none";
				document.getElementById(divId).style.display="block";
		    	oldDivId = divId;
			}
		}
	}
	else if(document.all)
	{
		if (oldDivId == "") {
			document.all[divId].style.display="block";
	    	oldDivId = divId;
		} else {
		  	if (oldDivId == divId) {
				document.all[oldDivId].style.display="none";
				oldDivId = "";
			} else {
				document.all[oldDivId].style.display="none";
				document.all[divId].style.display="block";
		    	oldDivId = divId;
			}
		}
   }
   else
   {

   }
}

sfHover = function() {
  if (document.getElementById("pulldown-menu")!=null)
  {
    var sfEls=new Array();
    sfEls[0] = document.getElementById("pulldown-menu").getElementsByTagName("LI");
    for (var i=0; i<sfEls.length; i++) {
    for (var j=0; j<sfEls[i].length; j++) {
    sfEls[i][j].onmouseover=function() {
    this.className+=" hover";
    }
    sfEls[i][j].onmouseout=function() {
    this.className=this.className.replace(new RegExp(" hover\\b"), "");
    }
    }
    }
  }
}
if (window.attachEvent) window.attachEvent("onload", sfHover);


var inputValueColor = "#333333";
var inputValueColorize = "#cccccc";

function manageInputValue(field, action)
{
/* script by JK @ Interway
 * funkciu ovplyvnia globalne premenne definovane pred funkciou:
 * var omnitClearWords4%ID% = true/false; ...
 * var defaultText4%ID% = "Zadajte hodnotu...";
 * povinna je akcia "init"
*/
  var action = action;
  if (typeof(action) == "undefined")
    action = "";

  // referencia na pole
  var fieldTag;
  if (typeof(field) == "string")
    fieldTag = document.getElementById(field);
  else if (typeof(field) == "object")
    fieldTag = field;
  else
    return;

  // definicia value textu
  var useText = fieldTag.value;
  
  try
  {
    useText = eval("defaultText4"+fieldTag.id);
  }
  catch (e) {}

  // bude sa mazat value na focus/click? false = ano
  var omnitClearWords = false;
  
  try
  {
    omnitClearWords = eval("omnitClearWords4"+fieldTag.id);
  }
  catch (e) {}

  if (action == "init")
  {
    fieldTag.value = useText;
    fieldTag.style.color = inputValueColorize;
    return;
  }
  // operacie s textom
  if (fieldTag.value == useText) {
    if (!omnitClearWords)
      fieldTag.value = "";
    fieldTag.style.color = inputValueColor;
  }

  if (action == "check")
  {
    var temp = fieldTag.value;
    if (temp == "" || temp.search(/^\s{1,}$/) != -1) {
      fieldTag.value = useText;
      fieldTag.style.color = inputValueColorize;
    }
  }
}

//   quickLinks openClose

var oldQuickId;
oldQuickId = "quick02";
function ocQuick(divId)
{
   if(document.getElementById)
   {
      if (oldQuickId!="") document.getElementById(oldQuickId).style.display="none";
      document.getElementById(divId).style.display="block";
      oldQuickId = divId;
      var ocEls=new Array();
      ocEls = document.getElementById("quickHome").getElementsByTagName("H3");
      for(var c=0; c<ocEls.length; c++)
      {
        ocEls[c].className = "";
        ocEls[c].style.backgroundColor = '#eff4fa';
      }
   }
   else if(document.all)
   {
      if (oldQuickId!="") document.all[oldQuickId].style.display="none";
      document.all[divId].style.display="block";
      oldQuickId = divId;
      var ocEls=new Array();
      ocEls = document.all("quickHome").getElementsByTagName("H3");
      for(var c=0; c<ocEls.length; c++)
      {
        ocEls[c].className = "";
        ocEls[c].style.backgroundColor = '#eff4fa';
      }
   }
   else
   {

   }
}

function quickBg(action,quickEl)
{
  if(action == "set")
  {
    if(quickEl.className != "quickOn") quickEl.style.backgroundColor='#cad5eb';
  }
  else if(action == "back")
  {
    if(quickEl.className != "quickOn") quickEl.style.backgroundColor = '#eff4fa';
  }
}

//resize event na okne
function getInnerSize () {
	var x,y;
	if (self.innerHeight) // all except Explorer
	{
		x = self.innerWidth;
		y = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight)
		// Explorer 6 Strict Mode
	{
		x = document.documentElement.clientWidth;
		y = document.documentElement.clientHeight;
	}
	else if (document.body) // other Explorers
	{
		x = document.body.clientWidth;
		y = document.body.clientHeight;
	}
	return [x,y];
}

function setElementWidth(name, width)
{
   var myEl = document.getElementById(name);
   if (myEl != null)
   {
      myEl.style.width = width+"px";
   }
}

function pageResizeEvent(isOnLoad)
{
   try
   {
     var innerSize = getInnerSize();
     var totalWidth = innerSize[0];
     if (totalWidth > 986)
     {
        totalWidth = 986;
        //sme volany pri nacitani stranky a vtedy je to pre tuto velkost OK
        if (isOnLoad==true) return;
     }
     totalWidth = Math.round(totalWidth * 0.95);
     
     if (navigator.userAgent.indexOf("MSIE 6")!=-1)
     {
        if(totalWidth < 762) totalWidth = 762;
     }
     else if (totalWidth < 742) totalWidth = 742;
     
     var innerDivWidth = totalWidth;
     setElementWidth("innerDivId", innerDivWidth);
     
     //odrataj marginy - konstanta 5 je zistena experimentalne ;-)
     totalWidth = totalWidth - 10 - 5;
     
     //IE6 fixes - odratat bordre
     if (navigator.userAgent.indexOf("MSIE6")!=-1)
     {
        //TODO: totalWidth = totalWidth - 2;
     }
     
     //vypocitaj velkosti jednotlivych blokov
     var menuRWidth = 175;
     //var menuWidth = Math.round(totalWidth * 0.23);
     var menuWidth = 200;
     //if (menuWidth < 200) menuWidth = 200;
        
     var contentDivWidth = totalWidth - menuWidth;
     var contentWidth = contentDivWidth - menuRWidth - 10 - 10 - 14;
//     var content2Width = contentDivWidth - 200;
     
     
     //nastav sirky
     setElementWidth("menu", menuWidth);
     setElementWidth("content", contentWidth);
     setElementWidth("contentDiv", contentDivWidth);
//     setElementWidth("content2", content2Width);
    
     //window.status = "resized:"+innerSize[0]+"x"+innerSize[1]+" innerDivWidth="+innerDivWidth+" menu="+menuWidth+" content="+contentWidth+" contentDiv="+contentDivWidth+" menuR="+menuRWidth;
   }
   catch (e)
   {
      window.status="err:"+e;
   }
}

function afterPrint()
{
   pageResizeEvent(false);
}


function beforePrint()
{
   //IE7
   if (navigator.userAgent.indexOf("MSIE 7")!=-1)
   {
      setElementWidth("menu", 0);
      setElementWidth("content", 780);
      setElementWidth("contentDiv", 800);
   }
   else
   {
      setElementWidth("menu", 0);
      setElementWidth("content", 580);
      setElementWidth("contentDiv", 600);
   }
}


window.onbeforeprint=beforePrint;
window.onafterprint=afterPrint;


(function($) {
    $.fn.extend({
        extlink: function () {
            var site = String(document.location)
                .replace(/^(https?:\/\/[^:\/]+).*$/, "$1")
                .replace(/^((site)?(file:\/\/.+\/))[^\/]+$/, "$3")
                .replace(/(\\.)/g, "\\$1");            
            $("a", this).filter(function (i) 
            {
                var href = $(this).attr("href");
                if (href == null)
                    return false;
                return (true);
            }).each(function () 
            {               
                var href = $(this).attr("href");                
                if (href.match(RegExp("^("+site+"|(https?:)?/[^/])")) == null
                    && href.match(RegExp("^(https?|ftp)://.+")) != null)
                {
                  $(this).after("&nbsp;<img alt='' class='linkIcon' src='/images/css/icon_exlink.gif' />");
                  
                  var onClick = "" + $(this).attr("onclick");
                  if (onClick==undefined || onClick.indexOf("window.open")==-1)
                  {
                     this.setAttribute("target", "_blank", 2);
                  }
                }
                else if (href.indexOf("mailto:")!=-1)
                {
                  $(this).after("&nbsp;<img alt='' class='linkIcon' src='/images/css/icon_mail.gif' />");
                }
                else if (href.indexOf(".pdf")!=-1 || href.indexOf(".doc")!=-1 || href.indexOf(".xls")!=-1)
                {

                  var onClick = "" + $(this).attr("onclick");
                  if (onClick==undefined || onClick.indexOf("window.open")==-1)
                  {
                     this.setAttribute("target", "_blank", 2);
                  }

                  $(this).after("&nbsp;<img alt='' class='linkIcon' src='/images/css/icon_download.gif' />");
                }
            });
        }
    });
})(jQuery);

$(document).ready(function () {
                $(this).extlink();


		$('div.faq h3').click(function(){
			$(this).next().toggle();
		});

                $('div.faq h3').hover(function(){
			$(this).css("color","#FF6600");
		},function(){
			$(this).css("color","#3399CC");
		});

});

//    otvorenie okna pre Euro kalkulacku (ING.sk)

function openWindowPopup(url,scroll,windowName,resizable) {

	 var heightWindow = 410;

	 var widthWindow = 220;

	 if (!resizable) resizable = "no"

	 if (windowName==null) {

	 	windowName = Math.random() + "";

	 	windowName = windowName.replace(".","x");

	 } else {

	  var ran = Math.random() + "";

	  ran = ran.replace(".","x");

	  /* chceme vzdy nove okno (mnozstvi n)*/

	  //windowName = windowName + ran;

	  /* chceme jen jedno okno (mnozstvi 1)*/

	  windowName = windowName;	 	

	 }

	 	/* na stred*/

	 //poziceTop = (screen.height - heightWindow)/2;

	 //poziceLeft = (screen.width - widthWindow)/2;

	 	

	 	/*vpravo nahoru*/

	 poziceTop = (0 + (5));

	 poziceLeft = (screen.width - (41+widthWindow));



	 var result = window.open(url,windowName,'scrollbars=' + scroll +',resizable=' + resizable + ',personalbar=no,menubar=no,status=yes,toolbar=no,height=' + heightWindow + ',width=' + widthWindow+ ',left=' + poziceLeft + ',top=' + poziceTop + ',screenX=0,screenY=0');  

}

