// Set active button for Admin menu.
function adminMenuActiveButton()
{
	if(document.getElementById('navigationMenu') != null)
	{
		var sPath = window.location.pathname;
		var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
		
		//Button
		var viewMesButton = document.getElementById('viewMesButton');
		var viewCvButton = document.getElementById('viewCvButton');
		var viewCvArButton = document.getElementById('viewCvArButton');
		
		switch(sPage)
		{
			case "viewMes.php":
				viewMesButton.className = 'adminMenuHover';
			break;
			case "viewCv.php":
				viewCvButton.className = 'adminMenuHover';
			break;
			case "viewCvAr.php":
				viewCvArButton.className = 'adminMenuHover';
			break;
		}
	}
}
// End function


////////////////////////////////////////////////////////////////////////


// Set style for Input tags, which are with type = TEXT or PASSWORD.
function txtInput()
{
	var sPath = window.location.pathname;
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	if(sPage != "contact_us.php")
	{
		var txtInputField = document.getElementsByTagName('input');
		for(i = 0; i < txtInputField.length; i++)
		{
			if((txtInputField[i].type == 'text') || (txtInputField[i].type == 'password'))
			{
				txtInputField[i].className = 'txtInputStyle_1';
			}
		}
	}
}
// End function.


////////////////////////////////////////////////////////////////////////


// ????? ???????? ?? ?????? ?? ?????? ?? ?????????? ????????.
function fixBrowsersBugs()
{
	var browserVersion = navigator.appVersion;
	var brString = browserVersion.indexOf("MSIE", 0);
	var curString = brString + 5;
	var brVersion = (browserVersion.substr(curString, 3));
	if(navigator.appName == "Microsoft Internet Explorer")
	{
		if(brVersion == "6.0")
		{
			var sPath = window.location.pathname;
			var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
			if(sPage == "")
			{
				alert("Please, update your browser.");
			}
		}
		if(brVersion == "7.0")
		{
			if(document.getElementById('banner2') != null)
			{
				document.getElementById('banner2').style.marginTop = "2";	
			}
			if(document.getElementById('servicesSubMenu') != null)
			{
				var links = document.getElementById('servicesSubMenu').getElementsByTagName('a');
				for(i = 0; i < links.length; i++)
				{
					links[i].style.marginTop = "14";
				}
			}
			if(document.getElementById('bottomSide') != null)
			{
				document.getElementById('bottomSide').style.paddingBottom = "25px";
			}
		}
	}
	if(navigator.appName == "Netscape")
	{
		if(document.getElementById('upload_file') != null)
		{
			document.getElementById('upload_file').style.marginRight = "90px";
		}
		
		
		var inputs = document.getElementsByTagName('input');
		for(i = 0; i < inputs.length; i++)
		{
			if((inputs[i].getAttribute('type') == 'submit') || (inputs[i].getAttribute('type') == 'reset') || (inputs[i].getAttribute('type') == "button"))
			{
				inputs[i].style.paddingBottom = "5px";
			}
		}
	}
}
// End function.


////////////////////////////////////////////////////////////////////////


// Set the active button in the main and admin menu, for every page
// This function start on every ONLOAD on the page.
function menuActiveButton()
{
	var sPath = window.location.pathname;
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	//Mainmenu buttons.
	var homeButton = document.getElementById('homeButton');
	var aboutUsButton = document.getElementById('aboutUsButton');
	var servicesButton = document.getElementById('servicesButton');
	var careerButton = document.getElementById('careerButton');
	var contactUsButton = document.getElementById('contactUsButton');
	
	
	// Switching active button whitch depends from sPage.
	switch(sPage)
	{
		case "":
			homeButton.className = 'active';
		break;
		case "index.php":
			homeButton.className = 'active';
		break;
		case "career.php":
			careerButton.className = 'active';
		break;
		case "service1":
			servicesButton.className = 'active';
		break;
		case "contact_us.php":
			contactUsButton.className = 'active';
		break;
		case "about_us.php":
			aboutUsButton.className = 'active';
		break;
		case "service1.php":
			servicesButton.className = 'active';
		break;
		case "service2.php":
			servicesButton.className = 'active';
		break;
		case "service3.php":
			servicesButton.className = 'active';
		break;
		case "service4.php":
			servicesButton.className = 'active';
		break;
		case "availablePositions.php":
			careerButton.className = 'active';
		break;
		case "job_info.php":
			careerButton.className = 'active';
		break;
		case "apply_blank.php":
			careerButton.className = 'active';
		break;
	}
}
// End function.


////////////////////////////////////////////////////////////////////////


// This function will load when <body> is loaded.
// The other functions in this file, are loaded from this function. 
function bodyOnload()
{
	//forms();
	
	txtInput();
	fixBrowsersBugs();
	menuActiveButton();
}
// End function.

////////////////////////////////////////////////////////////////////////

