//functinality to add - person/nonperson differentiation
function email()

{
a=document.all('container').innerHTML
b=''
c=a.length
x=''

for(i=0;i<=c;i++){
	if(a.charAt(i)!=' '){
		b+=a.charAt(i)}
			else{
			b+='%20' 
			}
}

windowprops='width=300,height=400'
window.open('emailtoafr.cfm?message='+a,'emailwin','windowprops')
}

function randElement(array)
{
len=array.length

randindex=Math.floor(Math.random()*len)
return array[randindex]
}
function writer2()
{
document.all('basket').innerHTML+='<br/>-'+document.all('container').innerHTML+'<br/>'
}

function writer(browser,functionof)
{
collnounrand=Math.floor(Math.random()*38)
collnounrand1=Math.floor(Math.random()*38)
adjrand=Math.floor(Math.random()*20)
adjrand1=Math.floor(Math.random()*20)
//impersonal arrays
pcollnoun = new Array('mechanics','jelly beans','door-to-door salesmen','hairdressers','mad axe murderers','dental hygeinists','solicitors','hippies','pigeons','merchant bankers','American sorority girls','pilgrims','yoga instructors','taxidermists called Mike','chinese mitten crabs','dictators','supermodels','Big Mac eaters','coke drinkers','McDonalds workers','alcoholics','drummers','boat dwellers','rocket scientists','nobel prize winners','manual labourers','Buddhist monks','drug addicts','criminals','lollipop men','torturers','IT professionals','salesmen','schoolchildren','scientists','teachers','cats','ticket collectors','bus drivers','car park attendants','road sweepers','telephone engineers','toilet cleaners','prostitutes','pets','goldfish','elephant trainers','hospital attendants','fish','carp','parking attendants','US presidents','tabloid reporters','mixed race children','anti-semites','television announcers','a-level students','power stations','prison inmates','artists','journalists','primary school teachers');
collnoun = new Array('tarmac','bricks','old cars','milk shake flavours','hallucinogenics','electric guitars','snuff boxes','wrinkles','objects of desire','napkins','mysoginists', 'sticking plasters', 'nail scissors','bicycle tyres','fork-lift trucks','androids','satellite dishes','potato peelers', 'suppositories','beer mats', 'land-mines', 'lecturns', 'park benches', 'urinals', 'sub-atomic particles','patios','irrational numbers','straight jackets','Starsky and Hutch memorabilia','ankle chains','spleens','old French proverbs','battlecruisers','traffic cones','pianos','cathode ray tubes','McDonalds restaurants','Buddhist monasteries','lollipops','pints of milk','trees','cars','cats','packs of cards','pieces of tarmac','car parks','taps','adverts','toilets','whore houses','pets','goldfish bowls','three legged stools','hospitals','concrete mixers','carp','chain saws','third world countries','magic wands','televisions','concert halls','power stations','libraries','trucks','planets','stadiums');
singnoun = new Array('cycle path','fedora','jungle','squash','gourd','rock and roll','fag','fairy','smurf','piano','cathode ray tube','restaurant','lollipop','milk carton','GM tree','car','cat','strategy game','peice of tarmac','car park','tap','cd box','toilet','sexual perversion','pet','sexual experience','three legged stool','hospitals','concrete mixer','carp','chain saw','gravel','magic wand','television','concert hall','power station','wind screen wiper','trowel','planet','computer mouse');
transpersactverbstatement= new Array('hits','crashes into','destroys','bumps into','dissolves','burns','consumes','assesses','scrubs','supports','has sex with')
intranspersactverbstatement= new Array('wrinkles','realigns itself','rots away ','eats '+randElement(collnoun),'overheats','stops functioning','screws lightbulbs in','phones its grandma','gets angry')
transactverbstatement= new Array('breaks','cleans','measures','passes','scrubs','designs')
intransactverbstatement= new Array('commits genocide','eats','commits a murder','has sex','watches TV','thinks about Russia','reads','uses the toilet','uses the phone','plays the piano','criticizes his partner','feels angry','writes rude letters to the Queen','maintains a web site about '+randElement(pcollnoun),'maintains a web site about '+randElement(collnoun),'invents a new and innovative type of '+randElement(singnoun))
intrans3persactverbstatement= new Array('explode','disappear into a black hole','win a design competition','be repaired','be neglected continuously for 7 years','have a nervous breakdown','be burnt','be used as toilets',' disintegrate ')
passverbstatement= new Array('run over','used in scientific experiments','sold in exchange for '+randElement(collnoun),'sold to third world countries','made extinct','stolen','flattened','cloned','emptied','polished','painted red','made into an art exhibit','painted purple','abandoned beside motorways','watched','divorced','picked up','destroyed','sexually abused','thrown away')
nationals= new Array('Danish nationals','Belgians','South Africans','Australians','Zimbabweans','Italians','British people','Frenchmen','Germans','Spaniards','Americans');
adj= new Array('vapid','banal','squishy','insipid','hoot\'n\'nanny','retrograde','rock solid','rocky','personalized','flat','byzantine','fat','thin','red','purple','rubberized','conical','cuboid','long','undersized','short','unfashionable','edible','carcinogenic','patented','cleverly constructed','badly designed','popular','passivist','pink','spotted','scaley');
//neither

org= new Array('Trusthouse Forte','The Nazi party','the British Medical Association','McDonalds','Microsoft','Mexico','Bill Gates accounting firm','MGM','Yeo Valley','The British Suzuki Institute','Doitall','the British Ministry of Defence','the US Airforce','the US army','every person in the USA');

genericqty= new Array('car use','the average length of a person\'s nostril hair','the average person\'s fitness level','life expectancy','the base rate','income tax rates','expenditure on defence','the number of nuclear missiles in commision','the level of CO2 emissions','milk consumption','the level of global temperatures','contraceptive usage','Internet usage','banana consumption','the popularity of javelin throwing','water usage','yoghurt eating','teenage angst','crime');

aspect= new Array('the number of radishes they use in their salads','the number of teenagers it employs','the number of tins in its warehouse','the number of cigarettes smoked by its employees','the number of radishes they use in their salads','the number of teenagers it employs','the number of cigarettes smoked by its employees','the number of radishes they use in their salads','the number of teenagers it employs','the number of tins in its warehouse','the number of cigarettes smoked by its employees');

change= new Array('increase','decrease','halve','increase','decrease','halve','increase by fifteen','increase','decrease','halve','increase by fifteen');
//personal arrays

ptranspersactverbstatement= new Array('hits','murders ','eats','thinks about','spends money on','burns','steals','analyses','scrubs','embraces','has sex with')

pintranspersactverbstatement= new Array('eats '+randElement(adj)+' '+randElement(collnoun),'overeats','thinks about '+randElement(collnoun),'spends money on '+randElement(collnoun),'screws lightbulbs in','phones their mother during sex','phones their grandma','gets angry','looks something up in the yellow pages','goes on a boat trip','visit a porn site','visits lastminute.com','has a tatoo drawn on their big toe','goes through the menopause','fluctuates between joy and sadness','sneezes','picks their nose','visits the doctor','is killed in a DIY accident','buys a new pair of dentures')

ptransactverbstatement= new Array('cajoles','eats','steps on','slaps','murders','has sex with','picks up','cleans','does hypnotherapy on','sues','thinks about','suspects','trains','slaps','dances with','measures','passes')

pintransactverbstatement= new Array('eats','murders','has sex','watches TV','thinks about Russia','reads','uses the toilet','uses the phone','plays the piano','criticizes his partner','feels angry','mows the lawn','dies','organizes a funeral','becomes anorexic','goes in and out of a mental hospital')


pintrans3persactverbstatement= new Array('explode ',' disappear into a black hole ',' win Miss World ',' recover from a serious illness ',' watch TV continuously for 7 years ',' have a nervous breakdown ',' be sacked ','use the toilet more regularly',' phone their mother ',' take up the piano ',' criticize their partners ',' feels angry ')


ppassverbstatement= new Array('run over','dissected','tranquilized','cloned','subdued','killed','killed prematurely','converted to Christianity','painted green','looked after','watched','divorced','sued','declared bankrupt','picked up','murdered','sexually abused','fired into space','sold for scrap','knighted','made into waxworks at Madame Tussaud\'s')


padj= new Array('fat','thin','enlightened','fashionable','overenthusiastic','homosexual','hysterical','hairy','paranoid','undersized','lighthearted','unfashionable','good looking','loudmouthed','obsessive neurotic','intelligent','stupid','poor','rich','passivist','schizophrenic');


persobj=Math.round(Math.random()*3)+1
sentence=Math.round(Math.random()*11)+1
yearlin=Math.round(Math.random()*300)+2004
amountlin=Math.round(Math.random()*10)+2
amountlin2=Math.round(Math.random()*100000)
perclin=Math.round(Math.random()*95)+1
unitsofyrand=Math.round(Math.random()*10)

tempString=''
//nonpersonal sentences
if(persobj=='1'||persobj=='2')
{
if(sentence=='1')
{
tempString=('Every year more than '+amountlin+' '+randElement(collnoun)+' are '+randElement(passverbstatement)+' by '+randElement(padj)+' '+randElement(pcollnoun) )

}
if(sentence=='2')
{tempString=('If '+randElement(org)+' were to '+randElement(change)+' '+randElement(aspect)+' by '+perclin+' % it would cost them $'+amountlin2+' a year')
}

if(sentence=='3')
{tempString=('If '+randElement(genericqty)+' continues to rise at its present rate then by '+yearlin+', '+perclin+'% of all '+randElement(collnoun)+' will '+randElement(intrans3persactverbstatement))
}

if(sentence=='4')
{tempString=('If '+randElement(genericqty)+' continues to rise at its present rate then by '+yearlin+', '+perclin+'% of all '+randElement(collnoun)+' will be '+randElement(passverbstatement))
}


if(sentence=='5')
{
tempString=('Every year more than '+amountlin+' '+randElement(collnoun)+' are '+randElement(passverbstatement)+' by '+randElement(padj)+' '+randElement(pcollnoun) )

}



if(sentence=='6')
{
tempString=(perclin+' percent of '+randElement(adj)+' '+randElement(collnoun)+' are ' +adj[adjrand1])

}
if(sentence=='7')
{
tempString=('The average person '+randElement(transactverbstatement)+' more than '+amountlin+' '+randElement(collnoun)+' per year')

}
if(sentence=='8')
{
tempString=('The average person '+randElement(pintranspersactverbstatement)+' more than '+amountlin+' times per day')

}
if(sentence=='9')
{
tempString=('The average person '+randElement(transpersactverbstatement)+' more than '+amountlin+' '+randElement(collnoun)+' per day')

}
if(sentence=='10')
{tempString=('If '+randElement(genericqty)+' continues to rise at its present rate then by '+yearlin+', '+perclin+'% of all '+randElement(collnoun)+' will become '+(Math.random()>.3 ? randElement(collnoun) : randElement(adj)))
}

if(sentence=='11')
{
	x=randElement(adj)
tempString=('By the year '+yearlin+' '+perclin+'% of '+randElement(nationals)+' will own a'+((x.charAt(0)=='a' || x.charAt(0)=='e' ||  x.charAt(0)=='i' ||  x.charAt(0)=='o' ||  x.charAt(0)=='u')?'n':'')+' '+x+' '+randElement(singnoun));
}


if(sentence=='12')
{tempString=(perclin+'% of '+randElement(nationals)+' admit to having fantasies about '+randElement(adj)+' '+randElement(collnoun));
}


}

//personal sentences

if(persobj=='3'||persobj=='4')
{
if(sentence=='1')
{
tempString=('Every year more than '+amountlin+' '+randElement(pcollnoun)+' are '+randElement(ppassverbstatement)+' by '+randElement(padj)+' '+randElement(pcollnoun) )

}
if(sentence=='2')
{tempString=('If '+randElement(org)+' were to '+randElement(change)+' '+randElement(aspect)+' by '+perclin+' % it would cost them $'+amountlin2+' a year')
}

if(sentence=='3')
{tempString=('If '+randElement(genericqty)+' continues to rise at its present rate then by '+yearlin+', '+perclin+'% of '+randElement(pcollnoun)+' will '+randElement(pintrans3persactverbstatement))
}

if(sentence=='4')
{tempString=('If '+randElement(genericqty)+' continues to rise at its present rate then by '+yearlin+', '+perclin+'% of all '+randElement(pcollnoun)+' will be '+randElement(ppassverbstatement))
}
if(sentence=='5')
{
tempString=('Every year more than '+amountlin+' '+randElement(pcollnoun)+' are '+randElement(ppassverbstatement)+' by '+randElement(padj)+' '+randElement(pcollnoun) )
}
if(sentence=='6')
{
tempString=(perclin+' percent of '+randElement(padj)+' '+randElement(pcollnoun)+' are ' +padj[adjrand1])
}
if(sentence=='7')
{
tempString=('The average person '+randElement(transactverbstatement)+' more than '+amountlin+' '+randElement(collnoun)+' per year')

}
if(sentence=='8')
{
tempString=('The average person '+randElement(pintranspersactverbstatement)+' more than '+amountlin+' times per day')

}
if(sentence=='9')
{
tempString=('The average person '+randElement(ptranspersactverbstatement)+' more than '+amountlin+' '+randElement(pcollnoun)+' per day')

}
if(sentence=='10')
{tempString=('If '+randElement(genericqty)+' continues to rise at its present rate then by '+yearlin+' '+perclin+'% of all '+randElement(collnoun)+' will become '+(Math.random()>.3 ? randElement(collnoun) : randElement(adj)))
}
if(sentence=='11')
{
x=randElement(adj)
tempString=('By the year '+yearlin+' '+perclin+'% of '+randElement(nationals)+' will own a'+((x.charAt(0)=='a' || x.charAt(0)=='e' ||  x.charAt(0)=='i' ||  x.charAt(0)=='o' ||  x.charAt(0)=='u')?'n':'')+' '+x+' '+randElement(singnoun));
}

if(sentence=='12')
{tempString=(perclin+'% of '+randElement(nationals)+' admit to having fantasies about '+randElement(adj)+' '+randElement(pcollnoun));
}
}
if(functionof!='initialalert'){
	if(browser=="IE")
	{
		document.all('container').innerHTML=tempString
	}
	 else{
	 	alert(tempString)
	 }
}else{
	alert("Did you know that "+tempString+"?")
}


}


