function on_load (firma) {
	versenden(firma);
	activate('aktiv');
	}
	
function mailto(Name,E1,Domain)  {
Email=(E1 + '@' + Domain)	;
document.write('<A href="mailto:' + Email + '" title="Mailto: ' + Name + '">' + Email + '</a>' );
}

function checkform() {
  var email = document.subscribeform.email.value;
  if(!isValidEmail(email)) {
			alert("Bitte geben Sie eine gültige E-Mail Adresse an");
			return false;
	 }
  for (i=0;i<fieldstocheck.length;i++) {
	  
	
    if (eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].value") == "") {
      alert("Bitte geben Sie ein "+fieldnames[i]);
      eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].focus()");
      return false;
    }
  }

  return true;
}

function isValidEmail(str) {
   return ((str.indexOf(".") > 2) && (str.indexOf("@") > 0));
}


function boxcolfocus(id){
	if (document.getElementById(id).defaultValue==document.getElementById(id).value) {
		document.getElementById(id).value = '';
		document.getElementById(id).setAttribute("class", "input_text_on");
	} 
}

function lin() { 
	
	if (document.userlink.vorname.value !=  document.userlink.vorname.defaultValue && document.userlink.nachname.value != document.userlink.nachname.defaultValue) {
			var location = document.userlink.vorname.value+'_'+document.userlink.nachname.value;
			document.userlink.action = location;
			document.userlink.submit(); //this.location.href=location;
		}
		
}

var fieldstocheck = new Array();
var fieldnames = new Array();
function addFieldToCheck(value,name) {
  fieldstocheck[fieldstocheck.length] = value;
  fieldnames[fieldnames.length] = name;
}

function compareEmail()
{
  return (document.subscribeform.elements["email"].value == document.subscribeform.elements["emailconfirm"].value);
}




function PadDigits(n, totalDigits) { 
        n = n.toString(); 
        var pd = ''; 
        if (totalDigits > n.length) 
        { 
            for (i=0; i < (totalDigits-n.length); i++) 
            { 
                pd += '0'; 
            } 
        } 
        return pd + n.toString(); 
} 

function versenden(subject) {
var url=new String(window.location);
subject = escape(subject);
var vershref="mailto:?subject="+subject+"&body="+url;
document.getElementById('versenden').href = vershref;
}

function Copy(Firma)  {
today = new Date()
CurrentYear = today.getYear();
if(CurrentYear < 2000) { CurrentYear = CurrentYear + 1900; }
document.write("&copy " + CurrentYear + " " + Firma);
}

function Updated(PreText)  {
	if(document.lastModified.length > 0) { 
	da = new Date(document.lastModified) 	// Create a Date Object set to the last modifed date
	dy = da.getFullYear() 	// Get full year (as opposed to last two digits only)
	dm = da.getMonth() + 1 	// Get month and correct it (getMonth() returns 0 to 11)
	dd = da.getDate() 	// Get date within month
	if ( dy < 1970 ) dy = dy + 100; 	// We still have to fix the millennium bug
	ys = new String(dy) 	// Convert year, month and date to strings
	ms = new String(dm) 	 
	ds = new String(dd) 	 
	if ( ms.length == 1 ) ms = "0" + ms; 	// Add leading zeros to month and date if required
	if ( ds.length == 1 ) ds = "0" + ds; 	 
	ys = ds + "." + ms + "." + ys 	// Combine year, month and date in ISO format
	document.write(PreText + ys); // Display the result
	}
}

