function getPageSize() {
		
	 var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = window.innerWidth + window.scrollMaxX;
		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
		if(document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth; 
		} else {
			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 = xScroll;		
	} else {
		pageWidth = windowWidth;
	}

	return [pageWidth,pageHeight];
}
function lightboxbgLoad(mode)
{
	document.getElementById('warning_bg').style.display = mode == 0 ? 'none' : 'block';
	
	var arrayPageSize = getPageSize();
	document.getElementById('warning_bg').style.width = arrayPageSize[0] + 'px';
	document.getElementById('warning_bg').style.height = arrayPageSize[1] + 'px';
}
function Warning(mode)
{
	document.getElementById('warning').style.display = mode == 0 ? 'none' : 'block';
	
	if(mode == 1)
	{
		window.location.hash = 'top';
		lightboxbgLoad(1);
	}
}
/* ############################### */

function openWindow(path,breite,hoehe)
{
	var breite = breite > 0 ? breite : screen.width;
	var hoehe = hoehe > 0 ? hoehe : screen.height;
	var preview = window.open (path, 'window', 'width=' + breite + ', height=' + hoehe + ', status=0, toolbar=0, menubar=0, resizable=0, scrollbars=1, fullscreen=0, left='+(screen.width/2-breite/2)+',top='+(screen.height/2-hoehe/2)+',screenX='+(screen.width/2-breite/2)+',screenY='+(screen.height/2-hoehe/2));
	preview.focus();
}

function openVideoFG(video,image){
	var breite = 750;
	var hoehe = 550;
	var preview = window.open ('../../gallery/player.php?video='+video+'&image='+image, 'video', 'width=' + breite + ', height=' + hoehe + ', status=0, toolbar=0, menubar=0, resizable=1, scrollbars=1, fullscreen=1, left='+(screen.width/2-breite/2)+',top='+(screen.height/2-hoehe/2)+',screenX='+(screen.width/2-breite/2)+',screenY='+(screen.height/2-hoehe/2));
	preview.focus();
}

function openVideoPF(video){
	var breite = 750;
	var hoehe = 550;
	var preview = window.open ('../../PornFightClub/player.php?video='+video, 'video', 'width=' + breite + ', height=' + hoehe + ', status=0, toolbar=0, menubar=0, resizable=1, scrollbars=1, fullscreen=1, left='+(screen.width/2-breite/2)+',top='+(screen.height/2-hoehe/2)+',screenX='+(screen.width/2-breite/2)+',screenY='+(screen.height/2-hoehe/2));
	preview.focus();
}

// open images for gallery etc.
function openImage(file,breite,hoehe,path,name){
	var preview = window.open (path, 'name', 'width=' + breite + ', height=' + hoehe + ', status=0, toolbar=0, menubar=0, resizable=1, scrollbars=1, fullscreen=1, left='+(screen.width/2-breite/2)+',top='+(screen.height/2-hoehe/2)+',screenX='+(screen.width/2-breite/2)+',screenY='+(screen.height/2-hoehe/2));
	with (preview.document) {
		open();
		write('<html>\n<head>\n<title>Gallery</title>\n');
		write('<link href="sty/style.css" rel="stylesheet" type="text/css"></head>\n');
		write('<body style="margin:10px">\n');
		write('<table width="100%" height="100%" align="center" cellspacing="0" cellpadding="0" border="0"><tr>\n');
		write('<td colspan="2" align="center" valign="middle" width="100%">');
		write('<a href="javascript:self.close()"><img class="img_thumb" src="'+file+'" border="0" alt="Schliessen"></a></td></tr>\n');
		//write('<tr><td width="50%" height="20" align="right" valign="top"><a href="javascript:self.print()">Drucken</a>&nbsp;</td>\n');
		//write('<td align="left" valign="top">|&nbsp;<a href="javascript:self.close()">Schliessen</a></td></tr>\n');
		write('</table></body>\n</html>\n');
		close();
	}
	preview.focus();
}

