
var W3CDOM = (document.createElement && document.getElementsByTagName);

function initFileUploads() {
	if (!W3CDOM) return;
	var fakeFileUpload = document.createElement('div');
	fakeFileUpload.className = 'fakefile';
	fakeFileUpload.appendChild(document.createElement('input'));
	var image = document.createElement('div');
	image.id ='im';
	image.innerHTML='файл не выбран';
	fakeFileUpload.appendChild(image);
	var x = document.getElementsByTagName('input');
	
	
	for (var i=0;i<x.length;i++) {
		if (x[i].type != 'file') continue;
		if (x[i].parentNode.id != 'li--8') continue;
		x[i].className = 'file hidden';
		var clone = fakeFileUpload.cloneNode(true);
		x[i].parentNode.appendChild(clone);
		
		
		x[i].relatedElement = clone.getElementsByTagName('input')[0];
			
		x[i].onchange = x[i].onmouseout = function () {
			if(this.value!=""){
			document.getElementById('im').innerHTML=' ';
			var names = (this.value).split("\\");
			$('#im').css("padding","2px 0px 0px 5px;");
			this.relatedElement.value =names[names.length-1];
			} else
			{
				image.innerHTML='файл не выбран';
				$('#im').css("padding","2px 0px 0px 25px");
			}
		}
	}
}


$(document).ready(function(){




var flaq;
var currentTab;
var tab1="";
var tab2;
$('.nav li ').hover(function () {
tab2="tab"+$(this).attr('id');
if(tab1!=tab2)$('.sub-nav').fadeOut("fast");
// flaq=true;


currentTab = "#"+tab2; // Set variable currentTab to value of href attribute of clicked link
if(tab1!=tab2)$(currentTab).fadeIn("fast"); // Show div with id equal to variable currentTab
return false;

},	function () {});

$('.sub-nav').hover(function () {
	flaq=true;
	tab1=$(this).attr('id');
	},function () {
	if(tab1!=tab2){$(this).fadeOut("fast"); tab1 = "";}
	

});

$('.navigation  ').hover(function () {},
	
	function () {
	
	  $(currentTab).fadeOut("fast");
	  tab1 = "";
	}
	);


});




$(document).ready(function(){
initFileUploads();
var mes_title = $('textarea').html();
$('input[type="text"]').focus(function () {
	$(this).css("background","#faeee2");
});

$('input[type="text"]').blur(function () {
		$(this).css("background","transparent");
});




$('textarea').click(function () {
	if($(this).html()==mes_title){
		$(this).empty();
		$(this).css("background","#faeee2");
		
	} 

});

$('textarea').blur(function () {
	

	if($(this).html()==""){
		$(this).html(mes_title);
		$(this).css("background","transparent");
	
	}
});



});
