/***************************************************************************
 *   Scripts for DASK.pl                                    *
 *   Copyright (C) 2005 by Andrzej Zadrozny                                *
 *   andrzejz@komputery.tarchomin.pl                                       *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
 images_array = new Array();
 /*=========================================
 preload images
 =========================================*/
 function preloader_add_image(image_src, img_id, img_state)
{
	if(images_array[img_id])
	{
		images_array[img_id][img_state] = new Image;
		images_array[img_id][img_state].src=image_src;
	}
	else
	{
		images_array[img_id] = new Array;
		images_array[img_id][img_state] = new Image;
		images_array[img_id][img_state].src=image_src;
	}
	

}
 /*=========================================
 menu
 =========================================*/
submenu_array = new Array;

function submenu_add_submenu(submenuid)
{
	if(submenu_array[submenuid])
	{
		submenu_array[submenuid] = new String;
		submenu_array[submenuid] = submenuid;
	}
	else
	{
		submenu_array[submenuid] = submenuid;
	}
	

}

function submenu_over(id)
{
	for(i in submenu_array)
	{
	if(id != i) changedisplay_hide(submenu_array[i]);
	else changedisplay_show(submenu_array[i]);
	}
}

function submenu_hide()
{
	for(i in submenu_array)
	{
	changedisplay_hide(submenu_array[i]);
	}
}

function changedisplay(id)
{
	if(document.getElementById(id).style.display == "none")
		document.getElementById(id).style.display = "block";
	else
		document.getElementById(id).style.display = "none";
	//return true;
}
function changedisplay_show(id)
{
	if(document.getElementById(id).style.display == "none")
		document.getElementById(id).style.display = "block";
	//return true;
}
function changedisplay_hide(id)
{
	if(document.getElementById(id).style.display == "block")
		document.getElementById(id).style.display = "none";
	//return true;
}


/*===========================================
rozpoznanie przeglÄ&#65533;darki
===========================================*/
	ns4 = false;
	ns6 = false;
	ie4 = false;
	ope = false;
	bad = false;
	khtml = false;
	if(navigator.product){if (navigator.product.indexOf('khtml') != -1){khtml = true;}}
	if (navigator.product=="Gecko") {ns6 = true;}
	else {if (((document.all) && (parseInt(navigator.appVersion)) >= 4) && !(window.opera)) ie4 = true;
	else {if ((document.layers) && (parseInt(navigator.appVersion) < 5)) ns4 = true;
	else {if ((document.all) && (window.opera)) ope = true;
	else bad = true;}}}

/*===========================================
wspÃ³Å&#65533;rzÄ&#65533;dne wskaÅºnika myszy
===========================================*/
	var mouseX, mouseY;
	document.onmousemove = wspolrzedne_wskaznika;


function wspolrzedne_wskaznika(rodzic)
{
if(ns4 || ns6)
	{
	mouseX = rodzic.pageX;
	mouseY = rodzic.pageY;
	}
	else
	{
	mouseX = document.body.scrollLeft + event.clientX;
	mouseY = document.body.scrollTop + event.clientY;
	}
// 	window.status = 'myszka = ('+mouseX+','+mouseY+')';
	return true;
}

