actSubmenue = false;
actSubSubmenue = false;
actBox = false;
actDater = false;


function toggleGalImg(el,posx,posy,maxleft,maxright)
{
var xymain = findPos(MM_findObj('pagecenter'));
var xy = findPos(el);
var b = false;

for(i=0;i<el.childNodes.length;i++)
{if(el.childNodes[i].id == 'galerieimgbig'){b = el.childNodes[i];}}

	if(b)
	{
		if(b.style.display != 'block')
		{
		b.style.position = 'absolute';
		b.style.display = 'block';
		b.style.visibility = 'visible';
		b.style.zIndex = 900;
		b.style.left = (xy.xPos-xymain.xPos+posx)+'px';
			if((xy.xPos-xymain.xPos+posx) < maxleft){b.style.left = maxleft+'px';}
			if((xy.xPos-xymain.xPos+posx) > maxright){b.style.left = maxright+'px';}
		b.style.top = (xy.yPos-xymain.yPos+posy)+'px';
			if((xy.yPos-xymain.yPos+posy) < 20){b.style.top = '20px';}
		}
		else
		{
		//b.style.position = 'relative';
		b.style.display = 'none';
		b.style.visibility = 'hidden';
		b.style.zIndex = 0;
		}
	}
}


function MenuOpen(subnavi)
{
//alert(actSubmenue+'/'+subnavi)
if(actSubmenue && actSubmenue != subnavi){MenuClose(actSubmenue);}
actSubmenue = subnavi;
	
var subn = MM_findObj(subnavi);
if(subn){subn.style.display = 'block';}
}

function MenuClose(subnavi)
{
actSubmenue = false;
var subn = MM_findObj(subnavi);
if(subn){subn.style.display = 'none';}

//if(actSubSubmenue){MenuClose(actSubSubmenue);}
//actSubSubmenue = false;
}

function SubMenuOpen(subnavi)
{
if(actSubSubmenue && actSubSubmenue != subnavi){MenuClose(actSubSubmenue);}
actSubSubmenue = subnavi;

//var tp = subnavi.substr(subnavi.length-1);
var subn = MM_findObj(subnavi);
	if(subn)
	{
	subn.style.display = 'block';
	//subn.style.marginTop = ((tp-1)*26 +1)+'px';
	}
}

function SubMenuClose(subnavi)
{
actSubSubmenue = false;

var subn = MM_findObj(subnavi);
if(subn){subn.style.display = 'none';}
}

function showBox(divname,divnum,show)
{
//var ct = 1;while(dv = MM_findObj(divname+ct)){hideBox(divname,ct);ct++;}
if(actBox){hideBoxName(actBox);}
actBox = divname+divnum;

  if (show.indexOf('!') != -1) {
    return false;
  } else if (show.indexOf(':') != -1) {
    return false;
  } else if (show != '') {

	var divn = MM_findObj(divname+divnum);
		if(divn){
		divn.innerHTML = '<div style="display:block;width:100%;padding:0;height:24px;background: url(/_media/headerbasis-grau.jpg) 0px 0px no-repeat;"><div style="padding-top:3px;padding-left:5px;color:#CCCCCC;font-weight:bold;">'+head[divnum]+'</div></div>';
		divn.innerHTML += '<div style="padding:5px;height:16px;"><span class="fett"><a href="javascript:void(0);" onClick="openSelProfil(\'4\',\''+user[show]+'\');">'+user[show]+'</a></span></div>';
		divn.innerHTML += '<div style="padding:5px;height:16px;">PLZ: '+plz[show]+'</div>';
		divn.innerHTML += '<div style="padding:5px;height:16px;">Entfernung: '+Math.floor(dist[show])+' KM</div>';
		divn.innerHTML += '<div style="padding:5px;">'+text[show]+'</div>';
		divn.style.position = 'absolute';
		divn.style.display = 'block';
		}
	}		
}

function hideBox(divname,divnum)
{
actBox = false;

	var divn = MM_findObj(divname+divnum);
	if(divn){
	divn.innerHTML = '';	
	divn.style.position = 'relative';
	divn.style.display = 'none';
	}
}

function hideBoxName(divnamenum)
{
actBox = false;

	var divn = MM_findObj(divnamenum);
	if(divn){
	divn.innerHTML = '';	
	divn.style.position = 'relative';
	divn.style.display = 'none';
	}
}

