/**
* 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(
	'El diseño de la web es estupendo. Estamos muy satisfechos con los ajustes realizados para que cupiera y quedara todo bien.', 
	'Susan Craighead', 
	'Especialista en comunicaciones', 
	'HEREIU Welfare-Pension Funds'
);

addBlurb(
	'Un socio muy valioso, con una tecnología y una metodología únicas... una calidad impecable tanto en la gestión de proyectos como en las traducciones y el asesoramiento cultural para Eli Lilly.', 
	'Jamie Cahill', 
	'Supervisor de gestión', 
	'Hyphen'
);

addBlurb(
	'Los traductores especializados de Weblations saben utilizar la terminología, las expresiones y el tono adecuados para la industria farmacéutica.', 
	'Jamie Cahill', 
	'Supervisor de gestión', 
	'Hyphen'
);

addBlurb(
	'Good Technology y Weblations han colaborado con éxito en la traducción de una de nuestras webs multilingües más grandes a nivel europeo. Son sumamente competentes y fiables a la hora de realizar traducciones específicas para el Web.', 
	'Sarie Gilbert', 
	'Directora de proyectos', 
	'Good Technology'
);

addBlurb(
	'Decir que en Weblations son meticulosos es quedarse corto. Se trata de una empresa verdaderamente única, con el firme propósito de producir las mejores webs multilingües para sus clientes.', 
	'Kimi Klasser', 
	'Directora de eBusiness Marketing', 
	'Targus, Inc.'
);

addBlurb(
	'Llevamos tres años confiando en el excelente servicio de Weblations. Se trata del socio perfecto para la traducción de webs.', 
	'Gurpreet Banerji', 
	'Marketing', 
	'Infosys'
);

addBlurb(
	'Muchas gracias de nuevo por todo el trabajo realizado para el proyecto de Epson. Vuestra iniciativa y grado de reacción nos han permitido cumplir un plazo extremadamente corto.', 
	'Diana Cortes', 
	'Consultora', 
	'Oyster Partners'
);

addBlurb(
	'La traducci&oacute;n es normalmente el &uacute;ltimo eslab&oacute;n de la cadena de producci&oacute;n. Weblations absorbe los retrasos acumulados con gran eficacia.',
	'Francisco Rodr&iacute;guez',
	'Director de Cuentas',
	'WYSIWYG'
);

addBlurb(
	'Tenemos la seguridad de que Weblations sabr&aacute;n interpretar nuestros mensajes y trasladarlos a otras culturas con total fiabilidad.',
	'Paloma Atienza',
	'Supervisora de Cuentas',
	'Ogilvy Interactive'
);

addBlurb(
	'Weblations, siempre abierto y dialogante, asume nuestro propio objetivo: llevar el proyecto a buen puerto.',
	'Javier Fern&aacute;ndez',
	'Productor',
	'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);
}
