//alert("This is library_ssi.js")

// Browser Sniffer - a very cut down version of
// http://developer.netscape.com/docs/examples/javascript/browser_type.htm

var agt=navigator.userAgent.toLowerCase();

var is_major=parseInt(navigator.appVersion);
var is_nav  =(  (agt.indexOf('mozilla')!=-1)
                 && (agt.indexOf('spoofer')==-1)
                 && (agt.indexOf('compatible')==-1)
                 && (agt.indexOf('opera')==-1)
                 && (agt.indexOf('webtv')==-1));
var is_nav4up= (is_nav && (is_major >=4));
var is_nav5up= (is_nav && (is_major >=5));
var is_ie   =(agt.indexOf("msie") !=-1);
var is_ie4up=(is_ie  && (is_major >=4));
var is_aol  =(agt.indexOf("aol") !=-1);
var is_opera=(agt.indexOf("opera") !=-1);
var is_opera4up=(is_opera && (is_major >=4));
var is_webtv=(agt.indexOf("webtv") !=-1);
var is_win  =(  (agt.indexOf("win")!=-1)
                 || (agt.indexOf("16bit")!=-1) );
var is_mac  =(agt.indexOf("mac")!=-1);
var is_firefox  =(agt.indexOf("firefox")!=-1);

// -----------------------------------------------------/
// --          MastHead Rollover Scripts              --/
// --                                                 --/
// -----------------------------------------------------/

var flag=false;
if (document.images)
{
 atgdon      =new Image(257,30); atgdon.src      ="/images/masthead/atgd3on.gif";
 atgdoff     =new Image(257,30); atgdoff.src     ="/images/masthead/atgd3off.gif";
 motifhome   =new Image(100,80); motifhome.src   ="/images/motifs/home2.gif";
 motifsearch =new Image(100,80); motifsearch.src ="/images/motifs/search2.gif";
 motifcontact=new Image(100,80); motifcontact.src="/images/motifs/contact2.gif";
 motiftheatre=new Image(100,80); motiftheatre.src="/images/motifs/vital.jpg";
 motifpr     =new Image(100,80); motifpr.src     ="/images/motifs/pr.gif";
 motifkendo  =new Image(100,80); motifkendo.src  ="/images/motifs/kendo.gif";
 motifweb    =new Image(100,80); motifweb.src    ="/images/motifs/web.gif";
 motifand    =new Image(100,80); motifand.src    ="/images/motifs/orla.gif";
 motifbigimg =new Image(100,80); motifbigimg.src ="/images/motifs/motifbig.gif";
 printableheadon =new Image(16,14);  printableheadon.src ="/images/masthead/printon.gif";
 printablefooton =new Image(16,14);  printablefooton.src ="/images/masthead/print.gif";
 printablession =new Image(16,14);   printablession.src ="/images/masthead/printon.gif";
 flag=true;
}

if (document.images)
{
// ptloff=new Image(6,6); ptloff.src="/images/page/tlcorner.gif";
// ptroff=new Image(6,6); ptroff.src="/images/page/trcorner.gif";
// pbloff=new Image(6,6); pbloff.src="/images/page/blcorner.gif";
// pbroff=new Image(6,6); pbroff.src="/images/page/brcorner.gif";
 printableheadoff=new Image(16,14);  printableheadoff.src     ="/images/masthead/print.gif";
 printablefootoff=new Image(16,14);  printablefootoff.src     ="/images/masthead/printon.gif";
 printablessioff =new Image(16,14);  printablessioff.src      ="/images/masthead/print.gif";
 motifoff=new Image(100,80); 
 motifoff.src ='/images/motifs/'+motif;
}


function rollIn(imgName)
{ //alert("rollIn "+imgName);
if (((document.images)&& (document.location.search.indexOf('printable')==-1)) && (flag==true))
 {
 document[imgName].src=eval(imgName + "on.src");
 self.status=eval(imgName + "on.src");
 }
 return true;
}

function rollOut(imgName)
{ //alert('rollOut('+imgName+')');
if ((document.images)&& (document.location.search.indexOf('printable')==-1))
 {document[imgName].src=eval(imgName + "off.src");  }
}

function rollmotifIn(imgName)
 {
 if ((document.images)&& (document.location.search.indexOf('printable')==-1))
 { document['motif'].src=eval("motif"+imgName + ".src");}
 }

