var isIE = window.navigator.userAgent.indexOf("MSIE")>-1;
version=0;
if (navigator.appVersion.indexOf("MSIE")!=-1){
temp=navigator.appVersion.split("MSIE")
version=parseFloat(temp[1])
}
var GlassWindow=null;
var oDiv=null;
var divHdr=null;
var divBdy=null;
var btn = {
    init : function() {
        if (!document.getElementById || !document.createElement || !document.appendChild) return false;
		className=new Array('btnUpHome','btnUpHome1','btnUpMenu','btnUpMenu2','btnUpForm','btnUpForm1');
		for (j=0; j<className.length; j++) {
		as = btn.getElementsByClassName(className[j]);
        for (i=0; i<as.length; i++) {
            if ( as[i].tagName == "INPUT" && ( as[i].type.toLowerCase() == "submit" || as[i].type.toLowerCase() == "button" ) ) {
				if (as[i].parentNode.tagName!='SPAN') {
					var s1 = document.createElement('span');
					s1.className='buttonBorder';
					a=as[i];
	                as[i] = as[i].parentNode.replaceChild(s1, as[i]);
	                //as[i] = as[i].parentNode.replaceChild(s1, as[i]);
					s1.appendChild(a);

				}
            }
        }

		}
    },
    findForm : function(f) {
        while(f.tagName != "FORM") {
            f = f.parentNode;
        }
        return f;
    },
    addEvent : function(obj, type, fn) {
        if (obj.addEventListener) {
			obj.addEventListener(type, fn, false);
        }
        else if (obj.attachEvent) {
            obj["e"+type+fn] = fn;
            obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
            obj.attachEvent("on"+type, obj[type+fn]);
        }
    },
    getElementsByClassName : function(className, tag, elm) {
        var testClass = new RegExp("(^|\s)" + className + "(\s|$)");
        var tag = tag || "*";
        var elm = elm || document;
        var elements = (tag == "*" && elm.all)? elm.all : elm.getElementsByTagName(tag);
        var returnElements = [];
        var current;
        var length = elements.length;
        for(var i=0; i<length; i++){
            current = elements[i];
            if(testClass.test(current.className)){
                returnElements.push(current);
            }
        }
        return returnElements;
    }
}

btn.addEvent(window,'load', function() {
	btn.init();
	var error= readCookie('error');
	if (error) {
		error=decodeURI(error);
		AlertError(replaceChars(error),"","");
		createCookie('error',false,-36000);
	}
} );
jQuery.fn.addOption = function()
{
    if(arguments.length == 0) return this;
    // select option when added? default is true
    var selectOption = true;
    // multiple items
    var multiple = false;
    if(typeof arguments[0] == "object")
    {
        multiple = true;
        var items = arguments[0];
    }
    if(arguments.length >= 2)
    {
        if(typeof arguments[1] == "boolean") selectOption = arguments[1];
        else if(typeof arguments[2] == "boolean") selectOption = arguments[2];
        if(!multiple)
        {
            var value = arguments[0];
            var text = arguments[1];
        }
    }
    this.each(
        function()
        {
            if(this.nodeName.toLowerCase() != "select") return;
            if(multiple)
            {
                for(var v in items)
                {
                    jQuery(this).addOption(v, items[v], selectOption);
                }
            }
            else
            {
                var option = document.createElement("option");
                option.value = value;
                option.text = text;
                this.options.add(option);
            }
            if(selectOption)
            {
                this.options[this.options.length-1].selected = true;
            }
        }
    )
    return this;
}

/*
 * Removes an option (by value or index) from a select box (or series of select boxes)
 *
 * @name     removeOption
 * @author   Sam Collett (http://www.texotela.co.uk)
 * @example  jQuery("#myselect").removeOption("Value"); // remove by value
 *           jQuery("#myselect").removeOption(0); // remove by index
 *
 */
jQuery.fn.removeOption = function()
{
    if(arguments.length == 0) return this;
    if(typeof arguments[0] == "string") var value = arguments[0];
    else if(typeof arguments[0] == "number") var index = arguments[0];
    else return this;
    this.each(
        function()
        {
            if(this.nodeName.toLowerCase() != "select") return;
            if(value)
            {
                var optionsLength = this.options.length;
                for(var i=optionsLength-1; i>=0; i--)
                {
                    if(this.options[i].value == value)
                    {
                        this.options[i] = null;
                    }
                }
            }
            else
            {
                this.remove(index);
            }
        }
    )
    return this;
}

