/*
This function written by Simon Willison:
http://simon.incutio.com/archive/2004/05/26/addLoadEvent
*/

function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
oldonload();
func();
		}
	}
}



// Hide email script, thanks to: http://www.htmldog.com

addLoadEvent(view_address);

function view_address() {
	address_to_replace=document.getElementById("e").firstChild;
	real_address=address_to_replace.nodeValue.replace("@", "@");
	address_to_replace.nodeValue=real_address; 
	address_to_replace.parentNode.setAttribute("href", "mailto:"+real_address); 
}




// Fancy Rules. Thanks to www.sitepoint.com.

addLoadEvent(fancyRules);

function fancyRules() { 
 if (!document.getElementsByTagName) return;  
 var hr = document.getElementsByTagName("hr");   
  for (var i=0; i<hr.length; i++) {           
  var newhr = hr[i]; 
  var wrapdiv = document.createElement('div');    	
  wrapdiv.className = 'line';                     
  newhr.parentNode.replaceChild(wrapdiv, newhr);  
  wrapdiv.appendChild(newhr);                     
 }
} 


// Are you sure.

function rusure(){
	question = confirm("Please note: you are about to view the old site. New site coming soon.")
	if (question !="0"){
		top.location = "http://www.hailltd.org"
	}
}




// AutoDate.

    today=new Date();
    y0=today.getFullYear();


// Simple form check.

function isReady(recv_form) {
  	if (recv_form.email.value != "")
  	  	return true;
  	else {
  	  	alert("Please include a valid email address.");
recv_form.email.focus();
return false;
}
}

// Simple toggle.
function toggle( targetId ){
 if (document.getElementById){
        target = document.getElementById( targetId );
          if (target.style.display == "none"){
             target.style.display = "";
          } else {
             target.style.display = "none";
         }
     }
}


// thanks to: Richard Rutter of www.clagnut.com for the script.

addLoadEvent(initImage);

document.write("<style type='text/css'>#client {visibility:hidden;}</style>");

function initImage() {
	imageId = 'client';
	image = document.getElementById(imageId);
	setOpacity(image, 0);
	image.style.visibility = "visible";
	fadeIn(imageId,0);
}


function fadeIn(objId,opacity) {
	if (document.getElementById) {
		obj = document.getElementById(objId);
		if (opacity <= 100) {
			setOpacity(obj, opacity);
			opacity += 10;
			window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 100);
		}
	}
}
function setOpacity(obj, opacity) {
	opacity = (opacity == 100)?99.999:opacity;
	// IE/Win
	obj.style.filter = "alpha(opacity:"+opacity+")";
	// Safari<1.2, Konqueror
	obj.style.KHTMLOpacity = opacity/100;
	// Older Mozilla and Firefox
	obj.style.MozOpacity = opacity/100;
	// Safari 1.2, newer Firefox and Mozilla, CSS3
	obj.style.opacity = opacity/100;
}