function openAGB()
{
AGBwin = window.open('if_nutzung.php', 'AGB', 'width=720,height=800,scrollbars=yes');
}
			///////////////////////////////////////////////// Bilder öffnen
			function pageOffset(win) 
			
			{ 
			    if(!win) win = window; 
			    var s = new Object(); 
			
			    if(typeof win.pageXOffset != 'undefined') 
			    { 
			         // Mozilla/Netscape 
			         s.left = win.pageXOffset; 
			         s.top = win.pageYOffset; 
			    } 
			    else 
			    { 
			         var obj = getBody(win); 
			         s.left = obj.scrollLeft; 
			         s.top = obj.scrollTop; 
			    } 
			    return s; 
			} 
			
			function getBody(w) 
			{ 
			    return (w.document.compatMode && w.document.compatMode == "CSS1Compat") ? 
			    w.document.documentElement : w.document.body || null; 
			} 
			
			
			function showPicT(divname,picnum,fixtop,fixleft)
			{
			fixtop = fixtop ? fixtop : false;
			fixleft = fixleft ? fixleft : false;
			setTimeout("showPic(\""+divname+"\",\""+picnum+"\","+fixtop+","+fixleft+")",50);
			}
			
			
			currpicnum = '';
			function showPic(divname,picnum,fixtop,fixleft)
			{
			var tdstart = '<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0"><tr valign="middle"><td align="center">';
			var tdend = '</td></tr></table>';
			var tdstr = tdstart+picnum+tdend;
			
				var divn = MM_findObj(divname);
				if(divn){
					if(currpicnum == '' || currpicnum != picnum)
					{
					currpicnum = picnum;
					st = pageOffset(this);
					divn.innerHTML = tdstr;
					divn.style.position = 'absolute';
						if(fixtop || fixleft)
						{
						if(fixtop){divn.style.top = fixtop+'px';}
						if(fixleft){divn.style.left = fixleft+'px';}	
						}
						else
						{divn.style.marginTop = (st.top-200)+'px';}
					divn.style.display = 'block';
					}
					else
					{hidePicT(divname);}
				}
				
			}
			
			
			
			function hidePicT(divname)
			{
				var divn = MM_findObj(divname);
				if(divn){
					currpicnum = '';
					divn.innerHTML = '';
					divn.style.position = 'absolute';
					divn.style.display = 'none';
				}	
			}
		
/////////////////////////////////////////////

/////////////////////////////////////////
function markAll(frm,prefix)
{
	var ns = 1;
	cb = frm.elements[prefix+ns];
	while(cb = frm.elements[prefix+ns])
	{
	cb.checked = true;
	ns++;
	cb = frm.elements[prefix+ns];
	}
}
////////////////////////////////////// AW-Fenster
function friends(x,y,opt) {
	h = screen.availHeight - (x + 30);
	w = screen.availWidth - (y + 10);
	if (document.layers) {
		newPage = window.open('http://members.augenweide.com'+opt, 'Friends', "height="+x+",location=0,menubar=0,personalbar=0,scrollbars=0,status=0,toolbar=0,width="+y+",resizable=0,screenX="+w+",screenY="+h)
	} else {
		newPage = window.open('http://members.augenweide.com'+opt, 'Friends', "height="+x+",location=0,menubar=0,personalbar=0,scrollbars=0,status=0,toolbar=0,width="+y+",resizable=0,left="+w+",top="+h)
	}
}

function Fenster(URL, name, x, y) {

   FENSTER = window.open('http://members.augenweide.com'+URL,name,"scrollbars=yes,width="+x+",height="+y)

}
/////////////////////////////777777
function togglePos(divname)
{
	var divn = MM_findObj(divname);
	if(divn && divn.style.display == 'none')
	{
	divn.style.position = 'absolute';
	divn.style.display = 'block';
	}
	else if(divn && divn.style.display == 'block')
	{
	divn.style.position = 'relative';
	divn.style.display = 'none';
	}
}

function showPos(divname)
{
	var divn = MM_findObj(divname);
	divn.style.position = 'absolute';
	divn.style.display = 'block';
}

function hidePos(divname)
{
	var divn = MM_findObj(divname);
	divn.style.position = 'relative';
	divn.style.display = 'none';
}

function fsakt(curr)
{
while(fsa = MM_findObj('fsboxfieldaktiv'))
{fsa.id='fsboxfield';}

curr.id = 'fsboxfieldaktiv';
}

function BoxOpen(boxname)
{
//alert(actSubmenue+'/'+subnavi)
//if(actBox && actBox != boxname){BoxClose(actBox);}
//actBox = boxname;
	
var boxn = MM_findObj(boxname);
if(boxn){boxn.style.display = 'block';}
}

