﻿﻿/* CProcessorData.GetCelebritiesHappyBirthdays() */
var happyB = new Array(
"Albanian","Urime ditelindjen",
"Arabic","Eid milaad saeed",
"Basque","Zorionak",
"Cantonese","Sun Yat Fai Lok",
"Catalan","Bon aniversari",
"Croatian","Sretan Rodendan",
"Farsi","Tavalodet Mobarak",
"Hawaiian","Hau'oli la hanau",
"Italian","Buon Compleanno",
"Latin","Fortuna dies natalis",
"Portuguese","Feliz Aniversario",
"Romanian","La Multi Ani",
"Serbian","Srecan Rodjendan",
"Spanish","Feliz Cumpleanos",
"Ukrainian","Mnohiya lita"
);
function sayHappy(lang) {
var max_ch = 5;
var choices = new Array(max_ch);
var found = false;
for (var i=0; i<max_ch; i++)
do {
choices[i] = Math.floor(Math.random()*(happyB.length/2));
found = false;
for (var j=0; j<i; j++)
    if (choices[i]==choices[j]) { found = true; break; }
} while (found);
var hint = Math.floor(Math.random()*max_ch);
var s = "How do you say Happy Birthday in <i>" + happyB[2*choices[hint]] + "</i>?";
for (var i=0; i<max_ch; i++)
s += "<br/><input type=\"radio\" name=\"sayHappyO\" value=\""
+ i + "\" onclick=\"sayHappyHit('" + (i==hint ? "" : happyB[2*choices[i]]) + "')\" />"
+ happyB[2*choices[i]+1] + "!";
document.write(s + "<div id=\"sayHappyR\" style=\"display:none\"></div>");
}
function sayHappyHit(hit) {
var elem = document.getElementById("sayHappyR");
elem.innerHTML = (hit=="" ? "YEP, THIS IS IT!!" : "Nope, this is " + hit);
elem.style.color = (hit=="" ? "green" : "red");
elem.style.display = "block";
}
/* CProcessorData.GetCelebritiesOlderOrYounger() */
var celebs = new Array(
"Clint Eastwood",1930,5,31,
"Sean Connery",1930,8,25,
"Dalai Lama",1935,7,6,
"Robert Redford",1936,8,18,
"Pele",1940,10,23,
"Muhammad Ali",1942,1,17,
"Harrison Ford",1942,7,13,
"Goldie Hawn",1945,11,21,
"Cher",1946,5,20,
"Donald Trump",1946,6,14,
"Sylvester Stallone",1946,7,6,
"George W. Bush",1946,7,6,
"Bill Clinton",1946,8,19,
"Steven Spielberg",1946,12,18,
"Arnold Schwarzenegger",1947,7,30,
"Jaclyn Smith",1947,10,26,
"Olivia Newton-John",1948,9,26,
"Prince Charles",1948,11,14,
"Richard Gere",1949,8,31,
"Jane Seymour",1951,2,15,
"Jimmy Connors",1952,9,2,
"Pierce Brosnan",1953,5,16,
"Kim Basinger",1953,12,8,
"Yanni",1954,11,14,
"Denzel Washington",1954,12,28,
"Kevin Costner",1955,1,18,
"Bruce Willis",1955,3,19,
"Reba McEntire",1955,3,28,
"Bill Gates",1955,10,28,
"Tom Hanks",1956,7,9,
"Kim Cattrall",1956,8,21,
"Michelle Pfeiffer",1957,4,29,
"Madonna",1958,8,16,
"Antonio Banderas",1960,8,10,
"Diego Armando Maradona",1960,10,30,
"Eddie Murphy",1961,4,3,
"Heather Locklear",1961,9,25,
"Meg Ryan",1961,11,19,
"Paula Abdul",1962,6,19,
"Tom Cruise",1962,7,3,
"Demi Moore",1962,11,11,
"Jodie Foster",1962,11,19,
"Michael Jordan",1963,2,17,
"Garry Kasparov",1963,4,13,
"Conan O'Brien",1963,4,18,
"Brad Pitt",1963,12,18,
"Sandra Bullock",1964,7,26,
"Keanu Reeves",1964,9,2,
"Teri Hatcher",1964,12,8,
"Sarah Jessica Parker",1965,3,25,
"Shania Twain",1965,8,28,
"Cindy Crawford",1966,2,20,
"Halle Berry",1966,8,14,
"Tia Carrere",1967,1,2,
"Kylie Minogue",1968,5,28,
"Salma Hayek",1968,9,2,
"Jennifer Aniston",1969,2,11,
"Gwen Stefani",1969,10,3,
"Jennifer Lopez",1970,7,24,
"Pete Sampras",1970,8,12,
"Claudia Schiffer",1970,8,25,
"Shaquille O'Neal",1972,3,6,
"Ben Affleck",1972,8,15,
"Cameron Diaz",1972,8,30,
"Gwyneth Paltrow",1972,9,28,
"Kate Beckinsale",1973,7,26,
"Ryan Seacrest",1974,12,24,
"Drew Barrymore",1975,2,22,
"Eva Longoria",1975,3,15,
"David Beckham",1975,5,2,
"Enrique Iglesias",1975,5,8,
"Angelina Jolie",1975,6,4,
"Charlize Theron",1975,8,7,
"Tiger Woods",1975,12,30,
"Alicia Silverstone",1976,10,4,
"Shakira",1977,2,2,
"Kobe Bryant",1978,8,23,
"Nelly Furtado",1978,12,2,
"Kate Hudson",1979,4,19,
"Jessica Simpson",1980,7,10,
"Christina Aguilera",1980,12,18,
"Paris Hilton",1981,2,17,
"Jessica Alba",1981,4,28,
"Anna Kournikova",1981,6,7,
"Roger Federer",1981,8,8,
"Beyonce Knowles",1981,9,4,
"Serena Williams",1981,9,26,
"Britney Spears",1981,12,2,
"Kelly Clarkson",1982,4,24,
"Kirsten Dunst",1982,4,30,
"Prince William",1982,6,21,
"Keira Knightley",1985,3,26,
"Mischa Barton",1986,1,24,
"Maria Sharapova",1987,4,19,
"Hilary Duff",1987,9,28,
"Rihanna",1988,2,18,
"JoJo",1990,12,20
);
function getOlder()
{
var sMine = comboText("sel_month") + " " + comboText("sel_day") + ", " + comboText("sel_year");
var mine = new Date(sMine);
var days = Math.floor(((new Date()).getTime()-mine.getTime())/(1000*60*60*24));
var s = "<p>If you were born <b>" + mine.toString().substr(0, 3) + ", " + sMine
+ "</b>, you should be <b>" + getAge(mine) + "</b> years old now...</p><hr/>";
for (var i=0; i<celebs.length; i+=4) {
var celeb = new Date(celebs[i+1], celebs[i+2], celebs[i+3]);
var older = (mine<celeb);
var sQ = (older ? "older" : "younger") + " than <b>" + celebs[i] + "</b>";
var days = Math.abs(Math.floor((mine.getTime()-celeb.getTime())/(1000*60*60*24)));
if (days==0) s += "<br/><span style=\"color:blue;font-weight:bold\">You were born the same day as " + celebs[i] + "</span>";
else if (days<365) s += "<br/><span style=\"color:blue\">You are about " + (days>30 ? (Math.floor(days/30)==1 ? "one month " : Math.floor(days/30) + " months ") : (days==1 ? "one day " : days + " days ")) + sQ + "</span>";
else if (days<365*2) s += "<br/><span style=\"color:blue\">You are about one year " + sQ + "</span>";
else s += "<br/>You are " + Math.floor(days/365) + " years " + sQ;
}
document.getElementById("id_result").innerHTML = s;
}

