function setPrintCSS(isPrint) {
// Определяем поддержку нужного нам элемента в броузерах
  if (document.getElementsByTagName)
      x = document.getElementsByTagName('link');
  else if (document.all)
      x = document.all.tags('link');
  else
  {
      alert('Простите, этот скрипт не работает в вашем броузере');
      return;
  }
// Пробегая по всем элементам LINK в HTML  - включаем и отключаем нужные нам стили
// идентифицируя их по атрибуту title
// параметр isPrint - отвечает просто за вариант стилей для печти или монитора
  for (var i=0;i<x.length;i++) {
      if(x[i].title == 'printview'){x[i].disabled = !isPrint;}
      if(x[i].title == 'screenview'){x[i].disabled = isPrint;}
  }
}





/*==== Correct fields checkout =====*/

previousObject = function(p) {
do p = p.previousSibling;
while (p && p.nodeType != 1);
return p;
}

function checkForm(f)
{
 var err = '';

var tmp = previousObject(document.getElementById('name').parentNode);
 if (document.getElementById('name').value == '')
 {
  err = err + '<li>' + '<strong>Your name</strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }
 
  var tmp = previousObject(previousObject(document.getElementById('type_addr')));
 if (document.getElementById('type_addr').selectedIndex <= 0)
 {
  err = err + '<li>' + '<strong>Type address </strong> - necessarily need to choose ' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }
 var tmp = previousObject(document.getElementById('addr1').parentNode);
 if (document.getElementById('addr1').value == '')
 {
  err = err + '<li>' + '<strong>Address1</strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }
 
 var tmp = previousObject(document.getElementById('city').parentNode);
 if (document.getElementById('city').value == '')
 {
  err = err + '<li>' + '<strong>City</strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }
   var tmp = previousObject(previousObject(document.getElementById('state')));
 if (document.getElementById('state').selectedIndex <= 0)
 {
  err = err + '<li>' + '<strong>State </strong> - necessarily need to choose ' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }
 
  var tmp = previousObject(document.getElementById('postal_code').parentNode);
 if (document.getElementById('postal_code').value == '')
 {
  err = err + '<li>' + '<strong>Postal Code</strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }
  var tmp = previousObject(previousObject(document.getElementById('country')));
 if (document.getElementById('country').selectedIndex <= 0)
 {
  err = err + '<li>' + '<strong>Country </strong> - necessarily need to choose ' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }
  

 tmp = previousObject(document.getElementById('phone').parentNode);
 if (document.getElementById('phone').value == '')
 {
  err = err + '<li>' + '<strong>Number of telephone </strong> - required to be filled' + '</li>';
  tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }

 tmp = previousObject(document.getElementById('phone').parentNode);
 if (document.getElementById('phone').value != '')
 {
  if (!checkPhone(document.getElementById('phone').value))
  {
   err = err + '<li>' + '<strong>Valid Phone</strong> - phone number must consist of digits' + '</li>';
     tmp.className = 'error'; 
  }
  else{
    tmp.className = '';
   }
 }
 
 tmp = previousObject(document.getElementById('email').parentNode);
 if (document.getElementById('email').value == '')
 {
  err = err + '<li>' + '<strong>Email</strong> - required to be filled' + '</li>';
  tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }

 
 tmp = previousObject(document.getElementById('email').parentNode);
 if (document.getElementById('email').value != '')
 {
  if (!checkEmail(document.getElementById('email').value))
  {
   err = err + '<li>' + '<strong>Valid Email</strong></li>';
     tmp.className = 'error'; 
  }
   else{
    tmp.className = '';
   }
 }
 
if (err != '')
 {
  err ='<span>You forgot or did not correctly enter one or more fields. Please correct these errors:</span><ul>' + err + '</ul>';

  
  document.getElementById('fill_form').innerHTML=err;
  document.getElementById('fill_form').className="visible";

/*@cc_on
@if (@_jscript_version <= 5.6)
  document.body.style.zoom=1;
/*@end @*/  
return false;
 }
 
 return true;
}

/*==== Correct fields billing =====*/

function checkForm2(f)
{
 var err = '';

var tmp = previousObject(document.getElementById('name').parentNode);
 if (document.getElementById('name').value == '')
 {
  err = err + '<li>' + '<strong>Your name</strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }
 
 var tmp = previousObject(document.getElementById('addr1').parentNode);
 if (document.getElementById('addr1').value == '')
 {
  err = err + '<li>' + '<strong>Address1</strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }
 
 var tmp = previousObject(document.getElementById('city').parentNode);
 if (document.getElementById('city').value == '')
 {
  err = err + '<li>' + '<strong>City</strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }
   var tmp = previousObject(previousObject(document.getElementById('state')));
 if (document.getElementById('state').selectedIndex <= 0)
 {
  err = err + '<li>' + '<strong>State </strong> - necessarily need to choose ' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }
 
  var tmp = previousObject(document.getElementById('postal_code').parentNode);
 if (document.getElementById('postal_code').value == '')
 {
  err = err + '<li>' + '<strong>Postal Code</strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }
  var tmp = previousObject(previousObject(document.getElementById('country')));
 if (document.getElementById('country').selectedIndex <= 0)
 {
  err = err + '<li>' + '<strong>Country </strong> - necessarily need to choose ' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }
  

 tmp = previousObject(document.getElementById('phone').parentNode);
 if (document.getElementById('phone').value == '')
 {
  err = err + '<li>' + '<strong>Number of telephone </strong> - required to be filled' + '</li>';
  tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }

 tmp = previousObject(document.getElementById('phone').parentNode);
 if (document.getElementById('phone').value != '')
 {
  if (!checkPhone(document.getElementById('phone').value))
  {
   err = err + '<li>' + '<strong>Valid Phone</strong> - phone number must consist of digits' + '</li>';
     tmp.className = 'error'; 
  }
  else{
    tmp.className = '';
   }
 }
 
 tmp = previousObject(document.getElementById('email').parentNode);
 if (document.getElementById('email').value == '')
 {
  err = err + '<li>' + '<strong>Email</strong> - required to be filled' + '</li>';
  tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }

 
 tmp = previousObject(document.getElementById('email').parentNode);
 if (document.getElementById('email').value != '')
 {
  if (!checkEmail(document.getElementById('email').value))
  {
   err = err + '<li>' + '<strong>Valid Email</strong></li>';
     tmp.className = 'error'; 
  }
   else{
    tmp.className = '';
   }
 }
 
   var tmp = previousObject(previousObject(document.getElementById('card_type')));
 if (document.getElementById('card_type').selectedIndex <= 0)
 {
  err = err + '<li>' + '<strong>Type Catd </strong> - necessarily need to choose ' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }
 var tmp = previousObject(document.getElementById('card').parentNode);
 if (document.getElementById('card').value == '')
 {
  err = err + '<li>' + '<strong>Name card</strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }
  var tmp = previousObject(document.getElementById('card_number').parentNode);
 if (document.getElementById('card_number').value == '')
 {
  err = err + '<li>' + '<strong>Сard number</strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }
   var tmp = previousObject(document.getElementById('cvc_code').parentNode);
 if (document.getElementById('cvc_code').value == '')
 {
  err = err + '<li>' + '<strong>Сard number</strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }
 
if (err != '')
 {
  err ='<span>You forgot or did not correctly enter one or more fields. Please correct these errors:</span><ul>' + err + '</ul>';

  
  document.getElementById('fill_form').innerHTML=err;
  document.getElementById('fill_form').className="visible";

/*@cc_on
@if (@_jscript_version <= 5.6)
  document.body.style.zoom=1;
/*@end @*/  
return false;
 }
 
 return true;
}
/*==== Correct fields registration =====*/

function checkForm3(f)
{
 var err = '';

var tmp = previousObject(document.getElementById('log_in').parentNode);
 if (document.getElementById('log_in').value == '')
 {
  err = err + '<li>' + '<strong>Login</strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }


 var tmp = previousObject(document.getElementById('pass').parentNode);
 if (document.getElementById('pass').value == '')
 {
  err = err + '<li>' + '<strong>Password</strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }
 
 var tmp = previousObject(document.getElementById('conf_password').parentNode);
 if (document.getElementById('conf_password').value == '')
 {
  err = err + '<li>' + '<strong>Confirm password: </strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }
 
 
 if (document.getElementById('pass').value != '' && document.getElementById('conf_password').value != '')
 {
  if (document.getElementById('pass').value != document.getElementById('conf_password').value)
  {
   err = err + '<li>' + '<strong>' + 'Passwords do not match ' + '</strong>' + '</li>';
   tmp.className = 'error'; 
  }
	
}

 
 var tmp = previousObject(document.getElementById('name').parentNode);
 if (document.getElementById('name').value == '')
 {
  err = err + '<li>' + '<strong>Your name</strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }
  var tmp = previousObject(document.getElementById('addr1').parentNode);
 if (document.getElementById('addr1').value == '')
 {
  err = err + '<li>' + '<strong>Address1</strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }
 
 var tmp = previousObject(document.getElementById('city').parentNode);
 if (document.getElementById('city').value == '')
 {
  err = err + '<li>' + '<strong>City</strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }

  var tmp = previousObject(previousObject(document.getElementById('country')));
 if (document.getElementById('country').selectedIndex <= 0)
 {
  err = err + '<li>' + '<strong>Country </strong> - necessarily need to choose ' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 } 
  var tmp = previousObject(document.getElementById('postal').parentNode);
 if (document.getElementById('postal').value == '')
 {
  err = err + '<li>' + '<strong>Postal Code</strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }
  var tmp = previousObject(previousObject(document.getElementById('state_prov')));
 if (document.getElementById('state_prov').selectedIndex <= 0)
 {
  err = err + '<li>' + '<strong>Country </strong> - necessarily need to choose ' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 } 
  

 tmp = previousObject(document.getElementById('phone').parentNode);
 if (document.getElementById('phone').value == '')
 {
  err = err + '<li>' + '<strong>Number of telephone </strong> - required to be filled' + '</li>';
  tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }

 tmp = previousObject(document.getElementById('phone').parentNode);
 if (document.getElementById('phone').value != '')
 {
  if (!checkPhone(document.getElementById('phone').value))
  {
   err = err + '<li>' + '<strong>Valid Phone</strong> - phone number must consist of digits' + '</li>';
     tmp.className = 'error'; 
  }
  else{
    tmp.className = '';
   }
 }
 
 tmp = previousObject(document.getElementById('email').parentNode);
 if (document.getElementById('email').value == '')
 {
  err = err + '<li>' + '<strong>email</strong> - required to be filled' + '</li>';
  tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }

 
 tmp = previousObject(document.getElementById('email').parentNode);
 if (document.getElementById('email').value != '')
 {
  if (!checkEmail(document.getElementById('email').value))
  {
   err = err + '<li>' + '<strong>Valid Email</strong></li>';
     tmp.className = 'error'; 
  }
   else{
    tmp.className = '';
   }
 }
 
 
if (err != '')
 {
  err ='<span>You forgot or did not correctly enter one or more fields. Please correct these errors:</span><ul>' + err + '</ul>';

  
  document.getElementById('fill_form').innerHTML=err;
  document.getElementById('fill_form').className="visible";

/*@cc_on
@if (@_jscript_version <= 5.6)
  document.body.style.zoom=1;
/*@end @*/  
return false;
 }
 
 return true;
}










/*==== Correct fields registration-exlusive =====*/

function checkForm4()
{
 var err = '';

var tmp = previousObject(document.getElementById('ContactPerson').parentNode);
 if (document.getElementById('ContactPerson').value == '')
 {
  err = err + '<li>' + '<strong>ContactPerson</strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }
 
var tmp = previousObject(document.getElementById('costumer_cname').parentNode);
 if (document.getElementById('costumer_cname').value == '')
 {
  err = err + '<li>' + '<strong> Сostumer Company Name </strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 } 

 tmp = previousObject(document.getElementById('Email').parentNode);
 if (document.getElementById('Email').value == '')
 {
  err = err + '<li>' + '<strong>Email</strong> - required to be filled' + '</li>';
  tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }

 
 tmp = previousObject(document.getElementById('Email').parentNode);
 if (document.getElementById('Email').value != '')
 {
  if (!checkEmail(document.getElementById('Email').value))
  {
   err = err + '<li>' + '<strong>Valid Email</strong></li>';
     tmp.className = 'error'; 
  }
   else{
    tmp.className = '';
   }
 }
 


var tmp = previousObject(document.getElementById('CustomerContactName').parentNode);
 if (document.getElementById('CustomerContactName').value == '')
 {
  err = err + '<li>' + '<strong> Customer Contact Name </strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 } 

var tmp = previousObject(document.getElementById('Address').parentNode);
 if (document.getElementById('Address').value == '')
 {
  err = err + '<li>' + '<strong>Address </strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 } 

var tmp = previousObject(document.getElementById('City').parentNode);
 if (document.getElementById('City').value == '')
 {
  err = err + '<li>' + '<strong>City </strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 } 

var tmp = previousObject(document.getElementById('State').parentNode);
 if (document.getElementById('State').value == '')
 {
  err = err + '<li>' + '<strong>State </strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 } 

var tmp = previousObject(document.getElementById('ZIP').parentNode);
 if (document.getElementById('ZIP').value == '')
 {
  err = err + '<li>' + '<strong>ZIP </strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 } 

var tmp = previousObject(document.getElementById('Country').parentNode);
 if (document.getElementById('Country').value == '')
 {
  err = err + '<li>' + '<strong>Country </strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 } 

var tmp = previousObject(document.getElementById('FirstContactDate').parentNode);
 if (document.getElementById('FirstContactDate').value == '')
 {
  err = err + '<li>' + '<strong>First Contact Date </strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 } 

var tmp = previousObject(document.getElementById('LastContactDate').parentNode);
 if (document.getElementById('LastContactDate').value == '')
 {
  err = err + '<li>' + '<strong>Last Contact Date </strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 } 

var tmp = previousObject(document.getElementById('ProjectName').parentNode);
 if (document.getElementById('ProjectName').value == '')
 {
  err = err + '<li>' + '<strong>Project Name </strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 } 

var tmp = previousObject(document.getElementById('ApplicationDescription').parentNode);
 if (document.getElementById('ApplicationDescription').value == '')
 {
  err = err + '<li>' + '<strong>Application Description </strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 } 

var tmp = previousObject(document.getElementById('ExpireDate').parentNode);
 if (document.getElementById('ExpireDate').value == '')
 {
  err = err + '<li>' + '<strong>Expire Date </strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 } 




if (err != '')
 {
  err ='<span>You forgot or did not correctly enter one or more fields. Please correct these errors:</span><ul>' + err + '</ul>';

  
  document.getElementById('fill_form').innerHTML=err;
  document.getElementById('fill_form').className="visible";

/*@cc_on
@if (@_jscript_version <= 5.6)
  document.body.style.zoom=1;
/*@end @*/  
return false;
 }
 
 return true;
}





/*==== Correct fields registration =====*/

function checkForm3(f)
{
 var err = '';

var tmp = previousObject(document.getElementById('company_name').parentNode);
 if (document.getElementById('company_name').value == '')
 {
  err = err + '<li>' + '<strong>Company Name</strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }


 var tmp = previousObject(document.getElementById('pass').parentNode);
 if (document.getElementById('pass').value == '')
 {
  err = err + '<li>' + '<strong>Password</strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }
 
 var tmp = previousObject(document.getElementById('conf_password').parentNode);
 if (document.getElementById('conf_password').value == '')
 {
  err = err + '<li>' + '<strong>Confirm password: </strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }
 
 
 if (document.getElementById('pass').value != '' && document.getElementById('conf_password').value != '')
 {
  if (document.getElementById('pass').value != document.getElementById('conf_password').value)
  {
   err = err + '<li>' + '<strong>' + 'Passwords do not match ' + '</strong>' + '</li>';
   tmp.className = 'error'; 
  }
	
}

 
 var tmp = previousObject(document.getElementById('name').parentNode);
 if (document.getElementById('name').value == '')
 {
  err = err + '<li>' + '<strong>Your name</strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }
  var tmp = previousObject(document.getElementById('addr1').parentNode);
 if (document.getElementById('addr1').value == '')
 {
  err = err + '<li>' + '<strong>Address1</strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }
 
 var tmp = previousObject(document.getElementById('city').parentNode);
 if (document.getElementById('city').value == '')
 {
  err = err + '<li>' + '<strong>City</strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }

  var tmp = previousObject(previousObject(document.getElementById('country')));
 if (document.getElementById('country').selectedIndex <= 0)
 {
  err = err + '<li>' + '<strong>Country </strong> - necessarily need to choose ' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 } 
  var tmp = previousObject(document.getElementById('postal').parentNode);
 if (document.getElementById('postal').value == '')
 {
  err = err + '<li>' + '<strong>Postal Code</strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }
  var tmp = previousObject(previousObject(document.getElementById('state_prov')));
 if (document.getElementById('state_prov').selectedIndex <= 0)
 {
  err = err + '<li>' + '<strong>Country </strong> - necessarily need to choose ' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 } 
  

 tmp = previousObject(document.getElementById('phone').parentNode);
 if (document.getElementById('phone').value == '')
 {
  err = err + '<li>' + '<strong>Number of telephone </strong> - required to be filled' + '</li>';
  tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }

 tmp = previousObject(document.getElementById('phone').parentNode);
 if (document.getElementById('phone').value != '')
 {
  if (!checkPhone(document.getElementById('phone').value))
  {
   err = err + '<li>' + '<strong>Valid Phone</strong> - phone number must consist of digits' + '</li>';
     tmp.className = 'error'; 
  }
  else{
    tmp.className = '';
   }
 }
 
 tmp = previousObject(document.getElementById('email').parentNode);
 if (document.getElementById('email').value == '')
 {
  err = err + '<li>' + '<strong>email</strong> - required to be filled' + '</li>';
  tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }

 
 tmp = previousObject(document.getElementById('email').parentNode);
 if (document.getElementById('email').value != '')
 {
  if (!checkEmail(document.getElementById('email').value))
  {
   err = err + '<li>' + '<strong>Valid Email</strong></li>';
     tmp.className = 'error'; 
  }
   else{
    tmp.className = '';
   }
 }
 
 
if (err != '')
 {
  err ='<span>You forgot or did not correctly enter one or more fields. Please correct these errors:</span><ul>' + err + '</ul>';

  
  document.getElementById('fill_form').innerHTML=err;
  document.getElementById('fill_form').className="visible";

/*@cc_on
@if (@_jscript_version <= 5.6)
  document.body.style.zoom=1;
/*@end @*/  
return false;
 }
 
 return true;
}










/*==== Correct fields registration =====*/

function checkForm5(f)
{
 var err = '';

var tmp = previousObject(document.getElementById('company_name').parentNode);
 if (document.getElementById('company_name').value == '')
 {
  err = err + '<li>' + '<strong>Company Name</strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }

var tmp = previousObject(document.getElementById('ContactName').parentNode);
 if (document.getElementById('ContactName').value == '')
 {
  err = err + '<li>' + '<strong>Contact Name</strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }

 tmp = previousObject(document.getElementById('Email').parentNode);
 if (document.getElementById('Email').value == '')
 {
  err = err + '<li>' + '<strong>Email </strong> - required to be filled' + '</li>';
  tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }

 
 tmp = previousObject(document.getElementById('Email').parentNode);
 if (document.getElementById('Email').value != '')
 {
  if (!checkEmail(document.getElementById('Email').value))
  {
   err = err + '<li>' + '<strong>Valid Email</strong></li>';
     tmp.className = 'error'; 
  }
   else{
    tmp.className = '';
   }
 }

var tmp = previousObject(document.getElementById('ContactLogin').parentNode);
 if (document.getElementById('ContactLogin').value == '')
 {
  err = err + '<li>' + '<strong>Contact Login</strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }

var tmp = previousObject(document.getElementById('CompanyPassword').parentNode);
 if (document.getElementById('CompanyPassword').value == '')
 {
  err = err + '<li>' + '<strong>Company Password</strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }

  var tmp = previousObject(document.getElementById('PaymentTerms').parentNode);
 if (document.getElementById('PaymentTerms').selectedIndex <= 0)
 {
  err = err + '<li>' + '<strong>Payment Terms </strong> - necessarily need to choose ' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 } 
  
var tmp = previousObject(document.getElementById('Address').parentNode);
 if (document.getElementById('Address').value == '')
 {
  err = err + '<li>' + '<strong>Address </strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }

var tmp = previousObject(document.getElementById('City').parentNode);
 if (document.getElementById('City').value == '')
 {
  err = err + '<li>' + '<strong>City </strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }

var tmp = previousObject(document.getElementById('Country').parentNode);
 if (document.getElementById('Country').value == '')
 {
  err = err + '<li>' + '<strong>Country </strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }

var tmp = previousObject(document.getElementById('State').parentNode);
 if (document.getElementById('State').value == '')
 {
  err = err + '<li>' + '<strong>State </strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }

var tmp = previousObject(document.getElementById('ZIP').parentNode);
 if (document.getElementById('ZIP').value == '')
 {
  err = err + '<li>' + '<strong>ZIP </strong> - required to be filled' + '</li>';
   tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }


 tmp = previousObject(document.getElementById('Telephone').parentNode);
 if (document.getElementById('Telephone').value == '')
 {
  err = err + '<li>' + '<strong>Number of telephone </strong> - required to be filled' + '</li>';
  tmp.className = 'error'; 
 }
 else{
  tmp.className = '';
 }

 tmp = previousObject(document.getElementById('Telephone').parentNode);
 if (document.getElementById('Telephone').value != '')
 {
  if (!checkPhone(document.getElementById('Telephone').value))
  {
   err = err + '<li>' + '<strong>Valid Phone</strong> - phone number must consist of digits' + '</li>';
     tmp.className = 'error'; 
  }
  else{
    tmp.className = '';
   }
 }
 


 
if (err != '')
 {
  err ='<span>You forgot or did not correctly enter one or more fields. Please correct these errors:</span><ul>' + err + '</ul>';

  
  document.getElementById('fill_form').innerHTML=err;
  document.getElementById('fill_form').className="visible";

/*@cc_on
@if (@_jscript_version <= 5.6)
  document.body.style.zoom=1;
/*@end @*/  
return false;
 }
 
 return true;
}


/**
	Checks /exclusive/register form data
*/
function checkExclusiveRegisterForm(f)
{
	var err = '';
	
	var tmp = previousObject(document.getElementById('ContactPerson').parentNode);
	if (document.getElementById('ContactPerson').value == '')
	{
		err = err + '<li>' + '<strong>Distributor Contact Person</strong> - required to be filled' + '</li>';
		tmp.className = 'error'; 
	}
	else{
		tmp.className = '';
	}
	
	var tmp = previousObject(document.getElementById('Email').parentNode);
	if (document.getElementById('Email').value == '')
	{
		err = err + '<li>' + '<strong>Distributor Contact Email</strong> - required to be filled' + '</li>';
		tmp.className = 'error';
	}
	else
	if (!checkEmail(document.getElementById('Email').value))
	{
		err = err + '<li>' + '<strong>Email</strong> - format is invalid' + '</li>';
		tmp.className = 'error';
	}
	else{
		tmp.className = '';
	}

	var tmp = previousObject(document.getElementById('costumer_cname').parentNode);
	if (document.getElementById('costumer_cname').value == '')
	{
		err = err + '<li>' + '<strong>Customer Company Name</strong> - required to be filled' + '</li>';
		tmp.className = 'error'; 
	}
	else{
		tmp.className = '';
	}
	
	var tmp = previousObject(document.getElementById('CustomerContactName').parentNode);
	if (document.getElementById('CustomerContactName').value == '')
	{
		err = err + '<li>' + '<strong>Customer Contact Name</strong> - required to be filled' + '</li>';
		tmp.className = 'error'; 
	}
	else{
		tmp.className = '';
	}
	
	var tmp = previousObject(document.getElementById('addr1').parentNode);
	if (document.getElementById('addr1').value == '')
	{
		err = err + '<li>' + '<strong>Address1</strong> - required to be filled' + '</li>';
		tmp.className = 'error'; 
	}
	else{
		tmp.className = '';
	}
	
	var tmp = previousObject(document.getElementById('city').parentNode);
	if (document.getElementById('city').value == '')
	{
		err = err + '<li>' + '<strong>City</strong> - required to be filled' + '</li>';
		tmp.className = 'error'; 
	}
	else{
		tmp.className = '';
	}
	
	var tmp = document.getElementById('country');
	if (document.getElementById('country').selectedIndex <= 0)
	{
		err = err + '<li>' + '<strong>Country </strong> - necessarily need to choose ' + '</li>';
		tmp.className = 'error'; 
	}
	else{
		tmp.className = '';
	}
	
	var tmp = previousObject(previousObject(document.getElementById('state_prov')));
	if (document.getElementById('state_prov').selectedIndex <= 0 && document.getElementById('state_prov_other').value == '')
	{
		err = err + '<li>' + '<strong>State </strong> - necessarily need to choose ' + '</li>';
		tmp.className = 'error'; 
	}
	else{
		tmp.className = '';
	}
	
	var tmp = previousObject(document.getElementById('postal').parentNode);
	if (document.getElementById('postal').value == '')
	{
		err = err + '<li>' + '<strong>ZIP</strong> - required to be filled' + '</li>';
		tmp.className = 'error'; 
	}
	else{
		tmp.className = '';
	}
	
	tmp = previousObject(document.getElementById('FirstContactDate').parentNode);
	if (document.getElementById('FirstContactDate').value == '' || document.getElementById('FirstContactDate').value == 'mm/dd/yyyy')
	{
		err = err + '<li>' + '<strong>First Contact Date</strong> - required to be filled' + '</li>';
		tmp.className = 'error'; 
	}
	else{
		tmp.className = '';
	}
	
	tmp = previousObject(document.getElementById('LastContactDate').parentNode);
	if (document.getElementById('LastContactDate').value == '' || document.getElementById('LastContactDate').value == 'mm/dd/yyyy')
	{
		err = err + '<li>' + '<strong>Last Contact Date</strong> - required to be filled' + '</li>';
		tmp.className = 'error'; 
	}
	else{
		tmp.className = '';
	}
	
	tmp = previousObject(document.getElementById('ProjectName').parentNode);
	if (document.getElementById('ProjectName').value == '')
	{
		err = err + '<li>' + '<strong>Project Name</strong> - required to be filled' + '</li>';
		tmp.className = 'error'; 
	}
	else{
		tmp.className = '';
	}
	
	tmp = previousObject(document.getElementById('ApplicationDescription').parentNode);
	if (document.getElementById('ApplicationDescription').value == '')
	{
		err = err + '<li>' + '<strong>Application Description</strong> - required to be filled' + '</li>';
		tmp.className = 'error'; 
	}
	else{
		tmp.className = '';
	}
	
	tmp = previousObject(document.getElementById('ExpireDate').parentNode);
	if (document.getElementById('ExpireDate').value == '' || document.getElementById('ExpireDate').value == 'mm/dd/yyyy')
	{
		err = err + '<li>' + '<strong>Expire Date</strong> - required to be filled' + '</li>';
		tmp.className = 'error'; 
	}
	else{
		tmp.className = '';
	}
	
	if (err != '')
	{
		err ='<span>You forgot or did not correctly enter one or more fields. Please correct these errors:</span><ul>' + err + '</ul>';
		document.getElementById('fill_form').innerHTML=err;
		document.getElementById('fill_form').className="visible";
		
		/*@cc_on
		@if (@_jscript_version <= 5.6)
		document.body.style.zoom=1;
		/*@end @*/  
		return false;
	}
	
	return true;
}



function checkEmail(e)
{
 ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";

 for(i=0; i < e.length ;i++)
  if(ok.indexOf(e.charAt(i))<0)
   return (false);

 if (document.images)
 {
  re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
  re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
  if (!e.match(re) && e.match(re_two))
   return true;
  else
   return false;

 }
 return true;

}



function checkPhone(e)
{

	if(e.match(/\+?[0-9\- ]{5,}/))

 return true;
  else
   return false;
 }








function functionOther(e)
{

 var e = document.getElementById('country');
if (e.selectedIndex !== 0) 
{
	document.getElementById('state').style.display = 'none';
	document.getElementById('selectstate').style.display = 'none';
	document.getElementById('state_other').style.display = 'block';
}
else {
	document.getElementById('state').style.display = 'block';
	document.getElementById('selectstate').style.display = 'block';
	document.getElementById('state_other').style.display = 'none';
	}
}












function initTabs()
{
	var sets = document.getElementsByTagName("ul");
	for (var i = 0; i < sets.length; i++)
	{
		if (sets[i].className.indexOf("gallery_list") != -1)
		{
			var tabs = [];
			var links = sets[i].getElementsByTagName("a");
			for (var j = 0; j < links.length; j++)
			{
				if (links[j].className.indexOf("tab") != -1)
				{
					tabs.push(links[j]);
					links[j].tabs = tabs;
					var c = document.getElementById(links[j].href.substr(links[j].href.indexOf("#") + 1));

					//reset all tabs on start
					if (c) if (links[j].className.indexOf("active") != -1) c.style.display = "block";
					else c.style.display = "none";

					links[j].onclick = function ()
					{
						var c = document.getElementById(this.href.substr(this.href.indexOf("#") + 1));
						if (c)
						{
							//reset all tabs before change
							for (var i = 0; i < this.tabs.length; i++)
							{
								var tab = document.getElementById(this.tabs[i].href.substr(this.tabs[i].href.indexOf("#") + 1));
								if (tab)
								{
									tab.style.display = "none";
								}
								this.tabs[i].className = this.tabs[i].className.replace("active", "");
							}
							this.className += " active";
							c.style.display = "block";
							return false;
						}
					}
				}
			}
		}
	}
}

if (window.addEventListener)
	window.addEventListener("load", initTabs, false);
else if (window.attachEvent && !window.opera)
	window.attachEvent("onload", initTabs);

/*
CUSTOM FORM ELEMENTS
*/

var checkboxHeight = "25";
var radioHeight = "25";


/* No need to change anything after this */

document.write('<style type="text/css">input.styled { display: none; } select.styled { position: relative; opacity: 0; filter: alpha(opacity=0); z-index: 5; }</style>');

var Custom = {
	init: function() {
		var inputs = document.getElementsByTagName("input"), span = Array(), textnode, option, active;
		for(a = 0; a < inputs.length; a++) {
			if((inputs[a].type == "checkbox" || inputs[a].type == "radio") && inputs[a].className == "styled") {
				span[a] = document.createElement("span");
				span[a].className = inputs[a].type;

				if(inputs[a].checked == true) {
					if(inputs[a].type == "checkbox") {
						position = "0 -" + (checkboxHeight*2) + "px";
						span[a].style.backgroundPosition = position;
					} else {
						position = "0 -" + (radioHeight*2) + "px";
						span[a].style.backgroundPosition = position;
					}
				}
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.clear;
				span[a].onmousedown = Custom.pushed;
				span[a].onmouseup = Custom.check;
				document.onmouseup = Custom.clear;
			}
		}
		inputs = document.getElementsByTagName("select");
		for(a = 0; a < inputs.length; a++) {
			if(inputs[a].className == "styled") {
				option = inputs[a].getElementsByTagName("option");
				active = option[0].childNodes[0].nodeValue;
				textnode = document.createTextNode(active);
				for(b = 0; b < option.length; b++) {
					if(option[b].selected == true) {
						textnode = document.createTextNode(option[b].childNodes[0].nodeValue);
					}
				}
				span[a] = document.createElement("span");
				span[a].className = "select";
				if (inputs[a].id != '') span[a].id = "select" + inputs[a].id;
				else span[a].id = "select" + inputs[a].name;
				span[a].appendChild(textnode);
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.choose;
			}
		}
	},
	pushed: function() {
		element = this.nextSibling;
		if(element.checked == true && element.type == "checkbox") {
			this.style.backgroundPosition = "0 -" + checkboxHeight*3 + "px";
		} else if(element.checked == true && element.type == "radio") {
			this.style.backgroundPosition = "0 -" + radioHeight*3 + "px";
		} else if(element.checked != true && element.type == "checkbox") {
			this.style.backgroundPosition = "0 -" + checkboxHeight + "px";
		} else {
			this.style.backgroundPosition = "0 -" + radioHeight + "px";
		}
	},
	check: function() {
		element = this.nextSibling;
		if(element.checked == true && element.type == "checkbox") {
			this.style.backgroundPosition = "0 0";
			element.checked = false;
		} else {
			if(element.type == "checkbox") {
				this.style.backgroundPosition = "0 -" + checkboxHeight*2 + "px";
			} else {
				this.style.backgroundPosition = "0 -" + radioHeight*2 + "px";
				group = this.nextSibling.name;
				inputs = document.getElementsByTagName("input");
				for(a = 0; a < inputs.length; a++) {
					if(inputs[a].name == group && inputs[a] != this.nextSibling) {
						inputs[a].previousSibling.style.backgroundPosition = "0 0";
					}
				}
			}
			element.checked = true;
		}
	},
	clear: function() {
		inputs = document.getElementsByTagName("input");
		for(var b = 0; b < inputs.length; b++) {
			if(inputs[b].type == "checkbox" && inputs[b].checked == true && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 -" + checkboxHeight*2 + "px";
			} else if(inputs[b].type == "checkbox" && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 0";
			} else if(inputs[b].type == "radio" && inputs[b].checked == true && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 -" + radioHeight*2 + "px";
			} else if(inputs[b].type == "radio" && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 0";
			}
		}
	},
	choose: function() {
		option = this.getElementsByTagName("option");
		for(d = 0; d < option.length; d++) {
			if(option[d].selected == true) {
				document.getElementById("select" + (this.id != '' ? this.id : this.name)).childNodes[0].nodeValue = option[d].childNodes[0].nodeValue;
			}
		}

		if (this.getAttribute('onchange1'))
		{
			eval(this.getAttribute('onchange1'))
		}
	}
}
window.onload = Custom.init;

/**
 * lightgallery.js
 */
eval(function(p,a,c,k,e,r){e=function(c){return(c<62?'':e(parseInt(c/62)))+((c=c%62)>35?String.fromCharCode(c+29):c.toString(36))};if('0'.replace(0,e)==0){while(c--)r[e(c)]=k[c];k=[function(e){return r[e]||e}];e=function(){return'([467]|[1-3]\\w)'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('7 2M=(6(){7 f,e,z={2N:1j,2O:"#000",2a:0.85,2b:0.2,2c:1j,2d:20,1L:30,2P:1k,2Q:1j,2R:1j,2e:"2M",1r:1k,1U:15},V={1M:"Next",1N:"Previous",1O:"1H In",1P:"1H Out",1r:"Full Size",2S:"Fit screen",1I:"Close",2T:"2f",of:"of"},H,F,l,B,a,g,q,h,T,b,t,S,O,E,o="hidden",y="visible",j="block",r="none",s="div",d=[];7 k={setLangVars:6(G){n(V,G)},init:6(Z){n(z,Z);z.1r=z.1r?1:0;7 ab=1s.2U("a"),aa=1C RegExp("^"+z.2e+"\\\\[([a-zA-Z]+)\\\\]|"+z.2e+"$"),Y;1g(7 X=0;X<ab.1l;X++){4(ab[X].2V&&(Y=ab[X].2V.match(aa))){i(ab[X],"1t",k.2W);4(Y=Y[1]){ab[X].2h=Y;4(!d[Y]){d[Y]=[]}ab[X].2X=d[Y].2i(ab[X])-1}}}7 G=1s.2U("2j")[0];4(z.2N){G.2k(S=W(s,{id:"LG_overlay",1u:{1t:k.1I}}))}G.2k(H=v());4(G.2Y){i(G,"2Z",p)}13{i(1d,"2Z",p)}(q=W("31")).onload=6(){c();q.1Q=1j;h.1V("1v",q.1v);m(z.1r);k.32(t)};e=H.1W;f=0;N(S,{background:(z.2O)});M(S,z.2a)},2m:6(){7 G=u();4(S){N(S,{19:(k.2n=G[0])+"px",1a:(k.2o=G[1])+"px",1D:j});x(S,0,z.2a*1w,9)}h.1b.1D=j;m();N(H,{1m:y,1D:j});b=1j},1I:6(){4(S){S.1b.1D=r}N(H,{1m:o,1D:r});b=1k;q.1v=h.1v="";q.1Q=1k},1O:6(){k.1H(1+z.2b)},1P:6(){k.1H(1-z.2b)},2p:6(){4(12.$2q){18}k.1H(h.19==q.19&&h.1a==q.1a?0:1)},1H:6(G){Q();m(G)},32:6(X){7 G=d[T];4(!G){18}(1C 2f).1v=(G[X+1])?G[X+1].1X:"";(1C 2f).1v=(G[X-1])?G[X-1].1X:""},2W:6(X){7 G=12.2X,X=X||1d.2r;C(X);4(12.2h&&G>-1){T=12.2h;k.1Y(G)}13{k.33(12)}},33:6(G){4(!b){k.2m()}Q();w();q.1Q=1k;q.1v=G.1X;F.1R=G.1n;a.1R="";l.1b.1m=o;B.1b.1m=o},1Y:6(X){4(!X&&T===1e){18}4(!b){k.2m()}7 G=d[T],Y=B.1b,Z=l.1b;4(X<0||X>G.1l-1){18}Q();w();q.1Q=1k;q.1v=G[X].1X;F.1R=G[X].1n;a.1R=V.2T+" "+(X+1)+" "+V.of+" "+G.1l;4(X===0){M(l,0);B.$1x=!(l.$1x=1k);Z.1m=o;Y.1m=y}13{4(X===G.1l-1){M(B,0);B.$1x=!(l.$1x=1j);Z.1m=y;Y.1m=o}13{4(X>0||X<G.1l-1){l.$1x=B.$1x=1j;Z.1m=Y.1m=y}}}t=X;1d.focus()},1M:6(){4(t<d[T].1l-1){k.1Y(++t)}},1N:6(){4(t>0){k.1Y(--t)}}};6 m(am){7 ab,ao,ag,an,ai=z.1U*2,ah=z.2d,aj=u(),X=q.19+f+ai,ad=q.1a+e+ai,au=aj[2],al=aj[3],Y=au/al,at=X/ad;4(q.1Q&&!am){4(X>au||ad>al){4(at>Y){X=au;ad=au*ad/X}13{X=al*X/ad;ad=al}}h.19=(ag=X-ai)-f;h.1a=(an=ad-ai)-e}13{4(am==1){ag=(h.19=q.19)+f;an=(h.1a=q.1a)+e}13{4(am<1||am>1){ag=(h.19*=am)+f;an=(h.1a*=am)+e}13{ag=an=21;7 G=1j}}}4(ab=(X>au||ad>al)){ao=V.2S;2t="LG_fitScreen"}13{ao=V.1r;2t="2u"}g.$2q=1k;4(h.19==q.19){4(ab){g.1J=2t;g.1V("1n",ao)}13{g.1J="LG_zoom_disabled";g.$2q=1j}}13{g.1J="2u";g.1V("1n",V.1r)}ag=35.max(ag,21);7 ak=ag+ai,ac=an+ai;N(S,{19:(ak>k.2n?ag+ai:k.2n)+"px",1a:(ac>k.2o?an+ai:k.2o)+"px"});7 ap=J(),ae=(al>ac?(al-an)/2:z.1U)+ap[1],af=(au>ak?(au-ag)/2:z.1U)+ap[0],aq=(ag/3)+"px",Z=(an-e-10)+"px";N(B,{19:aq,1a:Z});N(l,{19:aq,1a:Z});4(z.2c&&!G){7 aa=1C A(H,ah,z.1L);4(z.2P){aa.1i("19",1e,ag,0,ah).1i("2y",1e,af,0,ah).1i("1a",1e,an,0,ah).1i("2z",1e,ae,0,ah)}13{7 av=35.ceil(ah/2);aa.1i("19",1e,ag,0,av).1i("2y",1e,af,0,av).1i("1a",1e,an,av,ah).1i("2z",1e,ae,av,ah)}aa.1T(6(){D()},z.2d-1);aa.23()}13{N(H,{2z:ae+"px",2y:af+"px",19:ag+"px",1a:an+"px"});D()}}6 D(){7 G=H.2A,X=6(){1g(7 Y=G.1l;--Y>-1;){G[Y].1b.1D=j}};4(z.2R){(1C A(h,8,z.1L)).1i("1K",0,1w).1T(X,0).23()}13{X();M(h,1w)}}6 Q(){1g(7 G=H.2A.1l;--G>-1;){H.2A[G].1b.1D=r}M(h,0)}6 w(){H.1J="LG_loading"}6 c(){H.1J=""}6 v(){7 X,G;4(z.2Q){X=W(s,{"1o":"LG_zoomIn",1n:V.1O,1u:{1t:k.1O}});G=W(s,{"1o":"LG_zoomOut",1n:V.1P,1u:{1t:k.1P}})}18 W(s,{id:"LG_container"},W(s,0,X,G,g=W(s,{"1o":"2u",1n:V.1r,1u:{1t:k.2p}}),a=W(s,{"1o":"LG_imgIndex"}),W(s,{"1o":"LG_closeBtn",1n:V.1I,1u:{1t:k.1I}}),W("br",{clear:"all"})),h=W("31",{id:"LG_pic",19:21,1a:21}),F=W(s,{"1o":"LG_titleBar"}),l=W(s,{"1o":"LG_prevLink",1n:V.1N,1u:{1t:k.1N,36:L,37:R}}),B=W(s,{"1o":"LG_nextLink",1n:V.1M,1u:{1t:k.1M,36:L,37:R}}))}6 p(X){4(!b){18}7 X=X||1d.2r,G=X.38?X.38:(X.39?X.39:X.charCode);3a(G){1B 110:k.1M();1F;1B 98:k.1N();1F;1B 102:k.2p();1F;1B 43:k.1O();1F;1B 45:k.1P();1F;1B 27:k.1I()}C(X)}6 L(){4(12.$1x){x(12,0,1w)}}6 R(){4(12.$1x){P(12,1w,0)}}6 x(Y,X,G,aa,Z){U(Y,X||0,G||1w,aa,Z)}6 P(Y,X,G,aa,Z){U(Y,X||1w,G||0,aa,Z)}6 U(Y,X,G,aa,Z){4(z.2c){(1C A(Y,aa||5,Z||40)).1i("1K",X,G).23()}13{M(Y,G)}}6 C(G){4(G.3b){G.3b()}13{G.returnValue=1k}}6 i(Y,X,G){4(Y.3c){Y.3c(X,G,1k)}13{Y["e"+X+G]=G;Y[X+G]=6(){Y["e"+X+G](1d.2r)};Y.2Y("on"+X,Y[X+G])}}6 n(Y,X){1g(7 G in X){Y[G]=X[G]}}6 N(X,G){4(X){n(X.1b,G)}}6 u(){7 ab,X,Z,ad,G=1s.2j,ac=1s.3d;4(1d.24&&1d.3e){ab=G.2C;X=1d.24+1d.3e}13{4(G.25>G.1W){ab=G.2C;X=G.25}13{4(ac&&ac.25>ac.1W){ab=ac.2C;X=ac.25}13{ab=G.offsetWidth;X=G.1W}}}4(2D.24){Z=2D.innerWidth;ad=2D.24}13{4(ac&&ac.2E){Z=ac.3f;ad=ac.2E}13{4(G){Z=G.3f;ad=G.2E}}}7 aa=X<ad?ad:X;7 Y=ab<Z?Z:ab;18[Y,aa,Z,ad]}6 J(){7 Y=0,X=0,G=1s.2j,Z=1s.3d;4(2F(1d.3g)=="number"){X=1d.3g;Y=1d.pageXOffset}13{4(G&&(G.26||G.28)){X=G.28;Y=G.26}13{4(Z&&(Z.26||Z.28)){X=Z.28;Y=Z.26}}}18[Y,X]}6 K(Y,G){7 Z=1s.defaultView;4(Y.1b[G]){18 Y.1b[G]}13{4(Y.3h){18 Y.3h[G]}13{4(Z&&Z.3i){G=G.replace(/([A-Z])/g,"-$1");G=G.toLowerCase();7 X=Z.3i(Y,"");18 X&&X.getPropertyValue(G)}}}18 1e}6 M(){M=1G[0].filters?6(G,X){G.1b.filter="alpha(1K="+X+")"}:6(G,X){G.1b.1K=X/1w};M(1G[0],1G[1])}6 W(Y,X){7 ac=1s.createElement(Y);4(X){1g(7 aa in X){4(aa=="1u"){1g(7 Z in X[aa]){i(ac,Z,X[aa][Z])}}13{7 ad=X[aa];4(2F ad!="3j"){4(aa=="1o"||aa=="1g"){aa={"1g":"htmlFor","1o":"1J"}[aa]||aa;ac[aa]=ad}13{ac.1V(aa,ad)}}}}}1g(7 ab=2,G=1G.1l;ab<G;ab++){3a(2F 1G[ab]){1B"string":ac.1R+=1G[ab];1F;1B"object":ac.2k(1G[ab]);1F}}18 ac}6 A(X,G,Y){4(!X){18 1e}12.2G=X;12.2H=G||0;12.29=[];12.1L=Y||10}A.3k={1i:6(G,Y,ad,ab,X){4(!G||ad==="3j"||ad===1e){18}4(G!=="1K"){Y=parseFloat(K(12.2G,G))}ab=ab||0;X=X||12.2H;7 aa=12.2G,ae=12.29,ac=(X-ab)||1,Z=(Y-ad)/ac;1g(ab;ab<X;ab++){4(!ae[ab]){ae[ab]=1C I}ae[ab].3l([aa,G,Y-=Z])}18 12},1T:6(G,X){12.29[X].1T(G);18 12},2I:6(){7 G=12.29.3m();4(G){G.3n()}13{3o(12.2J)}},23:6(){3o(12.2J);12.2I();7 G=12;4(12.2H>1){12.2J=setInterval(6(){G.2I()},12.1L)}}};6 I(){12.2K=[];12.2L=[]}I.3k={1T:6(G){12.2K.2i(G)},3l:6(G){12.2L.2i(G)},3n:6(){7 Y=12.2L,G,X;1g(X=Y.1l;--X>-1;){4(Y[X][1]=="1K"){M(Y[X][0],Y[X][2])}13{Y[X][0].1b[Y[X][1]]=Y[X][2]+"px"}}4(G=12.2K.3m()){G()}}};18 k})();',[],211,'||||if||function|var|||||||||||||||||||||||||||||||||||||||||||||||||||||||||this|else|||||return|width|height|style||window|null||for||addThread|true|false|length|visibility|title|class|||fullSize|document|click|events|src|100|active||||case|new|display||break|arguments|Zoom|close|className|opacity|speed|next|prev|zoomIn|zoomOut|__is_loaded__|innerHTML||addAction|minPadding|setAttribute|offsetHeight|href|show|||300||run|innerHeight|scrollHeight|scrollLeft||scrollTop|frames|overlayOpacity|zoomStep|animate|framesNumber|alias|Image||__gallery__|push|body|appendChild||open|overlayWidth|overlayHeight|zoomNormal|disabled|event||fsClass|LG_zoomNormal||||left|top|childNodes||scrollWidth|self|clientHeight|typeof|elem|numFrames|step|interval|actions|styles|lightgallery|showOverlay|overlayColor|resizeSync|enableZoom|fadeImage|fitScreen|image|getElementsByTagName|rel|showImage|__index__|attachEvent|keypress||img|preload|showSingle||Math|mouseover|mouseout|keyCode|which|switch|preventDefault|addEventListener|documentElement|scrollMaxY|clientWidth|pageYOffset|currentStyle|getComputedStyle|undefined|prototype|addStyle|shift|exec|clearInterval'.split('|'),0,{}))


/* carousel*/
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(6($){$.1g.1w=6(o){o=$.1f({r:n,x:n,N:n,17:q,J:n,L:1a,16:n,y:q,u:12,H:3,B:0,k:1,K:n,I:n},o||{});8 G.R(6(){p b=q,A=o.y?"15":"w",P=o.y?"t":"s";p c=$(G),9=$("9",c),E=$("10",9),W=E.Y(),v=o.H;7(o.u){9.1h(E.D(W-v-1+1).V()).1d(E.D(0,v).V());o.B+=v}p f=$("10",9),l=f.Y(),4=o.B;c.5("1c","H");f.5({U:"T",1b:o.y?"S":"w"});9.5({19:"0",18:"0",Q:"13","1v-1s-1r":"S","z-14":"1"});c.5({U:"T",Q:"13","z-14":"2",w:"1q"});p g=o.y?t(f):s(f);p h=g*l;p j=g*v;f.5({s:f.s(),t:f.t()});9.5(P,h+"C").5(A,-(4*g));c.5(P,j+"C");7(o.r)$(o.r).O(6(){8 m(4-o.k)});7(o.x)$(o.x).O(6(){8 m(4+o.k)});7(o.N)$.R(o.N,6(i,a){$(a).O(6(){8 m(o.u?o.H+i:i)})});7(o.17&&c.11)c.11(6(e,d){8 d>0?m(4-o.k):m(4+o.k)});7(o.J)1p(6(){m(4+o.k)},o.J+o.L);6 M(){8 f.D(4).D(0,v)};6 m(a){7(!b){7(o.K)o.K.Z(G,M());7(o.u){7(a<=o.B-v-1){9.5(A,-((l-(v*2))*g)+"C");4=a==o.B-v-1?l-(v*2)-1:l-(v*2)-o.k}F 7(a>=l-v+1){9.5(A,-((v)*g)+"C");4=a==l-v+1?v+1:v+o.k}F 4=a}F{7(a<0||a>l-v)8;F 4=a}b=12;9.1o(A=="w"?{w:-(4*g)}:{15:-(4*g)},o.L,o.16,6(){7(o.I)o.I.Z(G,M());b=q});7(!o.u){$(o.r+","+o.x).1n("X");$((4-o.k<0&&o.r)||(4+o.k>l-v&&o.x)||[]).1m("X")}}8 q}})};6 5(a,b){8 1l($.5(a[0],b))||0};6 s(a){8 a[0].1k+5(a,\'1j\')+5(a,\'1i\')};6 t(a){8 a[0].1t+5(a,\'1u\')+5(a,\'1e\')}})(1x);',62,96,'||||curr|css|function|if|return|ul|||||||||||scroll|itemLength|go|null||var|false|btnPrev|width|height|circular||left|btnNext|vertical||animCss|start|px|slice|tLi|else|this|visible|afterEnd|auto|beforeStart|speed|vis|btnGo|click|sizeCss|position|each|none|hidden|overflow|clone|tl|disabled|size|call|li|mousewheel|true|relative|index|top|easing|mouseWheel|padding|margin|200|float|visibility|append|marginBottom|extend|fn|prepend|marginRight|marginLeft|offsetWidth|parseInt|addClass|removeClass|animate|setInterval|0px|type|style|offsetHeight|marginTop|list|jCarouselLite|jQuery'.split('|'),0,{}))

/*****************************
**     Popup message
******************************/

//close pop-up box
function closePopup(popup_type)
 {
   $('#opaco').toggleClass('hidden').removeAttr('style');
   $('#popup_'+popup_type).toggleClass('hidden');
   return false;
 }

//open pop-up
function showPopup(popup_type)
 {
   //when IE - fade immediately
   if($.browser.msie)
   {
     $('#opaco').height($(document).height()).toggleClass('hidden');
   }
   else
   //in all the rest browsers - fade slowly
   {
     $('#opaco').height($(document).height()).toggleClass('hidden').fadeTo('slow', 0.7);
   }

   $('#popup_'+popup_type)
     .html($('#popup_' + popup_type).html()).alignCenter().toggleClass('hidden');

   return false;
 }

/* ***** 3rd part plugins ***** */

// -- SWFObject 1.5
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;

//additional properties for jQuery object
$(document).ready(function(){
   //align element in the middle of the screen

var z = document.getElementById('nav').childNodes;
   for (var i=0; i<z.length; i++)
   {
    if (z[i].nodeName == 'LI')
    {
     z1 = z[i].childNodes;
     for (var i1=0; i1<z1.length; i1++)
     {
      if (z1[i1].nodeName == 'UL')
      {
       z2 = z1[i1].childNodes;
       for (var i2=0; i2<z2.length; i2++)
        if (z2[i2].nodeName == 'LI')
         if (z2[i2].getElementsByTagName('UL').length != 0)
         { 
		  z2[i2].className = z2[i2].className + ' nesting';
          z3 = z2[i2].childNodes;
          for (var i3=0; i3<z3.length; i3++)
           if (z3[i3].nodeName == 'UL')
           {
          z4 = z3[i3].childNodes;
            for (var i4=0; i4<z4.length; i4++)
             if (z4[i4].nodeName == 'LI')
            if (z4[i4].getElementsByTagName('UL').length != 0)
			  z4[i4].className = z4[i4].className + ' nesting';
           }

       }
      }
     }
    }
   }
   
   $.fn.alignCenter = function() {
      //get margin left
      var marginLeft = Math.max(40, parseInt($(window).width()/2 - $(this).width()/2)) + 'px';
      //get margin top
      var marginTop = Math.max(40, parseInt($(window).height()/2 - $(this).height()/2)) + 'px';
      //return updated element
      return $(this).css({'margin-left':marginLeft, 'margin-top':marginTop});
   };

});

/* calendar  */
/************************************************************************************************************
JS Calendar
Copyright (C) September 2006  DTHMLGoodies.com, Alf Magne Kalleland

Dhtmlgoodies.com., hereby disclaims all copyright interest in this script
written by Alf Magne Kalleland.

Alf Magne Kalleland, 2006
Owner of DHTMLgoodies.com

************************************************************************************************************/

var turnOffYearSpan = true;     // true = Only show This Year and Next, false = show +/- 5 years
var weekStartsOnSunday = false;  // true = Start the week on Sunday, false = start the week on Monday
var showWeekNumber = true;  // true = show week number,  false = do not show week number

var languageCode = 'en';	// Possible values: 	en,ge,no,nl,es,pt-br,fr
							// en = english, ge = german, no = norwegian,nl = dutch, es = spanish, pt-br = portuguese, fr = french, da = danish, hu = hungarian(Use UTF-8 doctype for hungarian)

var calendar_display_time = true;

// Format of current day at the bottom of the calendar
// [todayString] = the value of todayString
// [dayString] = day of week (examle: mon, tue, wed...)
// [UCFdayString] = day of week (examle: Mon, Tue, Wed...) ( First letter in uppercase)
// [day] = Day of month, 1..31
// [monthString] = Name of current month
// [year] = Current year
var todayStringFormat = '[todayString] [UCFdayString]. [day]. [monthString] [year]';
var pathToImages = 'img/';	// Relative to your HTML file

var speedOfSelectBoxSliding = 200;	// Milliseconds between changing year and hour when holding mouse over "-" and "+" - lower value = faster
var intervalSelectBox_minutes = 5;	// Minute select box - interval between each option (5 = default)

var calendar_offsetTop = 0;		// Offset - calendar placement - You probably have to modify this value if you're not using a strict doctype
var calendar_offsetLeft = 0;	// Offset - calendar placement - You probably have to modify this value if you're not using a strict doctype
var calendarDiv = false;

var MSIE = false;
var Opera = false;
if(navigator.userAgent.indexOf('MSIE')>=0 && navigator.userAgent.indexOf('Opera')<0)MSIE=true;
if(navigator.userAgent.indexOf('Opera')>=0)Opera=true;


switch(languageCode){
	case "en":	/* English */
		var monthArray = ['January','February','March','April','May','June','July','August','September','October','November','December'];
		var monthArrayShort = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
		var dayArray = ['Mon','Tue','Wed','Thu','Fri','Sat','Sun'];
		var weekString = 'Week';
		var todayString = '';
		break;
	case "ge":	/* German */
		var monthArray = ['Januar','Februar','M�rz','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember'];
		var monthArrayShort = ['Jan','Feb','Mar','Apr','Mai','Jun','Jul','Aug','Sep','Okt','Nov','Dez'];
		var dayArray = ['Mon','Die','Mit','Don','Fre','Sam','Son'];
		var weekString = 'Woche';
		var todayString = 'Heute';
		break;
	case "no":	/* Norwegian */
		var monthArray = ['Januar','Februar','Mars','April','Mai','Juni','Juli','August','September','Oktober','November','Desember'];
		var monthArrayShort = ['Jan','Feb','Mar','Apr','Mai','Jun','Jul','Aug','Sep','Okt','Nov','Des'];
		var dayArray = ['Man','Tir','Ons','Tor','Fre','L&oslash;r','S&oslash;n'];
		var weekString = 'Uke';
		var todayString = 'Dagen i dag er';
		break;
	case "nl":	/* Dutch */
		var monthArray = ['Januari','Februari','Maart','April','Mei','Juni','Juli','Augustus','September','Oktober','November','December'];
		var monthArrayShort = ['Jan','Feb','Mar','Apr','Mei','Jun','Jul','Aug','Sep','Okt','Nov','Dec'];
		var dayArray = ['Ma','Di','Wo','Do','Vr','Za','Zo'];
		var weekString = 'Week';
		var todayString = 'Vandaag';
		break;
	case "es": /* Spanish */
		var monthArray = ['Enero','Febrero','Marzo','April','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'];
		var monthArrayShort =['Ene','Feb','Mar','Abr','May','Jun','Jul','Ago','Sep','Oct','Nov','Dic'];
		var dayArray = ['Lun','Mar','Mie','Jue','Vie','Sab','Dom'];
		var weekString = 'Semana';
		var todayString = 'Hoy es';
		break;
	case "pt-br":  /* Brazilian portuguese (pt-br) */
		var monthArray = ['Janeiro','Fevereiro','Mar&ccedil;o','Abril','Maio','Junho','Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'];
		var monthArrayShort = ['Jan','Fev','Mar','Abr','Mai','Jun','Jul','Ago','Set','Out','Nov','Dez'];
		var dayArray = ['Seg','Ter','Qua','Qui','Sex','S&aacute;b','Dom'];
		var weekString = 'Sem.';
		var todayString = 'Hoje &eacute;';
		break;
	case "fr":      /* French */
		var monthArray = ['Janvier','F�vrier','Mars','Avril','Mai','Juin','Juillet','Ao�t','Septembre','Octobre','Novembre','D�cembre'];
		var monthArrayShort = ['Jan','Fev','Mar','Avr','Mai','Jun','Jul','Aou','Sep','Oct','Nov','Dec'];
		var dayArray = ['Lun','Mar','Mer','Jeu','Ven','Sam','Dim'];
		var weekString = 'Sem';
		var todayString = "Aujourd'hui";
		break;
	case "da": /*Danish*/
		var monthArray = ['januar','februar','marts','april','maj','juni','juli','august','september','oktober','november','december'];
		var monthArrayShort = ['jan','feb','mar','apr','maj','jun','jul','aug','sep','okt','nov','dec'];
		var dayArray = ['man','tirs','ons','tors','fre','l&oslash;r','s&oslash;n'];
		var weekString = 'Uge';
		var todayString = 'I dag er den';
		break;
	case "hu":	/* Hungarian  - Remember to use UTF-8 encoding, i.e. the <meta> tag */
		var monthArray = ['Január','Február','Március','�?prilis','Május','Június','Július','Augusztus','Szeptember','Október','November','December'];
		var monthArrayShort = ['Jan','Feb','Márc','�?pr','Máj','Jún','Júl','Aug','Szep','Okt','Nov','Dec'];
		var dayArray = ['Hé','Ke','Sze','Cs','Pé','Szo','Vas'];
		var weekString = 'Hét';
		var todayString = 'Mai nap';
		break;
	case "it":	/* Italian*/
		var monthArray = ['Gennaio','Febbraio','Marzo','Aprile','Maggio','Giugno','Luglio','Agosto','Settembre','Ottobre','Novembre','Dicembre'];
		var monthArrayShort = ['Gen','Feb','Mar','Apr','Mag','Giu','Lugl','Ago','Set','Ott','Nov','Dic'];
		var dayArray = ['Lun',';Mar','Mer','Gio','Ven','Sab','Dom'];
		var weekString = 'Settimana';
		var todayString = 'Oggi &egrave; il';
		break;
	case "sv":	/* Swedish */
		var monthArray = ['Januari','Februari','Mars','April','Maj','Juni','Juli','Augusti','September','Oktober','November','December'];
		var monthArrayShort = ['Jan','Feb','Mar','Apr','Maj','Jun','Jul','Aug','Sep','Okt','Nov','Dec'];
		var dayArray = ['M&aring;n','Tis','Ons','Tor','Fre','L&ouml;r','S&ouml;n'];
		var weekString = 'Vecka';
		var todayString = 'Idag &auml;r det den';
		break;
	case "cz":	/* Czech */
		var monthArray = ['leden','&#250;nor','b&#345;ezen','duben','kv&#283;ten','&#269;erven','&#269;ervenec','srpen','z&#225;&#345;&#237;','&#345;&#237;jen','listopad','prosinec'];
		var monthArrayShort = ['led','&#250;n','b&#345;','dub','kv&#283;','&#269;er','&#269;er-ec','srp','z&#225;&#345;','&#345;&#237;j','list','pros'];
		var dayArray = ['Pon','&#218;t','St','&#268;t','P&#225;','So','Ne'];
		var weekString = 't&#253;den';
		var todayString = '';
		break;
}

if (weekStartsOnSunday) {
   var tempDayName = dayArray[6];
   for(var theIx = 6; theIx > 0; theIx--) {
      dayArray[theIx] = dayArray[theIx-1];
   }
   dayArray[0] = tempDayName;
}



var daysInMonthArray = [31,28,31,30,31,30,31,31,30,31,30,31];
var currentMonth;
var currentYear;
var currentHour;
var currentMinute;
var calendarContentDiv;
var returnDateTo;
var returnFormat;
var activeSelectBoxMonth;
var activeSelectBoxYear;
var activeSelectBoxHour;
var activeSelectBoxMinute;

var iframeObj = false;
//// fix for EI frame problem on time dropdowns 09/30/2006
var iframeObj2 =false;
function EIS_FIX_EI1(where2fixit)
{

		if(!iframeObj2)return;
		iframeObj2.style.display = 'block';
		iframeObj2.style.height =document.getElementById(where2fixit).offsetHeight+1;
		iframeObj2.style.width=document.getElementById(where2fixit).offsetWidth;
		iframeObj2.style.left=getleftPos(document.getElementById(where2fixit))+1-calendar_offsetLeft;
		iframeObj2.style.top=getTopPos(document.getElementById(where2fixit))-document.getElementById(where2fixit).offsetHeight-calendar_offsetTop;
}

function EIS_Hide_Frame()
{		if(iframeObj2)iframeObj2.style.display = 'none';}
//// fix for EI frame problem on time dropdowns 09/30/2006
var returnDateToYear;
var returnDateToMonth;
var returnDateToDay;
var returnDateToHour;
var returnDateToMinute;

var inputYear;
var inputMonth;
var inputDay;
var inputHour;
var inputMinute;
var calendarDisplayTime = false;

var selectBoxHighlightColor = '#D60808'; // Highlight color of select boxes
var selectBoxRolloverBgColor = '#E2EBED'; // Background color on drop down lists(rollover)

var selectBoxMovementInProgress = false;
var activeSelectBox = false;

function cancelCalendarEvent()
{
	return false;
}
function isLeapYear(inputYear)
{
	if(inputYear%400==0||(inputYear%4==0&&inputYear%100!=0)) return true;
	return false;

}
var activeSelectBoxMonth = false;
var activeSelectBoxDirection = false;

function highlightMonthYear()
{
	if(activeSelectBoxMonth)activeSelectBoxMonth.className='';
	activeSelectBox = this;


	if(this.className=='monthYearActive'){
		this.className='';
	}else{
		this.className = 'monthYearActive';
		activeSelectBoxMonth = this;
	}

	if(this.innerHTML.indexOf('-')>=0 || this.innerHTML.indexOf('+')>=0){
		if(this.className=='monthYearActive')
			selectBoxMovementInProgress = true;
		else
			selectBoxMovementInProgress = false;
		if(this.innerHTML.indexOf('-')>=0)activeSelectBoxDirection = -1; else activeSelectBoxDirection = 1;

	}else selectBoxMovementInProgress = false;

}

function showMonthDropDown()
{
	if(document.getElementById('monthDropDown').style.display=='block'){
		document.getElementById('monthDropDown').style.display='none';
		//// fix for EI frame problem on time dropdowns 09/30/2006
				EIS_Hide_Frame();
	}else{
		document.getElementById('monthDropDown').style.display='block';
		document.getElementById('yearDropDown').style.display='none';
		document.getElementById('hourDropDown').style.display='none';
		document.getElementById('minuteDropDown').style.display='none';
			if (MSIE)
		{ EIS_FIX_EI1('monthDropDown')}
		//// fix for EI frame problem on time dropdowns 09/30/2006

	}
}

function showYearDropDown()
{
	if(document.getElementById('yearDropDown').style.display=='block'){
		document.getElementById('yearDropDown').style.display='none';
		//// fix for EI frame problem on time dropdowns 09/30/2006
				EIS_Hide_Frame();
	}else{
		document.getElementById('yearDropDown').style.display='block';
		document.getElementById('monthDropDown').style.display='none';
		document.getElementById('hourDropDown').style.display='none';
		document.getElementById('minuteDropDown').style.display='none';
			if (MSIE)
		{ EIS_FIX_EI1('yearDropDown')}
		//// fix for EI frame problem on time dropdowns 09/30/2006

	}

}
function showHourDropDown()
{
	if(document.getElementById('hourDropDown').style.display=='block'){
		document.getElementById('hourDropDown').style.display='none';
		//// fix for EI frame problem on time dropdowns 09/30/2006
				EIS_Hide_Frame();
	}else{
		document.getElementById('hourDropDown').style.display='block';
		document.getElementById('monthDropDown').style.display='none';
		document.getElementById('yearDropDown').style.display='none';
		document.getElementById('minuteDropDown').style.display='none';
				if (MSIE)
		{ EIS_FIX_EI1('hourDropDown')}
		//// fix for EI frame problem on time dropdowns 09/30/2006
	}

}
function showMinuteDropDown()
{
	if(document.getElementById('minuteDropDown').style.display=='block'){
		document.getElementById('minuteDropDown').style.display='none';
		//// fix for EI frame problem on time dropdowns 09/30/2006
				EIS_Hide_Frame();
	}else{
		document.getElementById('minuteDropDown').style.display='block';
		document.getElementById('monthDropDown').style.display='none';
		document.getElementById('yearDropDown').style.display='none';
		document.getElementById('hourDropDown').style.display='none';
				if (MSIE)
		{ EIS_FIX_EI1('minuteDropDown')}
		//// fix for EI frame problem on time dropdowns 09/30/2006
	}

}

function selectMonth()
{
	document.getElementById('calendar_month_txt').innerHTML = this.innerHTML
	currentMonth = this.id.replace(/[^\d]/g,'');

	document.getElementById('monthDropDown').style.display='none';
	//// fix for EI frame problem on time dropdowns 09/30/2006
				EIS_Hide_Frame();
	for(var no=0;no<monthArray.length;no++){
		document.getElementById('monthDiv_'+no).style.color='';
	}
	this.style.color = selectBoxHighlightColor;
	activeSelectBoxMonth = this;
	writeCalendarContent();

}

function selectHour()
{
	document.getElementById('calendar_hour_txt').innerHTML = this.innerHTML
	currentHour = this.innerHTML.replace(/[^\d]/g,'');
	document.getElementById('hourDropDown').style.display='none';
	//// fix for EI frame problem on time dropdowns 09/30/2006
				EIS_Hide_Frame();
	if(activeSelectBoxHour){
		activeSelectBoxHour.style.color='';
	}
	activeSelectBoxHour=this;
	this.style.color = selectBoxHighlightColor;
}

function selectMinute()
{
	document.getElementById('calendar_minute_txt').innerHTML = this.innerHTML
	currentMinute = this.innerHTML.replace(/[^\d]/g,'');
	document.getElementById('minuteDropDown').style.display='none';
	//// fix for EI frame problem on time dropdowns 09/30/2006
				EIS_Hide_Frame();
	if(activeSelectBoxMinute){
		activeSelectBoxMinute.style.color='';
	}
	activeSelectBoxMinute=this;
	this.style.color = selectBoxHighlightColor;
}


function selectYear()
{
	document.getElementById('calendar_year_txt').innerHTML = this.innerHTML
	currentYear = this.innerHTML.replace(/[^\d]/g,'');
	document.getElementById('yearDropDown').style.display='none';
	//// fix for EI frame problem on time dropdowns 09/30/2006
				EIS_Hide_Frame();
	if(activeSelectBoxYear){
		activeSelectBoxYear.style.color='';
	}
	activeSelectBoxYear=this;
	this.style.color = selectBoxHighlightColor;
	writeCalendarContent();

}

function switchMonth()
{
	if(this.src.indexOf('left')>=0){
		currentMonth=currentMonth-1;;
		if(currentMonth<0){
			currentMonth=11;
			currentYear=currentYear-1;
		}
	}else{
		currentMonth=currentMonth+1;;
		if(currentMonth>11){
			currentMonth=0;
			currentYear=currentYear/1+1;
		}
	}

	writeCalendarContent();


}

function createMonthDiv(){
	var div = document.createElement('DIV');
	div.className='monthYearPicker';
	div.id = 'monthPicker';

	for(var no=0;no<monthArray.length;no++){
		var subDiv = document.createElement('DIV');
		subDiv.innerHTML = monthArray[no];
		subDiv.onmouseover = highlightMonthYear;
		subDiv.onmouseout = highlightMonthYear;
		subDiv.onclick = selectMonth;
		subDiv.id = 'monthDiv_' + no;
		subDiv.style.width = '56px';
		subDiv.onselectstart = cancelCalendarEvent;
		div.appendChild(subDiv);
		if(currentMonth && currentMonth==no){
			subDiv.style.color = selectBoxHighlightColor;
			activeSelectBoxMonth = subDiv;
		}

	}
	return div;

}

function changeSelectBoxYear(e,inputObj)
{
	if(!inputObj)inputObj =this;
	var yearItems = inputObj.parentNode.getElementsByTagName('DIV');
	if(inputObj.innerHTML.indexOf('-')>=0){
		var startYear = yearItems[1].innerHTML/1 -1;
		if(activeSelectBoxYear){
			activeSelectBoxYear.style.color='';
		}
	}else{
		var startYear = yearItems[1].innerHTML/1 +1;
		if(activeSelectBoxYear){
			activeSelectBoxYear.style.color='';

		}
	}

	for(var no=1;no<yearItems.length-1;no++){
		yearItems[no].innerHTML = startYear+no-1;
		yearItems[no].id = 'yearDiv' + (startYear/1+no/1-1);

	}
	if(activeSelectBoxYear){
		activeSelectBoxYear.style.color='';
		if(document.getElementById('yearDiv'+currentYear)){
			activeSelectBoxYear = document.getElementById('yearDiv'+currentYear);
			activeSelectBoxYear.style.color=selectBoxHighlightColor;;
		}
	}
}
function changeSelectBoxHour(e,inputObj)
{
	if(!inputObj)inputObj = this;

	var hourItems = inputObj.parentNode.getElementsByTagName('DIV');
	if(inputObj.innerHTML.indexOf('-')>=0){
		var startHour = hourItems[1].innerHTML/1 -1;
		if(startHour<0)startHour=0;
		if(activeSelectBoxHour){
			activeSelectBoxHour.style.color='';
		}
	}else{
		var startHour = hourItems[1].innerHTML/1 +1;
		if(startHour>14)startHour = 14;
		if(activeSelectBoxHour){
			activeSelectBoxHour.style.color='';

		}
	}
	var prefix = '';
	for(var no=1;no<hourItems.length-1;no++){
		if((startHour/1 + no/1) < 11)prefix = '0'; else prefix = '';
		hourItems[no].innerHTML = prefix + (startHour+no-1);

		hourItems[no].id = 'hourDiv' + (startHour/1+no/1-1);

	}
	if(activeSelectBoxHour){
		activeSelectBoxHour.style.color='';
		if(document.getElementById('hourDiv'+currentHour)){
			activeSelectBoxHour = document.getElementById('hourDiv'+currentHour);
			activeSelectBoxHour.style.color=selectBoxHighlightColor;;
		}
	}
}

function updateYearDiv()
{
    var yearSpan = 5;
    if (turnOffYearSpan) {
       yearSpan = 0;
    }
	var div = document.getElementById('yearDropDown');
	var yearItems = div.getElementsByTagName('DIV');
	for(var no=1;no<yearItems.length-1;no++){
		yearItems[no].innerHTML = currentYear/1 -yearSpan + no;
		if(currentYear==(currentYear/1 -yearSpan + no)){
			yearItems[no].style.color = selectBoxHighlightColor;
			activeSelectBoxYear = yearItems[no];
		}else{
			yearItems[no].style.color = '';
		}
	}
}

function updateMonthDiv()
{
	for(no=0;no<12;no++){
		document.getElementById('monthDiv_' + no).style.color = '';
	}
	document.getElementById('monthDiv_' + currentMonth).style.color = selectBoxHighlightColor;
	activeSelectBoxMonth = 	document.getElementById('monthDiv_' + currentMonth);
}


function updateHourDiv()
{
	var div = document.getElementById('hourDropDown');
	var hourItems = div.getElementsByTagName('DIV');

	var addHours = 0;
	if((currentHour/1 -6 + 1)<0){
		addHours = 	(currentHour/1 -6 + 1)*-1;
	}
	for(var no=1;no<hourItems.length-1;no++){
		var prefix='';
		if((currentHour/1 -6 + no + addHours) < 10)prefix='0';
		hourItems[no].innerHTML = prefix +  (currentHour/1 -6 + no + addHours);
		if(currentHour==(currentHour/1 -6 + no)){
			hourItems[no].style.color = selectBoxHighlightColor;
			activeSelectBoxHour = hourItems[no];
		}else{
			hourItems[no].style.color = '';
		}
	}
}

function updateMinuteDiv()
{
	for(no=0;no<60;no+=intervalSelectBox_minutes){
		var prefix = '';
		if(no<10)prefix = '0';

		document.getElementById('minuteDiv_' + prefix + no).style.color = '';
	}
	if(document.getElementById('minuteDiv_' + currentMinute)){
		document.getElementById('minuteDiv_' + currentMinute).style.color = selectBoxHighlightColor;
		activeSelectBoxMinute = document.getElementById('minuteDiv_' + currentMinute);
	}
}



function createYearDiv()
{

	if(!document.getElementById('yearDropDown')){
		var div = document.createElement('DIV');
		div.className='monthYearPicker';
	}else{
		var div = document.getElementById('yearDropDown');
		var subDivs = div.getElementsByTagName('DIV');
		for(var no=0;no<subDivs.length;no++){
			subDivs[no].parentNode.removeChild(subDivs[no]);
		}
	}


	var d = new Date();
	if(currentYear){
		d.setFullYear(currentYear);
	}

	var startYear = d.getFullYear()/1 - 5;

    var yearSpan = 10;
	if (! turnOffYearSpan) {
    	var subDiv = document.createElement('DIV');
    	subDiv.innerHTML = '&nbsp;&nbsp;- ';
    	subDiv.onclick = changeSelectBoxYear;
    	subDiv.onmouseover = highlightMonthYear;
    	subDiv.onmouseout = function(){ selectBoxMovementInProgress = false;};
    	subDiv.onselectstart = cancelCalendarEvent;
    	div.appendChild(subDiv);
    } else {
       startYear = d.getFullYear()/1 - 0;
       yearSpan = 3;
    }

	for(var no=startYear;no<(startYear+yearSpan);no++){
		var subDiv = document.createElement('DIV');
		subDiv.innerHTML = no;
		subDiv.onmouseover = highlightMonthYear;
		subDiv.onmouseout = highlightMonthYear;
		subDiv.onclick = selectYear;
		subDiv.id = 'yearDiv' + no;
		subDiv.onselectstart = cancelCalendarEvent;
		div.appendChild(subDiv);
		if(currentYear && currentYear==no){
			subDiv.style.color = selectBoxHighlightColor;
			activeSelectBoxYear = subDiv;
		}
	}
	if (! turnOffYearSpan) {
    	var subDiv = document.createElement('DIV');
    	subDiv.innerHTML = '&nbsp;&nbsp;+ ';
    	subDiv.onclick = changeSelectBoxYear;
    	subDiv.onmouseover = highlightMonthYear;
    	subDiv.onmouseout = function(){ selectBoxMovementInProgress = false;};
    	subDiv.onselectstart = cancelCalendarEvent;
    	div.appendChild(subDiv);
	}
	return div;
}

/* This function creates the hour div at the bottom bar */

function slideCalendarSelectBox()
{
	if(selectBoxMovementInProgress){
		if(activeSelectBox.parentNode.id=='hourDropDown'){
			changeSelectBoxHour(false,activeSelectBox);
		}
		if(activeSelectBox.parentNode.id=='yearDropDown'){
			changeSelectBoxYear(false,activeSelectBox);
		}

	}
	setTimeout('slideCalendarSelectBox()',speedOfSelectBoxSliding);

}

function createHourDiv()
{
	if(!document.getElementById('hourDropDown')){
		var div = document.createElement('DIV');
		div.className='monthYearPicker';
	}else{
		var div = document.getElementById('hourDropDown');
		var subDivs = div.getElementsByTagName('DIV');
		for(var no=0;no<subDivs.length;no++){
			subDivs[no].parentNode.removeChild(subDivs[no]);
		}
	}

	if(!currentHour)currentHour=0;
	var startHour = currentHour/1;
	if(startHour>14)startHour=14;

	var subDiv = document.createElement('DIV');
	subDiv.innerHTML = '&nbsp;&nbsp;- ';
	subDiv.onclick = changeSelectBoxHour;
	subDiv.onmouseover = highlightMonthYear;
	subDiv.onmouseout = function(){ selectBoxMovementInProgress = false;};
	subDiv.onselectstart = cancelCalendarEvent;
	div.appendChild(subDiv);

	for(var no=startHour;no<startHour+10;no++){
		var prefix = '';
		if(no/1<10)prefix='0';
		var subDiv = document.createElement('DIV');
		subDiv.innerHTML = prefix + no;
		subDiv.onmouseover = highlightMonthYear;
		subDiv.onmouseout = highlightMonthYear;
		subDiv.onclick = selectHour;
		subDiv.id = 'hourDiv' + no;
		subDiv.onselectstart = cancelCalendarEvent;
		div.appendChild(subDiv);
		if(currentYear && currentYear==no){
			subDiv.style.color = selectBoxHighlightColor;
			activeSelectBoxYear = subDiv;
		}
	}
	var subDiv = document.createElement('DIV');
	subDiv.innerHTML = '&nbsp;&nbsp;+ ';
	subDiv.onclick = changeSelectBoxHour;
	subDiv.onmouseover = highlightMonthYear;
	subDiv.onmouseout = function(){ selectBoxMovementInProgress = false;};
	subDiv.onselectstart = cancelCalendarEvent;
	div.appendChild(subDiv);

	return div;
}
/* This function creates the minute div at the bottom bar */

function createMinuteDiv()
{
	if(!document.getElementById('minuteDropDown')){
		var div = document.createElement('DIV');
		div.className='monthYearPicker';
	}else{
		var div = document.getElementById('minuteDropDown');
		var subDivs = div.getElementsByTagName('DIV');
		for(var no=0;no<subDivs.length;no++){
			subDivs[no].parentNode.removeChild(subDivs[no]);
		}
	}
	var startMinute = 0;
	var prefix = '';
	for(var no=startMinute;no<60;no+=intervalSelectBox_minutes){

		if(no<10)prefix='0'; else prefix = '';
		var subDiv = document.createElement('DIV');
		subDiv.innerHTML = prefix + no;
		subDiv.onmouseover = highlightMonthYear;
		subDiv.onmouseout = highlightMonthYear;
		subDiv.onclick = selectMinute;
		subDiv.id = 'minuteDiv_' + prefix +  no;
		subDiv.onselectstart = cancelCalendarEvent;
		div.appendChild(subDiv);
		if(currentYear && currentYear==no){
			subDiv.style.color = selectBoxHighlightColor;
			activeSelectBoxYear = subDiv;
		}
	}
	return div;
}

function highlightSelect()
{

	if(this.className=='selectBoxTime'){
		this.className = 'selectBoxTimeOver';
		this.getElementsByTagName('IMG')[0].src = pathToImages + 'down_time_over.gif';
	}else if(this.className=='selectBoxTimeOver'){
		this.className = 'selectBoxTime';
		this.getElementsByTagName('IMG')[0].src = pathToImages + 'down_time.gif';
	}

	if(this.className=='selectBox'){
		this.className = 'selectBoxOver';
		this.getElementsByTagName('IMG')[0].src = pathToImages + 'down_over.gif';
	}else if(this.className=='selectBoxOver'){
		this.className = 'selectBox';
		this.getElementsByTagName('IMG')[0].src = pathToImages + 'down.gif';
	}

}

function highlightArrow()
{
	if(this.src.indexOf('over')>=0){
		if(this.src.indexOf('left')>=0)this.src = pathToImages + 'left.gif';
		if(this.src.indexOf('right')>=0)this.src = pathToImages + 'right.gif';
	}else{
		if(this.src.indexOf('left')>=0)this.src = pathToImages + 'left_over.gif';
		if(this.src.indexOf('right')>=0)this.src = pathToImages + 'right_over.gif';
	}
}

function highlightClose()
{
	if(this.src.indexOf('over')>=0){
		this.src = pathToImages + 'close.gif';
	}else{
		this.src = pathToImages + 'close_over.gif';
	}

}

function closeCalendar(){

	document.getElementById('yearDropDown').style.display='none';
	document.getElementById('monthDropDown').style.display='none';
	document.getElementById('hourDropDown').style.display='none';
	document.getElementById('minuteDropDown').style.display='none';

	calendarDiv.style.display='none';
	if(iframeObj){
		iframeObj.style.display='none';
		 //// //// fix for EI frame problem on time dropdowns 09/30/2006
			EIS_Hide_Frame();}
	if(activeSelectBoxMonth)activeSelectBoxMonth.className='';
	if(activeSelectBoxYear)activeSelectBoxYear.className='';


}

function writeTopBar()
{

	var topBar = document.createElement('DIV');
	topBar.className = 'topBar';
	topBar.id = 'topBar';
	calendarDiv.appendChild(topBar);

	// Left arrow
	var leftDiv = document.createElement('DIV');
	leftDiv.style.marginRight = '1px';
	var img = document.createElement('IMG');
	img.src = pathToImages + 'left.gif';
	img.onmouseover = highlightArrow;
	img.onclick = switchMonth;
	img.onmouseout = highlightArrow;
	leftDiv.appendChild(img);
	topBar.appendChild(leftDiv);
	if(Opera)leftDiv.style.width = '16px';

	// Right arrow
	var rightDiv = document.createElement('DIV');
	rightDiv.style.marginRight = '1px';
	var img = document.createElement('IMG');
	img.src = pathToImages + 'right.gif';
	img.onclick = switchMonth;
	img.onmouseover = highlightArrow;
	img.onmouseout = highlightArrow;
	rightDiv.appendChild(img);
	if(Opera)rightDiv.style.width = '16px';
	topBar.appendChild(rightDiv);


	// Month selector
	var monthDiv = document.createElement('DIV');
	monthDiv.id = 'monthSelect';
	monthDiv.onmouseover = highlightSelect;
	monthDiv.onmouseout = highlightSelect;
	monthDiv.onclick = showMonthDropDown;
	var span = document.createElement('SPAN');
	span.innerHTML = monthArray[currentMonth];
	span.id = 'calendar_month_txt';
	monthDiv.appendChild(span);

	var img = document.createElement('IMG');
	img.src = pathToImages + 'down.gif';
	img.style.position = 'absolute';
	img.style.right = '0px';
	monthDiv.appendChild(img);
	monthDiv.className = 'selectBox';
	if(Opera){
		img.style.cssText = 'float:right;position:relative';
		img.style.position = 'relative';
		img.style.styleFloat = 'right';
	}
	topBar.appendChild(monthDiv);

	var monthPicker = createMonthDiv();
	monthPicker.style.left = '37px';
	monthPicker.style.top = monthDiv.offsetTop + monthDiv.offsetHeight + 1 + 'px';
	monthPicker.style.width ='60px';
	monthPicker.id = 'monthDropDown';

	calendarDiv.appendChild(monthPicker);

	// Year selector
	var yearDiv = document.createElement('DIV');
	yearDiv.onmouseover = highlightSelect;
	yearDiv.onmouseout = highlightSelect;
	yearDiv.onclick = showYearDropDown;
	var span = document.createElement('SPAN');
	span.innerHTML = currentYear;
	span.id = 'calendar_year_txt';
	yearDiv.appendChild(span);
	topBar.appendChild(yearDiv);

	var img = document.createElement('IMG');
	img.src = pathToImages + 'down.gif';
	yearDiv.appendChild(img);
	yearDiv.className = 'selectBox';

	if(Opera){
		yearDiv.style.width = '50px';
		img.style.cssText = 'float:right';
		img.style.position = 'relative';
		img.style.styleFloat = 'right';
	}

	var yearPicker = createYearDiv();
	yearPicker.style.left = '113px';
	yearPicker.style.top = monthDiv.offsetTop + monthDiv.offsetHeight + 1 + 'px';
	yearPicker.style.width = '35px';
	yearPicker.id = 'yearDropDown';
	calendarDiv.appendChild(yearPicker);


	var img = document.createElement('IMG');
	img.src = pathToImages + 'close.gif';
	img.style.styleFloat = 'right';
	img.onmouseover = highlightClose;
	img.onmouseout = highlightClose;
	img.onclick = closeCalendar;
	topBar.appendChild(img);
	if(!document.all){
		img.style.position = 'absolute';
		img.style.right = '2px';
	}



}

function writeCalendarContent()
{
	var calendarContentDivExists = true;
	if(!calendarContentDiv){
		calendarContentDiv = document.createElement('DIV');
		calendarDiv.appendChild(calendarContentDiv);
		calendarContentDivExists = false;
	}
	currentMonth = currentMonth/1;
	var d = new Date();

	d.setFullYear(currentYear);
	d.setDate(1);
	d.setMonth(currentMonth);

	var dayStartOfMonth = d.getDay();
	if (! weekStartsOnSunday) {
      if(dayStartOfMonth==0)dayStartOfMonth=7;
      dayStartOfMonth--;
   }

	document.getElementById('calendar_year_txt').innerHTML = currentYear;
	document.getElementById('calendar_month_txt').innerHTML = monthArray[currentMonth];
	document.getElementById('calendar_hour_txt').innerHTML = currentHour;
	document.getElementById('calendar_minute_txt').innerHTML = currentMinute;

	var existingTable = calendarContentDiv.getElementsByTagName('TABLE');
	if(existingTable.length>0){
		calendarContentDiv.removeChild(existingTable[0]);
	}

	var calTable = document.createElement('TABLE');
	calTable.width = '100%';
	calTable.cellSpacing = '0';
	calendarContentDiv.appendChild(calTable);




	var calTBody = document.createElement('TBODY');
	calTable.appendChild(calTBody);
	var row = calTBody.insertRow(-1);
	row.className = 'calendar_week_row';
   if (showWeekNumber) {
      var cell = row.insertCell(-1);
	   cell.innerHTML = weekString;
	   cell.className = 'calendar_week_column';
	   cell.style.backgroundColor = selectBoxRolloverBgColor;
	}

	for(var no=0;no<dayArray.length;no++){
		var cell = row.insertCell(-1);
		cell.innerHTML = dayArray[no];
	}

	var row = calTBody.insertRow(-1);

   if (showWeekNumber) {
	   var cell = row.insertCell(-1);
	   cell.className = 'calendar_week_column';
	   cell.style.backgroundColor = selectBoxRolloverBgColor;
	   var week = getWeek(currentYear,currentMonth,1);
	   cell.innerHTML = week;		// Week
	}
	for(var no=0;no<dayStartOfMonth;no++){
		var cell = row.insertCell(-1);
		cell.innerHTML = '&nbsp;';
	}

	var colCounter = dayStartOfMonth;
	var daysInMonth = daysInMonthArray[currentMonth];
	if(daysInMonth==28){
		if(isLeapYear(currentYear))daysInMonth=29;
	}

	for(var no=1;no<=daysInMonth;no++){
		d.setDate(no-1);
		if(colCounter>0 && colCounter%7==0){
			var row = calTBody.insertRow(-1);
         if (showWeekNumber) {
            var cell = row.insertCell(-1);
            cell.className = 'calendar_week_column';
            var week = getWeek(currentYear,currentMonth,no);
            cell.innerHTML = week;		// Week
            cell.style.backgroundColor = selectBoxRolloverBgColor;
         }
		}
		var cell = row.insertCell(-1);
		if(currentYear==inputYear && currentMonth == inputMonth && no==inputDay){
			cell.className='activeDay';
		}
		cell.innerHTML = no;
		cell.onclick = pickDate;
		colCounter++;
	}


	if(!document.all){
		if(calendarContentDiv.offsetHeight)
			document.getElementById('topBar').style.top = calendarContentDiv.offsetHeight + document.getElementById('timeBar').offsetHeight + document.getElementById('topBar').offsetHeight -1 + 'px';
		else{
			document.getElementById('topBar').style.top = '';
			document.getElementById('topBar').style.bottom = '0px';
		}

	}

	if(iframeObj){
		if(!calendarContentDivExists)setTimeout('resizeIframe()',350);else setTimeout('resizeIframe()',10);
	}




}

function resizeIframe()
{
	iframeObj.style.width = calendarDiv.offsetWidth + 'px';
	iframeObj.style.height = calendarDiv.offsetHeight + 'px' ;


}

function pickTodaysDate()
{
	var d = new Date();
	currentMonth = d.getMonth();
	currentYear = d.getFullYear();
	pickDate(false,d.getDate());

}

function pickDate(e,inputDay)
{
	var month = currentMonth/1 +1;
	if(month<10)month = '0' + month;
	var day;
	if(!inputDay && this)day = this.innerHTML; else day = inputDay;

	if(day/1<10)day = '0' + day;
	if(returnFormat){
		returnFormat = returnFormat.replace('dd',day);
		returnFormat = returnFormat.replace('mm',month);
		returnFormat = returnFormat.replace('yyyy',currentYear);
		returnFormat = returnFormat.replace('hh',currentHour);
		returnFormat = returnFormat.replace('ii',currentMinute);
		returnFormat = returnFormat.replace('d',day/1);
		returnFormat = returnFormat.replace('m',month/1);

		returnDateTo.value = returnFormat;
		try{
			returnDateTo.onchange();
		}catch(e){

		}
	}else{
		for(var no=0;no<returnDateToYear.options.length;no++){
			if(returnDateToYear.options[no].value==currentYear){
				returnDateToYear.selectedIndex=no;
				break;
			}
		}
		for(var no=0;no<returnDateToMonth.options.length;no++){
			if(returnDateToMonth.options[no].value==parseInt(month)){
				returnDateToMonth.selectedIndex=no;
				break;
			}
		}
		for(var no=0;no<returnDateToDay.options.length;no++){
			if(returnDateToDay.options[no].value==parseInt(day)){
				returnDateToDay.selectedIndex=no;
				break;
			}
		}
		if(calendarDisplayTime){
			for(var no=0;no<returnDateToHour.options.length;no++){
				if(returnDateToHour.options[no].value==parseInt(currentHour)){
					returnDateToHour.selectedIndex=no;
					break;
				}
			}
			for(var no=0;no<returnDateToMinute.options.length;no++){
				if(returnDateToMinute.options[no].value==parseInt(currentMinute)){
					returnDateToMinute.selectedIndex=no;
					break;
				}
			}
		}
	}
	closeCalendar();

}

// This function is from http://www.codeproject.com/csharp/gregorianwknum.asp
// Only changed the month add
function getWeek(year,month,day){
   if (! weekStartsOnSunday) {
	   day = (day/1);
	} else {
	   day = (day/1)+1;
	}
	year = year /1;
    month = month/1 + 1; //use 1-12
    var a = Math.floor((14-(month))/12);
    var y = year+4800-a;
    var m = (month)+(12*a)-3;
    var jd = day + Math.floor(((153*m)+2)/5) +
                 (365*y) + Math.floor(y/4) - Math.floor(y/100) +
                 Math.floor(y/400) - 32045;      // (gregorian calendar)
    var d4 = (jd+31741-(jd%7))%146097%36524%1461;
    var L = Math.floor(d4/1460);
    var d1 = ((d4-L)%365)+L;
    NumberOfWeek = Math.floor(d1/7) + 1;
    return NumberOfWeek;
}

function writeTimeBar()
{
	var timeBar = document.createElement('DIV');
	timeBar.id = 'timeBar';
	timeBar.className = 'timeBar';

	var subDiv = document.createElement('DIV');
	subDiv.innerHTML = 'Time:';
	//timeBar.appendChild(subDiv);

	// Year selector
	var hourDiv = document.createElement('DIV');
	hourDiv.onmouseover = highlightSelect;
	hourDiv.onmouseout = highlightSelect;
	hourDiv.onclick = showHourDropDown;
	hourDiv.style.width = '30px';
	var span = document.createElement('SPAN');
	span.innerHTML = currentHour;
	span.id = 'calendar_hour_txt';
	hourDiv.appendChild(span);
	timeBar.appendChild(hourDiv);

	var img = document.createElement('IMG');
	img.src = pathToImages + 'down_time.gif';
	hourDiv.appendChild(img);
	hourDiv.className = 'selectBoxTime';

	if(Opera){
		hourDiv.style.width = '30px';
		img.style.cssText = 'float:right';
		img.style.position = 'relative';
		img.style.styleFloat = 'right';
	}

	var hourPicker = createHourDiv();
	hourPicker.style.left = '130px';
	//hourPicker.style.top = monthDiv.offsetTop + monthDiv.offsetHeight + 1 + 'px';
	hourPicker.style.width = '35px';
	hourPicker.id = 'hourDropDown';
	calendarDiv.appendChild(hourPicker);

	// Add Minute picker

	// Year selector
	var minuteDiv = document.createElement('DIV');
	minuteDiv.onmouseover = highlightSelect;
	minuteDiv.onmouseout = highlightSelect;
	minuteDiv.onclick = showMinuteDropDown;
	minuteDiv.style.width = '30px';
	var span = document.createElement('SPAN');
	span.innerHTML = currentMinute;

	span.id = 'calendar_minute_txt';
	minuteDiv.appendChild(span);
	timeBar.appendChild(minuteDiv);

	var img = document.createElement('IMG');
	img.src = pathToImages + 'down_time.gif';
	minuteDiv.appendChild(img);
	minuteDiv.className = 'selectBoxTime';

	if(Opera){
		minuteDiv.style.width = '30px';
		img.style.cssText = 'float:right';
		img.style.position = 'relative';
		img.style.styleFloat = 'right';
	}

	var minutePicker = createMinuteDiv();
	minutePicker.style.left = '167px';
	//minutePicker.style.top = monthDiv.offsetTop + monthDiv.offsetHeight + 1 + 'px';
	minutePicker.style.width = '35px';
	minutePicker.id = 'minuteDropDown';
	calendarDiv.appendChild(minutePicker);


	return timeBar;

}

function writeBottomBar()
{
	var d = new Date();
	var bottomBar = document.createElement('DIV');

	bottomBar.id = 'bottomBar';

	bottomBar.style.cursor = 'pointer';
	bottomBar.className = 'todaysDate';
	// var todayStringFormat = '[todayString] [dayString] [day] [monthString] [year]';	;;

	var subDiv = document.createElement('DIV');
	subDiv.onclick = pickTodaysDate;
	subDiv.id = 'todaysDateString';
	subDiv.style.width = (calendarDiv.offsetWidth - 95) + 'px';
	var day = d.getDay();
	if (! weekStartsOnSunday) {
      if(day==0)day = 7;
      day--;
   }

	var bottomString = todayStringFormat;
	bottomString = bottomString.replace('[monthString]',monthArrayShort[d.getMonth()]);
	bottomString = bottomString.replace('[day]',d.getDate());
	bottomString = bottomString.replace('[year]',d.getFullYear());
	bottomString = bottomString.replace('[dayString]',dayArray[day].toLowerCase());
	bottomString = bottomString.replace('[UCFdayString]',dayArray[day]);
	bottomString = bottomString.replace('[todayString]',todayString);


	subDiv.innerHTML = todayString + ': ' + d.getDate() + '. ' + monthArrayShort[d.getMonth()] + ', ' +  d.getFullYear() ;
	subDiv.innerHTML = bottomString ;
	bottomBar.appendChild(subDiv);

	var timeDiv = writeTimeBar();
	bottomBar.appendChild(timeDiv);

	calendarDiv.appendChild(bottomBar);



}
function getTopPos(inputObj)
{

  var returnValue = inputObj.offsetTop + inputObj.offsetHeight;
  while((inputObj = inputObj.offsetParent) != null)returnValue += inputObj.offsetTop;
  return returnValue + calendar_offsetTop;
}

function getleftPos(inputObj)
{
  var returnValue = inputObj.offsetLeft;
  while((inputObj = inputObj.offsetParent) != null)returnValue += inputObj.offsetLeft;
  return returnValue + calendar_offsetLeft;
}

function positionCalendar(inputObj)
{
	calendarDiv.style.left = getleftPos(inputObj) + 'px';
	calendarDiv.style.top = getTopPos(inputObj) + 'px';
	if(iframeObj){
		iframeObj.style.left = calendarDiv.style.left;
		iframeObj.style.top =  calendarDiv.style.top;
		//// fix for EI frame problem on time dropdowns 09/30/2006
		iframeObj2.style.left = calendarDiv.style.left;
		iframeObj2.style.top =  calendarDiv.style.top;
	}

}

function initCalendar()
{
	if(MSIE){
		iframeObj = document.createElement('IFRAME');
		iframeObj.style.filter = 'alpha(opacity=0)';
		iframeObj.style.position = 'absolute';
		iframeObj.border='0px';
		iframeObj.style.border = '0px';
		iframeObj.style.backgroundColor = '#FF0000';
		//// fix for EI frame problem on time dropdowns 09/30/2006
		iframeObj2 = document.createElement('IFRAME');
		iframeObj2.style.position = 'absolute';
		iframeObj2.border='0px';
		iframeObj2.style.border = '0px';
		iframeObj2.style.height = '1px';
		iframeObj2.style.width = '1px';
		//// fix for EI frame problem on time dropdowns 09/30/2006
		// Added fixed for HTTPS
		iframeObj2.src = 'blank.html';
		iframeObj.src = 'blank.html';
		document.body.appendChild(iframeObj2);  // gfb move this down AFTER the .src is set
		document.body.appendChild(iframeObj);
	}

	calendarDiv = document.createElement('DIV');
	calendarDiv.id = 'calendarDiv';
	calendarDiv.style.zIndex = 1000;
	slideCalendarSelectBox();

	document.body.appendChild(calendarDiv);
	writeBottomBar();
	writeTopBar();



	if(!currentYear){
		var d = new Date();
		currentMonth = d.getMonth();
		currentYear = d.getFullYear();
	}
	writeCalendarContent();



}

function setTimeProperties()
{
	if(!calendarDisplayTime){
		document.getElementById('timeBar').style.display='none';
		document.getElementById('timeBar').style.visibility='hidden';
		document.getElementById('todaysDateString').style.width = '100%';


	}else{
		document.getElementById('timeBar').style.display='block';
		document.getElementById('timeBar').style.visibility='visible';
		document.getElementById('hourDropDown').style.top = document.getElementById('calendar_minute_txt').parentNode.offsetHeight + calendarContentDiv.offsetHeight + document.getElementById('topBar').offsetHeight + 'px';
		document.getElementById('minuteDropDown').style.top = document.getElementById('calendar_minute_txt').parentNode.offsetHeight + calendarContentDiv.offsetHeight + document.getElementById('topBar').offsetHeight + 'px';
		document.getElementById('minuteDropDown').style.right = '50px';
		document.getElementById('hourDropDown').style.right = '50px';
		document.getElementById('todaysDateString').style.width = '115px';
	}
}

function calendarSortItems(a,b)
{
	return a/1 - b/1;
}


function displayCalendar(inputField,format,buttonObj,displayTime,timeInput)
{
	if(displayTime)calendarDisplayTime=true; else calendarDisplayTime = false;

	if(inputField.value.length>6){ //dates must have at least 6 digits...
       if(!inputField.value.match(/^[0-9]*?$/gi)){

			var items = inputField.value.split(/[^0-9]/gi);
			var positionArray = new Object();
			positionArray.m = format.indexOf('mm');
			if(positionArray.m==-1)positionArray.m = format.indexOf('m');
			positionArray.d = format.indexOf('dd');
			if(positionArray.d==-1)positionArray.d = format.indexOf('d');
			positionArray.y = format.indexOf('yyyy');
			positionArray.h = format.indexOf('hh');
			positionArray.i = format.indexOf('ii');


			this.initialHour = '00';
			this.initialMinute = '00';
			var elements = ['y','m','d','h','i'];
			var properties = ['currentYear','currentMonth','inputDay','currentHour','currentMinute'];
			var propertyLength = [4,2,2,2,2];
			for(var i=0;i<elements.length;i++) {
				if(positionArray[elements[i]]>=0) {
					window[properties[i]] = inputField.value.substr(positionArray[elements[i]],propertyLength[i])/1;
				}
			}

			currentMonth--;
		}else{
			var monthPos = format.indexOf('mm');
			currentMonth = inputField.value.substr(monthPos,2)/1 -1;
			var yearPos = format.indexOf('yyyy');
			currentYear = inputField.value.substr(yearPos,4);
			var dayPos = format.indexOf('dd');
			tmpDay = inputField.value.substr(dayPos,2);

			var hourPos = format.indexOf('hh');
			if(hourPos>=0){
				tmpHour = inputField.value.substr(hourPos,2);
				currentHour = tmpHour;
			}else{
				currentHour = '00';
			}
			var minutePos = format.indexOf('ii');
			if(minutePos>=0){
				tmpMinute = inputField.value.substr(minutePos,2);
				currentMinute = tmpMinute;
			}else{
				currentMinute = '00';
			}
		}
	}else{
		var d = new Date();
		currentMonth = d.getMonth();
		currentYear = d.getFullYear();
		currentHour = '08';
		currentMinute = '00';
		inputDay = d.getDate()/1;
	}

	inputYear = currentYear;
	inputMonth = currentMonth;


	if(!calendarDiv){
		initCalendar();
	}else{
		if(calendarDiv.style.display=='block'){
			closeCalendar();
			return false;
		}
		writeCalendarContent();
	}



	returnFormat = format;
	returnDateTo = inputField;
	positionCalendar(buttonObj);
	calendarDiv.style.visibility = 'visible';
	calendarDiv.style.display = 'block';
	if(iframeObj){
		iframeObj.style.display = '';
		iframeObj.style.height = '140px';
		iframeObj.style.width = '195px';
				iframeObj2.style.display = '';
		iframeObj2.style.height = '140px';
		iframeObj2.style.width = '195px';
	}

	setTimeProperties();
	updateYearDiv();
	updateMonthDiv();
	updateMinuteDiv();
	updateHourDiv();

}

function displayCalendarSelectBox(yearInput,monthInput,dayInput,hourInput,minuteInput,buttonObj)
{
	if(!hourInput)calendarDisplayTime=false; else calendarDisplayTime = true;

	currentMonth = monthInput.options[monthInput.selectedIndex].value/1-1;
	currentYear = yearInput.options[yearInput.selectedIndex].value;
	if(hourInput){
		currentHour = hourInput.options[hourInput.selectedIndex].value;
		inputHour = currentHour/1;
	}
	if(minuteInput){
		currentMinute = minuteInput.options[minuteInput.selectedIndex].value;
		inputMinute = currentMinute/1;
	}

	inputYear = yearInput.options[yearInput.selectedIndex].value;
	inputMonth = monthInput.options[monthInput.selectedIndex].value/1 - 1;
	inputDay = dayInput.options[dayInput.selectedIndex].value/1;

	if(!calendarDiv){
		initCalendar();
	}else{
		writeCalendarContent();
	}



	returnDateToYear = yearInput;
	returnDateToMonth = monthInput;
	returnDateToDay = dayInput;
	returnDateToHour = hourInput;
	returnDateToMinute = minuteInput;




	returnFormat = false;
	returnDateTo = false;
	positionCalendar(buttonObj);
	calendarDiv.style.visibility = 'visible';
	calendarDiv.style.display = 'block';
	if(iframeObj){
		iframeObj.style.display = '';
		iframeObj.style.height = calendarDiv.offsetHeight + 'px';
		iframeObj.style.width = calendarDiv.offsetWidth + 'px';
		//// fix for EI frame problem on time dropdowns 09/30/2006
		iframeObj2.style.display = '';
		iframeObj2.style.height = calendarDiv.offsetHeight + 'px';
		iframeObj2.style.width = calendarDiv.offsetWidth + 'px'
	}
	setTimeProperties();
	updateYearDiv();
	updateMonthDiv();
	updateHourDiv();
	updateMinuteDiv();

}

