function facebook_share() {
        addr=location.href;
        titlos=document.title;
        
window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(addr)+'&t='+encodeURIComponent(titlos),'sharer','toolbar=0,status=0,width=626,height=436');
        return false;
}

function check_english(value)
{
var result =true;
for (i=0; i<value.length; i++)
{
  if (value.charCodeAt(i)>127 )
  {
    result =  false; 
    break;
  }
}

if(result)
{
  result = IsNotNumeric(value);
}

if(!result)
{
 alert("Please type the destination in English and without numbers");
}

return result;
}


function IsNotNumeric(sText)
{
   var ValidChars = "0123456789";
   var result=true;
   var Char;
   for (i = 0; i < sText.length && result == true; i++) 
   { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) != -1) 
      {
         result=false;
      }
   }
   return result;
   
}

var swear_words_arr=new Array("fuck","bastard","Shit","pussy","dick","asshole","arse bandit","Arsehole","ass boy",
"assfuck","asswipe","aunty","balls","bell end","blow job","clit fight","cocksucker","crap","cunt","dick","dork","fucked",
"fucker","fucking","nigger","pussy","slapper","slut","son of a bitch","malakas","arhidi","gamw","kargiola","mouni","skata","poesty"); 
var swear_alert_arr=new Array(); 
var swear_alert_count=0; 

function reset_alert_count() 
{ 
swear_alert_count=0; 
} 

function wordFilter(form,fields) 
{ 
reset_alert_count(); 
var compare_text; 
var fieldErrArr=new Array(); 
var fieldErrIndex=0; 
for(var i=0; i<fields.length; i++) 
{ 
eval('compare_text=document.' + form + '.' + fields[i] + '.value;'); 
for(var j=0; j<swear_words_arr.length; j++) 
{ 
for(var k=0; k<(compare_text.length); k++) 
{ 
if(swear_words_arr[j]==compare_text.substring(k,(k+swear_words_arr[j].length)).toLowerCase()) 
{ 
var check1 = compare_text.substring((k+swear_words_arr[j].length),(k+swear_words_arr[j].length)+1).toLowerCase();
var check2 = compare_text.substring(k-1,k).toLowerCase();
if( check1 == " " || compare_text.length==(k+swear_words_arr[j].length))
{
if(check2 == " " || k==0)
{
swear_alert_arr[swear_alert_count]=compare_text.substring(k,(k+swear_words_arr[j].length)); 
swear_alert_count++; 
fieldErrArr[fieldErrIndex]=i; 
fieldErrIndex++; 
}
}
} 
} 
} 
} 
var alert_text=""; 
for(var k=1; k<=swear_alert_count; k++) 
{ 
alert_text+="\n" + "(" + k + ") " + swear_alert_arr[k-1]; 
eval('compare_text=document.' + form + '.' + fields[fieldErrArr[0]] + '.focus();'); 
eval('compare_text=document.' + form + '.' + fields[fieldErrArr[0]] + '.select();'); 
} 
if(swear_alert_count>0) 
{ 
alert("The data you typed cannot be saved.\nThe following illegal words were found:\n_______________________________\n" + alert_text + "\n_______________________________"); 
return false; 
} 
else 
{ 
return true; 
} 
} 


