function get_help(value,lang){
	var mywindow = window.open('include/help_window.php?val=' + value + '&lang='+ lang ,'helper','width=250,height=250,statusbar=no, menubar=no, resizable=1, scrollbars=1');
	mywindow.moveBy(200,200);
	
}

// POVECAVA FONTOV //

// Copyright 2003 Eddie Traversa
// http://www.dhtmlnirvana.com/
// free to use as long as this copyright notice stays intact
var tags = new Array( 'div','td','tr','p','b','table','strong','span','emphasis','a','h1','h2','h3','pre','sub','sup','i','th','cp','ul','ol','li','dt','dd');
var pixelArray =  new Array('9','10','11','13','15','17','19','21');
var emArray =  new Array('0.7','0.9','1.0','1.5','2.0','2.5','3');
var initSize = parseInt(getCookie("fontsize"));

function getInitSize() {
	if (!initSize) { 
		initSize = 2;
		var now = new Date();
		now.setTime(now.getTime() + 2 * 24 * 60 * 60 * 1000);
		setCookie("fontsize", initSize, now);
	} else if (initSize != 2) {
		tmp = initSize-2;
		initSize = 2;
		fontSizer(tmp, 'px');
	}
}

function fontSizer(inc,unit) {
		
	if (!document.getElementById) 
		return;
	var size = initSize;
		size += inc;
	if (size < 0 ) {
		size = 0;
	}
	if (size > 3 ) {
		size = 3;
	}
		var diff = size - initSize;
		initSize = size;
		var now = new Date();
		now.setTime(now.getTime() + 2 * 24 * 60 * 60 * 1000);
		setCookie("fontsize", initSize, now);
		
		getBody = document.getElementsByTagName('body')[0];
	for (i = 0 ; i < tags.length ; i++ ) {
		getallTags = getBody.getElementsByTagName(tags[i]);
		for (k = 0 ; k < getallTags.length ; k++) {
			//print getallTags[k].className;
			if (getallTags[k].className != 's_menu_link' && getallTags[k].className != 'plavo_bold' && getallTags[k].className != 'navbar' && getallTags[k].className != 'bliznjice') {
				if (getallTags[k].style.fontSize.length > 0) {
					px = toInt(getallTags[k].style.fontSize);
					getallTags[k].style.fontSize = (unit=='px') ? (pixelArray[size]*1 + px-pixelArray[size-diff])+unit : (emArray[size]*1 + px-emArray[size-diff])+unit;
				} else
					getallTags[k].style.fontSize = (unit=='px') ? pixelArray[size]+unit : emArray[size]+unit;
			}
		}
	}
}

function toInt(str) {
	for (j = 0; j <= str.length; j++) {
		if (j == str.length || str.charAt(j) < '0' || str.charAt(j) > '9') {
			return str.substring(0,j)*1;
		}
	}
}

/////////////////////

function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}


/*
  name - name of the desired cookie
  return string containing value of specified cookie or null
  if cookie does not exist
*/

function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}


/*
   name - name of the cookie
   [path] - path of the cookie (must be same as path used to create cookie)
   [domain] - domain of the cookie (must be same as domain used to
     create cookie)
   path and domain default if assigned null or omitted if no explicit
     argument proceeds
*/

