timerID = null;

function scrollInit()
{
   	if (document.getElementById)
		{
        	cnt = document.getElementById("thumbStripWrap");
        	txt = document.getElementById("thumbStripInner");
        	txt.style.left = 0;
        	txt.style.top = 0;
    		}
}
        
function scrollRt(speed)
{
    	if(document.getElementById)
		{
       	if(parseInt(txt.style.left) < -3)
			{
        		txt.style.left = parseInt(txt.style.left) + speed + "px";
			}
        	timerID = setTimeout("scrollRt("+speed+")",30)
    		}
}


function scrollLft(speed, limit)
{
    	if(document.getElementById)
		{
        	if(parseInt(txt.style.left) > limit)
			{ 
        		txt.style.left = parseInt(txt.style.left) - speed + "px";
			}
        	timerID = setTimeout("scrollLft("+speed+", "+limit+")",30)
    		}
}

function scrollUp(speed)
{
    	if(document.getElementById)
		{
			if(parseInt(txt.style.top) < -3)
			{
				txt.style.top = parseInt(txt.style.top) + speed + "px";
			}
			timerID = setTimeout("scrollUp("+speed+")",30)
		}
		//alert("down");
}


function scrollDown(speed, limit)
{
    	if(document.getElementById)
		{
        	if(parseInt(txt.style.top) > limit)
			{ 
        		txt.style.top = parseInt(txt.style.top) - speed + "px";
			}
        	timerID = setTimeout("scrollDown("+speed+", "+limit+")",30)
    		}
		//alert("up");
}


function scrollStop()
{
    	if(document.getElementById)
		{
        	clearTimeout(timerID);
    		}
}

function displayPic(image)
{
	if (navigator.appName == 'Microsoft Internet Explorer') {
		document.images.Pic1.style.filter="blendTrans(duration=1)";
		document.images.Pic1.filters.blendTrans.Apply();
		document.images.Pic1.src = image;
		document.images.Pic1.filters.blendTrans.Play();
	}else{
		document.images.Pic1.style.filter="alpha(opacity=0)";
		document.images.Pic1.style.opacity = 0;
		document.images.Pic1.style.MozOpacity = 0;
		document.images.Pic1.style.KhtmlOpacity = 0;
		document.images.Pic1.src = image;
		opacity("Pic1", 0, 100, 500);
	}
	scrollStop();
}	

function RandomPic()
{
	var RandomNumber = Math.round(2 * Math.random() + 1);
		document.images.Pic1.style.filter="blendTrans(duration=2)";		/* parameters used in the fade-in effect */
		document.images.Pic1.style.filter="blendTrans(duration=3)";
		document.images.Pic1.filters.blendTrans.Apply();
		document.images.Pic1.src = eval(artPiece + RandomNumber + ".src");
		document.images.Pic1.filters.blendTrans.Play();		/* invoke fade-in */
	window.setTimeout("RandomPic()", 8000);								
}	

function resCheck()			// check screen resolution and adjust page layout
{
	if(screen.height<700){
		pic = document.getElementById("Pic1");
		document.getElementById("Pic1").style.height = 230;
	}
}


// cross-browser script from http://brainerror.net/scripts/javascript/blendtrans/ to fade in images 

function opacity(id, opacStart, opacEnd, millisec) { 
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 
	
    //determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        }
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) 
            { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        }
    }
}

//change the opacity for different browsers 
function changeOpac(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
} 
