function Risalnik(tip,id){

	
	var data = $('risalnik_izberi');
	var risalnik = $('risalnik');
	var select = $('select');
	//var breadcrums = $('breadcrums');
	//var loader = '<div id="right_main_listing_loader"><img src="/img/ajax-loader.gif" /></div>';
	if(tip == 2){
		//Listing
		select.style.display = 'none';
		data.style.display = 'block';
		
		new Ajax.Request('/content/ajax/risalnik.php',
		{
			parameters: {tip: tip,id: id},
			onSuccess: function(transport)
			{
				if(transport.responseText){
					data.innerHTML = transport.responseText;
				}else{
					alert("Hmm i have some problems. Please contact administrator");
				}
			},
			on800: function(transport)
			{
				alert("Hmm i have some problems. Please contact administrator");
			}
		});
		
	}else if(tip == 1){
		select.style.display = 'none';
		risalnik.style.display = 'block';
	}else{
		select.style.display = 'block';
		risalnik.style.display = 'none';
		data.style.display = 'none';
	}
}


function Select(value) {
	var selectforma = document.getElementsByName('forma');
	var fillforma = document.getElementById('debelina');
	// Clear out the list of teams
	ClearOptions(fillforma);
	fillforma.disable = true;
	if(value.search(/POCINKANA PLOČEVINA/) != -1){
		AddToOptionList(fillforma, "0,50", "0,50");
		AddToOptionList(fillforma, "0,55", "0,55");
		AddToOptionList(fillforma, "0,60", "0,60");
		AddToOptionList(fillforma, "0,80", "0,80");
		AddToOptionList(fillforma, "1,00", "1,00");
		AddToOptionList(fillforma, "1,20", "1,20");
		AddToOptionList(fillforma, "1,50", "1,50");
		AddToOptionList(fillforma, "2,00", "2,00");
		fillforma.disabled = false;
	}else if(value.search(/POCINKANA BARVANA PLOČEVINA/) != -1) {
		AddToOptionList(fillforma, "0,50", "0,50");
		AddToOptionList(fillforma, "0,55", "0,55");
		AddToOptionList(fillforma, "0,60", "0,60");
		AddToOptionList(fillforma, "0,80", "0,80");
		AddToOptionList(fillforma, "1,00", "1,00");
		AddToOptionList(fillforma, "1,20", "1,20");
		AddToOptionList(fillforma, "1,50", "1,50");
		AddToOptionList(fillforma, "2,00", "2,00");
		fillforma.disabled = false;
		selectforma.disabled = true;
	}else if(value.search(/ALUMINIJ PLOČEVINA/) != -1) {
		AddToOptionList(fillforma, "0,50", "0,50");
		AddToOptionList(fillforma, "0,60", "0,60");
		AddToOptionList(fillforma, "0,70", "0,70");
		AddToOptionList(fillforma, "0,80", "0,80");
		AddToOptionList(fillforma, "1,00", "1,00");
		AddToOptionList(fillforma, "1,20", "1,20");
		AddToOptionList(fillforma, "1,50", "1,50");
		AddToOptionList(fillforma, "2,00", "2,00");
		AddToOptionList(fillforma, "3,00", "3,00");
		fillforma.disabled = false;
		selectforma.disabled = true;
	}else if(value.search(/ALUMINIJ BARVANA PLOČEVINA/) != -1) {
		AddToOptionList(fillforma, "0,70", "0,70");
		AddToOptionList(fillforma, "0,80", "0,80");
		AddToOptionList(fillforma, "1,00", "1,00");
		fillforma.disabled = false;
		selectforma.disabled = true;
	}else if(value.search(/BAKRENA PLOČEVINA/) != -1) {
		AddToOptionList(fillforma, "0,55", "0,55");
		AddToOptionList(fillforma, "0,60", "0,60");
		AddToOptionList(fillforma, "0,80", "0,80");
		AddToOptionList(fillforma, "1,00", "1,00");
		fillforma.disabled = false;
		selectforma.disabled = true;
	}else if(value.search(/TITANZINK/) != -1) {
		AddToOptionList(fillforma, "0,60", "0,60");
		AddToOptionList(fillforma, "0,70", "0,70");
		AddToOptionList(fillforma, "0,80", "0,80");
		AddToOptionList(fillforma, "1,00", "1,00");
		fillforma.disabled = false;
		selectforma.disabled = true;
	}else if(value.search(/NERJAVEČA PLOČEVINA/) != -1) {
		AddToOptionList(fillforma, "0,50", "0,50");
		AddToOptionList(fillforma, "0,60", "0,60");
		AddToOptionList(fillforma, "0,70", "0,70");
		AddToOptionList(fillforma, "0,80", "0,80");
		AddToOptionList(fillforma, "1,00", "1,00");
		fillforma.disabled = false;
		selectforma.disabled = true;
	}else{
		AddToOptionList(fillforma, "Vpišite pod komentar", "Vpišite pod komentar");
		fillforma.disabled = false;
		selectforma.disabled = true;
	}
		
}

function ClearOptions(OptionList) {

	//Always clear an option list from the last entry to the first
	for (x = OptionList.length; x >= 0; x = x - 1) {
		OptionList[x] = null;
	}

}

function AddToOptionList(OptionList, OptionValue, OptionText) {
	OptionList[OptionList.length] = new Option(OptionText, OptionValue);
}