function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}



// INPUT Felder

function focus_(obj_) {
	obj_ = this;
	obj_.style.color = "#595A5A";
	obj_.style.backgroundColor ="#FFFFE5";
	obj_.focus();
	obj_.select();
	if(obj_.value == obj_.title) {
		obj_.value ="";
	}
}

function blur_(obj_) {
	obj_ = this;
	//alert(obj_.id)
	obj_.style.backgroundColor ="#FFFFFF";
	if(obj_.value.length == 0 || obj_.value == obj_.title) {
		obj_.value = obj_.title;
		if(obj_.id == "qs_inp") {
			obj_.style.color = "#969696";
		} else
			obj_.style.color = "#595A5A";
	}
}

/*function over_(obj_) {
	obj_ = this;
	obj_.style.backgroundColor ="#FFFFE5";
}

function out_(obj_) {
	obj_ = this;
	obj_.style.backgroundColor ="";
}*/

function getInpToFocus() {
	//if (!document.getElementById) return
	inp = document.getElementsByTagName("input");
	are = document.getElementsByTagName("textarea");
	for(i=0; i<inp.length; i++) {
		inp[i].onfocus = focus_;
		inp[i].onblur = blur_;
		//inp[i].onmouseover = over_;
		//inp[i].onmouseout = out_;
	}
	for(i=0; i<are.length; i++) {
		are[i].onfocus = focus_;
		are[i].onblur = blur_;
		//are[i].onmouseover = over_;
		//are[i].onmouseout = out_;
	}
}

function checkSearchVal(str) {
 if(isNaN(str) != true && str != "") {
  var goID = 'index.php?id='+ str;
  window.location.href = goID;
  return false;
 }
 if(str == document.qs_form.elements[0].title | str == "") {
  alert('Bitte geben Sie einen Suchbegriff oder eine Seiten-ID ein!');
  document.qs_form.elements[0].focus();
  document.qs_form.elements[0].select();
  return false;
 }
 else return true;
}