function leave_travelplorer()
{
setTimeout( function () { leave(); } , 2000);
}

function leave()
{
  window.location.replace("http://www.spinpalace.com/greek/");
}



function formatText (tag) { 
        var selectedText = document.selection.createRange().text; 
         
        if (selectedText != "") { 
            var newText = "<" + tag + ">" + selectedText + "</" + tag + ">"; 
            document.selection.createRange().text = newText; 
        } 
    } 



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 drawProgressBar(color, width, percent)  
  {  
        var pixels = width * (percent / 100);  
      
        document.write('<div class="smallish-progress-wrapper" style="width: ' + width + 'px">');  
        document.write('<div class="smallish-progress-bar" style="width: ' + pixels + 'px; background-color: ' + color + ';"></div>');  
        document.write('<div class="smallish-progress-text" style="width: ' + width + 'px">' + percent + '%</div>');  
        document.write('</div>');  
  }  

function check_destination_lang(value)
{
var result =true;
if(document.guide_form.country.value == 89 || document.guide_form.country.value == 62)
{
  result = check_greek(value);
  if(!result)
  {
    alert("Παρακαλώ πληκτρολογήστε τον προορισμό στα Ελληνικά χωρίς αριθμούς");
  }
}
else
{
   if( !check_greek(value) && !check_english(value))
   {
    result = false;
   }
   if(!result)
   {
    alert("Παρακαλώ πληκτρολογήστε τον προορισμό στα Ελληνικά ή στα Αγγλικά χωρίς αριθμούς");
   } 
}
return result;
}


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);
  }
  return result;
}

function check_greek(value)
{
  var result =true;
  value = value.toUpperCase();
  value = value.replace(/ /g, "");
  value = value.replace(/ς/g,"Σ");
  value = trimString(value);
  var ValidChars = "Α’ΒΓΔΕΈΖΗΉΘΙΊΚΛΜΝΞΟΌΠΡΣΤΥΎΦΧΨΩΏΫΪ";
  
  for (i = 0; i < value.length && result == true; i++) 
  { 
      Char = value.charAt(i); 
      //alert(Char);
      if (ValidChars.indexOf(Char) == -1) 
      {
         result=false;
      }     
   }
  
  if(result)
  {
    result = IsNotNumeric(value);
  }
  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("γαμίσου,πούστης,μαλάκας,αρχίδι"); 
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("Τα δεδομένα που πληκτρολογήσατε δεν μπορούν να αποθηκευτούν.\nΒρέθηκαν οι παρακάτω απαγορευμένες λέξεις:\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_ajax_results(context_path,value)
{
  if(trimString(value)!="")
  {
    http.open('get', context_path+"/ServeAutoComplete?search="+encodeURIComponent(value));
    http.onreadystatechange = function(){LoadAjaxResults();};
    http.send(null);
  }
  else
  {
    document.getElementById("autocomplete").innerHTML="<div style='display:block;position:absolute;top:0px;left:0px;width:0px;border:0px;'></div>" ;
  }
}

function LoadAjaxResults() 
{
    if(http.readyState == 4)
    {
       
      if(http.status==200)
      {
        var response = http.responseText;
        document.getElementById("autocomplete").innerHTML = response;
      }  
      else
      {
        if (navigator.appName.indexOf('Netscape') == -1)
        {
          document.getElementById("autocomplete").innerHTML="" ;
          alert("Σφάλμα κατά την φόρτωση των δεδομένων.Παρακαλώ προσπάθηστε ξανά αργότερα.");
        }
      }
      
    }
}



function show_poll_results(context_path,poll_id,poll_answer_id)
{

  if(poll_answer_id == 0)
  {
    //var element = document.getElementById("poll_value");
    var radios = document.getElementsByTagName('input');
    for (var i=0; i<radios.length; i++)
    {
       var input = radios[ i ]; 
       if (input.type == 'radio' && input.name == "poll_value" && input.checked)
       {        
         poll_answer_id = input.value;
          break;
       }
    }
    
  }
  
  document.getElementById("poll_results").innerHTML="<img align='absmiddle' src='"+context_path+"/images/loader2.gif'/>" ;   
  http.open('get', context_path+"/ServeHandlePoll?poll_id="+poll_id+"&poll_answer_id="+poll_answer_id);
  http.onreadystatechange = function(){ShowPollResults(context_path);};
  http.send(null);

}

function ShowPollResults(context_path) 
{
    if(http.readyState == 4)
    {
       
      if(http.status==200)
      {
        var response = http.responseText;
        document.getElementById("poll_results").innerHTML="" ;
        document.getElementById("vote_area").innerHTML = response;
      }  
      else
      {
        document.getElementById("poll_results").innerHTML="" ;
        alert("Σφάλμα κατά την φόρτωση των δεδομένων.Παρακαλώ προσπάθηστε ξανά αργότερα.");
      }
      
    }
}


function show_map(context_path)
{
  if(document.guide_form.country.value=="0")
  {
     alert("Παρακαλώ επιλέξτε χώρα");
  }
  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=825,height=825,scrollbars');
      windowHandle.focus();
  }
}

function show_mapv2(context_path)
{
  if(document.getElementById("country_map").value=="0")
  {
     alert("Παρακαλώ επιλέξτε χώρα");
  }
  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=825,height=825,scrollbars');
      windowHandle.focus();
  }
}

