function write_script(survey_num,site,code,randnum) { str="