function showImageDetails( image_url, image_width, image_height ) {

	var oConfig = { 'url': image_url, 'width': image_width, 'height': image_height };
	
	createWindow( oConfig );
	
}

function changeRadioSelect( radioname ){
	oRadio = document.getElementById( radioname + '_radio' );
	oRadio.checked = true;
}

//funkcija kvieciama kai pakeiciama apskrities dropdown'o reiksme
function regionUpdate( prefix ){
	oRegionSelect = document.getElementById( prefix + '_region_select' );
	
	oCitySelect = document.getElementById( prefix + '_city_select' );
	oCityBlock = document.getElementById( prefix + '_city_block' );

	//isvalom city dropdown'a
	oCitySelect.options.length = 0;
	
	oDistrictSelect = document.getElementById( prefix + '_district_select' );
	oDistrictBlock = document.getElementById( prefix + '_district_block' );

	if( oDistrictSelect != null ){
		//isvalom rajonu dropdown'a
		oDistrictSelect.options.length = 0;
		//uzhide'inam nereikalingus
		oDistrictBlock.style.display = 'none';
	}

	oItemSelect = document.getElementById( prefix + '_' + prefix + '_select' );
	if( oItemSelect != null ){
		oItemBlock = document.getElementById( prefix + '_' + prefix + '_block' );

		//isvalom vaistiniu dropdown'a
		oItemSelect.options.length = 0;
		oItemBlock.style.display = 'none';
	}
	
	//tikrinam ar pasirinktas elementas turi id
	if( oRegionSelect.value > 0 ){
		//idedam default reiksmes
		oCitySelect.options[oCitySelect.options.length] = new Option( defaultDropdownText, 0 );
		if( oDistrictSelect != null ){
			oDistrictSelect.options[oDistrictSelect.options.length] = new Option( defaultDropdownText, 0 );
		}
		
		//tikrinam ar yra sarysiu su miestais
		if( typeof( regionCityRel[prefix][oRegionSelect.value] ) != 'undefined' && regionCityRel[prefix][oRegionSelect.value].length > 0 ){
			if( oCityBlock != null ){
				oCityBlock.style.display = 'block';
			}
			for( idx in regionCityRel[prefix][oRegionSelect.value] ){
				oCitySelect.options[oCitySelect.options.length] = new Option( regionCityRel[prefix][oRegionSelect.value][idx], idx );
			}
		}else{
			if( oCityBlock != null ){
				oCityBlock.style.display = 'none';
			}
		}
	}else{
		if( oCityBlock != null ){
			oCityBlock.style.display = 'none';
		}
	}
}

//funkcija kvieciama kai pakeiciama miesto dropdown'o reiksme
function cityUpdate( prefix ){
	oCitySelect = document.getElementById( prefix + '_city_select' );
	
	oDistrictSelect = document.getElementById( prefix + '_district_select' );
	oDistrictBlock = document.getElementById( prefix + '_district_block' );

	//isvalom rajonu dropdown'a
	oDistrictSelect.options.length = 0;

	oItemSelect = document.getElementById( prefix + '_' + prefix + '_select' );
	if( oItemSelect != null ){
		oItemBlock = document.getElementById( prefix + '_' + prefix + '_block' );

		//isvalom vaistiniu dropdown'a
		oItemSelect.options.length = 0;
	}
	
	//tikrinam ar pasirinktas elementas turi id
	if( oCitySelect.value > 0 ){
		//idedam default reiksmes
		oDistrictSelect.options[oDistrictSelect.options.length] = new Option( defaultDropdownText, 0 );
		
		//tikrinam ar yra sarysiu su rajonais
		if( typeof( cityDistrictRel[prefix][oCitySelect.value] ) != 'undefined' && cityDistrictRel[prefix][oCitySelect.value].length > 0 ){
			oDistrictBlock.style.display = 'block';
			for( idx in cityDistrictRel[prefix][oCitySelect.value] ){
				oDistrictSelect.options[oDistrictSelect.options.length] = new Option( cityDistrictRel[prefix][oCitySelect.value][idx], idx );
			}
		}else{
			oDistrictBlock.style.display = 'none';
		}
		
		if( oItemSelect != null ){
			oItemSelect.options[oItemSelect.options.length] = new Option( defaultDropdownText, 0 );
			//tikrinam ar yra sarysiu su vaistinem
			if( typeof( cityItemRel[prefix][oCitySelect.value] ) != 'undefined' && cityItemRel[prefix][oCitySelect.value].length > 0 ){
				oItemBlock.style.display = 'block';
				for( idx in cityItemRel[prefix][oCitySelect.value] ){
					oItemSelect.options[oItemSelect.options.length] = new Option( cityItemRel[prefix][oCitySelect.value][idx], idx );
				}
			}else{
				oItemBlock.style.display = 'none';
			}
		}
	}else{
		oDistrictBlock.style.display = 'none';
	}
}

function districtUpdate( prefix ){
	oDistrictSelect = document.getElementById( prefix + '_district_select' );

	oItemSelect = document.getElementById( prefix + '_' + prefix + '_select' );
	if( oItemSelect != null ){
		oItemBlock = document.getElementById( prefix + '_' + prefix + '_block' );

		//isvalom vaistiniu dropdown'a
		oItemSelect.options.length = 0;
	
		//tikrinam ar pasirinktas elementas turi id
		if( oDistrictSelect.value > 0 ){
			//idedam default reiksmes
			oItemSelect.options[oItemSelect.options.length] = new Option( defaultDropdownText, 0 );
			
			//tikrinam ar yra sarysiu su vaistinem
			if( typeof( districtItemRel[prefix][oDistrictSelect.value] ) != 'undefined' && districtItemRel[prefix][oDistrictSelect.value].length > 0 ){
				oItemBlock.style.display = 'block';
				for( idx in districtItemRel[prefix][oDistrictSelect.value] ){
					oItemSelect.options[oItemSelect.options.length] = new Option( districtItemRel[prefix][oDistrictSelect.value][idx], idx );
				}
			}else{
				oItemBlock.style.display = 'none';
			}
		}else{
			cityUpdate( prefix );
		}
	}
}

function reciever_change(){
	oCheckbox = document.getElementById( 'reciever' );
	oRecieverName = document.getElementById( 'reciever_name' );
	oRecieverSurName = document.getElementById( 'reciever_surname' );
	//oRecieverName.value = '';
	//oRecieverSurName.value = '';
	
	oRecieverBlock = document.getElementById( 'reciever_block' );
	
	if( oCheckbox.checked ){
		oRecieverBlock.style.display = 'block';
	}else{
		oRecieverBlock.style.display = 'none';
	}
}

