/*====================================================================================================*/
function setHighlights() {
	xInputs=document.getElementsByTagName("input");
	for (i=0;i<xInputs.length;i++) {
		if (xInputs[i].type=="text") {
			xInputs[i].onfocus=function() {
					if (this.defaultValue==this.value) {
						this.select();
					}//end if ()
				}//end function
			xInputs[i].onmouseup=function(){return false};//because safari is special
		}//end if (xInputs[i].type=="text")
	}//next i<xInputs.length
	xTextAreas=document.getElementsByTagName("textarea");
	for (i=0;i<xTextAreas.length;i++) {
		xTextAreas[i].onfocus=function() {
				if (this.defaultValue==this.value) {
					this.select();
				}//end if ()
			}//end function
		xTextAreas[i].onmouseup=function(){return false};//because safari is special
	}//next i<xTextAreas.length
}//end function
/*====================================================================================================*/
/*====================================================================================================*/
window.onload=function() {
	setHighlights();
}//end function
/*====================================================================================================*/
function nextImage(o) {
    do o=o.nextSibling;
    while(o && o.tagName != 'IMG');
    return o;
}//end function
//===============================================================================================================================================================
function firstChildImage(o) {
    o=o.firstChild;
    while(o && o.tagName != 'IMG') {
        o=o.nextSibling;
    }//wend
    return o;
}//end function
//===============================================================================================================================================================
function setOpacity(obj, o) {
    obj.style.opacity=(o/100);
    obj.style.MozOpacity=(o/100);
    obj.style.KhtmlOpacity=(o/100);
    obj.style.filter='alpha(opacity='+o+')';
}//end function
//===============================================================================================================================================================
function getNextImage(image) {
    if (next=nextImage(image)) {
		image.style.display='none';
		image.style.zIndex=0;
		next.style.display='block';
		next.style.zIndex=100;
    } else {
		next=firstChildImage(image.parentNode);
    }//end if (next=nextImage(image))
    return next;
}//end function
//===============================================================================================================================================================
function blendImages(id, speed, pause, caption) {
    if(speed == null) {
        speed=20;
    }//end if(speed == null)
    if(pause == null) {
        pause=5500;
    }//end if(speed == null)
    var blend=document.getElementById(id);
    var image=firstChildImage(blend);
    startBlending(image, speed, pause, caption);
}//end function
//===============================================================================================================================================================
function startBlending(image, speed, pause, caption) {
    image.style.display='block';
    if(caption != null) {
		document.getElementById(caption).innerHTML=image.alt;
    }//end if(caption != null)
    continueFadeImage(image, 0, speed, pause, caption);
}//end function
//===============================================================================================================================================================
function pausecomp(millis) {
    var date=new Date();
    var curDate=null;
    do { curDate=new Date(); }
    while(curDate-date < millis);
}//end function
//===============================================================================================================================================================
function continueFadeImage(image, opacity, speed, pause, caption) {
    opacity=opacity+3;
    if (opacity < 103) {
		setTimeout(function() {fadeImage(image, opacity, speed, pause, caption)}, speed);
    } else {
		image.parentNode.style.backgroundImage="url("+image.src+")";
		var paws=pause-1000;
		if (paws < 0 ) {
			paws=0;
		}//end if (paws < 0 )
	pausecomp(1000);
	setOpacity(image,0);
	image=getNextImage(image);
		setTimeout(function() {startBlending(image, speed, pause, caption)}, paws);		
    }//end opacity < 103)
}//end function
//===============================================================================================================================================================
function fadeImage(image, opacity, speed, pause, caption) {
    setOpacity(image,opacity);
    continueFadeImage(image, opacity, speed, pause, caption);
}//end function
//===============================================================================================================================================================
function startblender() {
    blendImages('blender');
	blendImages('blender2');
//	blendImages('blender3');
//	blendImages('blender4'); 
//	blendImages('blender5');
}//end function
