function setPointer(theRow, thePointerColor)
{
	if (thePointerColor == '' || typeof(theRow.style) == 'undefined') {
		return false;
	}
	if (typeof(document.getElementsByTagName) != 'undefined') {
		var theCells = theRow.getElementsByTagName('td');
	}
	else if (typeof(theRow.cells) != 'undefined') {
		var theCells = theRow.cells;
	}
	else {
		return false;
	}
	
	var rowCellsCnt  = theCells.length;
	for (var c = 0; c < rowCellsCnt; c++) {
		theCells[c].style.backgroundColor = thePointerColor;
	}
	
	return true;
}

function setPointerTD(theCell, thePointerColor)
{
	if (thePointerColor == '' || typeof(theCell.style) == 'undefined') {
		return false;
	}
	theCell.style.backgroundColor = thePointerColor;
	return true;
}
function openWindow(url, width, height, scrollbars) {
 var Win=window.open(url,"ToDo",'width=' + width + ',height=' + height + ',resizable=no,scrollbars=' + scrollbars + ',menubar=no' );
 Win.moveTo(10,10);
 Win.resizeTo(width,height);
 Win.focus();
}

function showOrHide(elementslist)
{
	var elements_array = elementslist.split(" ");
	var part_num = 0;
	while (part_num < elements_array.length)
	{
		var elementid = elements_array[part_num];
		if(document.getElementById(elementid).style.display != 'none')
		{
			document.getElementById(elementid).style.display = 'none';
			//setCookie(elementid, '0');
		}
		else
		{
			document.getElementById(elementid).style.display = '';
			//setCookie(elementid, '1');
		}
		part_num += 1;
	}
}
function powiekszZdjecie(imageName,posLeft,posTop) 
{
	newWindow = window.open("","newWindow","width=100,height=100,left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html>');
	newWindow.document.write('<head>');
	newWindow.document.write('<title>::</title>');
	newWindow.document.write('<script type="text/javascript">  ');
	newWindow.document.write('function resize1() {');
	newWindow.document.write('var image1= new Image();');
	newWindow.document.write('image1.src = "'+imageName+'";');
	newWindow.document.write('if(image1.width==0 || image1.height==0) { setTimeout(\'resize1()\',100); }');
	//newWindow.document.write('alert(image1.width + \' - \' + image1.height);');
	newWindow.document.write('self.resizeTo(parseInt(image1.width+20),parseInt(image1.height+80));');
	newWindow.document.write('}');
	newWindow.document.write('  </script>');
	newWindow.document.write('</head>');
	newWindow.document.write('<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close()">'); 
	newWindow.document.write('<center><img src='+imageName+' name="Zdjecie"></center>'); 
	newWindow.document.write('<script type="text/javascript">setTimeout(\'resize1()\',100);</script>');               
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
}

function otworzOkno(url, width, height, scrollbars) {
 var Win=window.open(url,"displayWindow",'width=' + width + ',height=' + height + ',resizable=no,scrollbars=' + scrollbars + ',menubar=no' );
 Win.moveTo(10,10);
 Win.resizeTo(width,height);
}

function Set_Cookie( name, value, expires, path, domain, secure ) 
{
// set time, it's in milliseconds
var today = new Date();
today.setTime( today.getTime() );

/*
if the expires variable is set, make the correct 
expires time, the current script below will set 
it for x number of days, to make it for hours, 
delete * 24, for minutes, delete * 60 * 24
*/
if ( expires )
{
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date( today.getTime() + (expires) );

document.cookie = name + "=" +escape( value ) +
( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
( ( path ) ? ";path=" + path : "" ) + 
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
}

// this function gets the cookie, if it exists
function Get_Cookie( name ) {
	
var start = document.cookie.indexOf( name + "=" );
var len = start + name.length + 1;
if ( ( !start ) &&
( name != document.cookie.substring( 0, name.length ) ) )
{
return null;
}
if ( start == -1 ) return null;
var end = document.cookie.indexOf( ";", len );
if ( end == -1 ) end = document.cookie.length;
return unescape( document.cookie.substring( len, end ) );
}
	
// this deletes the cookie when called
function Delete_Cookie( name, path, domain ) {
if ( Get_Cookie( name ) ) document.cookie = name + "=" +
( ( path ) ? ";path=" + path : "") +
( ( domain ) ? ";domain=" + domain : "" ) +
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}
