// Code written by Natalie V. Zubar (kopilka@infocom.kharkov.ua)
// Author claims no responsibility for esoteric method of past-life calculations and its results.
// If you decided to use it under your own name - you were a thief in your past life and you will cheat forever!
function mod(x, x_div){
for (var i=x; i>=x_div; i -= x_div);
return i;
}
function checkNum(str, min, max) {
if (str == "") {
alert("Don't leave it blank!");
return false;    }
for (var i = 0; i < str.length; i++) {
var ch = str.substring(i, i + 1);
if (ch < "0" || ch > "9") {
alert("Number, please!");
return false;
        }
    }
    var val = parseInt(str, 10);
    if ((val < min) || (val > max)) {
        alert("Type in a number from 1 to "+max+".");
        return false;
    }
 return true;
}
function pastlife(form){
	var sex; 
//Check for a valid date			
 if ((checkNum(form.day.value,1,31)) && (checkNum(form.month.value,1,12)) &&
(checkNum(form.year.value,0,99)))  {	
var day = parseInt(form.day.value,10);
var cur_month = parseInt(form.month.value,10);
var cur_year = parseInt(form.year.value,10);
// define past life sex
if (cur_month-2*(parseInt(cur_month/2)) == 0){
if (cur_year - 4*(parseInt(cur_year/4)) == 0)
sex = 1; else sex = 2} 
else if (cur_year - 4*(parseInt(cur_year/4)) == 0)
sex = 0; else sex = 1};
msgWindow=window.open("","diagnosis");
msgWindow.document.open(); 
msgWindow.document.bgColor="white"; 
msgWindow.document.writeln("<FONT Color=#000080 Face=Arial><B><I>Your Past Life Results:</I></B></FONT><hr size=1 color=red>");	
msgWindow.document.write("<FONT Color=#000080 Face=Arial>"); 
msgWindow.document.write("I do not know how you feel about it, but you were ");
var yearString = "ZYXWOTZYQVUTSXWVNZYXPQTZRWVUMYXWOTZYQVUTSXWVNZYXPUTZRWVUMYXWOTZYQVUTSXWVNZYXPUTZRWVUMYXWOTZYQVUTSXWV";
var ys; ys = yearString.charAt(cur_year);
var p1; var p2; var place;
if (sex == 1){
msgWindow.document.write("<FONT color=#000080>male</FONT>");
//for males	
var indexString = "VTWZXYURPSOMNQYWZVTUXOMPSQRNWUXTYZVMRNQOPSUZVYWXTRPSOMNQTYUXVWZPNQMRSOYWZVTUXNSORPQM";
var profString = "CDBADCABBACD";
p1 = profString.charAt(cur_month-1);
for (i=0;i<=6;i++){
if (ys == indexString.charAt((cur_month-1)*7+i)) break}
p2 = i+1;
//PLACE OF BIRTH Male
if (p2 == 1){
if (day < 3) place=5;
else if (day < 10) place=46;
else if (day < 17) place=37;
else if (day < 24) place=48;
else if (day < 31) place=65;
else place=6};
if (p2 == 2){
if (day < 8) place=28;
else if (day < 15) place=58;
else if (day < 22) place=10;
else if (day < 29) place=38;
else place=11};
if (p2 == 3){
if (day < 4) place=29;
else if (day < 11) place=53;
else if (day < 18) place=30;
else if (day < 25) place=69;
else place=1};
if (p2 == 4){
if (day < 7) place=74;
else if (day < 14) place=4;
else if (day < 21) place=47;
else if (day < 28) place=20;
else place=26};
if (p2 == 5){
if (day < 5) place=23;
else if (day < 12) place=21;
	else if (day < 19) place=44;
		else if (day < 26) place=16;
	else place=43};
	if (p2 == 6){
	if (day < 6) place=34;
else if (day < 13) place=27;
	else if (day < 20) place=14;
else if (day < 27) place=41;
	else place=50};
	if (p2 == 7){
	if (day < 2) place=73;
else if (day < 9) place=63;
else if (day < 16) place=66;
else if (day < 23) place=54;
		else if (day < 30) place=61;
	else place=72}
}
else {
//for females
	msgWindow.document.write("<FONT color=#000080>female</FONT>");
	var indexString = "OMPSQRNYWZVTUXSQMPNORUZVYWXTQORNSMPZXTWUVYOMPSQRNXVYUZTWNSORPQMVTWZXYUSQMPNORTYUXVWZ";
	var profString = "ACDBCABDDBCA";
	p1 = profString.charAt(cur_month-1);
for (i=0;i<=6;i++){
	if (ys == indexString.charAt((cur_month-1)*7+i)) break}
	p2 = i+1;
		//PLACE OF BIRTH Female
	if (p2 == 1){
	if (day < 3) place=22;
else if (day < 10) place=17;
else if (day < 17) place=36;
	else if (day < 24) place=59;
else if (day < 31) place=51;
	else place=9};
	if (p2 == 2){
	if (day < 8) place=40;
	else if (day < 15) place=2;
	else if (day < 22) place=64;
else if (day < 29) place=56;
else place=35};
if (p2 == 3){
if (day < 4) place=19;
else if (day < 11) place=67;
	else if (day < 18) place=13;
	else if (day < 25) place=32;
	else place=31};
	if (p2 == 4){
	if (day < 7) place=15;
else if (day < 14) place=49;
else if (day < 21) place=12;
else if (day < 28) place=39;
else place=33};
	if (p2 == 5){
	if (day < 5) place=42;
	else if (day < 12) place=60;
else if (day < 19) place=24;
else if (day < 26) place=3;
	else place=52};
if (p2 == 6){
if (day < 6) place=18;
else if (day < 13) place=25;
else if (day < 20) place=57;
	else if (day < 27) place=45;
else place=62};
if (p2 == 7){
		if (day < 2) place=8;
else if (day < 9) place=55;
else if (day < 16) place=70;
else if (day < 23) place=68;
else if (day < 30) place=71;
else place=7}
}
	var pro; pro=p1+p2;
msgWindow.document.write(" in your last earthly incarnation." + "<BR>");
//msgWindow.document.write("month=" + cur_month + " place=" + place + " ys=" + ys + " pro=" + pro + "<BR>");
	//countries data
var countryString="";
if (place == 1) countryString="Alaska"; 
else if (place == 2) countryString="Yukon"; 
else if (place == 3) countryString="North Canada"; 
else if (place == 4) countryString="Ontario"; 
else if (place == 5) countryString="Quebec";
else if (place == 6) countryString="Labrador"; 
else if (place == 7) countryString="Newfoundland"; 
else if (place == 8) countryString="Greenland"; 
	else if (place == 9) countryString="USA North-West"; 
	else if (place == 10) countryString="USA South-West";
	else if (place == 11) countryString="USA North-Center"; 
	else if (place == 12) countryString="USA South-Center"; 
else if (place == 13) countryString="USA North-East"; 
	else if (place == 14) countryString="USA South-East"; 
	else if (place == 15) countryString="Arctic"; 
else if (place == 16) countryString="Scotland"; 
else if (place == 17) countryString="Northern England"; 





	else if (place == 18) countryString="Central England"; 





	else if (place == 19) countryString="Southern England";





	else if (place == 20) countryString="Wales"; 





	else if (place == 21) countryString="Ireland"; 





	else if (place == 22) countryString="Northern Europe"; 





	else if (place == 23) countryString="France"; 





	else if (place == 24) countryString="Spain"; 





	else if (place == 25) countryString="Portugal"; 





	else if (place == 26) countryString="Austria"; 





	else if (place == 27) countryString="Germany"; 





	else if (place == 28) countryString="Ukraine"; 





	else if (place == 29) countryString="Italy"; 





	else if (place == 30) countryString="Turkey"; 





	else if (place == 31) countryString="West Russia"; 





	else if (place == 32) countryString="Siberia"; 





	else if (place == 33) countryString="Center Russia"; 





	else if (place == 34) countryString="Greece"; 





	else if (place == 35) countryString="Iran"; 





	else if (place == 36) countryString="Saudi Arabia"; 





	else if (place == 37) countryString="Poland"; 





	else if (place == 38) countryString="Hungary"; 





	else if (place == 39) countryString="Jugoslavia"; 





	else if (place == 40) countryString="Romania"; 





	else if (place == 41) countryString="Bulgaria"; 





	else if (place == 42) countryString="Izrael"; 





	else if (place == 43) countryString="Tibet"; 





	else if (place == 44) countryString="Burma"; 





	else if (place == 45) countryString="Tailand"; 





	else if (place == 46) countryString="South China"; 





	else if (place == 47) countryString="Mongolia"; 





	else if (place == 48) countryString="North China"; 





	else if (place == 49) countryString="Korea"; 





	else if (place == 50) countryString="North Japan"; 





	else if (place == 51) countryString="South Japan"; 





	else if (place == 52) countryString="Sumatra"; 





	else if (place == 53) countryString="Borneo"; 





	else if (place == 54) countryString="Filippines"; 





	else if (place == 55) countryString="New Guinea"; 





	else if (place == 56) countryString="North Australia"; 





	else if (place == 57) countryString="West Australia"; 





	else if (place == 58) countryString="East Australia";





	else if (place == 59) countryString="South Australia"; 





	else if (place == 60) countryString="North New Zealand"; 





	else if (place == 61) countryString="South New Zealand"; 





	else if (place == 62) countryString="Oceania";





	else if (place == 63) countryString="North India"; 





	else if (place == 64) countryString="Central India"; 





	else if (place == 65) countryString="South India"; 





	else if (place == 66) countryString="Egypt"; 





	else if (place == 67) countryString="North Africa"; 





	else if (place == 68) countryString="West Africa"; 





	else if (place == 69) countryString="Central Africa"; 





	else if (place == 70) countryString="South Africa"; 





	else if (place == 71) countryString="Mexico"; 





	else if (place == 72) countryString="Cyprus";





	else if (place == 73) countryString="Northern Latin America"; 





	else countryString="Southern Latin America";











	//year of past life calculation





	





	var ys1;











	     if (ys == "M") var mString = "185014001125102507000700180014751800130011751100";





	else if (ys == "N") var mString = "092518750425185017501350080006750825182515250875";





	else if (ys == "O") var mString = "172516750875070013251825177508001075165009001625";





	else if (ys == "P") var mString = "145005001800100008000550165017001325072511001550";





	else if (ys == "Q") var mString = "100014500950042517001525135011001625122517251025";





	else if (ys == "R") var mString = "097513751200127504500825137513500700092509250725";





	else if (ys == "S") var mString = "122506251250142509251150147507501300157506001125";





	else if (ys == "T") var mString = "117514001825127517500975185011501600187515251850";





	else if (ys == "U") var mString = "090009000775105013751675107515000825072510251500";





	else if (ys == "V") var mString = "122507501825140011501325167512751475160009501200";





	else if (ys == "W") var mString = "057516750775047517001450085017251775102517750400";





	else if (ys == "X") var mString = "180015751425157515501200160012001300037507751250";





	else if (ys == "Y") var mString = "107512501000165009501825155014250800175010750875";





	else                    var mString = "097505251175085015751125177513500700065013501050";





	





	ys1 = mString.charAt((cur_month-1)*4); 





	if (ys1 == "0") ys1 = ""; {





	ys1 += mString.charAt((cur_month-1)*4+1);





		ys1 += mString.charAt((cur_month-1)*4+2); ys1 += mString.charAt((cur_month-1)*4+3)} ;





		





	//past life profession











           if (pro == "A1") var proString = "digger, undertaker";





	else if (pro == "A2") var proString = "philosopher, thinker";





	else if (pro == "A3") var proString = "designer, engineering, craftsman";





	else if (pro == "A4") var proString = "chemist, alchemist, poison manufacturer";





	else if (pro == "A5") var proString = "seaman, cook, carpenter";





	else if (pro == "A6") var proString = "jeweler, watch-maker";





	else if (pro == "A7") var proString = "medic, surgeon, herbalist";





	else if (pro == "C1") var proString = "shepherd, horseman, forester";





	else if (pro == "C2") var proString = "leader, major, captain";





	else if (pro == "C3") var proString = "librarian, priest, keeper of tribal relics";





	else if (pro == "C4") var proString = "entertainer, musician, poet, temple-dancer";





	else if (pro == "C5") var proString = "seaman, dealer, businessman, broker";





	else if (pro == "C6") var proString = "monk, bee-keeper, lone gunman";





	else if (pro == "C7") var proString = "writer, dramatist, organizer of rituals";





	else if (pro == "B1") var proString = "builder of roads, bridges, docks";





	else if (pro == "B2") var proString = "map maker, astrologer, astronomer";





	else if (pro == "B3") var proString = "handicraftsman, mechanic";





	else if (pro == "B4") var proString = "warrior, hunter, fisherman, executor of sacrifices";





	else if (pro == "B5") var proString = "artist, magician, fortune teller";





	else if (pro == "B6") var proString = "sailor, shoemaker";





	else if (pro == "B7") var proString = "builder of houses, temples, cathedrals";





	else if (pro == "D1") var proString = "trainer, holder of the fine animals, birds, insects";





	else if (pro == "D2") var proString = "preacher, publisher, scribbler of ancient inscriptions";





	else if (pro == "D3") var proString = "farmer, weaver, tailor";





	else if (pro == "D4") var proString = "dramatist, director, musician, bard";





	else if (pro == "D5") var proString = "banker, usurer, moneylender, judge";





	else if (pro == "D6") var proString = "teacher, mathematician, geologist";





	else var proString = "dancer, singer, actor";
	//characteristics
	if (p2 == 1) {





		if (place-2*(parseInt(place/2)) > 0) var charString = "Person with huge energy, good in planning and supervising. If you were just garbage-man, you were chief garbage-man.";





		else var charString = "Revolutionary type. You inspired changes in any sphere - politics, business, religion, housekeeping. Could be a leader."





		};





	else if (p2 == 2) {





		if (place-2*(parseInt(place/2)) > 0) var charString = "Artistic personality, always transforming ugly into beautiful, gray into bright colors. You would find an opportunity of creative self-expression in any situation.";





		else var charString = "Timid, constrained, quiet person. You had creative talents, waited till that life to be liberated. Sometimes the environment considered you strange."





		};











	else if (p2 == 3) {





		if (place-2*(parseInt(place/2)) > 0) var charString = "Seeker of truth and wisdom. You could have seen your future lives. Others perceived you as an idealist illuminating the path to the future.";





		else var charString = "You always liked to travel, to investigate, could have been a detective or spy."





		};











	else if (p2 == 4) {





		if (place-2*(parseInt(place/2)) > 0) var charString = "You were a sane practical person, materialist with no spiritual consciousness. Your simple wisdom helped the weak and poor.";





		else var charString = "You always liked to travel, to investigate, could have been a detective or spy."





		};











	else if (p2 == 5) {





		if (place-2*(parseInt(place/2)) > 0) var charString = "Bohemian personality, mysterious, highly gifted, capable to understand ancient books. Magician abilities, could be a servant of dark forces.";





		else var charString = "Natural talent of psychologist, you knew how to use the opportunities. Cold-blooded and calm in any situation."





		};











	else if (p2 == 6) {





		if (place-2*(parseInt(place/2)) > 0) var charString = "Inquisitive, inventive, liked to get to the very bottom of things and to rummage in books. Talent for drama, natural born actor."	





		else var charString = "Such people are always involved with all new. You have always loved changes, especially in art, music, cooking."





		};











	else if (p2 == 7) {





		if (place-2*(parseInt(place/2)) > 0) var charString = "You had mind of a scientist, always seeking new explanations. Environment often misunderstood him, but respected his knowledge.";





		else var charString = "Ruthless character, carefully weighing his decisions in critical situations, with excellent self-control and strong will. Such people are generally liked, but not always loved."





		};











	// past life lesson











	if (p2 == 1){





 		     if (day < 12) var lesString = "You are bound  to solve problems of pollution of environment, recycling, misuse of raw materials, elimination of radioactivity by all means including psychological methods.";





		else if (day < 22) var lesString = "Your lesson -- to learn humility and faith in spiritual principles. You should believe in High Reason.";





		             else  var lesString = "You are bound  to learn to understand other people and to meet all life difficulties with joyful heart. You should help others, bringing them spirit of joy."};





	else if (p2 == 2) {





		     if (day < 12) var lesString = "It always seemed to you, that you perceptions of the world are somewhat different. Your lesson -- to trust your intuition as your best guide in present life.";





		else if (day < 22) var lesString = "Your main task -- to make the world more beautiful. Physical and spiritual deserts are just waiting for your touch. Keep smiling!";





		              else var lesString = "Your main lesson in present -- to develop magnanimity and feeling of brotherhood. Try to become less adhered to material property and learn to have only as many, as you may give back."};





	else if (p2 == 3) {





		     if (day < 12) var lesString = "Your lesson -- to develop kind a attitude towards people, to acquire the gift of understanding and compassion.";





		else if (day < 22) var lesString = "Your lesson -- development and expansion of your mental consciousness. Find good teacher, spend a part of your time and energy on his wisdom.";





		              else var lesString = "You fulfill  your lesson by helping old folks and children. You came to that life to learn to care about weak and helpless."};





	else if (p2 == 4) {





		     if (day < 12) var lesString = "You should develop your talent for love, happiness and enthusiasm and to distribute these feelings to all people.";





		else if (day < 22) var lesString = "You should develop self-love and ability to implant hope into hearts of people. Ambition -- is not everything. True wealth is buried in your soul.";





		              else var lesString = "Your lesson -- to conquer jealousy and anger in yourself and then in those, who will select you as their guide. You should understand that these weaknesses are caused by fear and self-regret."};





	else if (p2 == 5) {





		     if (day < 12) var lesString = "Your problem -- to learn to love and to trust Universe. You are bound to think, study, reflect, develop inner wisdom.";





		else if (day < 22) var lesString = "Your problem -- to learn determination and persistency. Every misfortune should crash upon your strong will.";





		              else var lesString = "The timid, lonely and self-confident people are everywhere, and your problem -- to overcome these tendencies in yourself and then to help other people."};





	else if (p2 == 6) {





		     if (day < 12) var lesString = "The world is full of ill and lonely people. You should help those, who are less fortunate than you are.";





		else if (day < 22) var lesString = "There is the invisible connection between material and spiritual world. Your lesson -- to search, to find and to use this bridge.";





		              else var lesString = "Your lesson -- to learn discretion  and reasonability and then teach others to do that. Your life will be happier, when you help those who lack reasoning."};





	else if (p2 == 7) {





		     if (day < 12) var lesString = "Your lesson -- to study, to practice and to use wisdom, enclosed in psychological sciences, and in ancient manuscripts. With strong faith and hard work you will reach your real destiny in present life.";





		else if (day < 22) var lesString = "Your lesson -- to combat violence and disharmony in our world, to understand its roots and origins. All global problems have similar origins.";





		              else var lesString = "Magic is everywhere around you, in most usual, most ordinary incidents. Your lesson -- to learn magic and to help people to see it clearly. You are magician!"};	
	//message composition

	msgWindow.document.write("You were born somewhere near modern " + countryString.fontcolor("#000080"));





	msgWindow.document.write(" circa " + ys1.fontcolor("#000080") + ".<BR>");





	msgWindow.document.write("Your profession was a " + proString.fontcolor("#000080") + ".<hr size=1 color=red>");





	msgWindow.document.write("Your brief psychological profile in that past life:<BR>" + charString.fontcolor("#000080") + "<hr size=1 color=red>");





	msgWindow.document.write("The lesson, that your last past life brought to present:<BR>" + lesString.fontcolor("#000080") + "<hr size=1 color=red></FONT> ");





	msgWindow.document.write("<FONT FACE=Arial Color=red><B><I>" + "Now do you remember?" + "</I></B><hr size=1 color=red><BR></FONT>");
//
}





 




