// JavaScript Document
function imageLoad() {  // called with onLoad()
    if (document.images) {
        img1on = new Image(); img1on.src = "images/bttnbck_g.gif"
		img2on = new Image(); img2on.src = "images/http.gif"
		img3on = new Image(); img3on.src = "images/stripe_bullet.gif";
		img4on = new Image(); img4on.src = "images/webpics/gn.gif";
		img5on = new Image(); img5on.src = "images/webpics/imaginaire.gif";
		img6on = new Image(); img6on.src = "images/webpics/pto.gif";
		img7on = new Image(); img7on.src = "images/webpics/fota.gif";
		img8on = new Image(); img8on.src = "images/webpics/amc.gif";
		img9on = new Image(); img9on.src = "images/webpics/optimist.gif";
		img10on = new Image(); img10on.src = "images/webpics/abis.gif";
		img11on = new Image(); img11on.src = "images/services_sidebar.gif";
		img12on = new Image(); img12on.src = "images/philosophy_sidebar.gif";
		img13on = new Image(); img13on.src = "images/portfolio_sidebar.gif";
		img14on = new Image(); img14on.src = "images/contact_sidebar.gif";
    }
}

if (document.images) {   // load the off images in the normal way	
	img1off = new Image(); img1off.src = "images/bttnbck_r.gif";
	img2off = new Image(); img2off.src = "images/redback_small_2.gif";
	img3off = new Image(); img3off.src = "images/home_sidebar.gif";
	img4off = new Image(); img4off.src = "images/greyfade.gif"
	img5off = new Image(); img5off.src = "images/redfade.gif"
}
//Function to pop info windows
function gotoBlog(poppageURL,popW,popH){
var newLocation = document.blogForm.blog[document.blogForm.blog.selectedIndex].value
var w = screen.availWidth;
var  h = screen.availHeight;

var leftPos = (w-popW)/2, topPos = (h-popH)/2;

window.open(newLocation, "", 'width=' + popW + ',height=' + popH + ',top=' + topPos + ',left=' + leftPos + ',scrollbars' + ',resizable');
}

//Function to pop old blogs in separate window
function gotoBlog2(poppageURL,popW,popH){
var w = screen.availWidth;
var  h = screen.availHeight;

var leftPos = (w-popW)/2, topPos = (h-popH)/2;

window.open(poppageURL, "", 'width=' + popW + ',height=' + popH + ',top=' + topPos + ',left=' + leftPos + ',scrollbars' + ',resizable');
}

//Place cursor in first form field
function placecursor(){
inqForm.Name.focus()
}
//Start form validation (Check for name and email)
function check_form(f) {
if(f.Name.value.length < 1){
alert("You have left the name field blank.");
f.Name.focus(); // put the prompt in the name field 
// if the browser is Netscape 6 or IE
if(document.all || document.getElementByID){
// change the color of text field
f.Name.style.background = "#FFFF9D";
}
// make sure the form is not submitted
return false;
}

// check the first email address ( the exclamation means "not" )
if(!check_email(f.Email.value)){
alert("Invalid email detected.");
f.Email.focus(); 
// if the browser is Netscape 6 or IE
if(document.all || document.getElementByID){
// change the color of text field
f.Email.style.background = "#FFFF9D";
}
// make sure the form is not submitted
return false;
}
}

// Email Validation. Written by PerlScriptsJavaScripts.com

function check_email(e) {
ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";

for(i=0; i < e.length ;i++){
if(ok.indexOf(e.charAt(i))<0){ 
return (false);
}	
} 
if (document.images) {
re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
if (!e.match(re) && e.match(re_two)) {
return (-1);		
} 
}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
// Code for garden tour before images
function showpicture(selectobj){
piccontainerobj=document.getElementById("picture")
alert(piccontainerobj)
resetfade(10)
piccontainerobj.innerHTML='<img src="'+selectobj+'">'
alert(piccontainerobj.innerHTML)
fadepictoview=setInterval("gradualfade(piccontainerobj)",50)
}

function resetfade(degree){
if (window.fadepictoview)
clearInterval(fadepictoview)
if (typeof piccontainerobj.style.MozOpacity=="string")
piccontainerobj.style.MozOpacity=degree/100
else if (piccontainerobj.filters)
piccontainerobj.filters.alpha.opacity=degree
}

function gradualfade(){
if (typeof piccontainerobj.style.MozOpacity=="string" && piccontainerobj.style.MozOpacity<1)
piccontainerobj.style.MozOpacity=Math.min(parseFloat(piccontainerobj.style.MozOpacity)+0.2, 0.99)
else if (piccontainerobj.filters && piccontainerobj.filters.alpha.opacity<100)
piccontainerobj.filters.alpha.opacity+=20
else //if not IE or Moz
clearInterval(fadepictoview)
}
//Allow users to print popup window
function winprint(){
window.print()
}