// show membership create window
function openPassCreate(){
	var breite = 650;
	var hoehe = 530;
	var preview = window.open ('empty.html', 'name', 'width=' + breite + ', height=' + hoehe + ', status=0, toolbar=0, menubar=0, resizable=1, scrollbars=1, fullscreen=1, left='+(screen.width/2-breite/2)+',top='+(screen.height/2-hoehe/2)+',screenX='+(screen.width/2-breite/2)+',screenY='+(screen.height/2-hoehe/2));
	with (preview.document) {
		open();
		write('<html>\n<head>\n<title>Zugang anfordern</title>\n');
		write('<link href="sty/style.css" rel="stylesheet" type="text/css"></head>\n');
		write('<body style="margin:0; padding:0; background-color:#ffffff">\n');
		write('<iframe src="http://gateway.inet-cash.de/mc/start.php?progid=28487&nummer=104787944&lang=de" style="width:640px; height:520px; overflow:auto; border:none; background:transparent; text-align:center; vertical-align:middle" width="605" height="480" frameborder="0" scrolling="no" align="middle"></iframe>\n');
		write('</body>\n</html>\n');
		close();
	}
	preview.focus();
}

// show password forget window
function openPassReset(){
	var breite = 650;
	var hoehe = 530;
	var preview = window.open ('empty.html', 'name', 'width=' + breite + ', height=' + hoehe + ', status=0, toolbar=0, menubar=0, resizable=1, scrollbars=1, fullscreen=1, left='+(screen.width/2-breite/2)+',top='+(screen.height/2-hoehe/2)+',screenX='+(screen.width/2-breite/2)+',screenY='+(screen.height/2-hoehe/2));
	with (preview.document) {
		open();
		write('<html>\n<head>\n<title>Passwort vergessen</title>\n');
		write('<link href="sty/style.css" rel="stylesheet" type="text/css"></head>\n');
		write('<body style="margin:0; padding:0; background-color:#ffffff">\n');
		write('<iframe src="http://gateway.inet-cash.de/mc/pwsend.php?progid=28487&lang=de" style="width:640px; height:520px; overflow:auto; border:none; background:transparent; text-align:center; vertical-align:middle" width="605" height="480" frameborder="0" scrolling="no" align="middle"></iframe>\n');
		write('</body>\n</html>\n');
		close();
	}
	preview.focus();
}

// show membership delete window
function openPassDelete(){
	var breite = 650;
	var hoehe = 530;
	var preview = window.open ('empty.html', 'name', 'width=' + breite + ', height=' + hoehe + ', status=0, toolbar=0, menubar=0, resizable=1, scrollbars=1, fullscreen=1, left='+(screen.width/2-breite/2)+',top='+(screen.height/2-hoehe/2)+',screenX='+(screen.width/2-breite/2)+',screenY='+(screen.height/2-hoehe/2));
	with (preview.document) {
		open();
		write('<html>\n<head>\n<title>Zugang abbestellen</title>\n');
		write('<link href="sty/style.css" rel="stylesheet" type="text/css"></head>\n');
		write('<body style="margin:0; padding:0; background-color:#ffffff">\n');
		write('<iframe src="http://gateway.inet-cash.de/mc/abo.php?progid=28487&lang=de" style="width:640px; height:520px; overflow:auto; border:none; background:transparent; text-align:center; vertical-align:middle" width="605" height="480" frameborder="0" scrolling="no" align="middle"></iframe>\n');
		write('</body>\n</html>\n');
		close();
	}
	preview.focus();
}

// show password forget div
function openURL(url){
	location.href = url;
}

function refer(url){
	
	location.href = url;
}

function matchRegex(s, p) {
	s = s.nodeType == 1 ? s.value : s;
	return s == '' || new RegExp(p).test(s);
}

function replaceUmlauts2HTML(text){
	
	text = text.replace(/ä/g, "%C3%A4");//"&auml;");
	text = text.replace(/ö/g, "%C3%B6");//"&ouml;");
	text = text.replace(/ü/g, "%C3%BC");//"&uuml;");
	text = text.replace(/Ä/g, "%C3%84");//"&Auml;");
	text = text.replace(/Ö/g, "%C3%96");//"&Ouml;");
	text = text.replace(/Ü/g, "%C3%9C");//"&Uuml;");
	text = text.replace(/ß/g, "%C3%9F");//"&szlig;");
	text = text.replace(/&/g, "%26");//"&amp;");
	return text;
}

