var nCrackrate = 100; // Anzahl m�glicher Versuche das Passwort zu Knacken pro Sekunde
var nTreshholddays = 365 * 10; // Schwellwert, ab wann das Passwort als Sicher gilt
var nSteps = 10; // Anzahl der Schritte, die im CSS angehangen werden

function frm_onload(frmname, obj)
{
	var contentFrame;
	var heightOfContentFrame;

	if (obj.contentWindow) {
		contentFrame = obj.contentWindow.document.getElementById('content_of_frame');
		if (contentFrame != null) {
			heightOfContentFrame = contentFrame.offsetHeight + 40;
		}

	} else {
		contentFrame = obj.contentDocument.getElementById('content_of_frame');
		if (contentFrame != null) {
			heightOfContentFrame = contentFrame.offsetHeight + 40;
		}
	}
	obj.style.height = heightOfContentFrame + "px";
}

function frm_onresize(frmname, height)
{
	if(document.getElementById(frmname)) {
		document.getElementById(frmname).style.height = (height+40) + "px";
	}
}

function contains(strText, strPattern) {
	for (i = 0; i < strText.length; i++) {
		if (strPattern.indexOf(strText.charAt(i)) > -1) return true;
	}
	return false;
}

function checkPass(strPass, strId, strClassname, strTextId, aTexts) {
	nCombinationCount = 0;

	strToCheck = "0123456789"; // �berpr�fen ob Ziffern vormmen
	if (contains(strPass, strToCheck)) nCombinationCount += strToCheck.length;
	strToCheck = "abcdefghijklmnopqrstuvwxyz"; // �berpr�fen ob kleine Buchstaben vorkommen
	if (contains(strPass, strToCheck)) nCombinationCount += strToCheck.length;
	strToCheck = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; // �berpr�fen ob grosse Buchstaben vorkommen
	if (contains(strPass, strToCheck)) nCombinationCount += strToCheck.length;
	strToCheck = ",;:-_=+|//?^&!.@$�#*()%~<>{}[]";// �berspr�fen ob Sonderzeichen vorkommen
	if (contains(strPass, strToCheck)) nCombinationCount += strToCheck.length;

	var nDays = ((Math.pow(nCombinationCount, strPass.length) / nCrackrate) / 2) / 86400; // Wieviele Tage ben�tigt man?
	var nStrongness = Math.round(nDays / nTreshholddays * 100); // St�rke errechnen
	if (nStrongness < (strPass.length * 5)) nStrongness += strPass.length * 5; // Zeichenl�nge f�r St�rke ber�cksichtigen
	if (nStrongness > 100) nStrongness = 100; // Max 100% zulassen
	nStrongness = Math.round(nStrongness / (100 / nSteps)); // Max Schritte

	oId = document.getElementById(strId);
	oId.className = strClassname + "-" + nStrongness;

	otId = document.getElementById(strTextId);

	if (aTexts) {
		nKey = Math.round((aTexts.length - 1) / nSteps * nStrongness);
		otId.innerHTML = aTexts[nKey];
	}
}




function user_mover(imgID) {
	var bgcolor='#E9E9E9';
	document.getElementById('ud_1_'+imgID).style.backgroundColor=bgcolor;
	document.getElementById('ud_2_'+imgID).style.backgroundColor=bgcolor;
	document.getElementById('ud_3_'+imgID).style.backgroundColor=bgcolor;
	document.getElementById('ud_4_'+imgID).style.backgroundColor=bgcolor;
}
function user_mout(imgID) {
	var bgcolor='';
	document.getElementById('ud_1_'+imgID).style.backgroundColor=bgcolor;
	document.getElementById('ud_2_'+imgID).style.backgroundColor=bgcolor;
	document.getElementById('ud_3_'+imgID).style.backgroundColor=bgcolor;
	document.getElementById('ud_4_'+imgID).style.backgroundColor=bgcolor;
}


function voteIn(number) {
	for(i=1; i<=number; i++) {
		document.getElementsByName('vote_img_'+i)[0].src='img/rating/star_2.png';
	}
}
function voteOut(number,img_str) {
	var img;
	img[1]=img_str.substr(0,1);
	img[2]=img_str.substr(1,1);
	img[3]=img_str.substr(2,1);
	img[4]=img_str.substr(3,1);
	img[5]=img_str.substr(4,1);
	for(i=1; i<=number; i++) {
		document.getElementsByName('vote_img_'+i)[0].src='img/rating/star_'+img[i]+'.png';
	}
}


