// JavaScript Document

// Browser Detection Javascript
// copyright 1 February 2003, by Stephen Chapman, Felgall Pty Ltd

// You have permission to copy and use this javascript provided that
// the content of the script is not changed in any way.

function getImgSize(imgSrc,imgCaption)
{
//var pTag1 = document.getElementById('myText');
var newImg = new Image();
newImg.src = imgSrc;
var height = newImg.height;
var width = newImg.width;
if (newImg.width > newImg.height)
{
document.imgbirthday.width = 467;
document.imgbirthday.height = 350;
}
else
{
document.imgbirthday.width = 265;
document.imgbirthday.height = 350;
}
document.getElementById('content-box1').setAttribute("value", imgCaption);
}

// Gallery script.
// With image cross fade effect for those browsers that support it.
// Script copyright (C) 2004 www.cryer.co.uk.
// Script is free to use provided this copyright header is included.
function LoadGallery(pictureName,imageFile,titleCaption,captionText)
{
var newImg = new Image();
newImg.src = imageFile;
var height = newImg.height;
var width = newImg.width;
if (newImg.width > newImg.height)
{
document.imgbirthday.width = 467;
document.imgbirthday.height = 350;
}
else
{
document.imgbirthday.width = 265;
document.imgbirthday.height = 350;
}	
document.getElementById('content-box1').setAttribute("value", captionText);

  if (document.all)
  {
    document.getElementById(pictureName).style.filter="blendTrans(duration=1)";
    document.getElementById(pictureName).filters.blendTrans.Apply();
  }
  document.getElementById(pictureName).src = imageFile;
  if (document.all)
  {
    document.getElementById(pictureName).filters.blendTrans.Play();
  }
  document.getElementById(titleCaption).innerHTML=captionText;
}
/*
	<a href="#_self" onclick="LoadGallery('EmilyGallery','emily01.jpg','EmilyGalleryCaption','Emily on a day out')">Emily on a day out</a>
*/


function popuppic(sPicURL)
{
var newImg = new Image();
newImg.src = sPicURL;
var height = newImg.height;
var width = newImg.width;

if (newImg.width > newImg.height)
{
	window.open( "../../popup.html?"+sPicURL, "",  
    "resizable=0,HEIGHT=525,WIDTH=700");
}
else if (newImg.width < newImg.height)
{
	window.open( "../../popup.html?"+sPicURL, "",  
    "resizable=0,HEIGHT=525,WIDTH=397");
}
else
{
	window.open( "../../popup.html?"+sPicURL, "",  
    "resizable=0,HEIGHT=500,WIDTH=500");	
}
}

var pic = null;
var popImg = null;  // use this when referring to pop-up image
var picTitle = null;
var imgCount = 0;
var imgWinName = "popImg";

function openPopImg(picName, windowTitle, windowWidth, windowHeight){
  closePopImg()
  picTitle = windowTitle
  imgWinName = "popImg" + imgCount++ //unique name for each pop-up window
  popImg = window.open(picName, imgWinName,
           "toolbar=no,scrollbars=no,resizable=no,width=" 
           + (parseInt(windowWidth))  + ",height=" 
           + (parseInt(windowHeight)),
		   screenX=0,screenY=0);
  }
function closePopImg(){    // close pop-up window if it is open 
  if (navigator.appName != "Microsoft Internet Explorer" 
      || parseInt(navigator.appVersion) >=4) //do not close if early IE
    if(popImg != null) if(!popImg.closed) popImg.close() 
  }
function setStatus(msg){
  status = msg
  return true
  }



function whichBrs() {
var agt=navigator.userAgent.toLowerCase();
if (agt.indexOf("opera") != -1) return 'Opera';
if (agt.indexOf("staroffice") != -1) return 'Star Office';
if (agt.indexOf("webtv") != -1) return 'WebTV';
if (agt.indexOf("beonex") != -1) return 'Beonex';
if (agt.indexOf("chimera") != -1) return 'Chimera';
if (agt.indexOf("netpositive") != -1) return 'NetPositive';
if (agt.indexOf("phoenix") != -1) return 'Phoenix';
if (agt.indexOf("firefox") != -1) return 'Firefox';
if (agt.indexOf("safari") != -1) return 'Safari';
if (agt.indexOf("skipstone") != -1) return 'SkipStone';
if (agt.indexOf("msie") != -1) return 'Internet Explorer';
if (agt.indexOf("netscape") != -1) return 'Netscape';
if (agt.indexOf("mozilla/5.0") != -1) return 'Mozilla';
if (agt.indexOf('\/') != -1) {
if (agt.substr(0,agt.indexOf('\/')) != 'mozilla') {
return navigator.userAgent.substr(0,agt.indexOf('\/'));}
else return 'Netscape';} else if (agt.indexOf(' ') != -1)
return navigator.userAgent.substr(0,agt.indexOf(' '));
else return navigator.userAgent;
}

function brsTyp(txtTyp)
{
	if (whichBrs() == 'Internet Explorer')
	{
		alert(IE);
	}
	else
	if(whichBrs() == 'Netscape')
	{
		alert(Netscape);
	}
	else
	if(whichBrs() == 'Firefox')
	{
		alert(Firefox);
	}
	else
	if(whichBrs() == 'Mozilla')
	{
		phoneMaskNotIE(txtPhone);
	}
}