function rollmotifOut()
 { // alert('rollmotifOut()');
 if ((document.images)&& (document.location.search.indexOf('printable')==-1))
 {document['motif'].src=motifoff.src;}
 }

function ietest(x) {if (window.focus) {window.focus()}}

// -----------------------------------------------------/
// --         NETSCAPE Layer Resize bug fix           --/
// --                                                 --/
// -----------------------------------------------------/

function reSized()
  { if (innerWidth !=top.storeWidth || innerHeight !=top.storeHeight)  location.reload();}

if (document.layers)
  {top.storeWidth=innerWidth;   top.storeHeight=innerHeight;}

if (document.layers){onresize=reSized;}

//      -----------------------------------------------------/
//      --                    popview                      --/
//      --                                                 --/
//      --      My script for a pop up image viewer        --/
//      -----------------------------------------------------/

//  This script provides a neat way to view larger images from thumbnail links.
//  A pop up window opens, displaying a "downloading" notice and the title of the image.
//  When the image has downloaded, a new window opens fitted to the image, with its title
//  shown in the Title bar, the window is given focus and the download image closed.
//  Clicking anywhere on the image will then close the window.

//  To avoid unnecessary downloading this script calls a 2nd page - viewer.htm,
//  which must be kept in the same directory as this script.
//  To use this script, wrap the thumbail in ordinary <a> tags, with these attributes:
//
//  <a
//  href="javascript:showViewer('imagepath','Image Title')"
//  onMouseOver="window.status='Image Title (Click for enlargement)';return true;"
//  onMouseOut="window.status='';return true">
//
//  Note that the image path is relative to the directory of the page which calls
//  this script and requires "\/" instead of "/" e.g. "\/images\/bigimages\/"
//
//  Also note that the above notes are out of date

pp=new Array;var ppno=0;

function showViewer(isrc,ittl)
 {
 window.status="Loading "+ittl;

 if(is_webtv )
  {// Load image in a table with title in status line in Webtv
  location.href="\/js\/nopopviewer.htm?isrc="+isrc+"ittl="+ittl
  }

 else if((is_nav && !is_nav4up) || is_opera )
  {// Just load the image in NN3 and Opera
  //alert("defunkt browser");
  location.href=isrc
  }

 else
  {// Pop-up image viewer
  var ww=250; var wh=240;  // size of download notice
  var posx=parseInt((window.screen.width-ww)/2);    // attempt to center
  var posy=parseInt((window.screen.availHeight-wh)/2);

//alert("posx="+posx+", posy="+posy)

  args="height=" + wh
       + ",width=" + ww
       + ",top=" + posy
       + ",left=" + posx
       + ",toolbar=0"
       + ",menubar=0"
       + ",status=1"
       + ",scrollbars=0"
       + ",resizable=0";
   viewer=new Object ;
   pp[ppno]=window.open("\/js\/viewer.htm?ppno="+ppno+"isrc="+isrc+"ittl="+ittl, "viewer", args)
   ppno+=1
   }
 }

//      -----------------------------------------------------/
//      --                  GOOGLE SCRIPT                 --/
//      --                                                 --/
//      -----------------------------------------------------/
// Google site search + Prevent multiple form submission

var googlesitesearchSubmitted = false;

function validategooglesiteForm(form)
{//alert("Validating")
if(!googlesitesearchSubmitted)
  {googlesitesearchSubmitted = true;
  var v=form.q.value.indexOf('www.georgedillon.com');
  //alert("v is "+v);
  if (v!=-1){}
  else
   { form.q.value+=" +site\:www.georgedillon.com";}

  timeoutUnlockform=setTimeout("googlesitesearchSubmitted=false",3000);

  }
 else
  {return false;}

 return true;
}

//      -----------------------------------------------------/
//      --                    Miscellaneous                --/
//      --                                                 --/
//      --    Little bits of things added last minute      --/
//      -----------------------------------------------------/

self.focus()


//mouse Over right alert once

