<!--
$(document).ready(function(){

	var paybackValues = new Array();
	paybackValues['14'] = new Array();
	paybackValues['14']['50'] = 62;
	paybackValues['14']['100'] = 120;
	paybackValues['14']['150'] = 180;
	paybackValues['14']['200'] = 240;
	paybackValues['14']['250'] = 300;
	
	paybackValues['28'] = new Array();
	paybackValues['28']['200'] = 130;
	paybackValues['28']['300'] = 185;
	paybackValues['28']['400'] = 240;
	paybackValues['28']['500'] = 300;
	paybackValues['28']['600'] = 360;
	paybackValues['28']['700'] = 420;
	paybackValues['28']['800'] = 480;
	paybackValues['28']['900'] = 540;
	paybackValues['28']['1000'] = 600;
	
	paybackValues['30'] = new Array();
	paybackValues['30']['200'] = 265;
	paybackValues['30']['250'] = 325;
	paybackValues['30']['300'] = 380;
	paybackValues['30']['400'] = 495;
	paybackValues['30']['500'] = 625;
	paybackValues['30']['600'] = 760;
	paybackValues['30']['700'] = 880;
	paybackValues['30']['800'] = 1000;
	paybackValues['30']['900'] = 1120;
	paybackValues['30']['1000'] = 1240;
	
	paybackValues['56'] = new Array();
	paybackValues['56']['300'] = 110;
	paybackValues['56']['400'] = 140;
	paybackValues['56']['500'] = 170;
	paybackValues['56']['600'] = 205;
	paybackValues['56']['700'] = 240;
	paybackValues['56']['800'] = 270;
	paybackValues['56']['900'] = 300;
	paybackValues['56']['1000'] = 330;

    var values = [50, 100, 150, 200, 250, 300, 400, 500, 600, 700, 800, 900, 1000]; 
	 $("#scale").slider({ 
        range: "min", 
        value: 150, 
        min: 50, 
        max: 1000, 
        slide: function(event, ui) { 
			
			var includeLeft = event.keyCode != $.ui.keyCode.RIGHT; 
            var includeRight = event.keyCode != $.ui.keyCode.LEFT; 
            var value = findNearest(includeLeft, includeRight, ui.value); 
            $('#cResult1, #amount').html(value + '&euro;');
			$('#sum').val(value);
			if (value < 200) {
				$('#paytype').val('A');
				$('#calculator div:not(#scale) a').removeClass('on').addClass('off');
				$('DIV#days1 a').removeClass('off').addClass('on');
				$('#cResult2').html('14 p');
				$('#cResult4').html(paybackValues['14'][value] + ' &euro;');
				$('#paymentsCountTitle').hide();
				$('#paymentsCount').hide();
			} else {

				if (value == 250) {
						$('#paytype').val('C');
						$('#calculator div:not(#scale) a').removeClass('on').addClass('off');
						$('DIV#days3 a').removeClass('off').addClass('on');
						$('#cResult2').html('30 p');
						$('#cResult4').html(paybackValues['30'][value] + ' &euro;');
						$('#paymentsCountTitle').hide();
						$('#paymentsCount').hide();
					} else {
						if (value > 200 && $('#paytype').val() == 'A') {
								$('#paytype').val('B');
								$('#calculator div:not(#scale) a').removeClass('on').addClass('off');
								$('DIV#days2 a').removeClass('off').addClass('on');
								$('#cResult2').html('28 p');
								$('#cResult4').html(paybackValues['28'][value] + ' &euro;');
								$('#paymentsCountTitle').show();
								$('#paymentsCount').html('2').show();
							}  else {

							switch($('#paytype').val())
							{
								case 'A':
									$('#cResult4').html(paybackValues['14'][value] + ' &euro;');
									$('#cResult2').html('14 p');
									$('#paymentsCountTitle').hide();
									$('#paymentsCount').hide();
								break;
								case 'B':
									$('#cResult4').html(paybackValues['28'][value] + ' &euro;');
									$('#cResult2').html('28 p');
									$('#paymentsCountTitle').show();
									$('#paymentsCount').show();
								break;
								case 'C':
									$('#cResult4').html(paybackValues['30'][value] + ' &euro;');
									$('#cResult2').html('30 p');
									$('#paymentsCountTitle').hide();
									$('#paymentsCount').hide();
								break;
								case 'D':
									$('#cResult4').html(paybackValues['56'][value] + ' &euro;');
									$('#cResult2').html('56 p');
									$('#paymentsCountTitle').show();
									$('#paymentsCount').show();
								break;
							}
						}
					}
			}
        } 
    }); 
	
	function findNearest(includeLeft, includeRight, value) { 
        var nearest = null; 
        var diff = null; 
        for (var i = 0; i < values.length; i++) { 
            if ((includeLeft && values[i] <= value) || (includeRight && values[i] >= value)) { 
                var newDiff = Math.abs(value - values[i]); 
                if (diff == null || newDiff < diff) { 
                    nearest = values[i]; 
                    diff = newDiff; 
                } 
            } 
        } 
        return nearest; 
    }

	$('#calculator div:not(#scale) a').click(function() {
		var selectedType = $(this).parent('DIV').attr('id');
		var currentSum = $('#sum').val();
		switch(selectedType){
			case 'days1':
				if (currentSum <= 250) {
					$('#paytype').val('A');
					$('#calculator div:not(#scale) a').removeClass('on').addClass('off');
					$(this).removeClass('off').addClass('on');
					$('#cResult2').html('14 p');
					$('#cResult4').html(paybackValues['14'][currentSum] + ' &euro;');
					$('#paymentsCountTitle').hide();
					$('#paymentsCount').hide();
				} 
			break;
			case 'days2':
				if (currentSum >= 200 && currentSum != 250) {
					$('#paytype').val('B');
					$('#calculator div:not(#scale) a').removeClass('on').addClass('off');
					$(this).removeClass('off').addClass('on');
					$('#cResult2').html('28 p');
					$('#cResult4').html(paybackValues['28'][currentSum] + ' &euro;');
					$('#paymentsCountTitle').show();
					$('#paymentsCount').html('2').show();
				}
			break;
			case 'days3':
				if (currentSum >= 200) {
					$('#paytype').val('C');
					$('#calculator div:not(#scale) a').removeClass('on').addClass('off');
					$(this).removeClass('off').addClass('on');
					$('#cResult2').html('30 p');
					$('#cResult4').html(paybackValues['30'][currentSum] + ' &euro;');
					$('#paymentsCountTitle').hide();
					$('#paymentsCount').hide();
				}
			break;
			case 'days4':
				if (currentSum >= 300 && currentSum != 250) {
					$('#paytype').val('D');
					$('#calculator div:not(#scale) a').removeClass('on').addClass('off');
					$(this).removeClass('off').addClass('on');
					$('#cResult2').html('56 p');
					$('#cResult4').html(paybackValues['56'][currentSum] + ' &euro;');
					$('#paymentsCountTitle').show();
					$('#paymentsCount').html('4').show();
				}
			break;
		}
		
	});

var loanValues = new Array(14,28,30);
loanValues[14] = new Array(50, 100, 150, 200, 250);
loanValues[28] = new Array(200, 300, 400, 500, 600, 700, 800, 900, 1000);
loanValues[30] = new Array(200, 300, 400, 500, 600, 700, 800, 900, 1000);

// XHTML STRICT...
$('A[rel="external"]').click( function() {
	window.open( $(this).attr('href') );
	return false;
});

$('#pst').change(function(){
	$('#psa').children().remove(); 
	elements = loanValues[$(this).val()];

	for(i = 0; i < elements.length; i++) {
		$('#psa').append('<option value="'+elements[i]+'">'+elements[i]+'</option>'); 
	}

});


$('form[id]').each(function(){
	$(this).attr("name",$(this).attr("id"))
});


$("#tupas_bank").change(function () { if($("#tupas_bank option:selected").val() != "-"){eval('document.'+$('#tupas_bank').val()+'.submit()');}});

$("ul#mainmenu li").children("a.on").parents("li").prev().children("a").css("background","none")

$("table tr:even td").addClass("odd");
$("#leftcol table tr:last td").css("border","none")

// FAQ PAGE

$("ul.faq").children("li").children("*:not(a:first-child)").hide();

$("ul.faq").children("li").children("a:first-child").toggle(function() {
	$(this).parents("li").children("*:not(a:first-child)").show();
	return false;
},function() {
	$(this).parents("li").children("*:not(a:first-child)").hide();
	return false;
});




if(typeof sIFR == "function"){
	sIFR.replaceElement(named({
		sSelector:"h2", 
		sFlashSrc:"/sifr.swf", 
		sColor:"#5fc401", 
		sWmode:"transparent"
	}));
	sIFR.replaceElement(named({
		sSelector:"#contentwrapper h1", 
		sFlashSrc:"/sifr.swf", 
		sColor:"#5fc401", 
		sWmode:"transparent"
	}));
	sIFR.replaceElement(named({
		sSelector:"#content h1", 
		sFlashSrc:"/sifr.swf", 
		sColor:"#5fc401", 
		sWmode:"transparent"
	}));
//setTimeout(function(){
	$("#rightcol h2.sIFR-replaced").css("margin","-3px 0 14px 0");
	$("#leftcol h2.sIFR-replaced").css("margin","16px 0 10px 0");
	$("#leftcol #rightcol h2.sIFR-replaced").css("margin","-3px 0 14px 0");
	$("#leftcol h2.sIFR-replaced:first").css("margin","0 0 10px 0");

	$("#rightcol h2.sIFR-replace.disalign").css("margin","16px 0 10px -20px");

//},10);
};


if($("#banner").length == 1){
	var so = new SWFObject("/banner.swf", "banner", "942px", "201px", "10", "");
	so.addParam("scale", "noscale");
	so.addParam("wmode", "transparent");
	so.write("banner");
}


});
-->