// Objekt XMLHttp
// Param url: Url der aufzurufenden Datei
// Param dst: ID des HTML-Elements
function XMLHttp(url,dst)
{
    // Den Browsertyp auslesen
    var browser=navigator.appName;

    if(browser=="Microsoft Internet Explorer")             // IE
    {
        var http=new ActiveXObject("Microsoft.XMLHTTP");
    }
    else                                                   // Mozilla, Safari, Opera, usw.
    {
        var http=new XMLHttpRequest();
    }

    // HTTP-Request senden
    // Parameter url als Adresse
    http.open("GET",url,true);

    // Wenn Status geaendert wurde
    http.onreadystatechange=function()
    {
        // ueberpruefen, ob daten gesendet wurden
        // readystate 4 = complete
        if(http.readyState==4)
        {
            // ueberpruefen, ob status vom server richtig ist
            // status 200 = OK
            if(http.status==200)
            {
                // Antwort vom Server in HTML-Element schreiben
                // dst als ID
                document.getElementById(dst).innerHTML=http.responseText;
				bindThickBoxEvents();
            }
            else
            {
                // HTTP Fehlercode zur�ckgeben
                alert("Fehler:\nHTTP-Status: "+http.status+"\nHTTP-Statustext: "+http.statusText);
            }
        }
    }
    http.send(null);
}

function change_link(MainURL,profile_userID,divID) {
	XMLHttp(MainURL+'content/profil_link.php?profile_userID='+profile_userID,divID);
}
function change_link_2(MainURL,profile_userID,string,divID) {
	var url=document.getElementsByName('form_link')[0].value;
	XMLHttp(MainURL+'content/profil_link.php?profile_userID='+profile_userID+'&'+string+'&url='+url,divID);
}
function change_link_3(MainURL,profile_userID,string,y,divID) {
	var url=document.getElementsByName('form_link_'+y)[0].value;
	XMLHttp(MainURL+'content/profil_link.php?profile_userID='+profile_userID+'&'+string+'&url='+url,divID);
}

