/*
 * Create email adresses
 * Used instead of mailto: for preventing spam
 */
 
sendMail = function(user,domain) {
	try {
		locationstring = "mailto:" + user + "@" + domain; 
		window.location = locationstring; 
	}
	catch(error) {
		errorMessage(error, "There was an error when trying to send mail to:\n\n"+user+"@"+domain);
		return false;
	}
}

//////////////////////////////////////////////////
/*
 * POPUP FUNCTIONS
 */

// Open Centered Popup

openCenteredPopup = function(mypage,w,h,scroll,resizable) {
	var win = null;

	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	
	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable='+resizable+'';
	
	win = window.open(mypage,"centerpopup",settings)
	win.focus();
}

// Open Popup 

openPopup = function(mypage,w,h,scroll,resizable,Lpos,Tpos) {
	var win = null;
	
	settings = 'height='+h+',width='+w+',top='+Tpos+',left='+Lpos+',scrollbars='+scroll+',resizable='+resizable+'';
	
	win = window.open(mypage,"popUp",settings)
	win.focus();
}


//////////////////////////////////////////////////
/*
 * SLIDESHOW
 */

// slideshow

<!-- Begin
// Set slideShowSpeed (milliseconds)
var slideShowSpeed = 3000;
// Duration of crossfade (seconds)
var crossFadeDuration = 3;
// Specify the image files
var Pic = new Array();
// to add more images, just continue
// the pattern, adding to the array below

Pic[0] = 'image_bin/01.jpg'
Pic[1] = 'image_bin/02.jpg'
Pic[2] = 'image_bin/03.jpg'
Pic[3] = 'image_bin/04.jpg'
Pic[4] = 'image_bin/05.jpg'
Pic[5] = 'image_bin/06.jpg'


// do not edit anything below this line
var t;
var j = 0;
var p = Pic.length;
var preLoad = new Array();
for (i = 0; i < p; i++) {
preLoad[i] = new Image();
preLoad[i].src = Pic[i];
}
function runSlideShow() {
if (document.all) {
document.images.SlideShow.style.filter="blendTrans(duration=2)";
document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)";
document.images.SlideShow.filters.blendTrans.Apply();
}
document.images.SlideShow.src = preLoad[j].src;
if (document.all) {
document.images.SlideShow.filters.blendTrans.Play();
}
j = j + 1;
if (j > (p - 1)) j = 0;
t = setTimeout('runSlideShow()', slideShowSpeed);
}
//  End -->


//////////////////////////////////////////////////
/*
 * Create roll overs for navigation
 * 
 */
 
home_up = new Image
straw_up = new Image
haylage_up = new Image
shavings_up = new Image
hay_up = new Image
contact_up = new Image
muckhopping_up = new Image
image1_up	= new Image
image2_up	= new Image
image3_up	= new Image
equisorb_up	= new Image

home_over = new Image
straw_over = new Image
haylage_over = new Image
shavings_over = new Image
hay_over = new Image
contact_over = new Image
muckhopping_over = new Image
image1_over = new Image
image2_over	= new Image
image3_over	= new Image
equisorb_over	= new Image

home_up.src = "image_bin/home_up.gif"
straw_up.src = "image_bin/straw_up.gif"
haylage_up.src = "image_bin/haylage_up.gif"
shavings_up.src = "image_bin/shavings_up.gif"
hay_up.src = "image_bin/hay_up.gif"
contact_up.src = "image_bin/contact_up.gif"
muckhopping_up.src = "image_bin/muckhopping_up.gif"
image1_up.src = "image_bin/image1_up.gif"
image2_up.src = "image_bin/image2_up.gif"
image3_up.src = "image_bin/image3_up.gif"
equisorb_up.src = "image_bin/equisorb_up.gif"

home_over.src = "image_bin/home_over.gif"
straw_over.src = "image_bin/straw_over.gif"
haylage_over.src = "image_bin/haylage_over.gif"
shavings_over.src = "image_bin/shavings_over.gif"
hay_over = "image_bin/hay_over.gif"
contact_over.src = "image_bin/contact_over.gif"
muckhopping_over.src = "image_bin/muckhopping_over.gif"
image1_over.src = "image_bin/image1_over.gif"
image2_over.src = "image_bin/image2_over.gif"
image3_over.src = "image_bin/image3_over.gif"
equisorb_over.src = "image_bin/equisorb_over.gif"

function imgOver(thisImg) {
	document[thisImg].src = "image_bin/" + thisImg + "_over.gif"
}
	
function imgOut(thisImg) {
	document[thisImg].src = "image_bin/" + thisImg + "_up.gif"
}

//////////////////////////////////////////////////


/*
 * Resizable pop up script
 */

		function PopupPic(sPicURL) { 
     window.open( "pop.asp?"+sPicURL, "pop",  
     "resizable=1,height=200,width=200"); } 

//////////////////////////////////////////////////


/* IMAGE PRELOADING
 * 
 * Used for preloading images on every page.
 * 
 */
 
function preloadImages(ImageSources)
{
  for (var i = 0; i < ImageSources.length; i++)
  {
    var oImage = new Image();
    oImage.src = ImageSources[i];
  }
}