//--============================================================================ -->
/*
	Note:
		This is a javaScript file that contains a collection of functions that I've used to design all my websites
		with. All functions are document to explains how each function works and how to use it. I have invested
		many hours collecting, documenting and creating them to make it a great file for me to use to design
		my website with. All codes that I have collected from other great programmers are referenced and
		credited for.

		You may use this file in your website by agreeing to these terms:

		1.	The file name (mystry.js) cannot be changed

		2.	If you make any changes or additions to this file	you may then change
			the file name to anything you desire. However, I would like you to give
			me some credit for my hard work by leaving my signature seen below
			in this file.

		3.	You cannot erase any referenced programmers in this file.

		4.	That you put a link to my site www.mystry.com on your site
			

				         "my passion no words can explain...
				           my dream no miracles can bring...
				            my path no one can follow..."
								- MystRy -

			        A member of TutorialCentral @ irc.bends.org ::: #central
				     TutorialForum @ www.tutorialforums.com

		===================== < SPECIAL NOTE > =====================

			     Many thanks to all my friends from TCentral, TutorialForum...
			(Robouk, Spoono, Locke, ArchNemesis, Chelle, Kedmyster, Scryypy)
			        (Noel Forbes, Missomnis, Queen Michelle and many more).
					You guys are the greatest!!!

		=====================        </ END >        =====================

		              Feel free to look through the code and you may use it on your page
			       as long as you give me credit by putting me on your site.

			          All rights reserved and content copyrighted (c) 2003.
*/
//-- ============================================================================ -->


//
//---------------------------------------------------------------------------------------------------------------------------------------------------------
//
// HOW TO USE
//
// 1.	Save this file in the directory where your html files are located
//
// 2.	Paste this line <script language="javascript" type="text/javascript" src="whereYouSaveThisFilePath/mystry.js"></script>
// 	in the head section of your html file.
//
// for example:
//
//	<html>
//	<head>
//	<title>your title</title>
//	<script language="javascript" type="text/javascript" src="javascript/mystry.js"></script>
//	</head>
//
//---------------------------------------------------------------------------------------------------------------------------------------------------------
//


//
//---------------------------------------------------------------------------------------------------------------------------------------------------------
//
// name:		nereidFade()
//
// description:	this function allows you to fade your image in and out during a mouseOver and mouseOut event
//
// created by:	the original creator is unknown just yet but I will update this as soon as I found out
//
// comment:
//
//---------------------------------------------------------------------------------------------------------------------------------------------------------
//

nereidFadeObjects = new Object();
nereidFadeTimers = new Object();

/* object - image to be faded (actual object, not name);
 * destOp - destination transparency level (ie 80, for mostly solid)
 * rate   - time in milliseconds between transparency changes (best under 100)
 * delta  - amount of change each time (ie 5, for 5% change in transparency)
 */

function nereidFade(object, destOp, rate, delta){
if (!document.all)
return
    if (object != "[object]"){  //do this so I can take a string too
        setTimeout("nereidFade("+object+","+destOp+","+rate+","+delta+")",0);
        return;
    }
        
    clearTimeout(nereidFadeTimers[object.sourceIndex]);
    
    diff = destOp-object.filters.alpha.opacity;
    direction = 1;
    if (object.filters.alpha.opacity > destOp){
        direction = -1;
    }
    delta=Math.min(direction*diff,delta);
    object.filters.alpha.opacity+=direction*delta;

    if (object.filters.alpha.opacity != destOp){
        nereidFadeObjects[object.sourceIndex]=object;
        nereidFadeTimers[object.sourceIndex]=setTimeout("nereidFade(nereidFadeObjects["+object.sourceIndex+"],"+destOp+","+rate+","+delta+")",rate);
    }
}

