// JScript File

var lcolor,lobj=null;
function hlight(obj,color){
	if(lobj!=null){
		lobj.style.backgroundColor=lcolor;
	}
	lcolor=obj.style.backgroundColor;
	lobj=obj;
	obj.style.backgroundColor=color;
}
function setbg(obj,bg){
	if(obj!=null){
		if(bg=='')
			obj.style.backgroundColor='';
		else
			obj.style.backgroundColor=bg;
	}
}

function DelThis(){
	return !confirm("Are you sure want delete item?");
}

function validateDisable(obj, group) {
	var valid = Page_ClientValidate(group);
	if (valid) {
		if (obj != null && _page_loaded) obj.disabled = true;
		return true;
	}
	return false;
}

function rszpstbck(){
	var div = $$("pstbck");
	div.style.position = "absolute";
	div.style.top = "0"; 
	div.style.zIndex = "1000";
	if (oBw.konqueror) { div.style.backgroundColor = "transparent" }
	else {
		if (oBw.ie) { div.style.filter = "alpha(opacity=50)" }
		else { div.style.opacity = "0.5" }
	}
	var z = getPageSize();
	div.style.height = z[1] + "px";
	var m = document;
	if (oBw.isIE) { div.style.left = m.documentElement.scrollLeft; div.style.width = m.documentElement.clientWidth }
	else { div.style.left = "0"; div.style.width = "100%" }
}

//var lastFocus = null;
//function dispPstbck() {
//	var div = $$("pstbck");
//	div.style.position = "absolute";
//	div.style.top = "0"; div.style.zIndex = "1000";
//	if (oBw.konqueror) { div.style.backgroundColor = "transparent" }
//	else {
//		if (oBw.ie) { div.style.filter = "alpha(opacity=50)" }
//		else { div.style.opacity = "0.5" }
//	}
//	var z = getPageSize();
//	div.style.height = z[1] + "px";
//	var m = document;
//	if (oBw.isIE) { div.style.left = m.documentElement.scrollLeft; div.style.width = m.documentElement.clientWidth }
//	else { div.style.left = "0"; div.style.width = "100%" }
//	div.style.display = 'block';
//	lastFocus = getEFocus();
//	if (lastFocus && lastFocus.blur) {lastFocus.blur(); }
//	//div.focus();
//}
//function rmvPstbck() {
//	var div = $$("pstbck");
//	div.style.display = 'none';
//	if (lastFocus && lastFocus.focus) {	lastFocus.focus();	}
//}


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

function log_out(){
	ht = document.getElementsByTagName("html");
	ht[0].style.filter = "progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)";
	if (confirm('Вы действительно хотите выйти?')){
		return true;
	}
	else{
		ht[0].style.filter = "";
		return false;
	}
}

function UpdateSize(getObj,getWidth){
	for(i=0;i<getObj.all.length;i++){
		var Obj;
		if((getObj.all.item(i).tagName=='IMG')){//||(getObj.all.item(i).tagName=='TABLE')){
			Obj = getObj.all.item(i);
			if(Obj.offsetWidth>getWidth){
				ResizeObj(Obj,Obj.offsetWidth,Obj.offsetHeight,getWidth);
			}
		}
	}
}
//Changing size by the width value
function ResizeObj(Obj,ObjWidth,ObjHeight,intSize){
	intYSize=(intSize/ObjWidth) * ObjHeight;
	Obj.width = intSize;
	Obj.height = intYSize;
	Obj.style.width = intSize;
	Obj.style.height = intYSize;
}


function hc(hach){
	wourl("http://stats.razorback2.com/ed2khistory?ed2k="+hach);
}


function toogleObj(obj,evnt){
	evnt = evnt || window.event;
	if ($$(obj)) {
		if ($$(obj).style.display == "none") {
			$$(obj).style.display = 'block';
			evnt.srcElement.className='btnTglCls';
		}
		else{
			$$(obj).style.display = 'none';
			evnt.srcElement.className='btnTglOpn';
		}
	}
	return false;
}
function toogleObj2(obj,minHeight,evnt){
	evnt = evnt || window.event;
	if ($$(obj)) {
		if ($$(obj).style.height == minHeight || $$(obj).style.height == '') {
			$$(obj).style.height = 'auto';
			evnt.srcElement.className='btnTglCls';
		}
		else{
			$$(obj).style.height = minHeight;
			evnt.srcElement.className='btnTglOpn';
		}
	}
	return false;
}

function SetUniqueRadioButton(nameregex, current) {
	re = new RegExp(nameregex);
	for (i = 0; i < document.forms[0].elements.length; i++) {
		elm = document.forms[0].elements[i]
		if (elm.type == 'radio') {
			//alert(elm.name)
			if (re.test(elm.name)) {
				elm.checked = false;
			}
		}
	}
	current.checked = true;
}









function setcntr(el, width, height) {
	$(document).ready(function() {
		$(window).scroll(function() {
			_setcntr(el, width, height);
		}).resize(function() {
			_setcntr(el, width, height);
		});
		_setcntr(el, width, height);
	});
}
function _setcntr(el, width, height) {
	$("#" + el).animate({ top: ($(window).scrollTop() + $('html').outerHeight(true) / 2 - height / 2) + "px" }, { queue: false, duration: 0 })
	.animate({ left: ($(window).scrollLeft() + $('html').outerWidth(true) / 2 - width / 2) + "px" }, { queue: false, duration: 0 })
};



$().ready(function() {
});

