function initsieeri(skoop) {

}
function emkautocomplete() {

	window['autocomp'] = true;
	
	var cachedData = null;
	$('#i01-03').autocomplete({
		delay: 200, 
		autoFocus: false, 
		minLength:3,
        source: function( request, response ) {
            var term=request.term.toUpperCase(), 
                labelsToShow=[],
		i,
		len,
		cur;
            if (cachedData) {
                for (i=0,len=cachedData.length;i<len;++i) {
                    cur = cachedData[i];
                    if (cur.label.toUpperCase().indexOf(term)>=0) {
                        labelsToShow.push(cur);
                    }
                }
		response(labelsToShow);
	    } else {
                $.getJSON( "ipank?act=GETPREDEFPAYM&mmtype=EMK&sesskey=" + document.unmainForm.sesskey.value, request, function( data, status, xhr ) {
                    cachedData = data.items;
                    for (i=0,len=cachedData.length;i<len;++i) {
                    	cur = cachedData[i];
	                if (cur.label.toUpperCase().indexOf(term)>=0) {
	                    labelsToShow.push(cur);
        	        }
	            }
		    response(labelsToShow);
                });
            }
        },
        select: function(e,ui) {
             var data = ui.item;
              
             document.unmainForm.saajanimi.value=data.crname;
             document.unmainForm.saajakonto.value=data.craaa;
             document.unmainForm.selgitus.value=data.desc;
             document.unmainForm.viitenr.value=data.refnr;
             document.unmainForm.summa.value=data.sum;
             document.unmainForm.mmknr.value=data.mmnr; 
             document.unmainForm.mmselect.value=data.mmnr;
             document.unmainForm.mmkkonto.value=data.dbaaa; 
             changeSel(document.unmainForm.accc, data.dbaaa); 
             changeSel(document.unmainForm.valuuta, data.crc); 
             var limit_free = $('#source_acc').find('OPTION:selected').attr('limit_free');
             $('#limit_free').html(limit_free);
             var limit_day = $('#source_acc').find('OPTION:selected').attr('limit_day');
             $('#limit_day').html(limit_day);
             $('#mmtext').html(document.unmainForm.mmchangetext.value);
             document.unmainForm.mmkaction.value='CHANGE';
	     $('#source_acc').multiselect('refresh');
             //console.log(ui);
             return false;
        }
});
}
function valmistaemkautocomplete() {

	window['autocomp'] = true;
	
	var cachedData = null;
	$('#i01-03').autocomplete({
		delay: 200, 
		autoFocus: false, 
		minLength:3,
	        source: function( request, response ) {
	            var term=request.term.toUpperCase(), 
	                labelsToShow=[],
			i,
			len,
			cur;
	            if (cachedData) {
	                for (i=0,len=cachedData.length;i<len;++i) {
	                    cur = cachedData[i];
	                    if (cur.label.toUpperCase().indexOf(term)>=0) {
	                        labelsToShow.push(cur);
	                    }
	                }
			response(labelsToShow);
		    } else {
	                $.getJSON( "ifirma?act=GETPREDEFPAYM&mmtype=EMK&sesskey=" + document.unmainForm.sesskey.value, request, function( data, status, xhr ) {
	                    cachedData = data.items;
	                    for (i=0,len=cachedData.length;i<len;++i) {
	                    	cur = cachedData[i];
		                if (cur.label.toUpperCase().indexOf(term)>=0) {
		                    labelsToShow.push(cur);
	        	        }
		            }
			    response(labelsToShow);
	                });
	            }
	        },
	        select: function(e,ui) {
	        	
	        	var data = ui.item;
	        	document.unmainForm.saajanimi.value=data.crname;
	        	document.unmainForm.saajakonto.value=data.craaa;
	        	document.unmainForm.selgitus.value=data.desc; 
	        	document.unmainForm.viitenr.value=data.refnr;
	        	document.unmainForm.summa.value=data.sum;
	        	document.unmainForm.comment_mma_text.value=''; 
	        	document.unmainForm.mmno.value=data.mmnr;
	        	document.unmainForm.mmselect.value=data.mmnr;
	        	changeSel(document.unmainForm.accc, data.dbaaa); 
	        	if(data.crc>'')changeSel(document.unmainForm.valuuta, data.crc); 
	        	var limit_free = $('#source_acc').find('OPTION:selected').attr('limit_free');
	        	$('#limit_free').html(limit_free);
	        	var limit_day = $('#source_acc').find('OPTION:selected').attr('limit_day');
	        	$('#limit_day').html(limit_day);
	        	document.unmainForm.mmadd.checked='';
	        	$('#additional-comment-toggle1').prop('name','mmchange');
	        	$('#mmtext').text(document.hiddentext.hdn1.value);
	        	//$('#i01-03').attr('readonly','readonly').addClass('disabled').parents('TD').eq(0).find('A.removevalue').removeClass('hidden');
	        	$('#source_acc').multiselect('refresh');
	        	return false;
	        }
	});
}

function unhideComment(self){ 
	if($(self).is(':checked')){
		$(self).parent('div').children('p').removeClass('hidden');
	}
	else {
		$(self).parent('div').children('p').addClass('hidden');
	}
}

function checkUnCheckAll(self){ 
	if($(self).is(':checked')){
		$(self).closest('ul').find('input:checkbox').prop('checked',true);
	}
	else {
		$(self).closest('ul').find('input:checkbox').prop('checked', false);
	}
}


require.config({
    paths: {
        'highstock': '/unet3/js/ipank/highstock'
    }
});


requirejs.config({
baseUrl: '/ipank/resp/js/',
paths: {
'jquery.column': 'jquery.column',
'highcharts': 'highcharts/highcharts',
'highcharts.more': 'highcharts/highcharts-more',
'history': 'jquery.history',
'highstock': '/ipank/resp/js/highstock',
'swfobject': 'swfobject/swfobject',
'sparkline': 'jquery.sparkline',
'swipe': 'jquery.touchSwipe.min'
},
priority: [
"jquery",
"jquery.column",
"highcharts",
"highcharts.more",
"highstock",
"history",
"swfobject",
"sparkline",
"footable",
"swipe"
],
shim: {
'jquery': {
exports: '$'
},
'highcharts': {
exports: 'Highcharts'
},
'highcharts.more': {
deps: ['highcharts']
},
'highstock': {
depends: 'highcharts',
exports: 'Highcharts'
},
'history': {
exports: 'hashchange'
},
'sparkline': {
exports: 'sparkline'
},
'footable': {
exports: 'footable'
}
}
});