# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
  # HERE I AM FACILITATING CONVENIENCE OF SELECT LISTS FOR MUNDANE ITEMS LIKE
  # ACTOR'S NATIONALITY, MOVIE LANGUAGE, YEAR OF BIRTH / MOVIE RELEASE ETC.
  # THOSE DROP-DOWN SELECT LISTS WILL MINIMIZE ERRORS AND EXPEDITE DATA ENTRY
  # I ADDED THEM HERE RATHER THAN IN THE INDIVIDUAL HELPERS, SO IT IS CLEAR 
  # TO SEE THE SOURCE IN ONE PLACE, AND ALSO THERE IS SOME RELATIONSHIP BET.
  # LANGUAGE / NATIONALITY. THE METHOD reformat IS NOT CURRENTLY USED, BUT
  # WAS ADDED FOR FUTURE ENHANCEMENTS.
  
  def curr_years
    cyear=Time.now.year
    lst=(1900..cyear).collect{|y| y}
    srtlst=lst.sort {|x,y| y<=> x} 
  end  
  
  def nationalities
    nat_list= ['Afghan','Albanian','Algerian','American','Andorran','Angolan',
      'Antiguans','Argentinean','Armenian','Australian','Austrian','Azerbaijani',
      'Bahamian','Bahraini','Bangladeshi','Barbadian','Barbudans','Batswana',
      'Belarusian','Belgian','Belizean','Beninese','Bhutanese','Bolivian',
      'Bosnian','Brazilian','British','Bruneian','Bulgarian','Burkinabe','Burmese',
      'Burundian','Cambodian','Cameroonian','Canadian','Cape Verdean',
      'Central African','Chadian','Chilean','Chinese','Colombian','Comoran',
      'Congolese','Congolese','Costa Rican','Croatian','Cuban','Cypriot',
      'Czech','Danish','Djibouti','Dominican','Dominican','Dutch','Dutchman',
      'Dutchwoman','East Timorese','Ecuadorean','Egyptian','Emirian',
      'Equatorial Guinean','Eritrean','Estonian','Ethiopian','Fijian','Filipino',
      'Finnish','French','Gabonese','Gambian','Georgian','German','Ghanaian','Greek',
      'Grenadian','Guatemalan','Guinea-Bissauan','Guinean','Guyanese','Haitian',
      'Herzegovinian','Honduran','Hungarian','I-Kiribati','Icelander','Indian',
      'Indonesian','Iranian','Iraqi','Irish','Irish','Israeli','Italian','Ivorian',
      'Jamaican','Japanese','Jordanian','Kazakhstani','Kenyan','Kittian and Nevisian',
      'Kuwaiti','Kyrgyz','Laotian','Latvian','Lebanese','Liberian','Libyan',
      'Liechtensteiner','Lithuanian','Luxembourger','Macedonian','Malagasy',
      'Malawian','Malaysian','Maldivan','Malian','Maltese','Marshallese',
      'Mauritanian','Mauritian','Mexican','Micronesian','Moldovan','Monacan',
      'Mongolian','Moroccan','Mosotho','Motswana','Mozambican','Namibian',
      'Nauruan','Nepalese','Netherlander','New Zealander','Ni-Vanuatu','Nicaraguan',
      'Nigerian','Nigerien','North Korean','Northern Irish','Norwegian','Omani',
      'Pakistani','Palauan','Panamanian','Papua New Guinean','Paraguayan','Peruvian',
      'Polish','Portuguese','Qatari','Romanian','Russian','Rwandan','Saint Lucian',
      'Salvadoran','Samoan','San Marinese','Sao Tomean','Saudi','Scottish',
      'Senegalese','Serbian','Seychellois','Sierra Leonean','Singaporean',
      'Slovakian','Slovenian','Solomon Islander','Somali','South African',
      'South Korean','Spanish','Sri Lankan','Sudanese','Surinamer','Swazi',
      'Swedish','Swiss','Syrian','Taiwanese','Tajik','Tanzanian','Thai','Togolese',
      'Tongan','Trinidadian or Tobagonian','Tunisian','Turkish','Tuvaluan','Ugandan',
      'Ukrainian','Uruguayan','Uzbekistani','Venezuelan','Vietnamese','Welsh',
      'Welsh','Yemenite','Zambian','Zimbabwean'
    ]
    nat_lst= nat_list.collect{|y| y}
  end  
  
  def languages
    lan_lis= [ 'Chinese, Mandarin','English', 'Spanish', 'Hindi','Hebrew', 'Russian', 'Arabic',
    'Portuguese', 'Bengali','French', 'Malay, Indonesian', 'German', 'Japanese', 'Farsi (Persian)', 
    'Urdu', 'Punjabi', 'Wu', 'Vietnamese', 'Javanese', 'Tamil', 'Korean', 'Turkish', 'Telugu', 
    'Marathi', 'Italian', 'Thai' 'Burmese', 'Cantonese', 'Kannada', 'Gujarati', 'Polish'
    ]
    lang_list = lan_lis.sort
    lang_list.collect{|l| l}
  end  

  def reformat(text)
    line =""
    txt=""
    words=text.split(" ")
    words.each do |x| 
       line += x + " "
       if line.length > 70
          txt += line + "<br />"
    	  line = ""
       end
    end 
    if line.length > 0
      txt += line
    end
    return txt  
  end

end