function show_travel_guides(context_path)
{
  if(document.getElementById("country_map").value=="0")
  {
     alert("Παρακαλώ επιλέξτε χώρα");
  }
  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("Σφάλμα κατά την φόρτωση των δεδομένων.Παρακαλώ προσπάθηστε ξανά αργότερα.");
      }
      
    }
}

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_mapv4(context_path,keyword_info_id)
{
  var URL = context_path+"/ShowMap.jsp?keyword_info_id="+keyword_info_id;
  windowHandle=window.open(URL,"my_new_window",'resizable=1,width=700,height=700,scrollbars,left=50,top=50');
  windowHandle.focus();
}

function show_weather(context_path,keyword_info_id)
{
  var URL = context_path+"/weather.jsp?keyword_info_id="+keyword_info_id;
  windowHandle=window.open(URL,"my_new_window",'resizable=1,width=550,height=520,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("Αν έχετε δημιουργήσει τον προσωπικό σας λογαριασμό,παρακαλώ συνδεθείτε στο TravelPlorer\n\nΔιαφορετικά ακολουθήστε τον σύνδεσμο ΓΙΝΕ ΜΕΛΟΣ στο κύριο μενού και δημιουργήστε τον δικό σας λογαριασμό στο TravelPlorer");
  }
}

function empty()
{

}

function no_data(title)
{
  alert("Δεν υπάρχει πληροφορία για την κατηγορία "+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").style.display='';
   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("Σφάλμα κατά την φόρτωση των δεδομένων.Παρακαλώ προσπάθηστε ξανά αργότερα.");
      }
    }
    document.getElementById("load_profile").innerHTML="" ;
    document.getElementById("load_profile").style.display='none';
}

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_ads(context_path)
{
   document.getElementById("load_ads").style.display='';
   document.getElementById("load_ads").innerHTML="<img align='absmiddle' src='"+context_path+"/images/loader_big.gif'/>" ;
   document.getElementById('ads').style.color='red';
   document.getElementById('broshure').style.color='';
   document.getElementById('contact').style.color='';
   document.getElementById('payment').style.color='';
   document.getElementById('faq').style.color='';
   
   http.open('get', context_path+"/GetUserAds");
   http.onreadystatechange = function(){ShowUserAds();};
   http.send(null);
}

function ShowUserAds() 
{
    if(http.readyState == 4)
    {
       
      if(http.status==200)
      {
        var response = http.responseText;
        document.getElementById("ads_area").innerHTML = response;
      }  
      else
      {
        alert("Σφάλμα κατά την φόρτωση των δεδομένων.Παρακαλώ προσπάθηστε ξανά αργότερα.");
      }
      document.getElementById("load_ads").innerHTML="" ;
      document.getElementById("load_ads").style.display='none';
    }
}

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("Σφάλμα κατά την φόρτωση των δεδομένων.Παρακαλώ προσπάθηστε ξανά αργότερα.");
      }
      document.getElementById("load_profile").innerHTML="" ;
      document.getElementById("load_profile").style.display='none';
    }
}



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("Σφάλμα κατά την φόρτωση των δεδομένων.Παρακαλώ προσπάθηστε ξανά αργότερα.");
      }
    }
}


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 show_direct_link2(context_path,country_id,country_desc,destination,keyword_info_id,from)
{
    var URL = context_path+"/ShowDirectLink.jsp?country_id="+country_id+"&country_desc="+country_desc+"&destination="+destination+"&keyword_info_id="+keyword_info_id+"&from="+from;
    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 save_to_favorites2(context_path,keyword_info_id)
{
   // favorite_type : 1 for guide/category, 2 for guide , 3 for save results
   http.open('get', context_path+"/AddToFavorites?keyword_info_id="+keyword_info_id+"&favorite_type=3");
   http.onreadystatechange = function(){SaveFavorites();};
   http.send(null);
}

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 SaveFavorites() 
{
    if(http.readyState == 4)
    {
       
      if(http.status==200)
      {
        var response = http.responseText;
        alert("Η ενέργεια που επιλέξατε εκτελέστηκε με επιτυχία.");
      }  
      else
      {
        alert("Σφάλμα κατά την φόρτωση των δεδομένων.Παρακαλώ προσπάθηστε ξανά αργότερα.");
      }
    }
}


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' || id_name=='special_needs_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("Σφάλμα κατά την φόρτωση των δεδομένων.Παρακαλώ προσπάθηστε ξανά αργότερα.");
      }
    }
}




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 demand_guide(destination)
{
  var field = document.getElementById('email');
  if(trimString(field.value) == "")
  {
    alert("Παρακαλώ πληκτρολογήστε την ηλεκτρονική σας διεύθυνση.");
  }
  else
  {
    if(!emailCheck(field.value))
    {
      field.focus();
    }
    else
    {
      alert("To TravelPlorer θα σε ενημερώσει με email μόλις προστεθεί ο πρώτος οδηγός για "+destination+" από κάποιον χρήστη.");
      document.demand_guide_form.submit();
    }
  }

}

