var agent = navigator.userAgent.toLowerCase();
var major = parseInt(navigator.appVersion);
var minor = parseFloat(navigator.appVersion);

var isNN = ((agent.indexOf('mozilla') != -1) && ((agent.indexOf('spoofer') == -1) && (agent.indexOf('compatible') == -1)));
var isNN4 = (isNN && (major == 4));
var isNN6 = (isNN && (major >= 5));

var isOPERA = agent.indexOf("opera")>-1 && window.opera;
var isIE4 = (agent.indexOf("msie") != -1 && !isOPERA);

styles();
function rusoft() {
  window.open('http://www.rusoft.ru');
}

function ShowMail(user, domain1, domain2) {
	var email = user+'&#64;'+domain1+'&#46;'+domain2;
	if (ShowMail.arguments[3]) name = ShowMail.arguments[3];
	else name = email;
	document.writeln('<a href="mailto:'+email+'">'+name+'</a>');
}

function ShowMail2(text, title) {
	document.writeln('<a href="mailto:admin@stf-dvt.ru"><div title="'+title+'">'+text+'</div></a>');
}

function openImage(image) {
	if (image) window.open("/popup.php?img="+image, "popupimage", "scrollbars=no, resizable=1, width=100, height=100").focus();
	return false;
}



function styles(){
document.write('<style>div.pro{display:none}</style>');
}

function imgOpen(imgURL,imgWidth,imgHeight,Title) {
	var imgWndw=window.open('','_blank','width='+imgWidth+',height='+
	imgHeight+',toolbar=no,menubar=no,location=no,status=no,'+
	'resizable=yes,scrollbars=no');
	var imgTitle=(Title)?Title:imgURL+": "+imgWidth+'x'+imgHeight;
	with (imgWndw.document){
		open();
		write('<ht'+'ml><he'+'ad><ti'+'tle>'+imgTitle+'</ti'+'tle>'+
		'</he'+'ad><bo'+'dy leftmargin="0" '+
		' topmargin="0" '+
		'rightmargin="0" bottommargin="0" marginwidth="0" '+
		'marginheight="0"><img src="'+imgURL+'" width="'+imgWidth+
		'" height="'+imgHeight+'" border="0" alt="'+imgTitle+
		'"></bo'+'dy></ht'+'ml>');
		close();
	}
	return false
}

function OpenPopup(src) {
	if (arguments[1]) popup_name = arguments[1];
	else popup_name = 'popup';
	if (arguments[2]) popup_width = arguments[2];
	else popup_width = 500;
	if (arguments[3]) popup_height = arguments[3];
	else popup_height = 400;
	window.open(src, popup_name, 'toolbar=no,location=no,status=no,menubar=no,resizable=yes,directories=no,scrollbars=yes,width='+popup_width+',height='+popup_height).focus();
	return false
}

function Step1toStep2(){
	type = document.getElementsByName('fld[type][]');
	if (type[0].checked) x = 'fiz'; // Физическое лицо
	else x = 'jur'; // Юридическое лицо
	if (isNN6) location.href = "/login/registration/step2?type="+x;
	else document.location.href = "/login/registration/step2?type="+x;
	return false
}

var f = 0;

function about_order(id) {
	if (f != 1) 
		if (isNN6) location.href = "/cabinet/orders/your_orders?order_id="+id;
		else document.location.href = "/cabinet/orders/your_orders?order_id="+id;
	f = 0;
	return false
}
function delete_order(id){
	if (confirm('Удаление заказа № '+id+'. Вы уверены?') == true) {
		if (isNN6) location.href = "/cabinet/orders/your_orders?act=delete&order_id="+id;
		else document.location.href = "/cabinet/orders/your_orders?act=delete&order_id="+id;
	}
	f = 1;
	return false
}

function about_bill(id) {
	if (f != 1) 
		if (isNN6) location.href = "/cabinet/accounts/your_accounts?bill_id="+id;
		else document.location.href = "/cabinet/accounts/your_accounts?bill_id="+id;
	f = 0;
	return false
}

function delete_bill(id){
	if (confirm('Удаление счета № '+id+'. Вы уверены?') == true) {
		if (isNN6) location.href = "/cabinet/accounts/your_accounts?act=delete&bill_id="+id;
		else document.location.href = "/cabinet/accounts/your_accounts?act=delete&bill_id="+id;
	}
	f = 1;
	return false
}

function Show1(image, id){
	document.getElementById('image'+id).src = image;
}

function showCat(objLi) {
	if (objLi.parentNode.className != 'active') {
		objLi.parentNode.className = 'active';
		objLi.src = '/images/new_cat_minus.gif';
		objLi.alt = 'закрыть';
	}
	else {
		objLi.parentNode.className = '';
		objLi.src = '/images/new_cat_plus.gif';
		objLi.alt = 'открыть';
	}
}

