
function setopacity(div,opacity){
ias = document.getElementById(div).style;

	if(typeof(ias.opacity) != "undefined") {

			ias.opacity = opacity ;

	} else if(typeof(ias.MozOpacity) != "undefined") {

			ias.MozOpacity = opacity;


	} else if(typeof(ias.KhtmlOpacity) != "undefined") {

			ias.KhtmlOpacity = opacity;

	} else if(typeof(ias.filter) != "undefined") {

			ias.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=" + (opacity*100)+ ")";
	}
}


var rand1 = 0;
var useRand = 0;
//image fade settings


var div1 = 'main';
var div2 = 'main2';

var div1_opacity = 0.6;
var div2_opacity = 0;


function swap_opacity(){
var div1_opacity = div1_opacity - 0.0001;
var div2_opacity = div2_opacity + 0.0001;

setopacity(div2,div2_opacity);
setopacity(div1,div1_opacity);

}
function swap_image(theimage,div,setimage)
{

		var imgnum = images.length - 1;
		do
		{
			var randnum = Math.random();
			rand1 = Math.round((imgnum - 1) * randnum) + 1;
		}
		while (rand1 == useRand);
		useRand = rand1;
		if(setimage!=0)
		{
			if (setimage == 1)
			{

					document.getElementById(div1).style.background = 'url(' + images[theimage].src + ')';
					changeOpac(0,div1);
					currentOpac(div1, 60, 1000);
					document.getElementById('main2').style.background = 'url(' + images[theimage].src + ')';
					setTimeout("currentOpac('main',0,500);",500);

			}
			else if(setimage == 2 && scroll_pause == 0)
			{

				if (document.getElementById(div1).style.background == 'url(' + images[useRand].src + ')') {
						var imgnum = images.length - 1;
						do
						{
							var randnum = Math.random();
							rand1 = Math.round((imgnum - 1) * randnum) + 1;
						}
						while (rand1 == useRand);
						useRand = rand1;
				}


					scroll_pause = 1;


						blendimage(div1,'main2','url(' + images[useRand].src + ')',1000,100);
						setTimeout("currentOpac('main',100,500);",500);
						setTimeout("document.getElementById('maintext2').innerHTML = ''",400);

						setTimeout("scroll_pause = 0;",3000);


			}
			else if (setimage != 2)
			{

						blendimage(div1,'main2','url(' + setimage + ')',1000,100);
						setTimeout("currentOpac('main',0,500);",500);


			}

		}
		else if (theimage != 0)
		{



				blendimage(div1,'main2','url(' + images[theimage].src + ')',1000,60);
				setTimeout("currentOpac('main',0,500);",500);


		}
		else
		{


				if (document.getElementById(div1).style.background == 'url(' + images[useRand].src + ')') {
						var imgnum = images.length - 1;
						do
						{
							var randnum = Math.random();
							rand1 = Math.round((imgnum - 1) * randnum) + 1;
						}
						while (rand1 == useRand);
						useRand = rand1;
				}

				blendimage(div1,'main2','url(' + images[useRand].src + ')',1000,60);
				setTimeout("currentOpac('main',0,500);",500);

		}




}

/**
 *
 * @access public
 * @return void
 **/
function loadTest(){
	alert("x");
}