function virgul(nStr)
{
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	return x1 + x2;
}

sfFocus = function() {
	var sfEls = document.getElementsByTagName("INPUT");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onfocus=function() {
			this.className+=" sffocus";
		}
		sfEls[i].onblur=function() {
			this.className=this.className.replace(new RegExp(" sffocus\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfFocus);


function toggle(whichLayer) {
	var im1 = new Image();
	var im2 = new Image();
	// this is the way the standards work
	var style2 = document.getElementById(whichLayer).style;
	style2.display = style2.display? "":"block";
	if (document.getElementById(whichLayer + "_img")) {
		if (document.getElementById(whichLayer).style.display == "block") {
			document.getElementById(whichLayer + "_img").src = im2.src;
		} else {
			document.getElementById(whichLayer + "_img").src = im1.src;
		}
	}
}

function pop(adres, defs) {
	window.open(adres,'',defs)
}

function sorbakalim(link, text) {
	if ( text ) { input_box = confirm( text ); } else { input_box = confirm("Emin misin?"); }
	if (input_box==true) { location.replace(link); }
}