var mOr="false"
function mOrfun()
{//alert("mOrfun")
if(mOr=="false")
  {alert("               PLEASE NOTE\:\n\nThe links in the RIGHT-HAND column are to files\nformatted for PRINTING. They are NOT optimised\nfor web-browsing and can be very LARGE.\n\nDo not click here unless you are sure you want\nto DOWNLOAD a file for PRINTING.\n\nTo download a file, right-click the fileNAME\n(Mac option-click) and choose 'Save target/link\nas...' or 'Download target(s) as...'\n\nP.S. This notice comes once (only) per page.");
  mOr="true"}
}


// Resize and center printable windows

function resizePrintable()
{//alert("resizePrintable");
//GET SCREEN DIMENSIONS
var sh=window.screen.height; var sw=window.screen.width;
if(window.screen.availHeight){sh=window.screen.availHeight;}
//MATCH IMAGE NAME AND GET IMAGE DIMENSIONS
if(sh>829) {window.moveTo((sw-750)/2,0);window.resizeTo(750,sh)}
else{if(sh>599) {window.moveTo((sw-750)/2,0);window.resizeTo(750,sh)}
     else {}}
}
if(document.location.search.indexOf("printable")!=-1)
{resizePrintable()}


// Allow user to resize text

function textSizer(cssSize){
if(cssSize=="csssmall"){cssSize=""}
  else{cssSize="?"+cssSize}
lh = location.href;hs=lh.indexOf('#');qs=lh.indexOf('?');
if(hs!=-1)
 {//alert('got a hash')
 if(qs!=-1)
  {//alert('got a hash and a qs')
  newURL=lh.substring(0,qs) +  cssSize + lh.substring(hs,lh.length);
  }
 else
  {//alert('got a hash but no qs')
  newURL=lh.substring(0,hs) + cssSize + lh.substring(hs,lh.length);
  }
 }
else
 {//alert('no hash')
 newURL=location.href.substring(0,((location.search) ? location.href.indexOf('?') : location.href.length)) + cssSize;
 }
}


// Prevent multiple form submission

var searchSubmitted = false;

function validateForm(form)
{//alert("Validating")
if(!searchSubmitted)
  {searchSubmitted = true;
  timeoutUnlockform=setTimeout("searchSubmitted=false",3000); }
 else
  return false;
 return true;
}

var commentSubmitted = false;
function validateCommentForm(form)
{ //alert("Validating");
if(!commentSubmitted)
  {commentSubmitted = true;
  timeoutUnlockform=setTimeout("commentSubmitted=false",3000); }
 else
  {return false;
  }
 return true;
}

top.commentval = 0;

function submitCommentForm()
{//alert("submitForm()");
	top.notready="ready";

	if (document.forms[1].c0m1m2e7n3tsubject.value == "")
	    {alert("Please enter a Subject.");
		document.forms[1].c0m1m2e7n3tsubject.focus();
	    top.notready="notready"}

	if (document.forms[1].c0m1m2e7n3tcomment.value == "")
	    {alert("Please enter a Comment.");
		document.forms[1].c0m1m2e7n3tcomment.focus();
	    top.notready="notready"}

	if (document.forms[1].c0m1m2e7n3tname.value == "")
	    {alert("Please enter a Name.");
		document.forms[1].c0m1m2e7n3tname.focus();
	    top.notready="notready"}

	if (document.forms[1].c0m1m2e7n3temail.value == "")
	    {alert("Please enter an Email address.");
		document.forms[1].c0m1m2e7n3temail.focus();
	    top.notready="notready"}
	    
        if (document.forms[1].c0m1m2e7n3tcomment.value.indexOf('ingtones')!=-1) 
	    {alert("Ha! Ha! Ha!");
	    top.notready="notready"}
	if (document.forms[1].c0m1m2e7n3tcomment.value.indexOf('Thank you for stopping by my site')!=-1) 
	    {alert("Ha! Ha! Ha!");
	    top.notready="notready"}
        if (document.forms[1].c0m1m2e7n3tcomment.value.indexOf('xoomer.alice.it')!=-1) 
	    {alert("Ha! Ha! Ha!");
	    top.notready="notready"}   
	    
	    

	if (document.forms[1].c0m1m2e7n3tval.value == top.commentval)
	    {}
	else
	    {alert("Sorry, you got the validation code wrong... please try again.");
		document.forms[1].c0m1m2e7n3tval.focus();
	    top.notready="notready"}

	if (top.notready=="ready")
		{
        document.forms[1].submit();
        }
        
        
}