function deleteCookie(name, path, domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

// date - any instance of the Date object
// * hand all instances of the Date object to this function for "repairs"

function fixDate(date) {
  var base = new Date(0);
  var skew = base.getTime();
  if (skew > 0)
    date.setTime(date.getTime() - skew);
}

// END cookeis //


function addEvent(elm, evType, fn, useCapture)
      // cross-browser event handling for IE5+, NS6+ and Mozilla/Gecko
      // By Scott Andrew
      {
		if (elm.addEventListener) {
				
          elm.addEventListener(evType, fn, useCapture); 
          return true; 
        } else if (elm.attachEvent) {
          var r = elm.attachEvent('on' + evType, fn); 
          return r; 
        } else {
          elm['on' + evType] = fn;
        }
      }
	
	

/* password functions */

function fokusiraj(e){
	var password = document.getElementById('password');
	//alert(password.type);
	password.value = '';
	password.setAttribute('type','password');
	

}


function bluraj(e){
	var password = document.getElementById('password');
	try{
		if(password.value == ''){
			password.type='text';
			password.value = zacetna_vrednost;
		}
	} catch (err) {} ;
}

function izracun(val,opt){
	if (val == 'frequency_of_payment'){
		if(opt == 'once_year') koef = 1;
		if(opt == 'twice_year') koef = 2;
		if(opt == 'four_time_year') koef = 4;
		if(opt == '12_times_year') koef = 12;
	}
	if(val == 'the_total_period_of_investment_plan'){
		
		var initial_investment = document.getElementById('initial_investment');
		//var the_total_period_of_investment_plan = document.getElementById('the_total_period_of_investment_plan');
		var total_number_of_payments = document.getElementById('total_number_of_payments');
		var estimated_amount_of_each = document.getElementById('estimated_amount_of_each');
		
		
		var vrednost = (10200 - initial_investment.value) / (opt * koef -1) ;
		total_number_of_payments.value = (opt * koef -1);
		estimated_amount_of_each.value =  Math.round(vrednost*Math.pow(10,2))/Math.pow(10,2);
		//alert(vrednost);
		
	}
	if(val == 'currency'){
		var znesek_placila = document.getElementById('znesek_placila');
		var caption_znesek_placila = document.getElementById('caption_znesek_placila');
		var vrednost = znesek_placila.value;
		if(opt == 'EUR'){
			znesek_placila.value = (vrednost/240);
			caption_znesek_placila.innerHTML = (vrednost/240);
		} else if (opt == 'SIT'){
			znesek_placila.value = (vrednost*240);
			caption_znesek_placila.innerHTML = (vrednost*240);
		}
	}
}

function addListeners(e){
	
	var password = document.getElementById('password');
	
	if(password){
		addEvent(password, 'focus', fokusiraj, false);
		addEvent(password, 'blur', bluraj, false);
		zacetna_vrednost = password.value;
	}
	
	total_number_of_payments = document.getElementById('total_number_of_payments');
	if(total_number_of_payments){
		addEvent(total_number_of_payments, 'focus', izracun, false);
	}
	
	var date_of_birth = document.getElementById('date_of_birth');
	if(date_of_birth){
		kontrola_polnoletnosti();
	}
	
	
}

function kontrola_polnoletnosti(){
	//alert('joj');
	var datum_polje = document.getElementById('date_of_birth');
	var datum = datum_polje.value;
	var datum = datum.split("-")
	var dd = datum[0];
	var mm = datum[1] - 1;
	var llll = datum[2];
	
	var meseci = new Array();
	meseci[0] = 'January';
	meseci[1] = 'February';
	meseci[2] = 'March';
	meseci[3] = 'April';
	meseci[4] = 'May';
	meseci[5] = 'June';
	meseci[6] = 'July';
	meseci[7] = 'August';
	meseci[8] = 'September';
	meseci[9] = 'October';
	meseci[10] = 'November';
	meseci[11] = 'December';

	
	var rojstvo = new Date(meseci[mm] + " "+ dd +", "+ llll);
	var danes = new Date();
	var razlika = danes.getTime() - rojstvo.getTime();
	
	//alert(meseci[mm]);
	
	var polnoletnost = 60 * 60 * 24 * 365 * 18 * 1000;
	if(razlika < polnoletnost){
			
		var tbody = document.getElementById('tbody');
		if(tbody){
			tbody.style.display = '';
		}
		//alert('Niste polnoletni. Morate vpisat pooblašèenca!');
	} else {
		
		var tbody = document.getElementById('tbody');
		if(tbody){
			tbody.style.display = 'none';
		}
	}
}

addEvent(window, 'load', addListeners, false);

function alertselected(){
		var element = document.getElementById('servis_zelim');
		window.open(element.options[element.selectedIndex].value,'_self');

//alert(element.selectedIndex)
}

/* ajax */
var xmlhttp=false;

///  TA KOMENTIRANA KODA MORA TU OBVEZNO BIT!!!!

/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
  try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e) {
   try {
    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
   } catch (E) {
    xmlhttp = false;
   }
  }
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
  xmlhttp = new XMLHttpRequest();
}
/*
function loadFragmentInToElement(fragment_url, element_id) {
    var element = document.getElementById(element_id);
    //element.innerHTML = 'Loading ...';
   xmlhttp.open("GET", fragment_url, true);
    xmlhttp.onreadystatechange = function() {
      if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
      element.innerHTML = xmlhttp.responseText;
      }
    }
    xmlhttp.send(null);
	return true;
}
*/
function loadFragmentInToElement(fragment_url, element_id) {
    element = document.getElementById(element_id);
    xmlreqGET(fragment_url,element);
  
}

