﻿// JScript File

// ************** Cross Browser check ************************"
function browser(){
	this.dom = (document.getElementById)?1:0;
	this.ie4 = (document.all && !this.dom)?1:0;
	this.ns4 = (document.layers && !this.dom)?1:0;
	this.ns6 = (this.dom && !document.all)?1:0
	return this;
}

function winSize(){
	is= new browser();
//	this.width = (is.ns4||is.ns6)? parent.window.innerWidth : parent.document.body.offsetWidth;
//	this.height = (is.ns4||is.ns6)? parent.window.innerHeight : parent.document.body.offsetHeight-10;
	this.width = parent.screen.width;
	this.height = parent.screen.height - 100;
	
}

function getLocalTime(){
   var d, s = '';
   var c = '_';
   d = new Date();

   s += d.getYear() + c;                     
   s += (d.getMonth() + 1) + c;         
   s += d.getDate() + c;


   s += d.getHours() + c;
   s += d.getMinutes() + c;
   s += d.getSeconds() + c;
   s += d.getMilliseconds();
   return(s);
}

function view_pic(img, w, h, title){
	
	if((typeof w == 'undefined')||(w == ''))
		w = 400;
	if((typeof h == 'undefined')||(h == ''))
		h = 400;
		
	is = new browser();
	var brWin = new winSize();
	
	posX = (brWin.width-w)/2;
	posY = (brWin.height-h)/2;
    (posX<0)? posX = 0 : 0;
	(posY<0)? posY = 0 : 0;
	scrollbar='0';

	loc_time = getLocalTime();

	win = window.open('','new_popup'+loc_time,'width='+w+',height='+h+',toolbar=no,menubar=no,resizable=no, scrollbars='+scrollbar+',statusbar=no,top='+posY+',left='+posX+',screenX='+posX+' ,screenY='+posY);

	win.document.open();
	win.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r\n');
	win.document.write('<html>\r\n<head>\r\n'
		+'<title>'+title+'</title>\r\n'
		+'<style type="text/css">\r\n'
		+' body{ margin:0; padding:0; background: #FFFFFF;}\r\n'
		+'</style>\r\n'
		+'</head>\r\n'
		+'<body>\r\n');
	win.document.write('<img src="'+img+'" width="'+w+'" height="'+h+'" alt="'+title+'" title="'+title+'" onclick="window.close();" />\r\n');
	win.document.write('</body>\r\n</html>\r\n');
	win.document.close();
	win.focus();
}