$(document).ready(function() {

	$('.box').click(function() {
		$(this).find('.hidden').slideToggle('slow');
		src = $(this).find('.but img').attr("src");
		if(src.lastIndexOf("box_close.gif")!=-1) {
			src = 'images/box_open.gif';
		} else {
			src = 'images/box_close.gif';
		}
		$(this).find('.but img').attr("src",src);
	});
	$(document).pngFix();
	$('.clients li').hover(function () {
		$(this).find('.hidden').fadeIn('slow');							
	}, function () {
		$(this).find('.hidden').fadeOut('slow');							
	});
	$('.clients li').click(function() {
		hr = $(this).find('.hidden .present a').attr("href");
		if(hr) {
            window.location.href = hr;
		}
		
	});
	
	$('.editors li').hover(function () {
		$(this).find('.hidden').fadeIn('slow');							
	}, function () {
		$(this).find('.hidden').fadeOut('slow');							
	});
	
	$('#rus_lang').click(function() {
		hr = location.href;
		if(location.pathname=='/'){
			location.href = 'index_rus.php';
			return false;
		}
		if(hr.lastIndexOf('_rus.php')==-1) {
			if(hr.lastIndexOf('_eng.php')!=-1) {
				pos =  hr.lastIndexOf('_eng.php')	
			} else {
				pos =  hr.lastIndexOf('.php')
		 	}
			hr_new = hr.substr(0,pos)+'_rus.php';
			location.href = hr_new;
		} 
		return false;							  
	});
	
	$('#eng_lang').click(function() {
		hr = location.href;
		if(location.pathname=='/'){
			location.href = 'index_eng.php';
			return false;
		}
		if(hr.lastIndexOf('_eng.php')==-1) {
			if(hr.lastIndexOf('_rus.php')!=-1) {
				pos =  hr.lastIndexOf('_rus.php')	
			} else {
				pos =  hr.lastIndexOf('.php')
		 	}
			hr_new = hr.substr(0,pos)+'_eng.php';
			location.href = hr_new;
		} 

		return false;							  
	});
		
	$('#ukr_lang').click(function() {
		hr = location.href;
		if(hr.lastIndexOf('_rus.php')!=-1) {
			pos =  hr.lastIndexOf('_rus.php')
			hr_new = hr.substr(0,pos)+'.php';
			location.href = hr_new;
		} 
		if(hr.lastIndexOf('_eng.php')!=-1) {
			pos =  hr.lastIndexOf('_eng.php')
			hr_new = hr.substr(0,pos)+'.php';
			location.href = hr_new;
		} 
		return false;							  
	});
});