var xmlreqs = new Array(); 
function CXMLReq(type, xmlhttp) { 
	this.type = type; 
	this.xmlhttp = xmlhttp; 
} 
function xmlreqGET(url,element) { 
	var xmlhttp=false; 
	if (window.XMLHttpRequest) { // Mozilla, etc. 
		xmlhttp=new XMLHttpRequest(); 
		xmlhttp.onreadystatechange = xmlhttpChange; 
		xmlhttp.open("GET",url,true); 
		xmlhttp.send(null); 
	} else if (window.ActiveXObject) { // IE 
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 
		if (xmlhttp) { 
			xmlhttp.onreadystatechange = xmlhttpChange; 
			xmlhttp.open("GET",url,true); 
			xmlhttp.send(); 
		} 
	} 
	var xmlreq = new CXMLReq('', xmlhttp); 
	xmlreqs.push(xmlreq); 
} 

function xmlreqPOST(url,data) { 
	var xmlhttp=false; 
	if (window.XMLHttpRequest) { // Mozilla etc. 
		xmlhttp=new XMLHttpRequest(); 
		xmlhttp.onreadystatechange=xmlhttpChange; 
		xmlhttp.open("POST",url,true); 
		xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 
		xmlhttp.send(data); 
	} else if (window.ActiveXObject) { // IE 
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 
		if (xmlhttp) { 
			xmlhttp.onreadystatechange=xmlhttpChange; 
			xmlhttp.open("POST",url,true); 
			xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 
			xmlhttp.send(data); 
		} 
	} 
	var xmlreq = new CXMLReq('', xmlhttp); 
	xmlreqs.push(xmlreq); 
} 

function xmlhttpChange() {
	if (typeof(window['xmlreqs']) == "undefined") return; 
	for (var i=0; i < xmlreqs.length; i++) { 
		if (xmlreqs[i].xmlhttp.readyState == 4) { 
			if (xmlreqs[i].xmlhttp.status == 200 || xmlreqs[i].xmlhttp.status == 304) { 
				var ajaxout = xmlreqs[i].xmlhttp.responseText;
				xmlreqs.splice(i,1); i--; 
				element.innerHTML = ajaxout;
				//alert(xmlhttp.responseText);
			} else { 
				// error 
				xmlreqs.splice(i,1); i--; 
			} 
		} 
	} 
}
//////////////////////////////////////////////////////////////
   <!--//--><![CDATA[//><!--
    activateMenu = function(nav) {
	    if(document.all && document.getElementById(nav).currentStyle){
	        // only MSIE supports document.all
            var navroot = document.getElementById(nav);

            /* Get all the list items within the menu */
            var lis=navroot.getElementsByTagName("LI");
            for(i=0;i<lis.length;i++){
                /* If the LI has another menu level */
                if(lis[i].lastChild.tagName=="UL"){
                    /* assign the function to the LI */
                    lis[i].onmouseover=function(){
                        /* display the inner menu */
                        this.lastChild.style.display="block";
                    }
                    lis[i].onmouseout=function(){
                        this.lastChild.style.display="none";
                    }
                }
            }
        }
    }

	function create_top_of_the_page_link(height, arrow_div) {
		var arrowdiv = document.getElementById(arrow_div);
		if (arrowdiv && getScrollPageSize()[1]>height) {
			arrowdiv.style.display='block';
		}
		else {
			arrowdiv.style.display='none';
		}
	}

	function getScrollPageSize() {
		var x,y;
		var test1 = document.body.scrollHeight;
		var test2 = document.body.offsetHeight
		if (test1 > test2) // all but Explorer Mac
		{
			x = document.body.scrollWidth;
			y = document.body.scrollHeight;
		}
		else // Explorer Mac;
		     //would also work in Explorer 6 Strict, Mozilla and Safari
		{
			x = document.body.offsetWidth;
			y = document.body.offsetHeight;
		}
		return [x, y];
	}

    window.onload=function(){
        // pass the function the id of the top level UL
        // remove one, when only using one menu
        activateMenu('dmenu');
    }
   //--><!]]>

