iamiphone = 0;
wwbb1 = "empty";
wwbbnot = "empty";
wwbb2 = "empty";
window.onresize = dosizer;

function showmore(me) {
	/*
    $("#morelink").fadeOut();
    $("#hider").css({"height": ($(".calcheight").height()-40) + "px" }); 
    */
}
function csschanges(x,y) {
	$("#info").html("x/y: " + x + " / " + y);
	// BODY
   	$('body').removeClass("background0");
   	$('body').removeClass("background600");
   	$('body').removeClass("background650");
   	$('body').removeClass("background700");
   	$('body').removeClass("background750");
   	$('body').removeClass("background800");
   	$('body').removeClass("background850");
   	$('body').removeClass("background900");
   	$('body').removeClass("background950");
   	$('body').removeClass("background1000");
   	
    if (x<= 835) {
    	$('body').addClass("background0");
    } else {
	    if (y < 670) {
	    	$('body').addClass("background600");
	    }
	    if (y > 670 && y <= 720) {
	    	$('body').addClass("background650");
	    }
	    if (y > 720 && y <= 770) {
	    	$('body').addClass("background700");
	    }
	    if (y > 770 && y <= 820) {
	    	$('body').addClass("background750");
	    }
	    if (y > 820 && y <= 870) {
	    	$('body').addClass("background800");
	    }
	    if (y > 870 && y <= 920) {
	    	$('body').addClass("background850");
	    }
	    if (y > 920 && y <= 970) {
	    	$('body').addClass("background900");
	    }
	    if (y > 970 && y <= 1020) {
	    	$('body').addClass("background950");
	    }
	    if (y > 1020) {
	    	$('body').addClass("background1000");
	    }
    }

}

function check_iphone () {
	if ( navigator.userAgent.match(/iPhone/i) ) {
		iamiphone = true;
	} else {
		iamiphone = false;
	}
}

function dosizer() {
    if (!iamiphone) {
        var ymax=screen.availHeight;
        var xmax=screen.availWidth;
        //self.moveTo(0,0);
        //window.resizeTo(xmax,ymax);
    //
        var x,y;
        if (self.innerHeight) // all except Explorer
        {
            x = self.innerWidth;
            y = self.innerHeight;
        }
        else if (document.documentElement && document.documentElement.clientHeight)
            // Explorer 6 Strict Mode
        {
            x = document.documentElement.clientWidth;
            y = document.documentElement.clientHeight;
        }
        else if (document.body) // other Explorers
        {
            x = document.body.clientWidth;
            y = document.body.clientHeight;
        }
        
        ymaxdiff=ymax-y;
        xmaxdiff=xmax-x;
        globaly = y;
        globalx = x;
    } else {
 //       alert("iphone");
        globalx = 891;
        globaly = 480;
    }
	csschanges(x,y);
    //dothis(1, "first");
}

function doPasswortFeldFormat() {
	$(".entry form input[name=post_password]").addClass("post_password");
	$(".entry form input[name=Submit]").addClass("submitPW");
}

function init() {
	// Innenkasten ausmessen und hšhe nachregeln fŸr kopierschutz
	// **************************************************** Innenkasten
    // **************************************************** check auf iPhone
    //alert("init is called");
	check_iphone();
	dosizer();
//	$("<div><p>Check das aus </p></div>").appendTo("li.page-item-42");
					$('<li>' +menuetext + '</li>').appendTo( $("li.page-item-42").parent() );
//	doMenuelink();
	
	// Menues Anfetten - diese Funktion entsteht in header und wird in der "Funktions.php" doSubmenue() erstellt
    $(wwbb1).addClass('bold');
    $(wwbbnot).removeClass('bold');
    $(wwbb2).addClass('bold');
    
    //
    // Passwortfeld
    doPasswortFeldFormat();
}


$(document).ready( function () {
    init();

});