function box(to_userID,to_catID,position_1,position_2,position_3,status,site,divID,MainURL) {
	XMLHttp(MainURL+'content/box.php?to_userID='+to_userID+'&to_catID='+to_catID+'&position_1='+position_1+'&position_2='+position_2+'&position_3='+position_3+'&status='+status+'&site='+site+'&divID='+divID,divID);
}
function gewinnspiel(AddOnURL,divID,MainURL) {
	XMLHttp(MainURL+'content/bbq_gewinnspiel_div.php?AddOnURL='+AddOnURL+'&MainURL='+MainURL+'&divID='+divID,divID);
}
function gewinnspiel_check(schritt,divID,MainURL) {
	if(document.getElementsByName('antwort')[0].checked==true) { var antwort=document.getElementsByName('antwort')[0].value; }
	if(document.getElementsByName('antwort')[1].checked==true) { var antwort=document.getElementsByName('antwort')[1].value; }
	if(document.getElementsByName('antwort')[2].checked==true) { var antwort=document.getElementsByName('antwort')[2].value; }

	XMLHttp(MainURL+'content/bbq_gewinnspiel_div.php?schritt='+schritt+'&antwort='+antwort+'&MainURL='+MainURL+'&divID='+divID,divID);
}
function gewinnspiel_check2(schritt,divID,MainURL) {
	XMLHttp(MainURL+'content/bbq_gewinnspiel_div.php?schritt='+schritt+'&MainURL='+MainURL+'&divID='+divID,divID);
	bindThickBoxEvents();
}
function gewinnspiel_check_form(divID,MainURL) {
	var vorname=document.getElementsByName('form_vorname')[0].value;
	var nachname=document.getElementsByName('form_nachname')[0].value;
	var strasse=document.getElementsByName('form_strasse')[0].value;
	var hsnr=document.getElementsByName('form_hsnr')[0].value;
	var plz=document.getElementsByName('form_plz')[0].value;
	var ort=document.getElementsByName('form_ort')[0].value;
	if(document.getElementsByName('form_teil')[0].checked==true) { teil='1'; } else { teil='0'; }
	XMLHttp(MainURL+'content/bbq_gewinnspiel_div.php?schritt=7&action=form&vorname='+vorname+'&nachname='+nachname+'&strasse='+strasse+'&hsnr='+hsnr+'&plz='+plz+'&ort='+ort+'&teil='+teil+'&MainURL='+MainURL+'&divID='+divID,divID);
}
function gewinnspiel_check_form2(divID,MainURL) {
	var email=document.getElementsByName('form_email')[0].value;
	var vorname=document.getElementsByName('form_vorname')[0].value;
	var nachname=document.getElementsByName('form_nachname')[0].value;
	var strasse=document.getElementsByName('form_strasse')[0].value;
	var hsnr=document.getElementsByName('form_hsnr')[0].value;
	var plz=document.getElementsByName('form_plz')[0].value;
	var ort=document.getElementsByName('form_ort')[0].value;
	if(document.getElementsByName('form_teil')[0].checked==true) { var teil='1'; } else { var teil='0'; }
	XMLHttp(MainURL+'content/bbq_gewinnspiel_div.php?schritt=7&action=form&email='+email+'&vorname='+vorname+'&nachname='+nachname+'&strasse='+strasse+'&hsnr='+hsnr+'&plz='+plz+'&ort='+ort+'&teil='+teil+'&MainURL='+MainURL+'&divID='+divID,divID);
}
function box_startpage(to_userID,to_catID,position_1,position_2,position_3,status,site,divID,MainURL) {
	XMLHttp(MainURL+'content/box.php?to_userID='+to_userID+'&to_catID='+to_catID+'&position_1='+position_1+'&position_2='+position_2+'&position_3='+position_3+'&status='+status+'&site='+site+'&divID='+divID,divID);
	XMLHttp(MainURL+'content/box_header.php?kat='+to_catID+'&MainURL='+MainURL+'&divID='+divID,'box_header');
}
function box2(to_userID,to_catID,position_1,position_2,position_3,status,site,divID,MainURL) {
	XMLHttp(MainURL+'content/box.php?to_userID='+to_userID+'&to_catID='+to_catID+'&position_1='+position_1+'&position_2='+position_2+'&position_3='+position_3+'&status='+status+'&site='+site+'&divID='+divID,divID);
	XMLHttp(MainURL+'content/box_header.php?kat='+to_catID+'&MainURL='+MainURL+'&divID='+divID,'box_header');
}
function box3(to_userID,to_catID,position_1,position_2,position_3,status,site,divID,MainURL) {
	XMLHttp(MainURL+'content/box.php?to_userID='+to_userID+'&to_catID='+to_catID+'&position_1='+position_1+'&position_2='+position_2+'&position_3='+position_3+'&status='+status+'&site='+site+'&divID='+divID,divID);
	XMLHttp(MainURL+'content/box_header_user.php?to_userID='+to_userID+'&kat='+to_catID+'&position_1='+position_1+'&MainURL='+MainURL+'&divID='+divID,'box_header');
}
function box_comments(to_userID,position_1,status,site,divID,MainURL) {
	XMLHttp(MainURL+'content/box_comments.php?to_userID='+to_userID+'&position_1='+position_1+'&status='+status+'&site='+site+'&divID='+divID,divID);
	XMLHttp(MainURL+'content/box_header_user.php?to_userID='+to_userID+'&position_1='+position_1+'&MainURL='+MainURL+'&divID='+divID,'box_header');
}
function box_blog(to_userID,position_1,status,site,divID,MainURL) {
	XMLHttp(MainURL+'content/box_blog.php?to_userID='+to_userID+'&position_1='+position_1+'&status='+status+'&site='+site+'&divID='+divID,divID);
	XMLHttp(MainURL+'content/box_header_user.php?to_userID='+to_userID+'&position_1='+position_1+'&MainURL='+MainURL+'&divID='+divID,'box_header');

	$.ajax({
	   type: "GET",
	   url: "../../blog/javascripts/file-uploader.js",
	   dataType: "script"
	 });
	$.ajax({
	   type: "GET",
	   url: "../../blog/javascripts/all2.js",
	   dataType: "script"
	 });
	$.ajax({
	   type: "GET",
	   url: "../../config/jquery.lightbox-0.5.min.js",
	   dataType: "script"
	 });
	//$('.images_big').lightBox({fixedNavigation:true});
	$("#new_comment2").hide();


}
function box4(reiter,divID,MainURL) {
	XMLHttp(MainURL+'content/monatsgewinner_content.php?reiter='+reiter+'&divID='+divID,divID);
	XMLHttp(MainURL+'content/monatsgewinner_header.php?reiter='+reiter+'&MainURL='+MainURL+'&divID='+divID,'monatsgewinner_header');
}
function quickbox(number,reiter,divID,MainURL) {
	XMLHttp(MainURL+'content/quickbox.php?reiter='+reiter+'&divID='+divID+'&number='+number,divID);
}

function box5(profilID,reiter,divID,MainURL) {
	XMLHttp(MainURL+'content/profil_fan_content.php?reiter='+reiter+'&MainURL='+MainURL+'&profilID='+profilID+'&divID='+divID,divID);
	XMLHttp(MainURL+'content/profil_fan_header.php?reiter='+reiter+'&MainURL='+MainURL+'&profilID='+profilID+'&divID='+divID,'fan_header');
}
function box_4fan(profilID,reiter,divID,MainURL) {
	XMLHttp(MainURL+'content/profil_fan_content_4fan.php?reiter='+reiter+'&MainURL='+MainURL+'&profilID='+profilID+'&divID='+divID,divID);
}
function box_header(kat,divID,MainURL) {
	XMLHttp(MainURL+'content/box_header.php?kat='+kat+'&MainURL='+MainURL+'&divID='+divID,divID);
}
function removeThickBoxEvents() {
	$('.thickbox').each(function(i) {
		$(this).unbind('click');
	});
}
function bindThickBoxEvents() {
	removeThickBoxEvents();
	tb_init('#bild_melden a.thickbox');
	tb_init('#teil a.thickbox');
}

