/**
* Writes a client testimonial table with random quote...
* Note: to encode/escape appropriate chars in texts. 
*/

blurbs = [];

function addBlurb(b, n, p, c){
	i = b.lastIndexOf(" ") + 1;
	b = b.substring(0, i) + '<nobr>' + b.substring(i);	// prevent closing quotes gif to wrap alone
	blurbs[blurbs.length] = [b, n, p, c];	
}

addBlurb(
	'The site looks beautiful! We are pleased with the design changes you made to make everything fit.', 
	'Susan Craighead', 
	'Communications Specialist', 
	'HEREIU Welfare-Pension Funds'
);

addBlurb(
	'A valuable partner with unique technology/methodology... impeccable quality in project management, translations and cultural evaluations for Eli Lilly.', 
	'Jamie Cahill', 
	'Management Supervisor', 
	'Hyphen'
);

addBlurb(
	'Weblations\' specialized translators provide the terminology, precise wording and tone that are essential in the pharmaceutical industry.', 
	'Jamie Cahill', 
	'Management Supervisor', 
	'Hyphen'
);

addBlurb(
	'Good Technology have worked successfully with Weblations on translating one of our largest multilingual European websites. They are extremely proficient and reliable in translations specifically for the internet.', 
	'Sarie Gilbert', 
	'Project Manager', 
	'Good Technology'
);

addBlurb(
	'To say Weblations are meticulous is an understatement. They are truly a unique company, committed to producing the best multilingual sites they can for their clients.', 
	'Kimi Klasser', 
	'Manager, eBusiness Marketing', 
	'Targus, Inc.'
);

addBlurb(
	'We have relied on Weblations\' excellent service for 3 years. They are the perfect website-translation partner.', 
	'Gurpreet Banerji', 
	'Marketing', 
	'Infosys'
);

addBlurb(
	'Many thanks again for your work on the Epson project. Your responsiveness and resourcefulness allowed us to meet an extremely tight deadline.', 
	'Diana Cortes', 
	'Consultant', 
	'Oyster Partners'
);

addBlurb(
	'Translation is usually the last phase of the production line. Weblations makes up for accumulated schedule slippage very efficiently.',
	'Francisco Rodr&iacute;guez',
	'Account Manager',
	'WYSIWYG'
);

addBlurb(
	'We can count on Weblations to interpret our messages and recreate them perfectly for other cultures.',
	'Paloma Atienza',
	'Account Manager',
	'Ogilvy Interactive'
);

addBlurb(
	'Weblations, always open and responsive, share a common objective with us: to see the project through to perfect completion.',
	'Javier Fern&aacute;ndez',
	'Producer',
	'IT Deusto'
);

rand = blurbs.length;
while(rand >= blurbs.length){					// overkill??
	rand = Math.floor((Math.random())*blurbs.length);
}

