
var orig_width;
var popup_left = window.screen.width/2;
var popup_top  = window.screen.height/2;


function showImg(img){
	
	getElement('divshowimg').style.display='block';
	document.images['showimg'].src=img.src;

	
	
	orig_width=img.width;
	orig_height=img.height;
	gooShowImg(10,orig_width,orig_height);

}

function gooShowImg(i,orig_width,orig_height){

	if (i<=0){
		clearTimeout(timer1);
		return false;
	}
	else {
		cur_width = document.images['showimg'].width=parseInt(orig_width/i);
		cur_height = document.images['showimg'].height=parseInt(orig_height/i);
				
		popup_left = (document.body.clientWidth/2)  - (cur_width/2)+document.body.scrollLeft;
		popup_top  = (document.body.clientHeight/2) - (cur_height/2)+document.body.scrollTop;

		getElement('divshowimg').style.left=popup_left;
		getElement('divshowimg').style.top=popup_top;
		
		
		i--;
		timer1=setTimeout("gooShowImg("+i+","+orig_width+","+orig_height+")",10);
		
		
		
	}
}
function gooCloseImg(i,orig_width,orig_height){

	if (i>10){
		clearTimeout(timer2);getElement('divshowimg').style.display='none';
		return false;
	}
	else {
		cur_width = document.images['showimg'].width=parseInt(orig_width/i);
		cur_height = document.images['showimg'].height=parseInt(orig_height/i);
		
		popup_left = (document.body.clientWidth/2)  - (cur_width/2)+document.body.scrollLeft;
		popup_top  = (document.body.clientHeight/2) - (cur_height/2)+document.body.scrollTop;

		getElement('divshowimg').style.left=popup_left;
		getElement('divshowimg').style.top=popup_top;

		
		i++;
		timer2=setTimeout("gooCloseImg("+i+","+orig_width+","+orig_height+")",10);
	}
}

function closeShowdiv(){
	clearTimeout(timer1);
	
	gooCloseImg(1,orig_width,orig_height);
	
	
}