/*
 * Sort options (ascending or descending) in a select box (or series of select boxes)
 *
 * @name     sortOptions
 * @author   Sam Collett (http://www.texotela.co.uk)
 * @param    ascending   Sort ascending (true/undefined), or descending (false)
 * @example  // ascending
 *           jQuery("#myselect").sortOptions(); // or jQuery("#myselect").sortOptions(true);
 *           // descending
 *           jQuery("#myselect").sortOptions(false);
 *
 */
jQuery.fn.sortOptions = function(ascending)
{
    this.each(
        function()
        {
            if(this.nodeName.toLowerCase() != "select") return;
            // default sort is ascending if parameter is undefined
            ascending = typeof ascending == "undefined" ? true : ascending;
            // get number of options
            var optionsLength = this.options.length;
            // create an array for sorting
            var sortArray = [];
            // loop through options, adding to sort array
            for(var i = 0; i<optionsLength; i++)
            {
                sortArray[i] =
                {
                    value: this.options[i].value,
                    text: this.options[i].text
                };
            }
            // sort items in array
            sortArray.sort(
                function(option1, option2)
                {
                    // option text is made lowercase for case insensitive sorting
                    option1text = option1.text.toLowerCase();
                    option2text = option2.text.toLowerCase();
                    // if options are the same, no sorting is needed
                    if(option1text == option2text) return 0;
                    if(ascending)
                    {
                        return option1text < option2text ? -1 : 1;
                    }
                    else
                    {
                        return option1text > option2text ? -1 : 1;
                    }
                }
            );
            // change the options to match the sort array
            for(var i = 0; i<optionsLength; i++)
            {
                this.options[i].text = sortArray[i].text;
                this.options[i].value = sortArray[i].value;
            }
        }
    )
    return this;
}

/*
 * Selects an option by value
 *
 * @name     selectOptions
 * @author   Mathias Bank (http://www.mathias-bank.de)
 * @param    value specifies, which options should be selected
 * @example  jQuery("#myselect").selectOptions("val1");
 *
 */
jQuery.fn.selectOptions = function(value) {
    this.each(
        function()    {
            if(this.nodeName.toLowerCase() != "select") return;
            
            // get number of options
            var optionsLength = this.options.length;
            
            
            for(var i = 0; i<optionsLength; i++) {
                if (this.options[i].value == value) {
                    this.options[i].selected = true;
                };
            }
        }
    )
    return this;
}

function PressEnter(myForm) {
  if (window.event && window.event.keyCode == 13)
    myForm.onclick();
  else
    return true;
}
function trim(str) {
     if(!str || typeof str != 'string')
	    return '';
     return str.replace(/^[\s]+/,'').replace(/[\s]+$/,'').replace(/[\s]{2,}/,' ');
 }
function replaceChars(entry) {
	out = "+"; // replace this
	add = " "; // with this
	temp = "" + entry; // temporary holder

	while (temp.indexOf(out)>-1) {
		pos= temp.indexOf(out);
		temp = "" + (temp.substring(0, pos) + add + 
		temp.substring((pos + out.length), temp.length));
	}
	return temp;
}

function SubmitForm(task,ids,msg) {
	var ok=true;
	if (msg.length>0) {
		var ok=confirm(msg);
	}
	if (ok) {
		document.editForm.task1.value=task;
		document.editForm.ids.value=ids;
		document.editForm.submit();
	}
	return ok;
}

function pressButton(task,ids,msg) {
    var ok=true;
    if (msg.length>0) {
        var ok=confirm(msg);
    }
    if (ok) {
        document.editForm.task1.value=task;
        document.editForm.ids.value=ids;
        document.location.href='index2.php?mod='+document.editForm.mod.value+'&task='+task+'&ids='+ids
    }
    return false;
}
function ajaxFunction()	{
	var xmlHttp;
	try {  // Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
		}
	catch (e) {  // Internet Explorer
		try
			{
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			}
	  catch (e)	{
		  try {
			  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			  }
		catch (e) {
			alert("Jusu narsykle nepalaiko AJAX!");
			return false;
			}
		}
	}
	return xmlHttp;
}
// JS Calendar
var calendar = null; // remember the calendar object so that we reuse
// it and avoid creating another