/**
* Writes the snippet of html with variable content to the specified page.
* args: (1) doc - the specified document object;  (2)path - the path to the 
* images folder; (3) align - "left" or "right" to let body copy flow around 
* the box or "bot" to place blurb at bottom of a page. The bottom-align 
* option actually writes the whole of the table row including the bot-left 
* corner "background" gif. 
*/
function writeBlurb(doc, path, align){
	align = align.toLowerCase();
	var str;
	if(align == "left" || align == "right"){
		str = '<table width="250" cellpadding="0" cellspacing="0" border="0" align="'+align+'">\
		<tr>\
			<td colspan="6"><img src="'+path+'/px.gif" width="250" height="10"></td>\
		</tr>\
		<tr>\
			<td><img src="'+path+'/px.gif" width="25" height="1"></td>\
			<td colspan="3" bgcolor="#000000"><img src="'+path+'/px.gif" width="198" height="1"></td>\
			<td colspan="2"><img src="'+path+'/px.gif" width="25" height="1"></td>\
		</tr>\
		<tr>\
			<td><img src="'+path+'/px.gif" width="25" height="1"></td>\
			<td bgcolor="#000000"><img src="'+path+'/px.gif" width="1" height="1"></td>\
			<td width="198" bgcolor="#f7efac">\
			<table width="198">\
			<tr><td>\
				<p class="testimonialtop">\
					<img src="'+path+'/quotes66.gif">' + blurbs[rand][0] + '<img src="'+path+'/quotes99.gif"></nobr>\
				</p>\
				<p class="testimonialbot">\
					' + blurbs[rand][1] + '<br>\
					' + blurbs[rand][2] + '<br>\
					' + blurbs[rand][3] + '\
				</p>\
			</td>\
			</td></tr>\
			</table>\
			<td bgcolor="#000000"><img src="'+path+'/px.gif" width="1" height="1"></td>\
			<td bgcolor="#999999"><img src="'+path+'/px.gif" width="2" height="1"></td>\
			<td><img src="'+path+'/px.gif" width="23" height="1"></td>\
		</tr>\
		<tr>\
			<td><img src="'+path+'/px.gif" width="25" height="1"></td>\
			<td colspan="3" bgcolor="#000000"><img src="'+path+'/px.gif" width="200" height="1"></td>\
			<td bgcolor="#999999"><img src="'+path+'/px.gif" width="2" height="1"></td>\
			<td><img src="'+path+'/px.gif" width="23" height="1"></td>\
		</tr>\
		<tr>\
			<td colspan="2"><img src="'+path+'/px.gif" width="26" height="2"></td>\
			<td colspan="3" bgcolor="#999999"><img src="'+path+'/px.gif" width="201" height="2"></td>\
			<td><img src="'+path+'/px.gif" width="23" height="2"></td>\
		</tr>\
		<tr>\
			<td colspan="6"><img src="'+path+'/px.gif" width="250" height="10"></td>\
		</tr>\
		</table>';
	}
	else{		// else align == bot
	

	str = '<tr>\
		<td class="whiteSpace" colspan="2">\
			<table width="100%" border="0" cellpadding="0" cellspacing="0">\
				<tr>\
					<td class="whiteSpace" width="104" align="left" valign="bottom"><img src="' + path + '/collageBot.gif" width="104" height="74" alt="" border="0"></td>\
					<td align="right">\
						<table width="450" cellpadding="0" cellspacing="0" border="0">\
							<tr>\
								<td colspan="6"><img src="' + path + '/px.gif" width="450" height="10"></td>\
							</tr>\
							<tr>\
								<td><img src="' + path + '/px.gif" width="10" height="1"></td>\
								<td colspan="3" bgcolor="#000000"><img src="' + path + '/px.gif" width="430" height="1"></td>\
								<td><img src="' + path + '/px.gif" width="2" height="1"></td>\
								<td colspan="2"><img src="' + path + '/px.gif" width="8" height="1"></td>\
							</tr>\
							<tr>\
								<td><img src="' + path + '/px.gif" width="10" height="1"></td>\
								<td bgcolor="#000000"><img src="' + path + '/px.gif" width="1" height="1"></td>\
								<td width="428" bgcolor="#f7efac">\
									<table width="428" cellpadding="0" cellspacing="0">\
										<tr>\
											<td>\
												<table border="0" cellpadding="2" cellspacing="0">\
													<tr>\
														<td valign="top" width="230">\
															<p class="testimonialtop">\
															<img src="' + path + '/quotes66.gif">' + blurbs[rand][0] + '<img src="' + path + '/quotes99.gif"></nobr>\
															</p>\
														</td>\
														<td valign="bottom" width="198"><p class="testimonialbot">\
															' + blurbs[rand][1] + '<br>\
															' + blurbs[rand][2] + '<br>\
															' + blurbs[rand][3] + '\
															</p>\
														</td>\
													</tr>\
												</table>\
											</td>\
										</tr>\
									</table>\
								</td>\
								<td bgcolor="#000000"><img src="' + path + '/px.gif" width="1" height="1"></td>\
								<td bgcolor="#999999"><img src="' + path + '/px.gif" width="2" height="1"></td>\
								<td><img src="' + path + '/px.gif" width="8" height="1"></td>\
							</tr>\
							<tr>\
								<td><img src="' + path + '/px.gif" width="10" height="1"></td>\
								<td colspan="3" bgcolor="#000000"><img src="' + path + '/px.gif" width="430" height="1"></td>\
								<td bgcolor="#999999"><img src="' + path + '/px.gif" width="2" height="1"></td>\
								<td><img src="' + path + '/px.gif" width="8" height="1"></td>\
							</tr>\
							<tr>\
								<td colspan="2"><img src="' + path + '/px.gif" width="11" height="2"></td>\
								<td colspan="3" bgcolor="#999999"><img src="' + path + '/px.gif" width="431" height="2"></td>\
								<td><img src="' + path + '/px.gif" width="8" height="2"></td>\
							</tr>\
							<tr>\
							<td colspan="6"><img src="' + path + '/px.gif" width="450" height="8"></td>\
							</tr>\
						</table>\
					</td>\
				</tr>\
			</table>\
		</td>\
	</tr>';
	}
	doc.write(str);
}