function submit_link()
{
  
  if(trimString(document.submit_external.url_title.value) == "" || trimString(document.submit_external.url.value) == "")
  {
    alert("Παρακαλώ πληκτρολογήστε τον τίτλο και την διεύθυνση του δικτυακού τόπου.");
  }
  else
  {
    document.submit_external.submit();
  }

}

function remind_password(context_path)
{
  var field = document.getElementById('email');
  if(trimString(field.value) == "")
  {
    alert("Παρακαλώ πληκτρολογήστε την ηλεκτρονική σας διεύθυνση.");
  }
  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("Δεν υπάρχει λογαριασμός για το email που πληκτρολογήσατε : "+email);
        }
        else
        {
            document.getElementById("load_forget_password").innerHTML="" ;
           alert("Το όνομα χρήστη και ο κωδικός ασφαλείας σας έχει σταλλεί μέσω email.\n\nΠαρακαλώ ελέγξτε το προσωπικό σας email.");
           window.location.replace("http://www.travelplorer.gr");
        }
      }  
      else
      {
        document.getElementById("load_forget_password").innerHTML="" ;
        alert("Σφάλμα κατά την φόρτωση των δεδομένων.Παρακαλώ προσπάθηστε ξανά αργότερα.");
      }
    }
}


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();
}
}
}


function emailCheck (str)
{

     var at="@";
		var dot=".";
		var lat=str.indexOf(at);
		var lstr=str.length;
		var ldot=str.indexOf(dot);
		if (str.indexOf(at)==-1)
    {
		   alert("Το email που πληκτρολογήσατε δεν είναι έγκυρο");
		   return false;
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr)
    {
		   alert("Το email που πληκτρολογήσατε δεν είναι έγκυρο");
		   return false;
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Το email που πληκτρολογήσατε δεν είναι έγκυρο");
		    return false;
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		  alert("Το email που πληκτρολογήσατε δεν είναι έγκυρο");
		    return false;
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Το email που πληκτρολογήσατε δεν είναι έγκυρο");
		    return false;
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Το email που πληκτρολογήσατε δεν είναι έγκυρο");
        return false;
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Το email που πληκτρολογήσατε δεν είναι έγκυρο");
		    return false;
		 }

 		 return true	;
}



function populate_areas(context_path,area_id)
{
  if(document.guide_form.country.value == 89 || document.guide_form.country.value == 62)
  {
    http.open('get', context_path+"/GetAreas?area_id="+area_id+"&country_id="+document.guide_form.country.value);
    http.onreadystatechange = function(){UpdateAreasResults();};
    http.send(null);
  }
  else
  {
    document.getElementById('area_lek').style.display='none';
    document.getElementById('area_space').style.display='none';
    document.getElementById('areas').style.display='none';
    document.getElementById("areas").innerHTML = "<input type='hidden' name='area' value='0'>";
    
  }
}

function UpdateAreasResults() 
{
    
    if(http.readyState == 4)
    {
      if(http.status==200)
      {
        var response = http.responseText;
        document.getElementById('areas').style.display='';
        document.getElementById('area_lek').style.display='';
        document.getElementById('area_space').style.display='';
        document.getElementById("areas").innerHTML = response;
        document.getElementById("area_space").innerHTML = "&nbsp;";
         document.getElementById('area_lek').innerHTML="<span style='font:bold 11px Tahoma, Arial;vertical-align:middle;color:#383838;'><b>Νομός:</b></span>";
        //document.getElementById("load_area").style.display='none';
      }  
      else
      {
        //document.getElementById("load_area").style.display='none';
        alert("Σφάλμα κατά την φόρτωση των δεδομένων.Παρακαλώ προσπάθηστε ξανά αργότερα.");
      }
    }
}