// This function gets called when an end-user clicks on some date
function selected(cal, date) {
	cal.sel.value = date; // just update the value of the input field
}

// And this gets called when the end-user clicks on the _selected_ date,
// or clicks the "Close" (X) button.  It just hides the calendar without
// destroying it.
function closeHandler(cal) {
	cal.hide();			// hide the calendar

	// don't check mousedown on document anymore (used to be able to hide the
	// calendar when someone clicks outside it, see the showCalendar function).
	Calendar.removeEvent(document, "mousedown", checkCalendar);
}

// This gets called when the user presses a mouse button anywhere in the
// document, if the calendar is shown.  If the click was outside the open
// calendar this function closes it.
function checkCalendar(ev) {
	var el = Calendar.is_ie ? Calendar.getElement(ev) : Calendar.getTargetElement(ev);
	for (; el != null; el = el.parentNode)
	// FIXME: allow end-user to click some link without closing the
	// calendar.  Good to see real-time stylesheet change :)
	if (el == calendar.element || el.tagName == "A") break;
	if (el == null) {
		// calls closeHandler which should hide the calendar.
		calendar.callCloseHandler(); Calendar.stopEvent(ev);
	}
}

// This function shows the calendar under the element having the given id.
// It takes care of catching "mousedown" signals on document and hiding the
// calendar if the click was outside.
function showCalendar(id) {
	var el = document.getElementById(id);
	if (calendar != null) {
		// we already have one created, so just update it.
		calendar.hide();		// hide the existing calendar
		calendar.parseDate(el.value); // set it to a new date
	} else {
		// first-time call, create the calendar
		var cal = new Calendar(true, null, selected, closeHandler);
		calendar = cal;		// remember the calendar in the global
		cal.setRange(1900, 2070);	// min/max year allowed
		calendar.create();		// create a popup calendar
		calendar.parseDate(el.value); // set it to a new date
	}
	calendar.sel = el;		// inform it about the input field in use
	calendar.showAtElement(el);	// show the calendar next to the input field

	// catch mousedown on the document
	Calendar.addEvent(document, "mousedown", checkCalendar);
	return false;
}

