/* ---------------------------- */
/* XMLHTTPRequest Enable */
/* ---------------------------- */
function createObject() {
var request_type;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
request_type = new ActiveXObject("Microsoft.XMLHTTP");
}else{
request_type = new XMLHttpRequest();
}
return request_type;
}





var http = createObject();
var http2 = createObject();




/* -------------------------- */
/* LOGIN */
/* -------------------------- */
/* Required: var nocache is a random number to add to request. This value solve an Internet Explorer cache issue */
var nocache = 0;
function formular() {
// Optional: Show a waiting message in the layer with ID ajax_response
document.getElementById('formular_response').innerHTML = "Loading..."
// Required: verify that all fileds is not empty. Use encodeURI() to solve some issues about character encoding.
var name = encodeURI(document.getElementById('name').value);
var email = encodeURI(document.getElementById('email').value);
var text = encodeURI(document.getElementById('text').value);
// Set te random number to add to URL request
nocache = Math.random();
// Pass the login variables like URL variable
http.open('get', 'formular.php?email='+email+'&name='+name+'&text='+text+'&nocache = '+nocache);
http.onreadystatechange = formReply;
http.send(null);
}
function formReply() {
if(http.readyState == 4){
var response = http.responseText;
if(response == 0){
// if login fails
document.getElementById('formular_response').innerHTML = response;
// else if login is ok show a message: "Welcome + the user name".
} else {
document.getElementById('formular_response').innerHTML = response;
}
}
}

var old_maincategory = 'leer';

function gaestebuch(page) {

nocache = Math.random();
// Pass the login variables like URL variable
http.open('get', 'gaestebuch.php?page='+page+'');

http.onreadystatechange = mainmenueReply;
http.send(null);



}


function gaestebuch2() {

nocache = Math.random();
// Pass the login variables like URL variable
http.open('get', 'gaestebuch/insert.php');

http.onreadystatechange = mainmenueReply;
http.send(null);




}

function gaestebuch_eintrag() {


var email = encodeURI(document.getElementById('email').value);
var name = encodeURI(document.getElementById('name').value);
var text = encodeURI(document.getElementById('text').value);
var captcha = document.getElementById('captcha2').value;
var send = encodeURI(document.getElementById('send').value);


nocache = Math.random();
// Pass the login variables like URL variable
http.open('get', 'gaestebuch/insert.php?email='+email+'&name='+name+'&text='+text+'&send='+text+'&captcha='+captcha+'&nocache = '+nocache);

http.onreadystatechange = mainmenueReply;
http.send(null);



}



function mainmenue(content) {
	
	if(old_maincategory == 'leer'){
	document.getElementById(content).style.backgroundImage = 'url(images/menue_hover.gif)';

	old_maincategory = content;

	}
	else{
	document.getElementById(old_maincategory).style.backgroundImage = 'url()';
	old_maincategory = content;

	}

// Optional: Show a waiting message in the layer with ID ajax_response


document.getElementById('content').innerHTML = "<center><img src=images/loader.gif></center>";

// Required: verify that all fileds is not empty. Use encodeURI() to solve some issues about character encoding.
// Set te random number to add to URL request
nocache = Math.random();
// Pass the login variables like URL variable
http.open('get', ''+content+'.php');

http.onreadystatechange = mainmenueReply;
http.send(null);



}

function impressum() {


document.getElementById('content').innerHTML = "<center><img src=images/loader.gif></center>";

// Required: verify that all fileds is not empty. Use encodeURI() to solve some issues about character encoding.
// Set te random number to add to URL request
nocache = Math.random();
// Pass the login variables like URL variable
http.open('get', 'impressum.php');

http.onreadystatechange = mainmenueReply;
http.send(null);



}


function submenue(content,auswahl) {
	

// Optional: Show a waiting message in the layer with ID ajax_response


document.getElementById('content').innerHTML = "<center><img src=images/loader.gif></center>";

// Required: verify that all fileds is not empty. Use encodeURI() to solve some issues about character encoding.
// Set te random number to add to URL request
nocache = Math.random();
// Pass the login variables like URL variable
http.open('get', ''+content+'.php?sub='+auswahl+'');

http.onreadystatechange = mainmenueReply;
http.send(null);



}







function mainmenueReply() {

if(http.readyState == 4){
var response = http.responseText;
if(response == 0){
// if login fails
document.getElementById('content').innerHTML = 'Fehler1!'+response;
// else if login is ok show a message: "Welcome + the user name".
} else {
document.getElementById('bottom').style.display = 'none';


document.getElementById('content').innerHTML = response;
Effect.Appear('content');
Effect.Appear('bottom');

}
}
}





function bildwechsel(content,status) {

if(status==2 ){
if(content==old_maincategory ){
document.getElementById(content).style.backgroundImage = 'url(images/menue_hover.gif)';

}
else{
document.getElementById(content).style.backgroundImage = 'url()';
}

}

else if (status==1){
document.getElementById(content).style.backgroundImage = 'url(images/menue_hover.gif)';

}


}


function subwechsel(content,status) {

if(status==2 ){
if(content==old_maincategory ){
document.getElementById(content).style.backgroundImage = 'url(images/menue_box_middle_hover.gif)';

}
else{
document.getElementById(content).style.backgroundImage = 'url(images/menue_box_middle.gif)';
}

}

else if (status==1){
document.getElementById(content).style.backgroundImage = 'url(images/menue_box_middle_hover.gif)';

}


}



function showhideDetail(id,campid,status){

if(status==1){
document.getElementById('middle_content_'+id).style.backgroundImage = 'url(images/content_box_middle_gross.gif)';
document.getElementById('mehr_'+id).style.display = 'none';

window.camp_id = id;

http.open('get', 'map.php?id='+campid+'');
http.onreadystatechange = mapReply;
http.send(null);


Effect.Appear('more_'+id);
Effect.Appear('more2_'+id);
}
else{
document.getElementById('middle_content_'+id).style.backgroundImage = 'url(images/content_box_middle.gif)';
document.getElementById('mehr_'+id).style.display = 'block';

document.getElementById('more_'+id).style.display = 'none';
document.getElementById('more2_'+id).style.display = 'none';
}


}



function mapReply() {

if(http.readyState == 4){
var response = http.responseText;

if(response == 0){

document.getElementById('googlecode_'+window.camp_id).innerHTML = 'Fehler!'+response;
} else {

document.getElementById('googlecode_'+window.camp_id).innerHTML = response;


}
}
}