function inform_country()
{
  //alert(document.getElementById("continent").value);
  if(document.getElementById("continent").value=="0")
  {
    alert("Παρακαλώ επιλέξτε πρώτα την ήπειρο και μετά τη χώρα");
  }
}

function inform_area()
{
  if(document.getElementById("country").value=="0")
  {
    alert("Παρακαλώ επιλέξτε πρώτα την χώρα και μετά την περιοχή.");
  }
}

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("Σφάλμα κατά την φόρτωση των δεδομένων.Παρακαλώ προσπάθηστε ξανά αργότερα.");
      }
    }
}

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("Σφάλμα κατά την φόρτωση των δεδομένων.Παρακαλώ προσπάθηστε ξανά αργότερα.");
      }
    }
}

function search_guide()
{
  if(trimString(document.guide_form.destination.value) =='' && document.guide_form.country.value=="0" && document.guide_form.continent.value=="0")
  {
     alert("Παρακαλώ επιλέξτε τουλάχιστον ένα από τα παρακάτω : ήπειρο,χώρα ή προορισμό");
  }
  else
  {
     if(check_destination_lang(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) =='')
  {
     if(document.contact_form.jsp.value=='contact')
     {
      alert("Παρακαλώ πληκτρολογήστε το όνομα σας,το προσωπικό σας email και την ερώτηση που επιθυμείτε να μας υποβάλλετε.");
     }
     else
     {
      alert("Παρακαλώ πληκτρολογήστε το ονοματεπώνυμο σας,το προσωπικό σας email και την ερώτηση που επιθυμείτε να μας υποβάλλετε.");
     }
  }
  else
  {
    if(document.contact_form.jsp.value=='contact')
    {
      alert("Ευχαριστούμε για την υποβολή της ερώτησης σας.\nΘα σας απαντήσουμε όσο το δυνατόν πιο γρήγορα.");
    }
    else
    {
      alert("Ευχαριστούμε για την υποβολή της ερώτησης σας σχετικά με τη διαφήμιση στο TravelPlorer.\nΘα σας απαντήσουμε όσο το δυνατόν πιο γρήγορα.");
    }
    document.contact_form.submit();
  }
}

function submit_article()
{
  if(trimString(document.article_form.full_name.value) ==''
  || trimString(document.article_form.email.value) =='' 
  || trimString(document.article_form.title.value) =='' 
  || (trimString(document.article_form.url.value) =='' && trimString(document.article_form.descr.value) ==''))
  {
    alert("Παρακαλώ πληκτρολογήστε το όνοματεπώνυμο σας,το προσωπικό σας email, τον τίτλο του άρθρου και το κείμενο ή την ηλεκτρονική διεύθυνση του άρθρου.");
  }
  else
  {
   
    alert("Ευχαριστούμε για την αποστολή του ταξιδιωτικού άρθρου.\nΤο άρθρο σας θα δημοσιευτεί όσο το δυνατόν πιο γρήγορα.");
    document.article_form.submit();
  }
}

function submit_invite()
{
  if(trimString(document.invite_form.sender_email.value) =='' || trimString(document.invite_form.fullname.value) =='')
  {
     alert("Παρακαλώ πληκτρολογήστε το ονοματεπώνυμο σου και το email σου.");
  }
  else
  {
    if(wordFilter('invite_form',['fullname']))
    {
       if(document.getElementById("handle_mail").value=="list")
       {
          if(trimString(document.invite_form.mail_list.value) =='' )
          {
            alert("Παρακαλώ πληκτρολογήστε τουλάχιστον ένα email.");
          }
          else
          {
            alert("Ευχαριστούμε.Η πρόσκληση έχει ήδη σταλλεί στους φίλους σας.");
            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("Παρακαλώ πληκτρολογήστε τουλάχιστον ένα email.");
         }
         else
         {
          alert("Ευχαριστούμε.Η πρόσκληση έχει ήδη σταλλεί στους φίλους σας.");
          document.invite_form.submit();
         }
      }
    }
    
  }
}

function submit_rate()
{
  if(wordFilter('review_form',['comment']))
  {
    document.review_form.submit();
    alert("Η αξιολόγηση  αποθηκεύτηκε με επιτυχία.");
    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>Πρόσθεσε μια λίστα με email (με τον χαρακτήρα ; ανάμεσα σε τους).</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()' >Ή πρόσθεσε μέχρι 5 email</a>";
  }
  else if(document.getElementById("handle_mail").value=='list')
  {
    document.getElementById("mail_text").innerHTML = "<b>Πρόσθεσε μέχρι 5 email</b>";
    document.getElementById("handle_mail").value="input";
    document.getElementById("mail_selection").innerHTML = "<a class='rdmr4' href='javascript:select_mail_area()' >Ή πρόσθεσε μια λίστα με email</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>";
      
  }
}