function BoxClose(boxname)
{
//actBox = false;
var boxn = MM_findObj(boxname);
if(boxn){boxn.style.display = 'none';}
}

function BoxToggle(boxname,butt,showvalue,hidevalue)
{
var boxn = MM_findObj(boxname);

	if(boxn && boxn.style.display == 'none')
	{
	butt.value=hidevalue;
	BoxOpen(boxname);
	}
	else if(boxn && boxn.style.display == 'block')
	{
	butt.value=showvalue;
	BoxClose(boxname);
	}
}

function findPos(el) {

    var xPos = 0;
    var yPos = 0;

    if(document.layers) 
	{
        xPos = el.x;
        yPos = el.y;
    }
    else {
	        while(el)
			{
	            xPos += el.offsetLeft;
	            yPos += el.offsetTop;
	            el   =  el.offsetParent;
	        }
    }
	//alert(xPos + ',' + yPos)
    return {xPos: xPos, yPos: yPos};
}

function OnlSetPC()
{
var pc = MM_findObj('pagecenter');
var pi = MM_findObj('pageinner') ? MM_findObj('pageinner') : MM_findObj('pageinnerzs');
var dnln = MM_findObj('downline');
var origleft = '50%';
var origmargin = '0px 0px 0px -450px';

		var iw,ih;
		if (self.innerHeight) // all except Explorer
		{
			iw = self.innerWidth;
			ih = self.innerHeight;
			if(dnln.y && dnln.y > ih){ih = dnln.y;}
		}
		else if (document.documentElement && document.documentElement.clientHeight)
			// Explorer 6 Strict Mode
		{
			iw = document.documentElement.clientWidth;
			ih = document.documentElement.clientHeight;
			if(dnln.offsetTop && dnln.offsetTop > ih){ih = dnln.offsetTop;}
		}
		else if (document.body) // other Explorers
		{
			iw = document.body.clientWidth;
			ih = document.body.clientHeight;
			if(dnln.offsetTop && dnln.offsetTop > ih){ih = dnln.offsetTop;}
		}


	if(pc && iw)
	{
	if(iw < 900){pc.style.left = '0px';pc.style.margin = '0';}
	else{pc.style.left = origleft;pc.style.margin = origmargin;}
	}
	
	if(pc && pi && ih)
	{pc.style.height = ih+'px';pi.style.height = (ih+300)+'px';}

}

function Onl()
{

}

//============================
 function Set_Cookie(name,value,expires,path,domain,secure) {
     document.cookie = name+"="+escape(value)+
         ( (expires) ? ";expires="+expires.toGMTString() : "")+
         ( (path) ? ";path="+path : "")+ 
         ( (domain) ? ";domain="+domain : "")+
         ( (secure) ? ";secure" : "");
 }

 function Delete_Cookie(name,path,domain) {
     document.cookie = name + "=" +
         ( (path) ? ";path=" + path : "") +
         ( (domain) ? ";domain=" + domain : "") +
         ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
 }

function setCookie(cdo,cname,cvalue)
{ 
//alert(cdo+"/"+cname+"/"+cvalue)
var today = new Date();
var cexpires = new Date(today.getTime() + (56 * 86400000));
var cpath = "/";
var cdomain = ".augenweide.com";
//var cdomain = "";
var csecure = "";
	if(!cdo)
	{
	//Delete_Cookie(cname,cpath,cdomain);
	document.cookie = cname+"="+";path="+cpath+";domain="+cdomain+";expires=Thu, 01-Jan-1970 00:00:01 GMT;"
	}
	else
	{
	b64arrays();
	var arr = utf8t2d(cvalue);
	var cvalueb64 = b64d2t(arr);
	cexpires.setMonth(cexpires.getMonth()+12);
	document.cookie = cname+"="+escape(cvalueb64)+";path="+cpath+";domain="+cdomain+";expires="+cexpires.toGMTString()+";";
	//Set_Cookie(cname,cvalueb64,cexpires,cpath,cdomain);
 	}
return true;
}

function readCookiesUP()
{ 
 var a = document.cookie;
 var carr = a.split(";");
 cookiehash = new Object();
 b64arrays();
	 for (i=0;i<carr.length;i++)
	 {
	 ccar = carr[i].split("=");
	 ccn = ccar[0];
		 if(ccn.substring(1) == "AW_UP")
		 {
			 cc = ccar[1].substring(0,ccar[1].length-3);
			 cc = ccar[1];
			 cc = unescape(utf8d2t(b64t2d(cc)));
			 ccc = cc.split(":");
			 uname = ccc[0];
			 upss = ccc[1];
			uname_field = MM_findObj('userid');
			if(uname_field){uname_field.value = uname;}
			upss_field = MM_findObj('passwort');
			if(upss_field){upss_field.value = upss;}	
			chckb_field = MM_findObj('savekeksUP');
			if(chckb_field){chckb_field.checked = true;}	
			
		 }
	 } 
}

