function isEmpty(FormName,  Message)
{
	var Name1;
	
	Name1 = FormName.value;
	
	//window.alert(Name1);	
	
	if(Name1.length == 0)
	{
		window.alert(Message);	
		return true;
	}
	
	return false;
}

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 toggleImage(imgName,firstImageSrc,secondImageSrc)
{
	if(document.images&&firstImageSrc&&secondImageSrc&&imgName)
	{
		tmp = new String(imgName.src);
		var isFirst=tmp.indexOf(firstImageSrc);
		var isSecond=tmp.indexOf(secondImageSrc);
		if(0<isFirst)
			imgName.src=tmp.substring(0,isFirst)+secondImageSrc;
		if(0<isSecond)
			imgName.src=tmp.substring(0,isSecond)+firstImageSrc;
	}
	return;
}

function OpenWindow(src)
{
	str='top=0,left=0,width=800,height=500,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes';
	window.open(src,null,str);
}	

function encodeUserPass()
{
  var pass = document.a.password.value;
  var save = 1; //document.a.save_password.checked ? 1 : 0;
  var time = new Date();
  var real_time = time.getTime();
  real_time = Math.floor(real_time/1000);

  // do a little verification of the password
  if (document.aws_md5_test && document.aws_md5_test()) {
    pass = 'md5/'+real_time+'/'+save+'/'
         + document.aws_md5(document.aws_md5(pass).substring(0,20) + real_time + save).substring(0,20);
  }
  document.b.userpass.value=base64(''+document.a.site.value+':'+pass);
  document.b.site.value=document.a.site.value;
  if(document.a.save_password.checked) document.b.save_password.value='true';
  document.b.submit();
}

function findLivePageWidth()
{
	if(window.innerWidth!=null)
		return window.innerWidth;
	if(document.body.clientWidth!=null)
		return document.body.clientWidth;
	return(null);
}

function popUp(evt,objectID)
{
	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);
				
			domStyle.top=topVal;
			domStyle.left=leftVal;
			domStyle.visibility='visible';
		}
	}
}

