//
//	javascript utilities
//	copyright Barry Hopwood, applied images, 2006
//

//	popup image window

var pos_left = 0;
var pos_top = 0;
//var img_win = null;

function can_detect(obj){

	return (typeof obj !="undefined");
	
}

function get_position(w, h){

	pos_left=(can_detect(window.screenLeft))? screenLeft+document.body.clientWidth/2-w/2 : can_detect(window.screenX)? screenX+innerWidth/2-w/2 : 0;
	pos_top=(can_detect(window.screenTop))? screenTop+document.body.clientHeight/2-h/2 : can_detect(window.screenY)? screenY+innerHeight/2-h/2 : 0;
	if (window.opera){
		pos_left-=screenLeft;
		pos_top-=screenTop;
	}
	
}

function popup_image(imgpath, title, img_width, img_height){

	get_position(img_width, img_height)
	var win_attr="width="+img_width+",height="+img_height+",toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,directories=no,status=no,left=100,top=100";
	var	img_win=window.open("imagepage.html",title,win_attr);
	if (img_win != null) {
    	img_win.document.open();
    	img_win.document.write('<html><head><title>Kangal Kopegi | The Kangal Dog of Turkey</title></head><body><img src="'+imgpath+'" style="margin:5px"></body></html>');
    	img_win.document.close();
		img_win.resize(img_width, img_height)
	    img_win.focus();
	}
	
}
