//var bName = navigator.appName;
//var bVer = parseFloat(navigator.appVersion);
//var ie = (bName == "Microsoft Internet Explorer" && bVer >= 4);

var slideimagesTopRight=new Array();
var slideheightTopRight=new Array();
var slidewidthTopRight=new Array();
var slidecaptionTopRight=new Array();
var imageholderTopRight=new Array();
var whichimageTopRight = 0;
var timerTopRight = 0;

var slidespeedTopRight=8000;
var blenddelay=0;
var crossFadeDuration=4;
var innerHTMLcontent="";
var speed = Math.round(1600 / 100);
 
function initTopRightImages(myLocation) {
	for(n=0;n<10;n++) {
		slideimagesTopRight[n]="/newHomePagePhotos/newTopRightPhotos/newTopRightpic" + n + ".jpg";
		slidewidthTopRight[n]=eval(240*myW);
		slideheightTopRight[n]=eval(120*myW);
	}

	for (i=0;i<slideimagesTopRight.length;i++){
 	   imageholderTopRight[i]=new Image();
	   imageholderTopRight[i].src=slideimagesTopRight[i];
	}
	blendimageTopRight(myLocation);
}

function blendimageTopRight(myLocation) {
  if (!document.images) {return;}
  var imageid1 = myLocation + "Image1";
  var imageid2 = myLocation + "Image2";
  var divid1 = myLocation + "Div1";
  var divid2 = myLocation + "Div2";

  if (ie) {
	document.getElementById(imageid1).src=imageholderTopRight[0].src;
	document.getElementById(imageid1).width=slidewidthTopRight[0];
	document.getElementById(imageid1).height=slideheightTopRight[0];
	document.getElementById(imageid1).style.border=0; 	
	document.getElementById(imageid1).hspace = 10*myW;
	document.getElementById(imageid1).vspace = 10*myW;
	document.getElementById(imageid1).align = "right";
	//document.getElementById(divid1).style.height=slideheightTopRight[0]; 	
	//document.getElementById(divid1).style.width=slidewidthTopRight[0]; 	
	document.getElementById(divid1).style.visibility="visible";
	//setTimeout("slideitTopRight('" + myLocation + "')",eval(slidespeedTopRight+blenddelay));
	setTimeout("slideitTopRight('" + myLocation + "')",eval(slidespeedTopRight+blenddelay));
  }
  else {
	var curnumber = whichimageTopRight;
	whichimageTopRight = (whichimageTopRight<slideimagesTopRight.length-1)? whichimageTopRight+1 : 0;
	var newnumber = whichimageTopRight;
	var curimage = imageholderTopRight[curnumber].src;
	var newimage = imageholderTopRight[newnumber].src;

	//place the current image in divid1
	document.getElementById(imageid1).src = curimage;
 	document.getElementById(imageid1).style.width=slidewidthTopRight[curnumber]; 	
 	document.getElementById(imageid1).style.height=slideheightTopRight[curnumber]; 	
	document.getElementById(imageid1).hspace = 10*myW;
	document.getElementById(imageid1).vspace = 10*myW;
	document.getElementById(imageid1).align = "right";
  	//document.getElementById(divid1).style.height=slideheightTopRight[curnumber]; 	
  	//document.getElementById(divid1).style.width=slidewidthTopRight[curnumber]; 	
	document.getElementById(divid1).style.visibility="visible";

	//make the new image transparent
	changeOpacTopRight(myLocation, 0, imageid1, imageid2, 0); 
     
	//place the new image on top of divid1 (in divid2)
	document.getElementById(imageid2).src = newimage;
	document.getElementById(imageid2).style.width=slidewidthTopRight[newnumber]; 	
	document.getElementById(imageid2).style.height=slideheightTopRight[newnumber]; 	
	document.getElementById(imageid2).hspace = 10*myW;
	document.getElementById(imageid2).vspace = 10*myW;
	document.getElementById(imageid2).align = "right";
	//document.getElementById(divid2).style.height=slideheightTopRight[newnumber]; 	
	//document.getElementById(divid2).style.width=slidewidthTopRight[newnumber]; 	
 	document.getElementById(divid2).style.visibility="visible"; 	


	//fade in  new image 
	for(i = 0; i <= 100; i++) { 
		setTimeout("changeOpacTopRight('" + myLocation + "', " + i + ",'" + imageid1 + "', '"  + imageid2 + "', " + timerTopRight + ")",(timerTopRight*2)*speed); 
		timerTopRight++; 
	}
  }
} 

//if not ie
function changeOpacTopRight(myLocation, opacity, id1, id2, counter) { 
	var object1 = document.getElementById(id1).style; 
	object1.opacity = (1-(opacity / 100)); 
	object1.MozOpacity = (1-(opacity / 100)); 
	object1.KhtmlOpacity = (1-(opacity / 100)); 
	object1.filter = "alpha(opacity=" + (100 - opacity) + ")";
	var object2 = document.getElementById(id2).style; 
	object2.opacity = (opacity / 100); 
	object2.MozOpacity = (opacity / 100); 
	object2.KhtmlOpacity = (opacity / 100); 
	object2.filter = "alpha(opacity=" + opacity + ")";
	if(counter >= 100){
		timerTopRight = 0;
		setTimeout("blendimageTopRight('" + myLocation + "')",eval(slidespeedTopRight+blenddelay));
	}
	return; 
}

//if ie
function slideitTopRight(myLocation){
  	var imageid1 = myLocation + "Image1";
	if (!document.images) {return;}
	whichimageTopRight=(whichimageTopRight<slideimagesTopRight.length-1)? whichimageTopRight+1 : 0;
	document.getElementById(imageid1).style.filter="blendTrans(duration=crossFadeDuration)";
	document.getElementById(imageid1).filters[0].apply();
	//blenddelay=document.getElementById(imageid1).filters[0].duration*3000;
	document.getElementById(imageid1).src=imageholderTopRight[whichimageTopRight].src;	
	document.getElementById(imageid1).width=slidewidthTopRight[whichimageTopRight];
	document.getElementById(imageid1).height=slideheightTopRight[whichimageTopRight];
	document.getElementById(imageid1).style.border=0; 	
	document.getElementById(imageid1).hspace = 10*myW;
	document.getElementById(imageid1).vspace = 10*myW;
	document.getElementById(imageid1).align = "right";
	document.getElementById(imageid1).filters[0].play();
	setTimeout("slideitTopRight('" + myLocation + "')",eval(slidespeedTopRight+blenddelay));
}















