function ShowHideElement(name)
{
	var obj = document.getElementById(name);
	if(obj.style.display == "none")
		obj.style.display = "block";
	else
		obj.style.display = "none";
}

// Change object size
// cmd (1 - Increase, 2 - Decrease)
// direction (1 - width, 2 - height, 3 - both)
// pref - preffix for the cookies
// obj - object
function FrmChangeSize(cmd, direction, pref, obj, step, minw, maxw, minh, maxh)
{
	if(!(cmd==1 || cmd==2)) return false;
	if(!(direction==1 || direction==2 || direction==3) ) return false;
	if(!step) step=50;
	if(!minh || !minw || !maxh || !maxw) return false;
	var obj = document.getElementById(obj);
	if(!obj) return false;
	if(!pref) pref = "pref_";

	var w=parseInt(obj.style.width);
	var h=parseInt(obj.style.height);

	if(cmd==1)
	{
		if( (direction == 1) || (direction == 3) )
		{
			if( (w + step) <= maxw ) w = w + step;
		}
		if( (direction == 2) || (direction == 3) )
		{
			if( (h + step) <= maxh ) h = h + step;
		}
	}
	if(cmd==2)
	{
		if( (direction == 1) || (direction == 3) )
		{
			if( (w - step) >= minw ) w = w - step;
		}
		if( (direction == 2) || (direction == 3) )
		{
			if( (h - step) >= minh ) h = h - step;
		}
	}

	obj.style.width = w+'px';
	obj.style.height = h+'px';
	var expDate = new Date;
	expDate.setTime (expDate.getTime() + (600*24*60*60*1000));
	SetCookie(pref + "w", w, expDate, "/");
	SetCookie(pref + "h", h, expDate, "/");
}


function SetCookie(name,value,expires,path,domain,secure) {
	document.cookie = name + "=" + escape(value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "");
}

function OpenWindow(url, imgname, w, h){
	var features='left=0,top=0,resizable=1,menubar=0,location=0,status=0,toolbar=0';
	wm=window.screen.width-10;hm=window.screen.height-60;
	if(w>wm || h>hm){features=features+',scrollbars=1';}else{features=features+',scrollbars=0';}
	if(w>wm){features=features+',width='+wm;}else{features=features+',width='+w;}
	if(h>hm){features=features+',height='+hm;}else{features=features+',height='+h;}
	window.open(url, imgname, features, true);
}
