
<!-- Hide
function replace(str,c1,c2)
{
   var temp = new String;
   for(i = 0; i < str.length; i++)
       if( str.charAt(i) == c1 )
          temp = temp + c2;
       else  
          temp = temp + str.charAt(i);
   return temp;
}

function validate(entry) {
	while (entry.charAt(0) == ' ') 					
		entry = entry.substring(1,entry.length);
	while (entry.charAt(entry.length - 1) == ' ') 
		entry = entry.substring(0,entry.length-1);
	entry=replace(entry,"i","Ý");
	entry=replace(entry,"ý","I");
	entry=replace(entry,"ö","Ö");
	entry=replace(entry,"ü","Ü");
      entry=replace(entry,"ð","Ð");
      entry=replace(entry,"ç","Ç");
      entry=replace(entry,"þ","Þ");
       
        entry=entry.toUpperCase();
        return entry;
	}



function check() {
  if ((document.formname.name.value=="")&&(document.formname.surname.value==""))
          { 
           alert("Enter a search criteria.");
           return false;
           } 
//   document.formname.name.value=validate(document.formname.name.value);
//   document.formname.surname.value=validate(document.formname.surname.value);     
  return true;
}

function check2() {
  if (document.forms.departmentsearch.name.value=="")
          { 
           alert("Enter a search criteria.");
           return false;
           } 

 // if (document.forms.departmentsearch.language[0].checked) 
//   document.forms.departmentsearch.name.value=validate(document.forms.departmentsearch.name.value);
  return true;
}


function checkstudent(Msg) {
  if ((document.studentform.name.value.length<3)&&(document.studentform.surname.value.length<2))
          { 
           alert(Msg);
           return false;
           } 
  return true;
}

function reset()
{
 document.forms[formname].name.value="";
 document.forms[formname].surname.value="";
}

function reset2(fname)
{
  document.forms[fname].elements[0].value="";

}

function initArray(length) {
  this.length = length
  for (var i = 0; i < this.length; i++)   
    this[i+1] = 0
}

var splitArray = new initArray(20);
var splitIndex = 0;

function splits(string,text) {
 // splits string at text
     var strLength = string.length, txtLength = text.length;
     if ((strLength == 0) || (txtLength == 0)) return;

     var i = string.indexOf(text);
     if ((!i) && (text != string.substring(0,txtLength))) return;
     if (i == -1) {
         splitArray[splitIndex++] = string;
         return;
     }

     splitArray[splitIndex++] = string.substring(0,i);
     
     if (i+txtLength < strLength)
         splits(string.substring(i+txtLength,strLength),text);

     return;
 }

 function split(string,text) {
     splitIndex = 0;
     splits(string,text);
 }

function parse(str,option)
{ var conj=" OR ";
  var i;

  if( str.length == 0 )
  {
    alert("You must enter a search text!") 
    return false
  }
  document.sorgu.CiRestriction.value="";
  if (option==0)
  {
    document.sorgu.CiRestriction.value = "(" + str + ")"
    return true
  } 
  if (option==1)
    conj=" AND ";
  split(str,' ');
  for (i=0 ;splitArray[i].length==0;i++)
    {
    } 
  document.sorgu.CiRestriction.value = "(" + splitArray[i++];
  for (;i<splitIndex;i++)
   { 
    if (splitArray[i]=="")
    continue;
    document.sorgu.CiRestriction.value=document.sorgu.CiRestriction.value+conj+splitArray[i]
   }
  document.sorgu.CiRestriction.value += ")"
  return true
}

// -->