var picture = 1;
var text = 1;

function OpenPic() {
   window.open ("images/image" + picture + ".jpg", 'picwindow1', "toolbar=no,menubar=no,scrollbars=no,resizable=no");
}

function doesImageExist(path)
{
	var oImg = new Image();
	oImg.onload = function(){alert("true");};
	oImg.onerror = function(){alert("false");};
	oImg.src = path;    
}

function rotate_fade(div_id,image_id,path) {
   if (document.image){
	   if (++picture > 16)  picture = 1;
//alert(image_id);
		var oImg = new Image();
		oImg.onload = function(){
			blendimage(div_id,image_id,path + 'thumb_image' + picture + '.jpg',1000);
		};
		oImg.onerror = function(){
			picture = 1;
			blendimage(div_id,image_id,path + 'thumb_image' + picture + '.jpg',1000);
		};
		oImg.src = path + 'thumb_image' + picture + '.jpg';    
   }
}


function rotate(div_id,image_id,path) {
   if (document.image){
	   if (++picture > 16)  picture = 1;
	   
		var oImg = new Image();
		oImg.onload = function(){
			document.image.src = path + "thumb_image" + picture + ".jpg";
		};
		oImg.onerror = function(){
			picture = 1;
			document.image.src = path + "thumb_image" + picture + ".jpg";
		};
		oImg.src = path + 'thumb_image' + picture + '.jpg';    
   }
}

function rotatetext() {
   if (document.text){
	   if (++text > 3)  text = 1;
	   document.text.src = "text/text_desc" + text +".gif";
	   window.setTimeout('rotatetext();',10666);
   }
}