function readCookiesCLUB()
{ alert('hier');
 var a = document.cookie;
 var carr = a.split(";");
 cookiehash = new Object();
 b64arrays();
	 for (i=0;i<carr.length;i++)
	 {
	 ccar = carr[i].split("=");
	 ccn = ccar[0];
		 if(ccn.substring(1) == "Augenweide_Clubs")
		 {
			 cc = ccar[1].substring(0,ccar[1].length-3);
			 cc = ccar[1];
			 cc = unescape(utf8d2t(b64t2d(cc)));
			 ccc = cc.split(":");
			 uname = ccc[0];
			 upss = ccc[1];
			uname_field = MM_findObj('user');
			if(uname_field){uname_field.value = uname;}
			upss_field = MM_findObj('pwd');
			if(upss_field){upss_field.value = upss;}	
			chckb_field = MM_findObj('savekeksCLUB');
			if(chckb_field){chckb_field.checked = true;}	
		 }
	alert(ccn.substring(1));
	} 
}

function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}

function sendLogin(obj,actn,targ)
{
	var snd = function()
	{
	obj.action = actn;
	obj.target = targ;
	obj.submit();
	}
setTimeout(function(){snd()},1000);
}

//============================
function fenster(winname,wintitel,breite,hoehe) {
	var links=screen.width/2-breite/2;
	var oben=screen.height/2-hoehe/2;
	NewWin = window.open(winname, wintitel, "width="+breite+",height="+hoehe+",top="+oben+",left="+links+",toolbar=0,location=0");
}

function fenster2(winname,wintitel,breite,hoehe) {
	var links=screen.width/2-breite/2;
	var oben=screen.height/2-hoehe/2;
	NewWin = window.open(winname, wintitel, "width="+breite+",height="+hoehe+",top="+oben+",left="+links+",toolbar=0,location=0,scrollbars=yes");
}
//===========================

function openAWMessenger(x,y,opt) {
	h = screen.availHeight - (x + 30);
	w = screen.availWidth - (y + 10);
	if (document.layers) {
		newPage = window.open('http://members.augenweide.com/'+opt, 'Friends', "height="+x+",location=0,menubar=0,personalbar=0,scrollbars=0,status=0,toolbar=0,width="+y+",resizable=0,screenX="+w+",screenY="+h)
	} else {
		newPage = window.open('http://members.augenweide.com/'+opt, 'Friends', "height="+x+",location=0,menubar=0,personalbar=0,scrollbars=0,status=0,toolbar=0,width="+y+",resizable=0,left="+w+",top="+h)
	}
}
//===================================

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; 

  for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) 
  {x.src=x.oSrc;}
}

function MM_preloadImages() { //v3.0
  var d=document; 
  if(d.images)
  { 
  if(!d.MM_p) 
  {d.MM_p=new Array();}
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; 
	for(i=0; i<a.length; i++)
	{
    if (a[i].indexOf("#")!=0)
	{
	d.MM_p[j]=new Image; 
	d.MM_p[j++].src=a[i];}
	}
  }
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  
  if(!d) {d=document;}
   if((p=n.indexOf("?"))>0&&top.frames.length) 
   {
    d=top.frames[n.substring(p+1)].document; 
	n=n.substring(0,p);
   }
  if(!(x=d[n])&&d.all) 
  {x=d.all[n];} 
  for (i=0;!x&&i<d.forms.length;i++) 
  {x=d.forms[i][n];}
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) 
  {x=MM_findObj(n,d.layers[i].document);}
  if(!x && document.getElementById) 
  {x=d.getElementById(n);} 
  return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; 
  document.MM_sr=new Array; 

  for(i=0;i<(a.length-2);i+=3)
  {
   if ((x=MM_findObj(a[i]))!=null)
   {
    document.MM_sr[j++]=x; 
   	if(!x.oSrc) 
	{x.oSrc=x.src;} 
	x.src=a[i+2];
	}
  }
}

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  if ((obj=MM_findObj(args[i]))!=null) 
  	{ v=args[i+2];
    if (obj.style) 
	{obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; 
	}
}
