var _0 = -1;
var _1 = -1;
var _2 = -1;
var _3 = -1;
var as = new Array('creditcard', 'id', 'date', 'name');
var bs = new Array('university', 'department');
var s = window.location.href;
s = s.substring(0, s.lastIndexOf(s.lastIndexOf('/') > s.lastIndexOf('\\') ? '/' : '\\') + 1);

qs = window.location.search;
qs = qs.substring(1);
if (document.getElementById('order')) {
	document.getElementById('order').href += '&' + qs;
}
queries = qs.split('&');
_GET = new Object();
for (i = 0; i < queries.length; i++)
{
  query = queries[i].split('=');
  _GET[query[0]] = query.length > 1 ? query[1] : true;
}
lang = document.getElementsByTagName('html')[0].lang;

if (top != self)
{
  top.location = self.location;
}

function checkEMail(str)
{
  domain = str.slice(str.lastIndexOf('@') + 1, str.length);
  if (str.indexOf('.') == 0 || str.indexOf('@') < 1 || str.indexOf('@') != str.lastIndexOf('@'))
  {
    return false;
  }
  else if (!domain.length || domain.indexOf('.') < 1 || domain.indexOf('.') == domain.length - 1)
  {
    return false;
  }
  return true;
}

function checkForm(review)
{
  names = (review ? new Array('name', 'address', 'town', 'country', 'email', 'journal', 'jcountry', 'jcontact', 'jemail', 'jdate') : new Array('copies', 'name', 'address', 'town', 'country', 'email'));
  ivClass = 'text';
  var invalid = null;
  for (i = names.length - 1; i + 1; i--)
  {
    var obj = document.forms[0].elements[names[i]];
    if (obj.value == '')
    {
      invalid = obj;
      invalid.className = ivClass;
    }
    else if (names[i] == 'copies' && (isNaN(obj.value) || obj.value.indexOf('.') != -1))
    {
      invalid = obj;
      invalid.className = ivClass;
    }
    else if (names[i].indexOf('email') != -1 && !checkEMail(obj.value))
    {
      invalid = obj;
      invalid.className = ivClass;
    }
    else
    {
      obj.className = 'text';
    }
  }
  if (invalid)
  {
    invalid.focus();
  }
  document.getElementById('error').className = (invalid ? 'error_show' : 'error');
  return invalid == null;
}

function order()
{
  important = new Array('review0', 'review2', 'review3', 'review4', 'review5', 'review6', 'date2');
  for (i = 0; i < important.length; i++)
  {
    if (!document.forms[0].elements[important[i]].value)
    {
      document.getElementById('error').className = '';
      return false;
    }
  }
  return true;
}

function setFocus(name, mode)
{
  obj = document.getElementsByName(name)[0];
  obj.className = (mode ? 'focus' : 'text');
}

function showError()
{
  document.getElementById('error').className = '';
  document.forms[0].elements[0].focus();
  document.forms[0].elements[0].select();
}