//
//---------------------------------------------------------------------------------------------------------------------------------------------------------
//
// name:		nereidFade()
//
// description:	this function allows you to display and hide a layer during a mouseOver and mouseOut event
//
// created by:	the original creator is unknown just yet but I will update this as soon as I found out
//
// comment:
//
// <img src="images/kingsAge6.gif" border="0" width="66" height="66" style="filter:alpha(opacity=30)" onMouseOver="nereidFade(this,100,50,20)" onMouseOut="nereidFade(this,30,50,5)" alt="">
//---------------------------------------------------------------------------------------------------------------------------------------------------------
//

function visi(nr)
{
	if (document.layers)
	{
		vista = (document.layers[nr].visibility == 'hide') ? 'show' : 'hide'
		document.layers[nr].visibility = vista;
	}
	else if (document.all)
	{
		vista = (document.all[nr].style.visibility == 'hidden') ? 'visible'	: 'hidden';
		document.all[nr].style.visibility = vista;
	}
	else if (document.getElementById)
	{
		vista = (document.getElementById(nr).style.visibility == 'hidden') ? 'visible' : 'hidden';
		document.getElementById(nr).style.visibility = vista;

	}
}

/* clears default values from input boxes */
function clearText(thefield){
			if (thefield.defaultValue==thefield.value)
			{
				thefield.value = "";
			}
}



/*

var message=""; 

function clickIE() {if (document.all) {(message);return false;}} 
function clickNS(e) {if 
(document.layers||(document.getElementById&&!document.all)) { 
if (e.which==2||e.which==3) {(message);return false;}}} 
if (document.layers) 
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;} 
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;} 

*/

/*

<A HREF="whatever.html" onMouseOver="over(0)"
	onMouseOut="out(0)"><IMG
 	SRC="pix/mo_home.gif" NAME="home" etc.></A>

<A HREF="whatever.html" onMouseOver="over(1)"
	onMouseOut="out(1)"><IMG
	SRC="pix/mo_place.gif" NAME="place" etc.></A>

*/

// Some variables

var path= "images/"
var outImg = new Array();
var overImg = new Array();
var imgName = new Array('home', 'capabilities', 'portfolio', 'clients', 'testimonials', 'partnership', 'careers', 'contact_us', 'do_search', 'ad_php_mysql', 'ad_multimedia', 'ad_partnership', 'ad_graphic_design', 'ad_web_design', 'ad_hosting');

// Pre-load part.

if (document.images)
{
	for (i = 0; i < imgName.length; i++)
	{
		outImg[i] = new Image;
		outImg[i].src = path + imgName[i] + "_off.gif"
		overImg[i] = new Image;
		overImg[i].src = path + imgName[i] + "_on.gif";
	}
}


// The functions: first mouseover, then mouseout

function over(no)
{
	if (document.images)
	{
		document.images[imgName[no]].src = overImg[no].src
	}
}

function out(no)
{
	if (document.images)
	{
		document.images[imgName[no]].src = outImg[no].src
	}
}

function inputBtnOn(target){
target.src = "images/login_button_on.gif";
}

function inputBtnOff(target){
target.src = "images/login_button_off.gif";
}

function inputOn(target){
target.className = "input_on";
}

function inputOff(target){
target.className = "input_off";
}

function buttonOn(target){
target.className = "button_on";
}

function buttonOff(target){
target.className = "button_off";
}

function fullScreen(theURL) {
window.open(theURL, '', 'fullscreen=yes, scrollbars=auto');
}

// <a href="#" onclick="open_window('url', 'window_name', desired_height, desired_width)">link_name</a>
function open_window(url, window_name, desired_height, desired_width)
{
	window_url = url;
	window_name = window_name;
	window_width = desired_width;
	window_height = desired_height;
	position_left = (screen.width - window_width) / 2;
	position_top = (screen.height - window_height) / 2;

	new_window = window.open(window_url, window_name, "width=" + window_width + ", height=" + window_height
			+ ", screenX=" + position_left + ", left=" + position_left + ", screenY="
			+ position_top + ", top=" + position_top);

	if(window.focus)
	{
		new_window.focus();
	}
}