function replaceHTML2Umlauts(text){
	
	text = text.replace(/&auml;/g, "ä");
	text = text.replace(/&ouml;/g, "ö");
	text = text.replace(/&uuml;/g, "ü");
	text = text.replace(/&Auml;/g, "Ä");
	text = text.replace(/&Ouml;/g, "Ö");
	text = text.replace(/&Uuml;/g, "Ü");
	text = text.replace(/&szlig;/g, "ß");
	text = text.replace(/&amp;/g, "&");
	return text;
}

Array.prototype.contains = function(elem){
	var i;
	for (i=0;i<this.length;i++) {
		if (this[i] === elem) {
			return true;
		}
	}
	return false;
}

Array.prototype.explode = function(){
	var i;
	var str = '';
	for (i=0;i<this.length;i++) {
		str = str + this[i] + ','
	}
	return str;
}

function checkPasswordRetype(pass1,pass2,fldImage,fldInfo,url){
	var check = false;
	var info = document.getElementById(fldInfo);
	var passMatch = document.getElementById(pass2).value;
	info.innerHTML = '';
	info.style.display = 'none';
	if(pass1.length>=6){
		if(passMatch==pass1){
			info.innerHTML = 'Passw&ouml;rter stimmen &uuml;berein';
			info.style.display = 'block';
			check = true;
		}else{
			info.innerHTML = 'Passw&ouml;rter stimmen nicht &uuml;berein';
			info.style.display = 'block';
		}
	}
	if(pass1.length>0 && pass1.length<6){
		info.innerHTML = 'Muss min. 6 Zeichen lang sein';
		info.style.display = 'block';
	}
	document.getElementById(fldImage).style.backgroundImage = check == true ? 'url('+url+'/img/icon_info_checked.png)' : 'url('+url+'/img/icon_info_warn.png)';
}

function checkPassword(pass,fldImage,fldInfo,url){	
	var regex01 = '^(?=.{8,})(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*\\W).*$';
	var regex02 = '^(?=.{7,})(((?=.*[A-Z])(?=.*[a-z]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[a-z])(?=.*[0-9]))).*$';
	var regex03 = '(?=.{6,}).*';
	var notallowed = '^(.)*("|\'|&)+(.)*$';
	var secure = 0;
	var secureMsg = new Array(3);
	var check = false;
	var info = document.getElementById(fldInfo);
	document.getElementById(fldImage).style.backgroundImage = 'none';
	info.innerHTML = '';
	info.style.display = 'none';
	secureMsg[0] = 'Dein Passwort ist sehr sicher';
	secureMsg[1] = 'Dein Passwort ist sicher';
	secureMsg[2] = 'Dein Passwort ist nicht sicher';
	if(pass.length>=6){
		if(!matchRegex(pass, notallowed)){
			check = true;
			if(matchRegex(pass, regex03)){
				secure = 2;
			}
			if(matchRegex(pass, regex02)){
				secure = 1;
			}
			if(matchRegex(pass, regex01)){
				secure = 0;
			}
			info.innerHTML = secureMsg[secure];
			info.style.display = 'block';
		}else{
			info.innerHTML = 'Bitte nicht diese Zeichen: &apos;, &quot;, &amp;';
			info.style.display = 'block';
		}
	}
	if(pass.length>0 && pass.length<6){
		info.innerHTML = 'Muss min. 6 Zeichen lang sein';
		info.style.display = 'block';
	}
	document.getElementById(fldImage).style.backgroundImage = check == true ? 'url('+url+'/img/icon_info_checked.png)' : 'url('+url+'/img/icon_info_warn.png)';
}

