
function page_init(sProps)
{
	if (sProps)      // sProps contains a list of expando-properties to set in the document.
	{
		var a = sProps.split(";");
		
		if (!document.page_props)
			document.page_props = new Object();
		
		var oProps = document.page_props;
		
		for (var i = 0; i < a.length; i++)
		{
			var prop = a[i].split("=");
			
			if (prop.length = 1)
			{
				oProps[prop[0]] = true;
			}
			else
			{
				oProps[prop[0]] = prop[1];
			}
		}
	}
	
	init_NameValuedFields();
	Cookie_Check();
}


function Cookie_Check()
{
	Set_Cookie( 'test', 'none', '', '/', '', '' );
	
	if ( Get_Cookie( 'test' ) )
	{
		Delete_Cookie('test', '/', '');
	}
	else
	{
		Show_Cookie_Warning();
	}
}


function Show_Cookie_Warning()
{
	var oTab = oGet("cookieWarning");
	oTab.className = "";
	
	var oProps = document.page_props;
	
	if (oProps && oProps["no_cookie_link"])
	{
		var oLink = oGet("the_cookie_info_link");
		oLink.className = "hidden";
	}
}


///////////////////////////////////////////////////////////

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 ) );
}


///////////////////////////////////////////////////////////
// cookie name & value are required. expires = number of days
///////////////////////////////////////////////////////////

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;
	}
   
	// alert( 'today ' + today.toGMTString() );       // this is for testing purpose only
   
	var expires_date = new Date( today.getTime() + (expires) );
   
	// alert('expires ' + expires_date.toGMTString());     // this is for testing purposes only

	document.cookie = name + "=" + escape( value ) +
		( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +    //expires.toGMTString()
		( ( path ) ? ";path=" + path : "" ) + 
		( ( domain ) ? ";domain=" + domain : "" ) +
		( ( secure ) ? ";secure" : "" );
}

///////////////////////////////////////////////////////////

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";
}

///////////////////////////////////////////////////////////







//  -----------  cross-browser compatibility functions  -----------


function oGet(n, d) 
{
	if (!d)
		d = document;
	
	var p = n.indexOf("?");
	
	if (p > 0 && parent.frames.length) 
	{
		d = parent.frames[n.substring(p + 1)].document;
		n = n.substring(0, p);
	}
	
	var x = d[n];
	
	if (!x && d.all) 
		x = d.all[n];
	
	for (var i = 0; !x && (i < d.forms.length); i++) 
		x = d.forms[i][n];
	
	for(var i = 0; !x && d.layers && (i < d.layers.length); i++) 
		x = oGet(n, d.layers[i].document);
	
	if(!x && d.getElementById) 
		x = d.getElementById(n); 
	
	return x;
}


function ASet(obj, sAttr, sValue)
{
	obj.setAttribute(sAttr, sValue);
	
	if (sAttr == "className")                 // kludge for firefox
		obj.setAttribute("class", sValue);
}


function AGet(obj, sAttr)
{
	return obj.getAttribute(sAttr);
}


function ASetAll(o, sAttr, sValue)
{
	if (o)    // not null
	{
		if (o.length)        // o is collection of objects
		{
			for (var i = 0; i < o.length; i++)
			{
				ASet(o[i], sAttr, sValue);
			}
		}
		else                 // o is a single object
		{
			ASet(o, sAttr, sValue);
		}
	}
}


function oGetAll(n, r)
{
	if (!r)
		r = document.body;
	
	var o = new Array();
	
	if (r.all)
	{
		var x = r.all[n];
		
		if (!x)
		{
			return o;
		}
		else if (x.length)
		{
			return x;
		}
		else
		{
			o[0] = x;
			return o;
		}
	}
	else
	{
		var a = new Array(r);
		
		for (var i = 0; i < a.length; i++)
		{
			if (a[i].id == n)
				o[o.length] = a[i];
			
			for (var j = 0; j < a[i].childNodes.length; j++)
			{
				var obj = a[i].childNodes[j];
				
				if (obj.nodeType == 1)
				{
					a[a.length] = obj;
				}
			}
		}
		
		return o;
	}
}



























