function freplacepictgal(i){
	
	TmpTxt = document.getElementById('gal' + i).getAttribute('src');
	document.getElementById('bigpict').setAttribute('src', TmpTxt.replace('small', 'big'));
	tmpar = document.getElementById('bigpict').getAttribute('src').replace('http://www.onestyle.com.ua/', '').split('/');
	tmpar[3] = tmpar[3].replace('.jpg', '');
	switch(tmpar[2]){
	case 'other':
		for(j=0;j<2000;j++){
			tmpar[3]++;
		}
		break;
	case 'fon':
		for(j=0;j<1000;j++){
			tmpar[3]++;
		}
		break;
	}

document.location = '/galary.php?u=' + tmpar[3];
}

function showGal(direct) {
	if (direct > 0){
		document.getElementById('gal1').setAttribute('src', document.getElementById('gal2').getAttribute('src'));
		document.getElementById('gal2').setAttribute('src', document.getElementById('gal3').getAttribute('src'));
		document.getElementById('gal3').setAttribute('src', document.getElementById('gal4').getAttribute('src'));
			
		tmpar = document.getElementById('gal4').getAttribute('src').replace('http://www.onestyle.com.ua/', '').split('/');
		
		tmpar[3] = tmpar[3].replace('.jpg', '');
		tmpar[3] ++;
		
		switch(tmpar[2]){
		case 'other':
			if (tmpar[3] > maxImage3){
				tmpar[3] = 0;
			}
			break;
		case 'fon':
			if (tmpar[3] > maxImage2){
				tmpar[3] = 0;
			}
			break;
		case 'interier':
			if (tmpar[3] > maxImage1){
				tmpar[3] = 0;
			}
			break;
		}
		
		document.getElementById('gal4').setAttribute('src', 'galary/small/' + tmpar[2] + '/' + tmpar[3] + '.jpg');
	}else{
		document.getElementById('gal4').setAttribute('src', document.getElementById('gal3').getAttribute('src'));
		document.getElementById('gal3').setAttribute('src', document.getElementById('gal2').getAttribute('src'));
		document.getElementById('gal2').setAttribute('src', document.getElementById('gal1').getAttribute('src'));	
		
		tmpar = document.getElementById('gal1').getAttribute('src').replace('http://www.onestyle.com.ua/', '').split('/');
		
		tmpar[3] = tmpar[3].replace('.jpg', '');
		tmpar[3] --;
				
		switch(tmpar[2]){
		case 'other':
			if (tmpar[3] < 0){
				tmpar[3] = maxImage3;
			}
			break;
		case 'fon':
			if (tmpar[3] < 0){
				tmpar[3] = maxImage2;
			}
			break;
		case 'interier':
			if (tmpar[3] < 0){
				tmpar[3] = maxImage1;
			}
			break;
		}
		
		document.getElementById('gal1').setAttribute('src', 'galary/small/' + tmpar[2] + '/' + tmpar[3] + '.jpg');
	}
}
function getdata(i){
	tmpar = document.getElementById('bigpict').getAttribute('src').replace('http://www.onestyle.com.ua/', '').split('/');
	tmpar[3] = tmpar[3].replace('.jpg', '');
	switch(tmpar[2]){
	case 'other':
		for(j=0;j<2000;j++){
			tmpar[3]++;
		}
		break;
	case 'fon':
		for(j=0;j<1000;j++){
			tmpar[3]++;
		}
		break;
	}	
	document.getElementById('fgetinfo').setAttribute('action', '/galary.php?u=' + tmpar[3]);
}