function createRequestObject() 
{
    var httpRequest;

    if(window.ActiveXObject) // for IE
    {
        httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else if (window.XMLHttpRequest) // for other browsers
    {
        httpRequest = new XMLHttpRequest();
    }
    
    return httpRequest;
}



function show_map(context_path)
{
  if(document.guide_form.country.value=="0")
  {
     alert("please select country");
  }
  else
  {
      var URL = context_path+"/ServeForwardMap?country_id="+document.guide_form.country.value;
      windowHandle=window.open(URL,"my_new_window2",'resizable=1,location=1,width=600,height=825,scrollbars,left=800,top=5');
      windowHandle.focus();
  }
}

function show_mapv2(context_path)
{
  if(document.getElementById("country_map").value=="0")
  {
     alert("please select country");
  }
  else
  {
      var URL = context_path+"/ServeForwardMap?country_id="+document.getElementById("country_map").value;
      windowHandle=window.open(URL,"my_new_window2",'resizable=1,location=1,width=600,height=825,scrollbars,left=800,top=5');
      windowHandle.focus();
  }
}

function view_user_reviews(context_path,guide_id)
{
  var URL = context_path+"/ShowUserReviews.jsp?guide_id="+guide_id;
  windowHandle=window.open(URL,"my_new_window",'width=850,height=700,scrollbars,left=50,top=50');
  windowHandle.focus();
}

function show_travel_guides(context_path)
{
  if(document.getElementById("country_map").value=="0")
  {
     alert("please select country");
  }
  else
  {
      var URL = context_path+"/country_guides.jsp?country_id="+document.getElementById("country_map").value;
      window.location.replace(URL);
  }
}


function show_all_guides(context_path)
{
 http.open('get', context_path+"/ShowCountriesLink?country_id="+document.getElementById("country").value);
 http.onreadystatechange = function(){ShowCountriesLink(context_path);};
 http.send(null);
}

function ShowCountriesLink(context_path) 
{
    if(http.readyState == 4)
    {
       
      if(http.status==200)
      {
        var response = http.responseText;
        document.getElementById("all_guides").innerHTML = response;
      }  
      else
      {
        alert("Error while loading data.Please try later");
      }
      
    }
}

function show_country_areas(context_path,country_id)
{
  var URL = context_path+"/country_areas.jsp?country_id="+country_id;
  windowHandle=window.open(URL,"my_new_window",'width=800,height=825,scrollbars,left=5,top=5');
  windowHandle.focus();
}

function show_index_more(context_path,type)
{
  var URL = context_path+"/index_more.jsp?type="+type;
  windowHandle=window.open(URL,"my_new_window",'width=400,height=150,scrollbars,left=560,top=350');
  windowHandle.focus();
}

function add_review(context_path,guide_id,data_id,data_type,user,review_type)
{
  var URL = context_path+"/AddReview.jsp?data_id="+data_id+"&data_type="+data_type+"&guide_id="+guide_id+"&user="+user+"&review_type="+review_type;
  windowHandle=window.open(URL,"my_new_window",'width=670,height=320,scrollbars,left=500,top=350');
  windowHandle.focus();
}

function show_review(context_path,guide_id,data_id,data_type)
{
  var URL = context_path+"/ShowReviews.jsp?data_id="+data_id+"&data_type="+data_type+"&guide_id="+guide_id;
  windowHandle=window.open(URL,"my_new_window",'width=700,height=700,scrollbars,left=50,top=50');
  windowHandle.focus();
}




function show_photos(context_path,guide_id)
{
  var URL = context_path+"/TransferShowPhotos.jsp?guide_id="+guide_id;
  windowHandle=window.open(URL,"my_new_window",'resizable=1,width=800,height=850,scrollbars,left=50,top=50');
  windowHandle.focus();
}

function show_mapv3(context_path,guide_id)
{
  var URL = context_path+"/ShowMap.jsp?guide_id="+guide_id;
  windowHandle=window.open(URL,"my_new_window",'resizable=1,width=700,height=700,scrollbars,left=50,top=50');
  windowHandle.focus();
}

function show_category_content(context_path,data_id,data_type,guide_id)
{
   var URL = context_path+"/ViewGuideCategoryContent.jsp?data_id="+data_id+"&data_type="+data_type+"&guide_id="+guide_id;
   windowHandle=window.open(URL,"my_new_window",'width=650,height=600,scrollbars,left=50,top=50');
   windowHandle.focus();
}

function please_login(message)
{
  if(message==1)
  {
    alert("If you have an account please login to TravelPlorer\n\nOtherwise follow the link REGISTER at the top and create your account at TravelPlorer");
  }
}

function empty()
{

}

function no_data(title)
{
  alert("There is no information for "+title);
}



var http = createRequestObject();

function load_video(context_path,video_id)
{
  document.getElementById("load_video").style.display='';
  document.getElementById("load_video").innerHTML="<img align='absmiddle' src='"+context_path+"/images/loader_big.gif'/>" ;
  http.open('get', context_path+"/GetVideo?video_id="+video_id);
  http.onreadystatechange = function(){LoadVideos();};
  http.send(null);
}

function LoadVideos() 
{
    if(http.readyState == 4)
    {
      if(http.status==200)
      {
        var response = http.responseText;
        document.getElementById("show_video").innerHTML = response;
      }  
      else
      {
        alert("Σφάλμα κατά την φόρτωση των δεδομένων.Παρακαλώ προσπάθηστε ξανά αργότερα.");
      }
    }
    document.getElementById("load_video").innerHTML="" ;
    document.getElementById("load_video").style.display='none';
}


function show_favorites(context_path)
{
   document.getElementById("load_profile").style.display='';
   document.getElementById("load_profile").innerHTML="<img align='absmiddle' src='"+context_path+"/images/loader_big.gif'/>" ;
   document.getElementById('guides').style.color='';
   document.getElementById('favorites').style.color='red';
   document.getElementById('searches').style.color='';
   document.getElementById('account').style.color='';
   document.getElementById('password').style.color='';
   http.open('get', context_path+"/GetUserFavorites");
   http.onreadystatechange = function(){ShowFavorites();};
   http.send(null);
}

function show_remove_favorites(context_path,favorite_id)
{
   document.getElementById("load_profile").innerHTML="<img align='absmiddle' src='"+context_path+"/images/loader_big.gif'/>" ;
   http.open('get', context_path+"/GetUserFavorites?favorite_id="+favorite_id);
   http.onreadystatechange = function(){ShowFavorites();};
   http.send(null);
}

function ShowFavorites() 
{
    if(http.readyState == 4)
    {
       
      if(http.status==200)
      {
        var response = http.responseText;
        document.getElementById("profile_area").innerHTML = response;
      }  
      else
      {
        alert("Error while loading data.Please try later");
      }
    }
    document.getElementById("load_profile").innerHTML="" ;
}

function show_my_guides(context_path)
{
  document.getElementById("load_profile").innerHTML="<img align='absmiddle' src='"+context_path+"/images/loader_big.gif'/>" ;
  http.open('get', context_path+"/GetUserGuides");
  http.onreadystatechange = function(){ShowGuides();};
  http.send(null);
}


function show_guides(context_path)
{
   document.getElementById("load_profile").style.display='';
   document.getElementById("load_profile").innerHTML="<img align='absmiddle' src='"+context_path+"/images/loader_big.gif'/>" ;
   document.getElementById('guides').style.color='red';
   document.getElementById('favorites').style.color='';
   document.getElementById('searches').style.color='';
   document.getElementById('account').style.color='';
   document.getElementById('password').style.color='';
   http.open('get', context_path+"/GetUserGuides");
   http.onreadystatechange = function(){ShowGuides();};
   http.send(null);
}

function ShowGuides() 
{
    if(http.readyState == 4)
    {
       
      if(http.status==200)
      {
        var response = http.responseText;
        document.getElementById("profile_area").innerHTML = response;
      }  
      else
      {
        alert("Error while loading data.Please try later");
      }
      document.getElementById("load_profile").innerHTML="" ;
    }
}



function edit_guide(context_path,guide_id)
{
  var parameters = "save_to_session_guide_id=" + guide_id;
  http.open('POST',context_path+"/SaveGuideForEdit" , true);
  http.onreadystatechange = function(){EditGuide(context_path);};
  http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  http.setRequestHeader("Content-length", parameters.length);
  http.setRequestHeader("Connection", "close");
  http.send(parameters);    
}

function EditGuide(context_path) 
{
    if(http.readyState == 4)
    {
       
      if(http.status==200)
      {
        var response = http.responseText;
        var URL = context_path+"/add_guide.jsp?update=true";
        window.location.replace(URL);
      }  
      else
      {
        alert("Error while forwarding the guide.Please try later");
      }
    }
}


function print_travel_guide(context_path,guide_id)
{
    //var URL = context_path+"/print_travel_guide.jsp?guide_id="+guide_id;
    var URL = context_path+"/PrintTravelGuide?guide_id="+guide_id;
    windowHandle=window.open(URL,"my_new_window");
    windowHandle.focus();
}

function show_direct_link(context_path,country_id,country_desc,destination,from,guide_id)
{
    var URL = context_path+"/ShowDirectLink.jsp?country_id="+country_id+"&country_desc="+country_desc+"&destination="+destination+"&from="+from+"&guide_id="+guide_id;
    windowHandle=window.open(URL,"my_new_window",'width=500,height=180,scrollbars,left=600,top=130');
    windowHandle.focus();
}

function print_results(context_path,data_type,data_id)
{
    var URL = context_path+"/PrintResults?data_type="+data_type+"&data_id="+data_id;
    windowHandle=window.open(URL,"my_new_window");
    windowHandle.focus();
}

function save_to_favorites(context_path,favorite_type,guide_id,data_id,data_type)
{
   // favorite_type : 1 for guide/category, 2 for guide , 3 for save results
   http.open('get', context_path+"/AddToFavorites?data_id="+data_id+"&data_type="+data_type+"&favorite_type="+favorite_type+"&guide_id="+guide_id);
   http.onreadystatechange = function(){SaveFavorites();};
   http.send(null);
}

function SaveFavorites() 
{
    if(http.readyState == 4)
    {
       
      if(http.status==200)
      {
        var response = http.responseText;
        alert("Your selection was executed succesfully");
      }  
      else
      {
        alert("Error while saving to Favorites.Please try later");
      }
    }
}


function show_first_data(context_path)
{
   document.getElementById("load_results").style.display='';
   document.getElementById("load_results").innerHTML="<img align='absmiddle' src='"+context_path+"/images/loader_big.gif'/>" ;
   http.open('get', context_path+"/GetResultsData");
   http.onreadystatechange = UpdateResults;
   http.send(null);
}

function show_data(context_path,data_id,data_type,limit,blogic)
{
   document.getElementById("load_results").style.display='';
   document.getElementById("load_results").innerHTML="<img align='absmiddle' src='"+context_path+"/images/loader_big.gif'/>" ;
   var links = document.getElementsByTagName("a");
   var selected = blogic+"_link";
  
   for(var i = 0; i<links.length; i++)
   {
      //Do whatever you want with the links
      var id_name = links[i].id;
      if(blogic!='transit')
      {
        if(id_name.indexOf("_link")!=-1 )
        {
       
          if(selected == id_name )
          {
            links[i].style.color='#FF0000';
            links[i].style.fontSize='12px';
          }
          else
          {
            if(id_name=='green_link' || id_name=='money_link' || id_name=='suggestions_link' || id_name=='personal_link' || id_name=='avoid_link' 
            || id_name=='miss_link' || id_name=='romance_link')
            {
              links[i].style.color='#2d2b2b';
              links[i].style.fontSize='11px';
            }
            else
            {
              links[i].style.color='#2d2b2b';
              links[i].style.fontSize='11px';
            }
                   
          }
        }
     }
   }
   
   http.open('get', context_path+"/GetResultsData?data_id="+data_id+"&data_type="+data_type+"&limit="+limit);
   http.onreadystatechange = function(){UpdateResults();};
   http.send(null);
}

function UpdateResults() 
{
    if(http.readyState == 4)
    {
      if(http.status==200)
      {
        var response = http.responseText;
        document.getElementById("load_results").innerHTML="" ;
        document.getElementById("load_results").style.display='none';
        document.getElementById("results_data").innerHTML = response;
        window.location.replace("#");
      }  
      else
      {
        document.getElementById("load_results").innerHTML="" ;
        document.getElementById("load_results").style.display='none';
        alert("Error while loading data.Please try later");
      }
    }
}




function trimString (str)
{
  while (str.charAt(0) == ' ')
    str = str.substring(1);
  while (str.charAt(str.length - 1) == ' ')
    str = str.substring(0, str.length - 1);
  return str;
}

function remind_password(context_path)
{
  var field = document.getElementById('email');
  if(trimString(field.value) == "")
  {
    alert("please type the email address");
  }
  else
  {
    if(!emailCheck(field.value))
    {
      field.focus();
    }
    else
    {
      document.getElementById("load_forget_password").innerHTML="<img align='absmiddle' src='"+context_path+"/images/loader2.gif'/>" ;
      http.open('get', context_path+"/ServeRemindPassword?email="+field.value);
      http.onreadystatechange = function(){RemindPassword(context_path,field.value);};
      http.send(null);
    }
  }
}


function RemindPassword(context_path,email) 
{
    if(http.readyState == 4)
    {
      if(http.status==200)
      {
        var response = http.responseText;
        if(response.indexOf("exist=false")!=-1)
        {
           document.getElementById("load_forget_password").innerHTML="" ;
           alert("We are unable to find a membership for "+email);
        }
        else
        {
            document.getElementById("load_forget_password").innerHTML="" ;
           alert("An email has been sent to you \n\nPlease check your mail for login instructions");
           window.location.replace("http://www.travelplorer.com");
        }
      }  
      else
      {
        document.getElementById("load_forget_password").innerHTML="" ;
        alert("Error while sending the password.Please try later");
      }
    }
}


function emailResult(field)
{
  if(trimString(field.value) !='')
  {
    if(!emailCheck(field.value))
    {
      field.focus();
      //field.select();
    }
  }
}

function emailResultv2(field)
{
  
  if(trimString(field.value) !='')
  {
    emailCheck(field.value);
  }
}

function emailResultv3(field)
{
  if(trimString(field.value) !='')
  {
    if(!emailCheck(field.value))
    {
      field.focus();
      //field.select();
    }
  }
}

function emailCheck (emailStr) {



/* The following variable tells the rest of the function whether or not
to verify that the address ends in a two-letter country or well-known
TLD.  1 means check it, 0 means don't. */

var checkTLD=1;

/* The following is the list of known TLDs that an e-mail address must end with. */

var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;

/* The following pattern is used to check if the entered e-mail address
fits the user@domain format.  It also is used to separate the username
from the domain. */

var emailPat=/^(.+)@(.+)$/;

/* The following string represents the pattern for matching all special
characters.  We don't want to allow special characters in the address. 
These characters include ( ) < > @ , ; : \ " . [ ] */

var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";

/* The following string represents the range of characters allowed in a 
username or domainname.  It really states which chars aren't allowed.*/

var validChars="\[^\\s" + specialChars + "\]";

/* The following pattern applies if the "user" is a quoted string (in
which case, there are no rules about which characters are allowed
and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
is a legal e-mail address. */

var quotedUser="(\"[^\"]*\")";

/* The following pattern applies for domains that are IP addresses,
rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
e-mail address. NOTE: The square brackets are required. */

var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;

/* The following string represents an atom (basically a series of non-special characters.) */

var atom=validChars + '+';

/* The following string represents one word in the typical username.
For example, in john.doe@somewhere.com, john and doe are words.
Basically, a word is either an atom or quoted string. */

var word="(" + atom + "|" + quotedUser + ")";

// The following pattern describes the structure of the user

var userPat=new RegExp("^" + word + "(\\." + word + ")*$");

/* The following pattern describes the structure of a normal symbolic
domain, as opposed to ipDomainPat, shown above. */

var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");

/* Finally, let's start trying to figure out if the supplied address is valid. */

/* Begin with the coarse pattern to simply break up user@domain into
different pieces that are easy to analyze. */

var matchArray=emailStr.match(emailPat);

if (matchArray==null) {

/* Too many/few @'s or something; basically, this address doesn't
even fit the general mould of a valid e-mail address. */

alert("Email address seems incorrect (check @ and .'s)");
return false;
}
var user=matchArray[1];
var domain=matchArray[2];

// Start by checking that only basic ASCII characters are in the strings (0-127).

for (i=0; i<user.length; i++) {
if (user.charCodeAt(i)>127) {
alert("Ths username contains invalid characters.");
return false;
   }
}
for (i=0; i<domain.length; i++) {
if (domain.charCodeAt(i)>127) {
alert("Ths domain name contains invalid characters.");
return false;
   }
}

// See if "user" is valid 

if (user.match(userPat)==null) {

// user is not valid

alert("The username doesn't seem to be valid.");
return false;
}

/* if the e-mail address is at an IP address (as opposed to a symbolic
host name) make sure the IP address is valid. */

var IPArray=domain.match(ipDomainPat);
if (IPArray!=null) {

// this is an IP address

for (var i=1;i<=4;i++) {
if (IPArray[i]>255) {
alert("Destination IP address is invalid!");
return false;
   }
}
return true;
}

// Domain is symbolic name.  Check if it's valid.
 
var atomPat=new RegExp("^" + atom + "$");
var domArr=domain.split(".");
var len=domArr.length;
for (i=0;i<len;i++) {
if (domArr[i].search(atomPat)==-1) {
alert("The domain name does not seem to be valid.");
return false;
   }
}

/* domain name seems valid, but now make sure that it ends in a
known top-level domain (like com, edu, gov) or a two-letter word,
representing country (uk, nl), and that there's a hostname preceding 
the domain or country. */

if (checkTLD && domArr[domArr.length-1].length!=2 && 
domArr[domArr.length-1].search(knownDomsPat)==-1) {
alert("The address must end in a well-known domain or two letter " + "country.");
return false;
}

// Make sure there's a host name preceding the domain.

if (len<2) {
alert("This address is missing a hostname!");
return false;
}

// If we've gotten this far, everything's valid!
return true;
}

function populate_areas(context_path,area_id)
{
  document.getElementById("load_area").style.display='inline';
  http.open('get', context_path+"/GetAreas?area_id="+area_id+"&country_id="+document.guide_form.country.value);
  http.onreadystatechange = function(){UpdateAreasResults();};
  http.send(null);
}

function UpdateAreasResults() 
{
    
    if(http.readyState == 4)
    {
      if(http.status==200)
      {
        var response = http.responseText;
        document.getElementById("areas").innerHTML = response;
        document.getElementById("load_area").style.display='none';
      }  
      else
      {
        document.getElementById("load_area").style.display='none';
        alert("Error while loading data.Please try later");
      }
    }
}

function inform_country()
{
  //alert(document.getElementById("continent").value);
  if(document.getElementById("continent").value=="0")
  {
    alert("Please select continent first and then select country");
  }
}

function inform_area()
{
  if(document.getElementById("country").value=="0")
  {
    alert("Please select country first and then select subdivision");
  }
}

function populate_countries(context_path,country_id,area_id)
{
  document.getElementById("load_country").style.display='inline';
  http.open('get', context_path+"/GetCountries?country_id="+country_id+"&continent_id="+document.guide_form.continent.value+"&from="+document.getElementById('from').value+"&area_id="+area_id);
  http.onreadystatechange = function(){UpdateCountryResults();};
  http.send(null);
}

function UpdateCountryResults() 
{
    if(http.readyState == 4)
    {
      if(http.status==200)
      {
        var response = http.responseText;
        document.getElementById("countries").innerHTML = response;
        document.getElementById("load_country").style.display='none';
      }  
      else
      {
        document.getElementById("load_country").style.display='none';
        alert("Error while loading data.Please try later");
      }
    }
}

function populate_continents(context_path,continent_id,country_id,area_id)
{
  document.getElementById("load_continent").style.display='inline';
  http.open('get', context_path+"/GetContinents?continent_id="+continent_id+"&country_id="+country_id+"&area_id="+area_id);
  http.onreadystatechange = function(){UpdateContinentResults();};
  http.send(null);
}

function UpdateContinentResults() 
{
    if(http.readyState == 4)
    {
       
      if(http.status==200)
      {
        var response = http.responseText;
        document.getElementById("continents").innerHTML = response;
        document.getElementById("load_continent").style.display='none';
      }  
      else
      {
        document.getElementById("load_continent").style.display='none';
        alert("Error while loading data.Please try later");
      }
    }
}

function search_guide()
{
  if(trimString(document.guide_form.destination.value) =='' && document.guide_form.country.value=="0" && document.guide_form.continent.value=="0")
  {
     alert("please select at least one of the following : continent,country or destination");
  }
  else
  {
     if(check_english(trimString(document.guide_form.destination.value)))
     {
        document.guide_form.submit();
     }
  }
}

function submit_contact()
{
  if(trimString(document.contact_form.name.value) =='' || trimString(document.contact_form.email.value) =='' || trimString(document.contact_form.message.value) =='')
  {
     alert("Please type your name,your email and the question you would like to ask");
  }
  else
  {
    alert("Thank you for sending us your question.\nWe will send you our answer as soon as possible.");
    document.contact_form.submit();
  }
}

function submit_invite()
{
  if(trimString(document.invite_form.sender_email.value) =='' || trimString(document.invite_form.fullname.value) =='')
  {
     alert("Please type your fullname and email");
  }
  else
  {
    if(wordFilter('invite_form',['fullname']))
    {
       if(document.getElementById("handle_mail").value=="list")
       {
          if(trimString(document.invite_form.mail_list.value) =='' )
          {
            alert("Please type at least one mail address");
          }
          else
          {
            alert("Invitation to your friends will be sent as soon as possible.");
            document.invite_form.submit();
          }
      }
      else if (document.getElementById("handle_mail").value=="input")
      {
         if(trimString(document.invite_form.email1.value) ==''
         && trimString(document.invite_form.email2.value) ==''
         && trimString(document.invite_form.email3.value) ==''
         && trimString(document.invite_form.email4.value) ==''
         && trimString(document.invite_form.email5.value) =='')
         {
          alert("please type at least one mail address");
         }
         else
         {
          alert("Invitation to your friends will be sent as soon as possible.");
          document.invite_form.submit();
         }
      }
    }
    
  }
}

function submit_rate()
{
  if(wordFilter('review_form',['comment']))
  {
    document.review_form.submit();
    alert("The Review was saved succesfully");
    window.close(this);
  }
}

function select_mail_area()
{
  if(document.getElementById("handle_mail").value=='input')
  {
    document.getElementById("mail_area").innerHTML = "<textarea style='width:400px;' cols='70' rows='5' name='mail_list' id='mail_list'  ></textarea>";
    document.getElementById("handle_mail").value="list";
    document.getElementById("mail_text").innerHTML = "<b>Enter a List of Email Adresses (separated with ;)</b>";
    //document.getElementById("mail_selection").value='Enter up to five Mail Adresses';
    document.getElementById("mail_selection").innerHTML = "<a class='rdmr4' href='javascript:select_mail_area()' >OR Enter up to five Email Adresses</a>";
  }
  else if(document.getElementById("handle_mail").value=='list')
  {
    document.getElementById("mail_text").innerHTML = "<b>Enter up to five Email Adresses</b>";
    document.getElementById("handle_mail").value="input";
    document.getElementById("mail_selection").innerHTML = "<a class='rdmr4' href='javascript:select_mail_area()' >OR Enter a list of Email Adresses</a>";
    //document.getElementById("mail_selection").value='Enter a list of Email Adresses';
   document.getElementById("mail_area").innerHTML = "<div id='mail1' ><b>1.</b>&nbsp;<input onblur='emailResultv3(this)' style='width:300px;height:20px;vertical-align:middle;' type='text' name='email1' /></div>"
      +"<div id='mail2' style='margin-top:3px'><b>2.</b>&nbsp;<input onblur='emailResultv3(this)' type='text' name='email2' style='width:300px;height:20px;;vertical-align:middle;'/></div>"
      +"<div id='mail3' style='margin-top:3px'><b>3.</b>&nbsp;<input onblur='emailResultv3(this)' type='text' name='email3' style='width:300px;height:20px;vertical-align:middle;'/></div>"
      +"<div id='mail4' style='margin-top:3px'><b>4.</b>&nbsp;<input onblur='emailResultv3(this)' type='text' name='email4' style='width:300px;height:20px;vertical-align:middle;'/></div>"
      +"<div id='mail5' style='margin-top:3px'><b>5.</b>&nbsp;<input onblur='emailResultv3(this)' type='text' name='email5' style='width:300px;height:20px;vertical-align:middle;'/></div>";
      
  }
}

function demand_guide(destination)
{
  var field = document.getElementById('email');
  if(trimString(field.value) == "")
  {
    alert("Please type your email.");
  }
  else
  {
    if(!emailCheck(field.value))
    {
      field.focus();
    }
    else
    {
      alert("TravelPlorer will send you an email when a new travel guide is added for "+destination+".");
      document.demand_guide_form.submit();
    }
  }

}