// iris dishon javascript file. All rights reserved.

function stopError() {
            return true;
         }
 window.onerror = stopError;

 function imgOnNav(imgName) {
      if (document.images) {
		pathst=document[imgName].src;
		if(pathst.substring(pathst.lastIndexOf('.')-1,pathst.lastIndexOf('.'))=='a'){
		document[imgName].src=pathst.substring(0,pathst.lastIndexOf('.')-1)+'b.gif';}
        }
  }

  function imgOffNav(imgName) {
   if (document.images) {
		pathst=document[imgName].src;
		if(pathst.substring(pathst.lastIndexOf('.')-1,pathst.lastIndexOf('.'))=='b'){
		document[imgName].src=pathst.substring(0,pathst.lastIndexOf('.')-1)+'a.gif';}
        }
  }

function changer(){	
		if (document.images.bone.con=='before'){
		imgOnNav('bone');
		document.images.bone.con='after'
		}else{
		imgOffNav('bone');
		document.images.bone.con='before'
		}
	clock=setTimeout("changer()",150);
	}

function show(imgName,closeUp) {
	theURL='show.php?'
	a=show.arguments;
	for(i=0; i<a.length; i++){
    	if (a[i]=='closeup') {
			theURL = theURL + '&closeup=yes' ;
		} else {
			if (i>0) {
				theURL = theURL + '&img' + i + '=' + a[i] ;
			} else {
				theURL = theURL + 'img' + i + '=' + a[i] ;
			}
		}
		
	}
	newwin = window.open(theURL,'viewer','scrollbars=yes,resizable=yes,width=800,height=500,screenx=50,screeny=50,left=50,top=50');
	setTimeout('newwin.focus();',250);
	timeImages();
}

function timeImages(){
	if (newwin.closed) {
		loadImages();
	} else {	
		setTimeout('timeImages();',50);
	}
}

function loadImages() {
	for (i=0; i<document.images.length;i++){
		if (!document.images[i].complete) {
			document.images[i].src=document.images[i].src;
			}
		}
}

function parentImages() {
	if (window.opener != null) {
		for (i=0; i<document.images.length;i++){
			if (!document.images[i].complete) {
				document.images[i].src=document.images[i].src;
				}
			}
		for (i=0; i<window.opener.document.images.length;i++){
			if (!window.opener.document.images[i].complete) {
				window.opener.document.images[i].src=window.opener.document.images[i].src;
				}
			}
	}	
}

function goback() {
	alert(history.length);
	alert(history.previous());
	var h=2;
	if (navigator.appName.indexOf("Microsoft") != -1) h=1;
	if (history.length == h) {
		history.back();
	} else {
		window.close();
	}
}
imagearr=new Array;
	
function MM_preloadImages() {
a=MM_preloadImages.arguments;
 for(i=0; i<a.length; i++){
    imagearr[i]=new Image; 
	 imagearr[i].src=a[i];
		}

}

