  var xmlhttp;
  // this should work for all browsers except IE6 and older
  try
  {
    // try to create XMLHttpRequest object
    xmlhttp = new XMLHttpRequest();
  }
  catch(e)
  {
    // assume IE6 or older
    var XmlHttpVersions = new Array("MSXML2.XMLHTTP.6.0",
                                    "MSXML2.XMLHTTP.5.0",
                                    "MSXML2.XMLHTTP.4.0",
                                    "MSXML2.XMLHTTP.3.0",
                                    "MSXML2.XMLHTTP",
                                    "Microsoft.XMLHTTP");
    // try every prog id until one works
    for (var i=0; i<XmlHttpVersions.length && !xmlhttp; i++) 
    {
      try 
      { 
        // try to create XMLHttpRequest object
        xmlhttp = new ActiveXObject(XmlHttpVersions[i]);
      } 
      catch (e) {}
    }
  }
  
  
  
function isblank(s)
{
  for(var i = 0; i < s.length; i++)
  {
     var c = s.charAt(i);
     if ((c != ' ') &&
         (c != '\n') &&
         (c != '\t'))
        return false;
  }
  return true;
}



function verify(f)
{
  var msg;
  var empty_fields = "";
  var errors = "";

  // Loop through the elements of the form, looking for all
  // text and textarea elements that don't have an
  //  "optional" property defined.  Then, check for fields
  // that are empty and make a list of them.
  // Also, if any of these elements have a "min" or a "max"
  // property defined, then verify that they are numbers
  // and that they are in the right range.
  // Put together error messages for fields that are wrong.
  for(var i = 0; i < f.length; i++)
  {
     var e = f.elements[i];

     if ((
         (e.type == "textarea")) &&
         !e.optional)
     {
        // first check if the field is empty
        if ((e.value == null) ||
            (e.value == "") ||
            isblank(e.value))
        {
           empty_fields += "\n        " +
                           e.description;
           continue;
        }

  
        // Now check for fields that are supposed
        // to be words.
        if (e.words && !isblank(e.value))
        {
        
           var append1 = "";
           var addedError3 = false;
           var addedError2 = false;

           for(var j = 0; j < e.value.length; j++)
           {
              var c = e.value.charAt(j);

       

              if ((c < '9' || c == '9' ) && (c!= '<') && (c!= '>') && (c!= '/') && (c!= '=') && (c!= '\"') &&
                 addedError3 == false)
              {
                 addedError3 = true;
                 append1 +=
     "\n           - must contain only letters ";
              }
           }

           if (append1)
              errors +=  "\n - The field " +
                         e.description +
                         ":" + append1;
        }

     } // if (type is text or textarea) and !optional
  } // for each character in field

  // Now, if there were any errors, then display the
  // messages, and return true to prevent the form from
  // being submitted.  Otherwise return false
  if (!empty_fields && !errors)
     return true;

  
   

  if (empty_fields)
  {
     msg = "- \u03a0\u03b1\u03c1\u03b1\u03ba\u03b1\u03bb\u03ce\u0020\u03c3\u03c5\u03bc\u03c0\u03bb\u03b7\u03c1\u03ce\u03c3\u03c4\u03b5\u0020\u03c4\u03b1\u0020\u03c0\u03b1\u03c1\u03b1\u03ba\u03ac\u03c4\u03c9\u0020\u03c0\u03b5\u03b4\u03af\u03b1:"
           + empty_fields + "\n";
     if (errors)
        msg += "\n";
  }
  msg += errors;
  alert(msg);
  return false;
}

