/**
*(c)CopyRight 2009 This Script is the work of Mike.cc
* No Part of this maybe copied with out the permission
* of the creator
* mike.cc@tesco.net
*/

function first(){
var name = document.gifty.name.value;
var names = document.gifty.surname.value;
var title2 = document.gifty.title.value;
var othert = document.gifty.othert.value;
var house = document.gifty.house.value;
var street = document.gifty.street.value;
var town = document.gifty.town.value;
var area = document.gifty.area.value;
var pcode = document.gifty.pcode.value;


var story = "<div id='left'><img src='giftaid/11thmedlogo.jpg' width='100' height='100' alt='logo'></div> ";
story += "<div id='right'><img src='http://www.11thmedwayscouts.co.uk/images/scouts.gif'width='150' height='100' alt='Scouts logo'></div>";
story += "<div id='left'><address>11th MEDWAY SCOUT GROUP<br> Rycroft Hall<br> Boundary Road<br> Chatham<br> Kent</address></div><br><br>";

story += "<br><br><br><br><br><br><br><br><h3>Donor Details:</h3>"
story += "<p>" + wordcap(othert) + "" + wordcap(title2) + " " + wordcap(name) + " " + wordcap(names) + "";
story += "<br>" + wordcap(house) + " " + wordcap(street) + "<br>" + wordcap(town) + "<br>" +  wordcap(area) + "<br>" + wordcap1(pcode) + "</p>";

 story += "<br><br><br><br><br><br>";
 story += "<h4>DECLARATION :</h4><p><br> I want the charity to treat all donations I have made since April 6th 2000,<br>and all donations I make from the date of this declaration until I notify you otherwise,<br> as a Gift Aid donation";
 story += "</p>";
 story += "<br><br><br><br><br>Signed: .........................................................                        Date:....../....../......";
 story += "<br>"+wordcap(othert)+""+wordcap(title2)+" "+wordcap(name)+" "+wordcap(names)+"";
	// show story in new window
setupWindow(name, story);
}


function setupWindow(name, contentString) {
	// opens a new window to display the given contentString,
	
	// using the given name to personalize page title and heading,

var top = "<html><head><title>" +wordcap(name)+  "'s Gift Aid Declaration</title>";
top += "<link rel='stylesheet' type='text/css' href='giftaid/gift.css'></head>";
top += "<body><h1>GIFT AID DECLARATION</h1>"; // heading

var StoryWindow = window.open('', 'StoryWindow'); // open a new window

	// construct page with the following variables
	
StoryWindow.document.write(top);
StoryWindow.document.write(contentString);
StoryWindow.document.write("</body></html>");
StoryWindow.document.close();

StoryWindow.focus(); //raise this window to the front, in case it's not visible
}

function wordcap (word) {
var firstletter = word.charAt(0);
var rest = word.substring(1);
return firstletter.toUpperCase() + rest;
}
function wordcap1 (word) {
var firstletter = word;
return firstletter.toUpperCase()
}