function PreloadImages()
{
	var loadedImages = new Array;
	for (i=0; i < PreloadImages.arguments.length; i++)
	{
		loadedImages[i] = new Image();
		loadedImages[i].src = PreloadImages.arguments[i];
	}
}

function SwapImage(targetImage, newImageSrc)
{
	if(document.images)
	if (targetImage && targetImage.src)
	targetImage.src = newImageSrc;
}


function OpenBigImageWindow(imgName,imgSRC,imgWidth,imgHeight)
{
	if( imgName && imgSRC && imgWidth && imgHeight )
	{			str='width='+imgWidth+',height='+imgHeight+',left=200,top=200,status=no,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,titlebar=no';
			
			wnd = window.open("",null,str);
			wnd.focus();
			wnd.document.close();
			wnd.document.open();
			wnd.document.clear();
						
			str = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"><html><head><title>"+ imgName + "</title></head><body bgcolor=\"#ffffff\" leftmargin=\"0\" marginheight=\"0\" marginwidth=\"0\" rightmargin=\"0\" topmargin=\"0\"><img src=\""+ imgSRC +"\" alt=\""+ imgName +"\" width=\""+ imgWidth +"\" height=\""+ imgHeight +"\" border=\"0\"></body></html>";
			wnd.document.write(str);
	}	
}

function OpenWindowPage(PageSrc,Width,Height)
{
	if( Width && Height )
	{	str='width='+Width+',height='+Height+',left=200,top=200,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,titlebar=no';
			
		wnd = window.open(PageSrc,null,str);
		wnd.focus();
	}	
}



// --- required --- // -------------------------------------------------------------
function isEmpty(FormName,  Message)
{
	var Name1;
	
	Name1 = FormName.value;
		
	if(Name1.length == 0)
	{
		window.alert(Message);	
		return true;
	}
	
	return false;
}
//
function isDate(day,month,year)
{
        var today = new Date();
        year  = ((!year)?today.getFullYear():year);
        month = ((!month)?today.getMonth():month-1);
        if(!day) return false
        var test = new Date(year,month,day);
        if( (year==test.getFullYear()) && (month==test.getMonth()) && (day==test.getDate()) )
                return true;
        else
                return false;
}
//
function checkDates(Year1,Month1,Day1,Year2,Month2,Day2,Message,bCheckCurrDate)
{
	Date1 = new Date(Year1.value,Month1.value-1,Day1.value);
	Date2 = new Date(Year2.value,Month2.value-1,Day2.value);	
	DateCurr = new Date();	
	var strDate1    = Day1.value+'-'+Month1.value+'-'+Year1.value;
	var strDate2    = Day2.value+'-'+Month2.value+'-'+Year2.value;
	var strDateCurr = DateCurr.getDate()+'-'+(DateCurr.getMonth()+1)+'-'+DateCurr.getFullYear();
	
	if(!isDate(Day1.value,Month1.value,Year1.value))
	{		
		window.alert(strDate1+' '+Message);
		return false;
	}	
	if(!isDate(Day2.value,Month2.value,Year2.value))
	{
		window.alert(strDate2+' '+Message);
		return false;
	}			
	if((Date1 >= Date2))
	{
		window.alert(strDate1+'>='+strDate2+' '+Message);
		return false;	
	}
	
	bCheckCurrDate = ((bCheckCurrDate)?false:true);
	
	if(bCheckCurrDate)
	{
		if(Date1 < DateCurr)
		{
			window.alert(strDate1+'<'+strDateCurr+' '+Message);
			return false;	
		}	
	}	
		
	return true;
}
// --- required --- // -------------------------------------------------------------

var isDHTML = 0;
var isLayer = 0;
var isAll   = 0;
var isID    = 0;

if(document.getElementById)
	isID = isDHTML = 1;
else
	if(document.all)
		isAll = isDHTML = 1;
	else
	{
		browserVersion = parseInt(navigator.appVersion);
		if((navigator.appName.indexOf('Netscape')!=-1) && (browserVersion==4))
			isLayer = isDHTML = 1;
	}

function findDOM(objectID,withStyle)
{
	if(1==withStyle)
	{
		if(isID)
			return (document.getElementById(objectID).style);
		else
			if(isAll)
				return document.all[objectID].style;
			else
				if(isLayer)
					return document.layer[objectID];
	}
	else
	{
		if(isID)
			return (document.getElementById(objectID));
		else
			if(isAll)
				return document.all[objectID];
			else
				if(isLayer)
					return document.layer[objectID];
	}
}

function findLivePageWidth()
{
	if(window.innerWidth!=null)
		return window.innerWidth;
	if(document.body.clientWidth!=null)
		return document.body.clientWidth;
	return(null);
}

function popUp(evt,objectID,MinusLeft,MinusTop)
{
	if(isDHTML)
	{
		var livePageWidth=findLivePageWidth();
		domStyle=findDOM(objectID,1);
		dom = findDOM(objectID,0);
		state=domStyle.visibility;		
		if(dom.offsetWidth)
			elemWidth=dom.offsetWidth;
		else
			if(dom.clip.width)
				elemWidth=dom.clip.width;
		
		if(state=='visible'||state=='show')
			domStyle.visibility='hidden';
		else
		{
			if(evt.pageY)
			{
				topVal=evt.pageY+4;				
				leftVal=evt.pageX-(elemWidth/2);
			}
			else
			{
				if(evt.y)
				{
					topVal=evt.y+4+document.body.scrollTop;
					leftVal=evt.x-(elemWidth/2)+document.body.scrollLeft;			
				}
			}		
		
			if(leftVal<2)
				leftVal=2;
			else
				if((leftVal+elemWidth)>livePageWidth)
					leftVal=leftVal-(elemWidth/2);
			
			topVal  = MinusTop  ? topVal+MinusTop   : topVal;
			leftVal = MinusLeft ? leftVal+MinusLeft+elemWidth/2 : leftVal;
				
			domStyle.top=topVal;
			domStyle.left=leftVal;
			domStyle.visibility='visible';
		}
	}
}

