// I handle mouse-over states for images
function switcher(i) {
	var id = document.getElementById(i);
	var s = id.src;
	var type;
	var src;
	var nsrc;
	
	if (s.indexOf(".gif") >= 0) {
		type = ".gif";
	} else if (s.indexOf(".jpg") >= 0) {
		type = ".jpg";
	} else {
		alert("This is not an image.");
	}
	
	src = s.replace(type, "");
	
	if (src.indexOf("-on") == -1) {
		nsrc = src + "-on" + type;
	} else {
		nsrc = src.replace(/-on/, "");
		nsrc += type;
	}
	
	id.src = nsrc;
}


// Form overlay
var browsew = 640;
var browseh = 480;

function resetForm(){
	document.getElementById("Action").value = "0";
	document.getElementById("FullName").value = "";
	document.getElementById("Email").value = "";
	document.getElementById("Phone").value = "";
	document.getElementById("Message").value = "";

}

function loadoverlay(id1, id2) {
	var browsew = document.documentElement.clientWidth;
	var browseh = (document.height !== undefined) ? document.height : document.body.offsetHeight;
	var totalheight = document.documentElement.scrollHeight;
	var overlay = document.getElementById(id1);
	var theform = document.getElementById(id2);
	overlay.style.width = browsew + "px";
	overlay.style.height = totalheight + "px";
	overlay.className = "overlay";
	theform.className = "contactForm";
	theform.style.left = (browsew - 500)/2 + 'px';
	theform.style.top = 100 + 'px';

	document.getElementById("Action").value = "1000";
}
function hideForm(id1) {
	var theform = document.getElementById(id1);
	theform.className = "off";
}

function closeoverlay(id1, id2) {
	var overlay = document.getElementById(id1);
	var theform = document.getElementById(id2);
	overlay.className = "off";
	theform.className = "off";
	
	document.getElementById("Action").value = "0";
	document.EmailForm.submit();
}

// I load Flash movies
var required = DetectFlashVer('8','0','0');
var tr = 0;

function fl(url,w,h,t) {
	var fla;
	if (required) {
		fla = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="' + w + '" height="' + h + '">';
		fla += '<param name="movie" value="' + url + '" />';
		fla += '<param name="quality" value="high" />';
		if (tr == 0) {
			fla += '<param name="wmode" value="transparent" />';
		} else {
		}
		fla += '<embed src="' + url + '" quality="high" pluginspage="https://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"';
		if (tr == 0) {
			fla += 'wmode="transparent" ';
		} else {
		}
		fla += 'width="' + w + '" height="' + h + '"></embed>';
		fla +='</object>';
	} else {
		fla = '<p>You do not have the required version of the <a href="https://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash">Adobe Flash</a> plug-in. Please download and install the plug-in to experience this site in full.</p>';
	}
	
	if (t == null) {
		document.write(fla);
	} else {
		document.getElementById(t).innerHTML = fla;
	}
}