function checkEmail(email,fldImage,fldInfo,url){
	var check = false;
	var info = document.getElementById(fldInfo);
	document.getElementById(fldImage).style.backgroundImage = 'none';
	info.innerHTML = '';
	info.style.display = 'none';
	if(email.length>=6){
		if(matchRegex(email, '^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+@[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$')){
			$.ajax({
				type: 'GET',
				url: url+'/_inc_registerusercheck.php',
				data: 'do=checkuser&email='+email,
				success: function(isReg){
					if(isReg=='false'){
						info.innerHTML = 'Deine Emailadresse ist g&uuml;ltig';
						info.style.display = 'block';
						check = true;
					}else{
						info.innerHTML = 'Emailadresse wird bereits benutzt';
						info.style.display = 'block';
						check = false;
					}
					document.getElementById('userisregistered').value = check == true ? 0 : 1;
					document.getElementById(fldImage).style.backgroundImage = check == true ? 'url('+url+'/img/icon_info_checked.png)' : 'url('+url+'/img/icon_info_warn.png)';
				}
			});
		}else{
			info.innerHTML = 'Deine Emailadresse ist ung&uuml;ltig';
			info.style.display = 'block';
		}
	}else{
		info.innerHTML = 'Muss min. 6 Zeichen lang sein';
		info.style.display = 'block';
	}
	document.getElementById(fldImage).style.backgroundImage = check == true ? 'url('+url+'/img/icon_info_checked.png)' : 'url('+url+'/img/icon_info_warn.png)';
}

function checkUsername(username,fldImage,fldInfo,url){
	var notallowed = '^(.)*("|\'|&)+(.)*$';
	var check = false;
	var info = document.getElementById(fldInfo);
	document.getElementById(fldImage).style.backgroundImage = 'none';
	info.innerHTML = '';
	info.style.display = 'none';
	if(username.length>=6){
		if(!matchRegex(username, notallowed)){
			$.ajax({
				type: 'GET',
				url: url+'/_inc_registerusercheck.php',
				data: 'do=checkuser&name='+username,
				success: function(isReg){
					if(isReg=='false'){
						info.innerHTML = 'Benutzername noch nicht vergeben';
						info.style.display = 'block';
						check = true;
					}else{
						info.innerHTML = 'Benutzername ist bereits vergeben';
						info.style.display = 'block';
						check = false;
					}
					document.getElementById('userisregistered').value = check == true ? 0 : 1;
					document.getElementById(fldImage).style.backgroundImage = check == true ? 'url('+url+'/img/icon_info_checked.png)' : 'url('+url+'/img/icon_info_warn.png)';
				}
			});
		}else{
			info.innerHTML = 'Bitte nicht diese Zeichen: &apos;, &quot;, &amp;';
			info.style.display = 'block';
		}
	}else{
		info.innerHTML = 'Muss min. 6 Zeichen lang sein';
		info.style.display = 'block';
	}
	document.getElementById('userisregistered').value = check == true ? 0 : 1;
	document.getElementById(fldImage).style.backgroundImage = check == true ? 'url('+url+'/img/icon_info_checked.png)' : 'url('+url+'/img/icon_info_warn.png)';
}

function checkRegisterform(fldImage,fldInfo,url){
	var info = document.getElementById(fldInfo);
	var email = document.getElementById('email').value;
	var user = document.getElementById('username').value;
	var userIs = document.getElementById('userisregistered').value;
	var pw1 = document.getElementById('password').value;
	var pw2 = document.getElementById('passwordretype').value;
	var errCnt = 0;
	document.getElementById(fldImage).style.backgroundImage = 'none';
	info.innerHTML = '';
	info.style.display = 'none';
	if(email.length<6){
		errCnt = errCnt + 1;
	}
	if(user.length<6 || userIs==1){
		errCnt = errCnt + 1;
	}
	if(pw1.length<6 || pw1!=pw2){
		errCnt = errCnt + 1;
	}
	document.getElementById(fldImage).style.backgroundImage = errCnt == 0 ? 'url('+url+'/img/icon_info_checked.png)' : 'url('+url+'/img/icon_info_warn.png)';
	if(errCnt==0){
		return true;
	}else{
		info.innerHTML = 'Bitte gib alle Felder richtig an';
		info.style.display = 'block';
	}
	return false;
}

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

$(document).ready(function(){

var first = 0;
var speed = 500;
var pause = 7000;

function removeFirst(){
first = $('ul#listticker li:first').html();
$('ul#listticker li:first')
.animate({opacity: 0}, speed)
.fadeOut('slow', function() {$(this).remove();addLast(first);});

}
function addLast(first){
last = '<li>'+first+'</li>';
$('ul#listticker').append(last)
$('ul#listticker li:last')
.animate({opacity: 1}, speed)
.fadeIn('slow')
}

interval = setInterval(removeFirst, pause);
});