/* CProcessorData.GetCelebritiesEventsInYourLife() */
var events = new Array(
"when the First World War began, after the heir to the Austria-Hungarian throne was shot and killed in Sarajevo",1914,6,28,false,0,"",
"when the first atomic bomb was dropped on Hiroshima, followed three days later by another bomb on Nagasaki",1945,8,6,false,0,"Xs3JE4WRL-8",
"when the Soviet Union successfully launched Sputnik I, the world's first artificial satellite",1957,10,4,false,0,"",
"when Hawaii was admitted as the 50th of the United States of America",1959,8,21,false,0,"",
"when Martin Luther King Jr. was assassinated",1968,4,4,false,0,"",
"when the Woodstock rock music festival was held, with The Who and Jimi Hendrix among the stars",1969,8,15,false,1,"",
"when Apple introduced the Macintosh",1984,1,10,false,0,"",
"when the space shuttle Challenger exploded and disintegrated within a minute into its flight",1986,1,28,false,0,"bUX9fR8tV1s",
"when the Berlin Wall was about to fall",1989,11,9,false,0,"",
"when Operation Desert Storm began, after Iraq invaded Kuweit",1991,1,17,false,0,"",
"when O.J. Simpson was charged with murder, but later acquitted after an infamous process",1994,6,20,false,0,"",
"when Princess Diana was killed in Paris in a car crash",1997,8,31,false,0,"",
"on the first day of the 21st century",2000,1,1,false,0,"",
"when Reese Witherspoon received best actress award for her role in 'Walk the Line'",2005,3,5,false,0,"LBO35aHYJus"
);
function getEvents()
{
var sMine = comboText("sel_month") + " " + comboText("sel_day") + ", " + comboText("sel_year");
var mine = new Date(sMine);
var days = Math.floor(((new Date()).getTime()-mine.getTime())/(1000*60*60*24));
var s = "<p>If you were born <b>" + mine.toString().substr(0, 3) + ", " + sMine
+ "</b>, you should be <b>" + getAge(mine) + "</b> years old now...</p><hr/>";
for (var i=0; i<events.length; i+=7) {
var ev = new Date(events[i+1], events[i+2], events[i+3]);
if (ev>=mine) {
var days = Math.abs(Math.floor((mine.getTime()-ev.getTime())/(1000*60*60*24)));
var code = events[i+6].toString();
if (code.substr(0,3)=="!!!")
code = code.substr(3, code.length-3);
s += "<br/><br/>";
if (events[i+6]!=null && events[i+6].length!=0)
s += "<p align=\"center\"><object type=\"application/x-shockwave-flash\" style=\"width: 425px; height: 350px;\" data=\"http://www.youtube.com/v/" + events[i+6] + "\">"
+ "<param name=\"quality\" value=\"best\" /><param name=\"wmode\" value=\"transparent\" />"
+ "<param name=\"movie\" value=\"http://www.youtube.com/v/" + events[i+6] + "\" />"
+ "<param name=\"plug-inspage\" value=\"http://www.macromedia.com/go/getflashplayer\" />"
+ "</object></p>";
//s += "<p align=\"center\"><object width=\"425\" height=\"350\">"
//+ "<param name=\"movie\" value=\"http://www.youtube.com/v/" + events[i+6] + "\" /><param name=\"wmode\" value=\"transparent\" />"
//+ "<embed src=\"http://www.youtube.com/v/" + events[i+6] + "\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"425\" height=\"350\"></embed>"
//+ "</object></p>";
//s += "<a rel=\"nofollow\" href=\"../Watch-This-Video.aspx?code=" + events[i+6] + "&amp;name=Life+Events\">"
//+ "<img align=\"left\" vspace=\"3\" hspace=\"5\" src=\"../images/gen_youtube2.gif\" border=\"0\" width=\"100\" height=\"68\" alt=\"Watch This Video: Life Events\" title=\"Watch This Video: Life Events\" />"
//+ "</a>";
if (days==0) s += "<span style=\"color:blue;font-weight:bold\">You were born the day " + events[i] + "</span>";
else if (days<365) s += "You were about <b>" + (days>30 ? (Math.floor(days/30)==1 ? "one month " : Math.floor(days/30) + " months ") : (days==1 ? "one day " : days + " days ")) + "old</b> " + events[i];
else if (days<365*2) s += "You were about <b>one year old</b> " + events[i];
else s += "You were <b>" + Math.floor(days/365) + " years old</b> " + events[i];
s += ".";
}}
document.getElementById("id_result").innerHTML = s;
}
function comboText(idsel) { var sel = document.getElementById(idsel); return sel.options[sel.selectedIndex].text; }
function getAge(bday)
{
var now = new Date();
var day = now.getDay(); var month = now.getMonth()+1; var year = now.getFullYear();
var age = year - bday.getFullYear() - 1;
if (bday.getMonth()<month || bday.getMonth()==month && bday.getDay()<=day) age++;
return age;
}