function preSearch() {
		
	
        //Put the form data into a variable
	var theQuery = document.getElementById('query').value  ;
 
   document.getElementById('foo').innerHTML = "";
           var slashCount = 0;
           var append = "";
           var addedError1 = false;
		    var addedError2 = false;
     var checkOK = "\u0020\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03c9\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9\u03ac\u03af\u03cc\u03ad\u03ce\u03cd\u03ae\u0386\u0388\u038a\u038e\u0389\u038c\u038f\u03cb\u03ca\u0390\u03c2ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";

           for(var j = 0; j < theQuery.length; j++)
           {
			 var c = theQuery.charAt(j);

          
for (i = 0;  i < checkOK.length;  i++)
{

if  (c == checkOK.charAt(i) )  
{
  addedError1 = true;
  break;
}
              
}
if (addedError1==true){
	 
	addedError2=true;
	addedError1=false;
	}
	else if ((addedError1==false) && (addedError2==true)){
		 
		addedError2=false;
		break;
		}
			else if ((addedError1==true) && (addedError2==true)){
			 
		addedError2=false;
		break;
		}
		else { 
		break;}
 
		   }
		   
   if (addedError2 == false)
 { if(theQuery==""){}
  
  else{
 
      document.getElementById('foo').innerHTML = "\u03bc\u03b7\u0020\u03b5\u03c0\u03b9\u03c4\u03c1\u03b5\u03c0\u03cc\u03bc\u03b5\u03bd\u03bf\u03c2\u0020\u03c7\u03b1\u03c1\u03b1\u03ba\u03c4\u03ae\u03c1\u03b1\u03c2";
 
  }
 
}
 
	 
			  
   
		  
	
	
	if(addedError2 == true){
			if  (theQuery.length < 3 )  
{
       document.getElementById('foo').innerHTML = "\u0391\u03c0\u03b1\u03c1\u03b1\u03af\u03c4\u03b7\u03c4\u03bf\u03b9\u0020\u0033\u0020\u03c7\u03b1\u03c1\u03b1\u03ba\u03c4\u03ae\u03c1\u03b5\u03c2";
 
 
}
else {
	 
        //If the form data is *not* blank, query the DB and return the results
	if(theQuery !== "") {
		 theQuery = encodeURI(theQuery);
                //Change the content of the "result" DIV to "Searching..."

                //This gives our user confidence that the script is working if it takes a moment for the result to be returned. However the user will likely never see this as the result will be returned in an instant...
		//document.getElementById('fillin').innerHTML = "Searching...";
		 
		document.getElementById('mainContent').innerHTML = '<br><br><br><br><img src="images/ajax_loader.gif"/> ';
                //This sets a variable with the URL (and query strings) to our PHP script
		var url = 'livesearch.php?liveqall=' + theQuery;
                //Open the URL above "asynchronously" (that's what the "true" is for) using the GET method
		xmlhttp.open('GET', url, true);
                //Check that the PHP script has finished sending us the result
		xmlhttp.onreadystatechange = function() {
			if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                                //Replace the content of the "result" DIV with the result returned by the PHP script
				document.getElementById('mainContent').innerHTML = xmlhttp.responseText + ' ';
			} else {
                                //If the PHP script fails to send a response, or sends back an error, display a simple user-friendly notification
				document.getElementById('mainContent').innerHTML = '';
			}
		};
		xmlhttp.send(null);  
	}
}
}}
function preSearchleft() {
        //Put the form data into a variable
	var theQuery = document.getElementById('queryleft').value  ;
	var theQuery1 = document.getElementById('query_cat').value  ;
	var theQuery2 = document.getElementById('query_year').value  ;
	var theQuery3 = document.getElementById('query_month').value  ;
	var theQuery4 = document.getElementById('query_type').value  ;
	var theQuery5 = document.getElementById('query_number').value  ;
	
	
	
	   document.getElementById('foo1').innerHTML = "";
           var slashCount = 0;
           var append = "";
               var addedError1 = false;
		    var addedError2 = false;
     var checkOK = "\u0020\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03c9\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9\u03ac\u03af\u03cc\u03ad\u03ce\u03cd\u03ae\u0386\u0388\u038a\u038e\u0389\u038c\u038f\u03cb\u03ca\u0390\u03c2ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";

           for(var j = 0; j < theQuery.length; j++)
           {
			 var c = theQuery.charAt(j);

          
for (i = 0;  i < checkOK.length;  i++)
{

if  (c == checkOK.charAt(i) )  
{
  addedError1 = true;
 
}
              
}
if (addedError1==true){
	 
	addedError2=true;
	addedError1=false;
	}
	else if ((addedError1==false) && (addedError2==true)){
		 
		addedError2=false;
		break;
		}
			else if ((addedError1==true) && (addedError2==true)){
			 
		addedError2=false;
		break;
		}
		else { 
		break;}
 
		   }
		   
   if (addedError2 == false)
 { if(theQuery==""){}
  
  else{
 
      document.getElementById('foo1').innerHTML = "\u03bc\u03b7\u0020\u03b5\u03c0\u03b9\u03c4\u03c1\u03b5\u03c0\u03cc\u03bc\u03b5\u03bd\u03bf\u03c2\u0020\u03c7\u03b1\u03c1\u03b1\u03ba\u03c4\u03ae\u03c1\u03b1\u03c2";
 
  }
 
}
 
	 
			  
   
		  
	
	
	if(addedError2 == true){
			if  (theQuery.length < 3 )  
{
       document.getElementById('foo1').innerHTML = "\u0391\u03c0\u03b1\u03c1\u03b1\u03af\u03c4\u03b7\u03c4\u03bf\u03b9\u0020\u0033\u0020\u03c7\u03b1\u03c1\u03b1\u03ba\u03c4\u03ae\u03c1\u03b5\u03c2";
 
 
}
else {
	 theQuery = encodeURI(theQuery);
        //If the form data is *not* blank, query the DB and return the results
	if(theQuery !== "") {
                //Change the content of the "result" DIV to "Searching..."

                //This gives our user confidence that the script is working if it takes a moment for the result to be returned. However the user will likely never see this as the result will be returned in an instant...
		//document.getElementById('fillin').innerHTML = "Searching...";
		document.getElementById('mainContent').innerHTML = '<br><br><br><br><img src="images/ajax_loader.gif"/> ';
                //This sets a variable with the URL (and query strings) to our PHP script
		var url = 'livesearch.php?liveq=' + theQuery + '&cat=' + theQuery1 + '&number=' + theQuery5 + '&month=' + theQuery3+ '&type=' + theQuery4+ '&year=' + theQuery2;
                //Open the URL above "asynchronously" (that's what the "true" is for) using the GET method
		xmlhttp.open('GET', url, true);
                //Check that the PHP script has finished sending us the result
		xmlhttp.onreadystatechange = function() {
			if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                                //Replace the content of the "result" DIV with the result returned by the PHP script
				document.getElementById('mainContent').innerHTML = xmlhttp.responseText + ' ';
			} else {
                                //If the PHP script fails to send a response, or sends back an error, display a simple user-friendly notification
				document.getElementById('mainContent').innerHTML = '';
			}
		};
		xmlhttp.send(null);  
	}
} }
}
 