/**
* Pops up a new window in the middle of the screen
*/
function popupWindow(mypage, myname, w, h, scroll) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}
function popupTest() {
	win = window.open('', 'test',"height=0,width=0");
	if (win==null) {
		alert("Jūsų nmaršyklė blokuoja iššokančius langus! Turite leisti iššokančius langus (popup)!");
	}
	win.close();
	alert(navigator.userProfile)
	return false;
}
function createCookie(name,value,seconds) {
    if (seconds) {
        var date = new Date();
        date.setTime(date.getTime()+seconds);
        var expires = "; expires="+date.toGMTString();
    } else {
        var expires = "";
    }
    document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name) {
    var xname = name + "=";
    var sk = document.cookie.split(';');
    for(var i=0;i < sk.length;i++) {
        var tmp = sk[i];
        while (tmp.charAt(0)==' ') tmp = tmp.substring(1,tmp.length);
        if (tmp.indexOf(xname) == 0) return tmp.substring(xname.length,tmp.length);
    }
    return null;
}
function getScroll(){
    var yScroll;

    if (window.pageYOffset) {
        yScroll = window.pageYOffset;
    } else if (document.documentElement && document.documentElement.scrollTop){  // Explorer 6 Strict
        yScroll = document.documentElement.scrollTop;
    } else if (document.body) {// all other Explorers
        yScroll = document.body.scrollTop;
    }
        return yScroll;
}
function getViewportHeight() {
	if (window.innerHeight!=window.undefined) return window.innerHeight;
	if (document.compatMode=='CSS1Compat') return document.documentElement.clientHeight;
	if (document.body) return document.body.clientHeight;

	return window.undefined;
}
function getViewportWidth() {
	var offset = 17;
	var width = null;
	if (window.innerWidth!=window.undefined) return window.innerWidth;
	if (document.compatMode=='CSS1Compat') return document.documentElement.clientWidth;
	if (document.body) return document.body.clientWidth;
}
function ShowGlassWindow(show){
	if(GlassWindow==null){
		GlassWindow=document.createElement('div');
		with(GlassWindow.style){
			//стили экрана после создания
			display='none'; //невидим
			position='absolute'; //абсолютное позиционирование
			left = 0;
			top =0;
			width1 = getViewportWidth()+"px";
			height1 = getViewportHeight()+getScroll()+"px";
			width = "0px";
			height = "0px";
			zIndex=1;
			background='#565656';
			filter='alpha(opacity=70)'; // IE
			opacity='0.70'; // FF
			if (navigator.appName.indexOf("Microsoft")!=-1) {
				width = document.body.offsetWidth;
				height = document.body.offsetHeight+getScroll();
			}
			
//			alert("1"+width+"2"+width1);
			if (parseInt(width)<parseInt(width1)) {
				width=width1;
			}
			if (parseInt(height)<parseInt(height1)) {
				height=height1;
			}
		}
		// добавлем созданный элемент в структуру документа
		document.body.appendChild(GlassWindow);

	}
	if(show){
		with(GlassWindow.style){
			// позиционируем экран в левый верхний угол экрана и площадью во весь экран браузера
			left = 0;
			top = getScroll()+"px";
			//width = document.body.clientWidth;
			//height = document.body.clientHeight;
		}
	}
	//отображаем/прячем экран
	if (show) {
		hideSelect();
		with(GlassWindow.style){
			//стили экрана после создания
			background='#565656';
			filter='alpha(opacity=70)'; // IE
			opacity='0.70'; // FF
			display='block'; //невидим
			left = 0;
			top =0;
			width1 = getViewportWidth()+"px";
			height1 = getViewportHeight()+getScroll()+"px";
			width = "0px";
			height = "0px";
			if (navigator.appName.indexOf("Microsoft")!=-1) {
				width = document.body.offsetWidth;
				height = document.body.offsetHeight+getScroll();
			}
			
//			alert("1"+width+"2"+width1);
			if (parseInt(width)<parseInt(width1)) {
				width=width1;
			}
			if (parseInt(height)<parseInt(height1)) {
				height=height1;
			}
		}
		
	} else {
		with(GlassWindow.style){
			//стили экрана после создания
			display='none'; //невидим
			left = -2000;
			top =-2000;
		}
		showSelect();
	}
}
function ShowModalWindow(show, Header, Body, Footer) {
	ShowGlassWindow(show); //показываем/скрываем экран
// получим ссылку на форму диалога (элемент с id=modal)
	if(show) {
		oDiv=document.createElement("div");
		divHdr=document.createElement("div");
		divBdy=document.createElement("div");
		divFoo=document.createElement("div");
		document.body.appendChild(oDiv);
		oDiv.style.zIndex=2;
		//divHdr.innerHTML='<img style="vertical-align:middle"  src="info.gif">&nbsp;&nbsp;'+divHdr.innerHTML;
		//divHdr.innerHTML='<div align="right"><button class="btndeleteoff" title="Naikinti" id="delete" onmousedown="this.className=\'btndeleteon\'" onmouseup="this.className=\'btndeleteoff\'" onmouseout="this.className=\'btndeleteoff\'" onclick="ShowModalWindow(false, \'\',\'\', \'\')"></button></div>'+divHdr.innerHTML;
		divHdr.style.fontWeight='bold';
		divHdr.style.width='395px';
		divHdr.style.padding='10px';
		divHdr.style.paddingBottom='5px';
		divHdr.style.color='#990000';
		divHdr.style.background='#eff1f4';
		divHdr.style.zIndex=2;
		divBdy.style.zIndex=2;
		divFoo.style.zIndex=2;
		oDiv.appendChild(divHdr);
		divBdy.style.width='395px';
		divBdy.style.paddingLeft='10px';
		divBdy.style.paddingRight='10px';
		divBdy.style.color='#FFFFFF';
		divBdy.style.background='#eff1f4';
		oDiv.appendChild(divBdy);
		divFoo.style.fontWeight='bold';
		divFoo.style.width='395px';
		divFoo.style.padding='10px';
		divFoo.style.paddingTop='15px';
		divFoo.style.color='#990000';
		divFoo.style.background='#eff1f4';
		divFoo.style.zIndex=2;
		oDiv.appendChild(divFoo);
		oDiv.style.position="absolute";
		oDiv.style.visibility='hidden';
	}
	if(show){
		//createCookie('Position',getScroll());
		//window.scrollTo( 0, 0);
		var body = document.body;
			
//			alert("1"+width+"2"+width1);
		
//		oDiv.style.top  = (Math.round((body.clientHeight - 150)/2) + getScroll())+'px';
//		oDiv.style.left = Math.round((body.clientWidth/2)-200)+'px';
		oDiv.style.top  = Math.round((getViewportHeight()/2)-150) + getScroll()+'px';
		oDiv.style.left = Math.round((getViewportWidth()/2)-200)+'px';
		oDiv.style.visibility='visible';
		divBdy.innerHTML=Body;
		divFoo.innerHTML=Footer;
		if (Header.indexOf("<")==0) {
			divHdr.innerHTML=Header;
		} else {
			divHdr.innerHTML='<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td>'+Header+'</td><td align="right"><button class="btndelete" title="Uždryti" id="delete" onclick="ShowModalWindow(false, \'\',\'\', \'\')"></button></td></tr></table>';
		}
		oDiv.focus();
		document.body.style.overflow='hidden';
	}
	else {
  /*		var Position = readCookie('Position');
		if ( Position > 0 ) {
			window.scrollTo( 0, Position );
		}*/
		document.body.style.overflow='auto';
		oDiv.style.visibility='hidden';
		oDiv.style.top  ="-1000px";
		oDiv.style.left = "-1000px";
		divHdr.innerHTML="";
		divBdy.innerHTML="";
	}
}
function ShowModalWindow1(show, Header, Body, Footer) {
	ShowGlassWindow(show); //показываем/скрываем экран
// получим ссылку на форму диалога (элемент с id=modal)
	if(show) {
			oDiv=document.createElement("div");
			divHdr=document.createElement("div");
			divBdy=document.createElement("div");
			divFoo=document.createElement("div");
			document.body.appendChild(oDiv);
			oDiv.appendChild(divHdr);
			oDiv.appendChild(divBdy);
			oDiv.appendChild(divFoo);
		oDiv.style.zIndex=2;
		//divHdr.innerHTML='<img style="vertical-align:middle"  src="info.gif">&nbsp;&nbsp;'+divHdr.innerHTML;
		//divHdr.innerHTML='<div align="right"><button class="btndeleteoff" title="Naikinti" id="delete" onmousedown="this.className=\'btndeleteon\'" onmouseup="this.className=\'btndeleteoff\'" onmouseout="this.className=\'btndeleteoff\'" onclick="ShowModalWindow(false, \'\',\'\', \'\')"></button></div>'+divHdr.innerHTML;
		divHdr.style.fontWeight='bold';
		divHdr.style.width='329px';
//		divHdr.style.padding='10px';
//		divHdr.style.paddingBottom='5px';
		divHdr.style.paddingTop='13px';
		divHdr.style.color='#990000';
		divHdr.style.background='#eff1f4';
		divHdr.style.zIndex=2;
		divBdy.style.zIndex=2;
		divFoo.style.zIndex=2;
		divBdy.style.width='329px';
//		divBdy.style.paddingLeft='10px';
//		divBdy.style.paddingRight='10px';
		divBdy.style.color='#FFFFFF';
		divBdy.style.background='#eff1f4';
		divFoo.style.fontWeight='bold';
		divFoo.style.width='329px';
//		divFoo.style.padding='10px';
//		divFoo.style.paddingTop='15px';
		divFoo.style.paddingBottom='30px';
		divFoo.style.color='#990000';
		divFoo.style.background='#eff1f4';
		divFoo.style.zIndex=2;
		oDiv.style.position="absolute";
		oDiv.style.visibility='hidden';
	}
	if(show){
		//createCookie('Position',getScroll());
		//window.scrollTo( 0, 0);
		var body = document.body;
		width = getViewportWidth()+getScroll()+"px";
		height = getViewportHeight()+"px";
//		oDiv.style.top  = (Math.round((body.clientHeight - 150)/2) + getScroll())+'px';
//		oDiv.style.left = Math.round((body.clientWidth/2)-200)+'px';
		oDiv.style.top  = Math.round((getViewportHeight()/2)-150) + getScroll()+'px';
		oDiv.style.left = Math.round((getViewportWidth()/2)-200)+'px';
		oDiv.style.visibility='visible';
		divBdy.innerHTML=Body;
		divFoo.innerHTML=Footer;
		divHdr.innerHTML=Header;
		oDiv.focus();
		document.body.style.overflow='hidden';
	}
	else {
  /*		var Position = readCookie('Position');
		if ( Position > 0 ) {
			window.scrollTo( 0, Position );
		}*/
		document.body.style.overflow='auto';
		oDiv.style.visibility='hidden';
		oDiv.style.top  ="-1000px";
		oDiv.style.left = "-1000px";
		divHdr.innerHTML="";
		divBdy.innerHTML="";
	}
}
function AlertError(msg,title,btn) {
		if (btn.length<1) {
			btn="Taisyti";
		}
	var text='<div align="center" style="color:#FFFFFF; background-color:#a00000; padding:25px 0 25px 0;">'+msg+'</div>';
	var footer='<p align="center"><span class="buttonBorder"><input type="button" name="error" class="btnUpForm1" onclick="ShowModalWindow(false, \'\',\'\',\'\')" value="'+btn+'" /></span></p>'
		ShowModalWindow(true, title,text, footer);
}
function ConfirmMsg(msg,call,title,btn1,btn2) {
		if (btn1.length<1) {
			btn1="Taip";
		}
		if (btn2.length<1) {
			btn2="Ne";
		}
	var text='<div align="center" style="color:#FFFFFF; background-color:#1b7d1b; padding:25px 0 25px 0;">'+msg+'</div>';
	var footer='<p align="center"><span class="buttonBorder"><input type="button" name="error1" class="btnUpForm1" onclick="ShowModalWindow(false, \'\',\'\', \'\');'+call+';" value="'+btn1+'" /></span> <span class="buttonBorder"><input type="button" name="error2" class="btnUpForm1" onclick="ShowModalWindow(false, \'\',\'\',\'\')" value="'+btn2+'" /></span></p>';

		ShowModalWindow(true, title,text, footer);
		return false;
}
function loading(text){
	var body = document.body;
	oDiv=document.getElementById("loading");
	oDiv.style.top  = (Math.round((getViewportHeight()/2)-50)+getScroll())+'px';
	oDiv.style.left = Math.round((getViewportWidth()/2)-20)+'px';
	oDiv.style.zIndex=2;
	if (text.length>0) {
		oDiv.style.display='block';
		ShowGlassWindow(true);
	} else {
		btn.init();
		ShowGlassWindow(false);
		oDiv.style.top  = '-1000px';
		oDiv.style.left = '-1000px';
		oDiv.style.display='none';
	}
	return text;
}
function ClientSearchWindow() {
	window.open('index2.php?mod=client&task=search','klientai','height=600,width=824,menubar=0,resizable=1,scrollbars=1');
}
function closeWindow(id,day) {
	client_id=window.opener.document.getElementById("client_id");
	if (client_id) {
		client_id.value=id;
		window.opener.document.getElementById("pay_affter").value=day;
		window.opener.document.getElementById("changeday").disabled=false;
		var nofind=true;
	} else {
		client_id=window.opener.document.getElementById("find_client_id");
		client_id.value=id;
		var nofind=false;
	}

	for (var i = 0; i < client_id.length; i++) {
		if (client_id.options[i].value == id) {
			client_id.options[i].selected=true;
		} else {
			client_id.options[i].selected=false;
		}
	}
	if (nofind) {
		client_id.onchange();
	}
	window.close();
}
function replacePoint(input) {
	var error = false;
	input.value=input.value.replace(",",".");
  	if (window.event && window.event.keyCode == 9){
    	return false;
    }

}
function changeKeyCode(e, name, num)
{
	var keynum;
	if(window.event) // IE
	  {
		e=window.event;
		keynum = e.keyCode;
	  }
	else if(e) // Netscape/Firefox/Opera
	  {
	  keynum = e.keyCode;
	  }
	  
var x=document.getElementsByName(name);
	if (keynum==40 || keynum==13 ) {
		if (num<x.length) {
			x[num].focus();
		}
	} else if (keynum==38) {
		if (num>1) {
			x[num-2].focus();
		}
}
return false;
}
function showSelect() {
	if (isIE && version<7) {
			svn=document.getElementsByTagName("SELECT");
			for (a=0;a<svn.length;a++){
			svn[a].style.display="";
			}
	}
}
function hideSelect() {
	if (isIE && version<7) {
		svn=document.getElementsByTagName("SELECT");
		for (a=0;a<svn.length;a++){
			svn[a].style.display="none";

		}
	}
}
function changeDot(value) {
	value=value.replace(",",".");
	return value;
}
function roundNumber(num, dec) {
    var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
    return result.toFixed(dec);
}
