/*
 * Purpose:	Define generic objects to be used for the Firstrun page(s)
 *
 * CVS: $Id: objects.js,v 1.3 2003/11/22 00:12:31 dsmith Exp $
 *
 * This file is a part of the Real Networks software library.
 * Copyright (C) 2001 Real Networks, Inc.
 * All rights reserved.
 *
 */

/* Define the page object */
function PageItem(id, headLines, desc, pageLinks, formItems, buttons, renderFunction, prevPage, nextPage)
{
	this.id = id;
	
	/* string arrays */
	this.headLines = headLines;
	this.desc = desc;
	this.pageLinks = pageLinks;
	this.error;
	/* FormItem object array */
	this.formItems = formItems;
	
	/* Button object array */
	this.buttons = buttons;
	this.dfltButton = null;
	/* takes the function name as a string */
	this.render = eval(renderFunction);
	
	/* these are references to other PageItems's */
	this.prev = prevPage;
	this.next = nextPage;
}

/* Define the Button object */
function Button(id, text, action)
{
	this.id = id;
	this.text = text;
	this.action = action;
}

/* Define the FormItem object */
function FormItem(id, text, desc, defaultValue, type, size, format, required, data)
{
	this.id = id;
	this.text = text;
	this.desc = desc;
	if( type=="checkbox" )
		this.checked = defaultValue;
	else
		this.defaultValue = defaultValue;
	this.type = type;
	this.size = size;
	this.format = format;
	this.required = (required)?required:false;
	this.data = data;
	this.render=renderFormElement;
	this.maxlength=20;
	this.error=false;
	this.bgColor="#ffffff";
	this.textFgColor="#0000ff";
	this.validate = genericDataValidation;
}

/* Define FormDataObj */
function FormDataItem( value, text)
{
	/* string arrays */
	this.value = value;
	this.text = text;
}

function doRenderLink()
{
	return this.desc + " <a href=\"" + this.url + "\" " + this.target
 		+ " tabindex=" + (tabIndex++) + "><font color=666666>"
		+ this.text + "</font></a>" + this.descend;
}

/* Define a Link Object */
function Links( desc, text, descend, urlPointer, target )
{
	/* Note: all url's will go through swithboard.
		just send the key as a parameter
	*/
	this.desc = desc;
	this.text = text;
	this.descend = descend;
	this.url=(urlPointer.indexOf("javascript") >= 0)?urlPointer:"http://switchboard.real.com/player/firstrun.html?cd="+urlPointer; 
	this.target = target;
	this.render = doRenderLink;
}
var off_objects_loaded = true;