function prt_Date(Beschreibung)  {
today = new Date()
CurrentYear = today.getYear();
if(CurrentYear < 2000) { CurrentYear = CurrentYear + 1900; }
document.write(Beschreibung + " " + PadDigits(today.getDate(), 2) + "." + PadDigits((today.getMonth()+1), 2) + "." + CurrentYear);
}
function menu_goto( menuform )
{
    //var baseurl = "http://www.put-your-domain-name-here.com" ;
    selecteditem = menuform.newurl.selectedIndex ;
    newurl = menuform.newurl.options[ selecteditem ].value ;
    if (newurl.length != 0) {
      //location.href = baseurl + newurl ;
    }
}
function checkFormular(form) // Funktioniert nicht!!
{
valid = true;

var required= form.required.value ;
required = required.replace(" ","");
Arequired = required.split(",");

var compare= form.compare.value ;
compare = compare.replace(" ","");
compare = compare.split(",");

var warning_on_ID= form.warning_on_ID.value ;
warning_on_ID = warning_on_ID.replace(" ","");
warning_on_ID = warning_on_ID.split(",");

var warning_off_ID= form.warning_off_ID.value ;
warning_off_ID = warning_off_ID.replace(" ","");
warning_off_ID = warning_off_ID.split(",");

for(var i=0; i < required.length; i++)
	{
		
	var x = getElementsByTagName(required[i]);
	alert(x.value);
	if ( x.value == "" ) //&& document.getElementById(required[i])
    	{
			
		document.getElementById(required[i]).style.color = 'red';
		valid = false;
    	}
	else document.getElementById(required[i]).style.color = '';
	}

/*for(var i=0; i < form.compare.length; i++)
	{
	if ( form.compare[i].value != form.compare[i+1].value && document.getElementById(compare[i+1]))
    	{
		document.getElementById(compare[i+1]).style.color = 'red';
		valid = false;
    	}
	else document.getElementById(compare[i+1]).style.color = '';
	}
 */
 
 // also add thing to check that has email 'at'
 
 
 if ( valid == false )
	{
	 	document.getElementById('pflicht_1').style.display = 'none';
		document.getElementById('pflicht_2').style.color = 'red';
		document.getElementById('pflicht_2').style.display = 'block';
		document.getElementById('ueberprufen').style.color = 'red';
		document.getElementById('ueberprufen').style.display = 'block';
	}
 if (valid == true) {
	 	//form.submit();
    }
}
function searchsubmit() {
	var searchtext = document.getElementById('suchtext').value;
	searchtext2 =  searchtext + " site:.aktinova.ch";
	document.search.q.value = searchtext2;
	//document.q.value = searchtext2;
	//document.getElementById('suchtext').value = searchtext2;
	//document.getElementById('suchtext').value = searchtext;
	return true;
}


// Font size change script - start
var min=8;
var max=18;
function increaseFontSize() {
   var p = document.getElementsByTagName('div');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = 12;
      }
	  s += 2;
      if(s!=max) {
         p[i].style.fontSize = s+"px"
      }
      
   }
}
function decreaseFontSize() {
   var p = document.getElementsByTagName('div');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = 12;
      }
	  s -= 2;
      if(s!=min) {
         p[i].style.fontSize = s+"px"
      }
      
   }   
}

function FontSize(size) {
	//alert(size);
    var p = document.getElementById('content_frame');
	//alert(p.style.fontSize);
    p.style.fontSize = size+"px"
	
}
// Font size change script - end




// Include Ajax Code - start

function include(url, id) {
	url = url + '?nocache=' + Date(); // to prevent IE from caching AJAX requests
	var http = false;
if(navigator.appName == "Microsoft Internet Explorer") {
	http = new ActiveXObject("Microsoft.XMLHTTP");
} else {
  	http = new XMLHttpRequest();
}
 	 http.abort();
 	 http.open("GET", url, true);
  	 http.onreadystatechange=function() {
  	  if(http.readyState == 4 && http.responseText != '' ) {
			document.getElementById(id).innerHTML  = http.responseText;
  	  }
 	 }
  	http.send(null);
}
// Include Ajax Code - end

// Menu activation code
function file_only(url) {
		var end = (url.indexOf("?") == -1) ? url.length : url.indexOf("?");
    	return url.substring(url.lastIndexOf("/")+1, end);
	}
function activate(classname) {
	// Establish language of page
	var metas = document.getElementsByTagName("meta");
	for (i=0; i < metas.length; i++)
	{
		if(metas.item(i).content == 'de' || metas.item(i).content == 'DE') var lang = 'de';
		if(metas.item(i).content == 'en' || metas.item(i).content == 'EN') var lang = 'en';
		if(metas.item(i).content == 'es' || metas.item(i).content == 'ES') var lang = 'es';
		if(metas.item(i).content == 'fr' || metas.item(i).content == 'FR') var lang = 'fr';
		if(metas.item(i).content == 'it' || metas.item(i).content == 'IT') var lang = 'it';
		if(metas.item(i).content == 'cs' || metas.item(i).content == 'CS') var lang = 'cs';
	}
		
	
	// Cycle through links
	for (i=0; i < document.links.length; i++)
	{
		if (document.links[i].href == document.location.href) { // If link matches document href
			if (document.links[i].parentNode.nodeName == 'LI' ||
 document.links[i].parentNode.nodeName == 'li') document.links[i].parentNode.className=classname;
			}
		if (document.links[i].name == lang) document.links[i].parentNode.className=classname;
	}
}

