function isEmailValid(who) {
	var email=/^[A-Za-z0-9]+([_\.-][A-Za-z0-9]+)*@[A-Za-z0-9]+([_\.-][A-Za-z0-9]+)*\.([A-Za-z]){2,4}$/i;
	return(email.test(who));
}

function getPageSize(){
	var xScroll, yScroll;
	if (window.innerHeight && window.scrollMaxY) {
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) { // all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else {
		pageHeight = yScroll;
	}
	
	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}
	
	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
	return arrayPageSize;
}

function getPageScroll(){
	var yScroll;
	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){ // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
	}
	arrayPageScroll = new Array('',yScroll)
	return arrayPageScroll;
}

var as_url='';
var as_title='';
var as_uberschreiben=false;
function onload_cookiePage(title,url){
	if(!as_uberschreiben){
		if(!($.cookie('seitemerken_id')>0) || ($.cookie('seitemerken_id')=='null') || ($.cookie('seitemerken_id')==null) || ($.cookie('seitemerken_id')=='undefined')){
			$.cookie('seitemerken_id', '0', { path: '/', expires: 10 });
		}
		if(!($.cookie('seitemerken_count')>0) || ($.cookie('seitemerken_count')=='null') || ($.cookie('seitemerken_count')==null) || ($.cookie('seitemerken_count')=='undefined')){
			$.cookie('seitemerken_count', '0', { path: '/', expires: 10 });
		}
		$.cookie('as_titel', title, { path: '/', expires: 10 });
		$.cookie('as_url', url, { path: '/', expires: 10 });
		as_url=url;
		as_title=title;
	}
}
function onload_cookiePageUberschreiben(title,url){
	onload_cookiePage(title,url);
	as_uberschreiben=true;
}



function ajax_initObject_SeiteMerken()	{
	var A;
	try	{
		A=new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e)	{
		try	{
			A=new ActiveXObject("Microsoft.XMLHTTP");
		} catch (oc)	{
			A=null;
		}
	}
	if(!A && typeof XMLHttpRequest != "undefined")	{
		A = new XMLHttpRequest();
	}
	return A;
}

function ajax_doRequest_seiteMerken(url)	{
	var x;

	x = ajax_initObject_SeiteMerken();
	if(!x)	{
		return true;
	}
	x.open("GET", url, true);

	x.onreadystatechange = function()	{
		if (x.readyState != 4)	{
			return;
		}
		seiteMerkenJavascript(x.responseText);
	}
	x.send("");

	delete x;
}

function seiteMerkenJavascript(t3ajax){
	getGemerkteSeiten();
	if(t3ajax=='schon_gemerkt'){ alert(jsextra_seitegemerkt); return;}
	if(t3ajax=='fehler'){ alert(jsextra_fehlerbeimerken); return;}
	// die animation
	showAddSticky();
}

function seiteMerken(){
	var today = new Date();
	ajax_doRequest_seiteMerken('http://'+jsextra_host+'/index.php?eID=seitemerken&time='+today.getTime()+'&u='+as_url+'&t='+as_title);

	return false;
}

function getCookie(cookiestring){
	return $.cookie(cookiestring);
}

function setCookie( name, value, expires2, path2, domain2, secure2 ) {
	$.cookie(name, value, { path: '/', expires: 10 });
}

function deleteCookie( name, path2, domain2 ) {
	$.cookie(name, null, { path: '/' });
}