nn4 = (document.layers) ? true : false;

ie4 = (document.all) ? true : false;

dom = (document.createTextNode)? true : false;


function popupWindow(fileUrl, winW, winH, winN, scrollB) {

	var winWidth = (winW)? winW : 740;
	
	var winHeight = (winH)? winH : 520;

	var winName = (winN)? winN : 'popupWin';
	
	winWidth = parseInt(winWidth) + 18;
	winHeight = parseInt(winHeight) + 27;
		
	var scrollBars = (scrollB)? scrollB : 'auto';

	if (nn4 || ie4 || dom) {

		if (screen.width < winWidth + 50) { winWidth = screen.width - 50; scrollbars = 'yes'; }

		if (screen.height < winHeight + 100) { winHeight = screen.height - 100; scrollbars = 'yes'; }

		posX = Math.round((screen.width - winWidth) / 2);

		posY = Math.round((screen.height - winHeight) / 2);

		posCode = (nn4)? "screenX="+posX+",screenY="+posY : "left="+posX+",top="+posY;

	} else {

		posCode = "";

	}
	
	var popupWin = window.open(fileUrl, winName,"menubar=no,toolbar=no,scrollbars=" + scrollBars + ",status=yes,resizable=yes,width=" + winWidth + ",height=" + winHeight + "," + posCode);

	if (popupWin) popupWin.focus();

}

function pngLoader()
{
	if (/MSIE (5\.5|6).+Win/.test(navigator.userAgent))
	{
		var kamaz = document.getElementById('kamaz');
		kamaz.className = 'kamaz_png_fix';
	}
}

function changeImg(obj, objSrc)
{
	obj.src=objSrc;
}

function checkForm(f)
{
	var descr = document.getElementById('descr');
	var company = document.getElementById('company');
	var fio = document.getElementById('fio');
	var city = document.getElementById('city');
	var phone = document.getElementById('phone');
	var email = document.getElementById('email');
	
	var warning = true;
	
	descr.className = "normal";
	company.className = "normal";
	fio.className = "normal";
	city.className = "normal";
	phone.className = "normal";
	email.className = "normal";
	
	if(!f.descr.value){
		descr.className = 'alert';
		warning = false;
	}
	if(!f.company.value){
		company.className = 'alert';
		warning = false;
	}
	if(!f.fio.value){
		fio.className = 'alert';
		warning = false;
	}
	if(!f.city.value){
		city.className = 'alert';
		warning = false;
	}
	if(!f.phone.value){
		phone.className = 'alert';
		warning = false;
	}
	if(!f.email.value){
		email.className = 'alert';
		warning = false;
	}
	
	if(warning)
		f.submit();
	else
		return warning;
}


	function line_highlight(obj, on, off){
		if(obj.tagName == 'TD')
			var h_obj = obj.parentNode;
		else
			var h_obj = obj;
		if(!on)
			on = 'highlight';
		h_obj.className = h_obj.className == on ? off : on;
	}
	
	
	function viewParagraph(ptable, link){
		var obj = document.getElementById(ptable);
		obj.className = obj.className == 'pNone' ? 'pVisible' : 'pNone';
		link.className = link.className == 'cur' ? '' : 'cur';
	}