function img(profile_name,to_userID,galID,seite,imgID,divID,MainURL) {

	$.ajax({
	  url: "../../../../../../content/bilder_img.php",
	  data: "profile_name="+profile_name+"&to_userID="+to_userID+"&galID="+galID+"&seite="+seite+"&imgID="+imgID+"&divID="+divID+"&MainURL="+MainURL+"",
	  success: function(data){
		$("#bilder_img").html(data);
	  }
	});
	$.ajax({
	  	type: "GET",
	   	url: "../../../../../../comments/javascripts/all.js",
	   	dataType: "script"
	});
}
function newURL() {
	alert('URL wird modifiziert!');
	window.location.href="../bilder/";
}
function new_answer(frageID) {
	document.getElementById('answer_'+frageID+'_1').style.display="block";
	document.getElementById('answer_'+frageID+'_2').style.display="block";
	document.getElementById('answer_'+frageID+'_3').style.display="block";

	document.getElementById('answer_'+frageID+'_4').style.display="none";
	document.getElementById('answer_'+frageID+'_5').style.display="none";
	document.getElementById('answer_'+frageID+'_6').style.display="none";
}
function new_question() {
	var frageID=parseInt(document.getElementsByName('fragen')[0].value);
	frageID=frageID+1;
	document.getElementsByName('fragen')[0].value=frageID;
	document.getElementById('answer_'+frageID+'_x_1').style.display="block";
	document.getElementById('answer_'+frageID+'_x_2').style.display="block";
	document.getElementById('answer_'+frageID+'_x_3').style.display="block";

	document.getElementById('answer_'+frageID+'_x_4').style.display="block";
	document.getElementById('answer_'+frageID+'_x_5').style.display="block";
	document.getElementById('answer_'+frageID+'_x_6').style.display="block";

	document.getElementById('answer_'+frageID+'_x_7').style.display="block";
	document.getElementById('answer_'+frageID+'_x_8').style.display="block";
	document.getElementById('answer_'+frageID+'_x_9').style.display="block";

	document.getElementById('answer_'+frageID+'_4').style.display="block";
	document.getElementById('answer_'+frageID+'_5').style.display="block";
	document.getElementById('answer_'+frageID+'_6').style.display="block";
	if(frageID==5) {
		document.getElementById('fragen_div').style.display="none";
	}
}
function checkGWS() {
	Check = confirm("Hast du auch nochmal alles kontrolliert?\nWenn du �nderungen hast, must du dich an einen Administrator wenden.\n\nDr�cke auf OK um das Gewinnspiel abzuspeichern.");
	if(Check==true) {
		document.gws_save.submit();
	}

}

function gws(profile_userID,divID,MainURL) {
	XMLHttp(MainURL+'content/gws_ajax.php?profile_userID='+profile_userID+'&MainURL='+MainURL+'&divID='+divID,divID);
}
function gws_check(profile_userID,schritt,divID,MainURL) {
	if(document.getElementsByName('antwort_number')[0].value==2||document.getElementsByName('antwort_number')[0].value==3) {
		if(document.getElementsByName('antwort')[0].checked==true) { var antwort=document.getElementsByName('antwort')[0].value; }
		if(document.getElementsByName('antwort')[1].checked==true) { var antwort=document.getElementsByName('antwort')[1].value; }
	}
	if(document.getElementsByName('antwort_number')[0].value==3) {
		if(document.getElementsByName('antwort')[2].checked==true) { var antwort=document.getElementsByName('antwort')[2].value; }
	}

	XMLHttp(MainURL+'content/gws_ajax.php?profile_userID='+profile_userID+'&schritt='+schritt+'&antwort='+antwort+'&MainURL='+MainURL+'&divID='+divID,divID);
}
function gws_check2(profile_userID,divID,MainURL) {
	if(document.getElementsByName('form_teil')[0].checked==true) { var teil='1'; } else { var teil='0'; }
	XMLHttp(MainURL+'content/gws_ajax.php?schritt=6&formteil='+teil+'&MainURL='+MainURL+'&divID='+divID+'&profile_userID='+profile_userID,divID);
}

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.01
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.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 && d.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];}
}
