// JavaScript Document
function showImage(image, width, height)
	{
		this.width = parseInt(width) + 20;
		this.height = parseInt(height) + 20;
		
		len = location.href.split("/").length
		var dir = '';
		
		for(x=0; x < len -1; x++)
			{
				dir = dir + location.href.split("/")[x] + "/";
			}
		
		var windowname = 'mywin'
		var mywin = window.open('','','top=20,left=20,width='+this.width+',height='+this.height+',toolbar=0,resizable=1');
		img = mywin.document.createElement('img');
		img.src = dir + "images/" + image;
		mywin.document.body.appendChild(img);

	}
	
function updateField(element,sendvalue) 
	{
		document.getElementById(element).value = sendvalue;
	}
	
function signUp()
	{
		new Ajax.Updater('newsletter', 'process_newsletter.asp', {onLoading:function(request){Element.show('indicator')}, onComplete:function(request){Element.hide('indicator');}, parameters:"name=" + encodeURI(document.getElementById("name").value) + "&email=" + encodeURI(document.getElementById("email").value), evalScripts:true, asynchronous:true});
	}
	
function sendQuote()
	{
		new Ajax.Updater('quote', 'process_quote.asp', {onLoading:function(request){Element.show('indicator')}, onComplete:function(request){Element.hide('indicator');}, parameters:"quote_fname=" + encodeURI(document.getElementById("quote_fname").value) + "&quote_sname=" + encodeURI(document.getElementById("quote_sname").value) + "&quote_comp_address1=" + encodeURI(document.getElementById("quote_comp_address1").value) + "&quote_comp_address2=" + encodeURI(document.getElementById("quote_comp_address2").value) + "&quote_comp_city=" + encodeURI(document.getElementById("quote_comp_city").value) + "&quote_comp_county=" + encodeURI(document.getElementById("quote_comp_county").value) + "&quote_comp_postcode=" + encodeURI(document.getElementById("quote_comp_postcode").value) + "&quote_comp_telephone=" + encodeURI(document.getElementById("quote_comp_tel").value) + "&quote_comp_fax=" + encodeURI(document.getElementById("quote_comp_fax").value) + "&quote_comp_email=" + encodeURI(document.getElementById("quote_comp_email").value) + "&quote_comp_website=" + encodeURI(document.getElementById("quote_comp_website").value) + "&quote_survey_address1=" + encodeURI(document.getElementById("quote_survey_address1").value) + "&quote_survey_address2=" + encodeURI(document.getElementById("quote_survey_address2").value) + "&quote_survey_city=" + encodeURI(document.getElementById("quote_survey_city").value) + "&quote_survey_county=" + encodeURI(document.getElementById("quote_survey_county").value) + "&quote_survey_postcode=" + encodeURI(document.getElementById("quote_survey_postcode").value) + "&quote_years=" + encodeURI(document.getElementById("quote_years").value) + "&quote_floors=" + encodeURI(document.getElementById("quote_floors").value) + "&quote_size=" + encodeURI(document.getElementById("quote_size").value) + "&quote_use=" + encodeURI(document.getElementById("quote_use").value) + "&quote_type=" + encodeURI(document.getElementById("quote_type").value), evalScripts:true, asynchronous:true});
	}
	
function externalLinks() 
	{
		if (!document.getElementsByTagName) return;
		var anchors = document.getElementsByTagName("a");
		
		for (var i=0; i<anchors.length; i++) 
			{
				var anchor = anchors[i];
				if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external")
				anchor.target = "_blank";
			}
	}
	
	
window.onload = function()
	{
		externalLinks();
	};