// This file contains common functions, that might reasonably be used on any page.

function writeLinks()
{
	document.writeln("<div align=\"center\"><p>")
	document.writeln("[<a href='" + iSubStr + "membershome.asp' onmouseover=\"pausetick();\" onmouseout=\"unpausetick();\">User Area Homepage</a>]")
	document.writeln("[<a href='" + iSubStr + "helpmovies.asp' target=\"_top\" onmouseover=\"pausetick();\" onmouseout=\"unpausetick();\">HelpMovies</a>]")
	document.writeln("[<a href='" + iSubStr + "codeproject/forum/forumindex.asp' onmouseover=\"pausetick();\" onmouseout=\"unpausetick();\">Support</a>]")
	document.writeln("[<a href='" + iSubStr + "codeproject/forum/search.asp' onmouseover=\"pausetick();\" onmouseout=\"unpausetick();\">Search Support</a>]")
	document.writeln("[<a href='" + iSubStr + "account.asp' onmouseover=\"pausetick();\" onmouseout=\"unpausetick();\">My Account</a>]")
	document.writeln("</p></div>")
}

//------------------------------------- Image Swap Buttons

function SmartButton(obj_name, default_image, hilight_image, click_action)
{
	var image_name = obj_name + "_image";
	document.write("<a href='#' ");
	document.write("onMouseOver='" + obj_name + ".makeHilight();pausetick();' ");
	document.write("onMouseOut ='" + obj_name + ".makeDefault();unpausetick();' ");
	document.write("onClick='" + obj_name + ".doClick(); return false;' ");
	document.write(">");
	document.write("<img src='" + default_image + "' ");
	document.write(" name='" + image_name + "' border='0'></a>");

// assign the properties 

	this.default_image = default_image;
	this.hilight_image = hilight_image;
	this.click_action = click_action;
	this.image_name = image_name;

// assign the methods

	this.makeHilight = makeHilight;
	this.makeDefault = makeDefault;
	this.doClick = doClick;
}

function makeHilight()
{
	var the_image = eval("window.document." + this.image_name);
	the_image.src = this.hilight_image;
}

function makeDefault()
{
	var the_image = eval("window.document." + this.image_name);
	the_image.src = this.default_image;
}

function doClick()
{
	eval(this.click_action);
}

//---------------------pre load images

function preloadImages(preImages)
{
	loadedImages = new Array();

    // Loop through all the arguments.
    var argLength = preImages.length;

    for(arg=0;arg<argLength;arg++)
    {
      // For each arg, create a new image.
	loadedImages[arg] = new Image();
      // Then set the source of that image to the current argument.
    loadedImages[arg].src = preImages[arg];
    }
}


