function browserCheck() 
{
	var b = navigator.appName;
	if (b == "Netscape") 
		this.b = "ns";
	else if (b == "Microsoft Internet Explorer") 
		this.b = "ie";
	else 
		this.b = b
	this.us = navigator.userAgent;
	
	//Opera check
	
	this.opera = this.us.indexOf("Opera");
	if(this.opera != -1){
		this.opera = true;
		this.b = "";
	}
	else {
		this.opera = false;
	}
	
	//Firefox Check
	
	this.firefox = this.us.indexOf("Firefox");
	if(this.us.indexOf("Firefox")!=-1){
		this.firefox = true;	
	}else{
		this.firefox = false;	
	}
	
	//Pocket
	
	if(this.us.indexOf("Pocket")!=-1){
		this.pocket = true;	
	}	else if(this.us.indexOf("PPC")!=-1){
		this.pocket = true;	
	}else{
		this.pocket = false;	
	}
	
	//DOM Check
	
	this.DOM = (document.createElement && document.getElementsByTagName);
	
	this.version = navigator.appVersion;
	if (this.b == 'ie')
	{ 
		var ve = this.version.indexOf("MSIE")
		this.v = parseInt(this.version.substr(ve+4))
	}
	else 
	this.v = parseInt(this.version)
	this.ns = (this.b=="ns" && this.v>=4)
	this.ns4 = (this.b=="ns" && this.v<5)
	this.ns5 = (this.b=="ns" && this.v==5)
	this.ie = (this.b=="ie" && this.v>=4)
	this.ie4 = (this.version.indexOf('MSIE 4')>0)
	this.ie5 = (this.version.indexOf('MSIE 5')>0)
	this.ie55 = (this.version.indexOf('MSIE 5.5')>0)
	this.ie6 = (this.version.indexOf('MSIE 6')>0) 
	this.min = (this.ns||this.ie)
}//end BrowserCheck() 

is = new browserCheck();

if(is.pocket){
	document.write('<link rel="stylesheet" type="text/css" href="/common/pocket.css"/>');
}else{
	document.write('<link rel="stylesheet" type="text/css" href="/common/styles.css"/>');
}

function WindowProperty(){
	if(is.ie){
		this.iH = document.body.clientHeight;
		this.iW = document.body.clientWidth;	
	}else{
		this.iH = window.innerHeight;
		this.iW = window.innerWidth;	
	}
}

// Example: obj = findObj("image1");
function findObj(theObj, theDoc)
{
  var p, i, foundObj;
  
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  
  return foundObj;
}


function SetLayout(){

	Obj = findObj("container");

	WinProp = new WindowProperty();

	if(WinProp.iW < 960){
		Obj.style.width = "97%";
	}else{
		Obj.style.width = "960px";
	}
	
	Obj.style.display = "block";
	
}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		Img01 = newImage("/img/icon-down-over.png");
		Img02 = newImage("/img/icon-sitemap-over.png");		
		Img03 = newImage("/img/icon-contacts-over.png");				
		preloadFlag = true;
	}
}

function ScreenInfo(){
	this.w=screen.width;
	this.h=screen.height;
}

scrinfo = new ScreenInfo();
var popUpWin;

// required function ScreenInfo()
function	popUp(URLStr, width, height)
{
	leftPos = (scrinfo.w - width)/2;
	topPos = (scrinfo.h - height)/2;
	if(popUpWin) popUpWin.close();	
	URLStr = "view.html?" + URLStr;
	popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbars=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+leftPos+', top='+topPos+',screenX='+leftPos+',screenY='+topPos+'');
}