// JavaScript Document

var access = "allow"; 
var actimg;
var showwelc = 2; 
var menurand_show;
var philoaccess;
var accessLP = "allow";

function LoadDLPage(id)
{	
	$('#div_media').fadeOut(250);
	setTimeout("$('#div_media').load('inc/media_"+id+".php')",300);
	setTimeout("$('#div_media').fadeIn('slow');",600)
	
	}

function LoadVideo(id)
{	
	$('#header').fadeOut('slow');
	$('#content').fadeOut('slow');
	$('#footer').fadeOut('slow');
	
	$('#vid_title').html($('#list_vid_title'+id).html());
	$('#vid_creator').html($('#list_vid_creator'+id).html());
	$('#vid_date').html($('#list_vid_date'+id).html());
	setTimeout("$('#big_video').fadeIn('slow');",1000);
	}


function UnloadVideo()
	{
	$('#big_video').fadeOut('slow');
	setTimeout("$('#header').fadeIn('slow');$('#content').fadeIn('slow');$('#footer').fadeIn('slow');",1000);
	}
function LoadWallpaper(id,objekt){
	$('#div_media').fadeOut(250);
	$.post("/inc/media_wp_wrapper.php", { id: id, objekt: objekt},
  function(html){
	 $('#div_media').html(html);
	 
	$('#div_media').fadeIn(250);
    //setTimeout("$('#div_media').html("+htmlx+");",300);
    //setTimeout("$('#div_media').fadeIn('slow');",600)
  });

	
	}
function SaveWallpaper(id){
	//$('.dldialog').show();
	
width = screen.width;
height = screen.height;
downloaded = "false";
if (width == 1024 && height == 768) {
	$("#iframe_jpg").attr("src","/img/wallpapers/media_dl_jpg.php?id="+id+"&w="+width+"&h="+height); downloaded = "true";
	} 
if (width == 1280 && height == 1024) {
	$("#iframe_jpg").attr("src","/img/wallpapers/media_dl_jpg.php?id="+id+"&w="+width+"&h="+height); downloaded = "true";
	} 
if (width == 1280 && height == 720) {
	$("#iframe_jpg").attr("src","/img/wallpapers/media_dl_jpg.php?id="+id+"&w="+width+"&h="+height); downloaded = "true";
	} 
if (width == 1280 && height == 800) {
	$("#iframe_jpg").attr("src","/img/wallpapers/media_dl_jpg.php?id="+id+"&w="+width+"&h="+height); downloaded = "true";
	} 
if (width == 1368 && height == 766) {
	$("#iframe_jpg").attr("src","/img/wallpapers/media_dl_jpg.php?id="+id+"&w="+width+"&h="+height); downloaded = "true";
	}
if (width == 1440 && height == 900) {
	$("#iframe_jpg").attr("src","/img/wallpapers/media_dl_jpg.php?id="+id+"&w="+width+"&h="+height); downloaded = "true";
	} 
if (width == 1600 && height == 900) {
	$("#iframe_jpg").attr("src","/img/wallpapers/media_dl_jpg.php?id="+id+"&w="+width+"&h="+height); downloaded = "true";
	} 
if (width == 1680 && height == 1050) {
	$("#iframe_jpg").attr("src","/img/wallpapers/media_dl_jpg.php?id="+id+"&w="+width+"&h="+height); downloaded = "true";
	} 
if (width == 1920 && height == 1080) {
	$("#iframe_jpg").attr("src","/img/wallpapers/media_dl_jpg.php?id="+id+"&w="+width+"&h="+height); downloaded = "true";
	} 
if (width == 1920 && height == 1200) {
	$("#iframe_jpg").attr("src","/img/wallpapers/media_dl_jpg.php?id="+id+"&w="+width+"&h="+height); downloaded = "true";
	} 
if (downloaded != "true") {DLJPG();}

function DLJPG() {		

$('#div_media').block({ message: $('.dldialog'),
				css: {
					padding: "5px",
					background: "#000000",
					textAlign:      'left',
					border:	"0px solid #000000",
					cursor:         'normal'
					
					
					}
				
				
				
				});
}}





function ChangePhilo ()
	{
		if (philoaccess == 1)
		{ 
			return false;
		} else 
			{
				$('#menu_rand2').load('inc/philosophie2_inc.php')
			}
	
	}
function SetAccess(status,time)
	{
		if(status == "deny")
			{
				access = "deny";
				
			}
		if(status == "allow")
			{
				setTimeout("access = 'allow';",time);	
				
			}
	}

function CheckAccess()
	{
		if(access == "deny")
			{
				return false; 
				
			}
		if(access == "allow")
			{
				return true; 
				
			}
		}
function ChangeImage(img)
	{
	if (img == "leer"){
	$('#img_l_img').css('background-image',null);

	} else
	{
		$('#welcm').hide();
		$('#img_l_img').fadeOut('fast');
		setTimeout("$('#img_l_img').css('background-image','url(img/"+img+"_img.jpg)')",250);
		$('#img_l_img').fadeIn('fast');
	}

	
	}
	
function LoadContent(img,content)
	{
				$('#welcm').hide();
				$('#img_l_img').fadeOut('fast');
				setTimeout("$('#img_l_img').css('background-image','url(img/"+img+"_img.jpg)')",250);

				$('#img_l_img').fadeIn('fast');
				$('#contentloader').load(content);
	}	
	
function SetHeadBox(title)
	{
		//$('#right_head_box').text(title);
	}

function Initialize(init)
	{
		$(init).click();
	}

function welcome()
{
	if (showwelc == 1)
		{ 
			return false;
		} else 
			{
				$('#welcm').fadeIn('slow');
			}
}

function PhiloZusammen()
	{
		if (philoaccess == 1)
		{ 
			return false;
		} else 
			{
				$('#contentloader').load('inc/zusammen.php');
			}
		

	}


function killimpdiv(time)		// Wird nich mehr benötigt
{
	$("#imp_div1").fadeOut(time);
	$("#imp_div2").fadeOut(time);
	$("#imp_div3").fadeOut(time);
	setTimeout('$("#imp_div1").remove();',time);
	setTimeout('$("#imp_div2").remove();',time);
	setTimeout('$("#imp_div3").remove();',time);

}
	
function menubar_show()
{
	if (menurand_show == "off")
		{ 
			return false;
		} else 
			{
				$('#menu_rand').show();
				$('#menu_rand2').show();
			}
}

function show_menu(menu,leistungen,impressum)
{
	if (menu == 'off')
		{
			$('#menu_rand').hide();
			//$('#menu_rand2').hide();  
			//menurand_show = "off";
		}
	
	if (menu == 'on')
		{
			menurand_show = "on"; menubar_show();
		}
	if (leistungen == 'off')
		{
			$('#menu_rand_leistungen').hide();
			//$('#menu_rand2').hide();  
			//menurand_show = "off";
		}
	
	if (leistungen == 'on')
		{
			$('#menu_rand_leistungen').show();
				$('#menu_rand2').show();
		}
	if (impressum == 'off')
		{
			$('#menu_rand_impressum').hide();
			//$('#menu_rand2').hide();  
			//menurand_show = "off";
		}
	
	if (impressum == 'on')
		{
			$('#menu_rand_impressum').show();
				$('#menu_rand2').show();
		}
		
}	

function show_kontakt_formular(status)
{
	if (status == 'off')
		{
			$('#kontakt_formular').hide();
		}
	
	if (status == 'on')
		{
			$('#kontakt_formular').show();
		}
}	

function PhiloChangeText()
	{
	if (philoaccess == 2)
		{
	   		$('#contentloader').load('inc/philosophie2_inc.php');
	   		philoaccess = 1;
		}
		if (philoaccess != 2)
		{
	   		return false;
		}
	
	}
	
	function leistungspack()
	{
		if(accessLP == "deny")
			{
				return false; 
				
			}
		if(accessLP == "allow")
			{
		setTimeout("$('#leistungen_1').show('fast')",1000);
		setTimeout("$('#leistungen_2').show('fast')",2000);
		setTimeout("$('#leistungen_3').show('fast')",3000);
		setTimeout("$('#leistungen_4').show('fast')",4000);
		setTimeout("$('.leistungen_all').fadeOut('fast')",7000);
		setTimeout("$('#leistungen_5').show('fast')",8000);
		
			}
	}

function newsreader(news_id){
	
	$.ajax({
   type: "POST",
   url: "news.php",
   data: "news_id="+news_id,
   success: function(html){
		$('#contentloader').html(html);
   }
 });

	
	}


function homemenubar(status){
	if (status == 'off')
		{
			$('#home_dd_menu').hide();
		}
	
	if (status == 'on')
		{
			$('#home_dd_menu').show();
		}
		
	}
	

function ClearContent(){
	$('#contentloader').text('');
	
	
	}
$(document).ready(function(){    
setTimeout("welcome()",2000);

	show_menu('on','off','off');
	show_kontakt_formular('off');

$('a').click(function(){homemenubar('off');$('#kundenlogin').hide();});
	
	
	
	
//	$(".menufader").hover(function(){
//$('#home_dd_menu').show();
//},function(){
//$('#home_dd_menu').hide();
//});
	
	
	$("#a_home").click(function(){
		
		location.href= "http://www.alpha-it.de"
		
		return false;
	});
	
	
	
	$("#a_downloads").click(function(){
		if(access == "deny")
			{
				return false; 
				
			}
		if(access == "allow")
			{
		$('#menu_rand2').hide();
		philoaccess = 1;
		showwelc = 1;
		ClearContent();
		show_menu('off','off','off');
		show_kontakt_formular('off');
		
		
		LoadContent('','inc/media_inc.php');

		$('#kundenlogin').hide();
        return false; 
									  }});
	
	
	
	
	
	$("#a_leistungen").click(function(){
		if(access == "deny")
			{
				return false; 
				
			}
		if(access == "allow")
			{
		//SetAccess('deny');
		philoaccess = 1; // 1 = kein Philotext2
		showwelc = 1;    // 1 = Wilkommen im Team nicht anzeigen
		
		ClearContent();	// Das Content Div Leer machen
		SetHeadBox('Leistungen');
		LoadContent('leistungen','inc/leistungen_inc.php');
		
		show_menu('off','on','off');	// Das Menu steht auf menu,leistungen,impressum aus an aus
		show_kontakt_formular('off');
	
		leistungspack();
		accessLP = "deny";
		Initialize("li#menu_l1");
		$('#kundenlogin').hide();
		setTimeout("accessLP = 'allow'",8500);	
				
			}
		
		return false;
	});
	
	$("#a_philosophie").click(function(){
		if(access == "deny")
			{
				return false; 
				
			}
		if(access == "allow")
			{								
		
		philoaccess = 1;
		showwelc = 1;
		
		ClearContent();
		SetHeadBox('Philosophie');
		ChangeImage('philosophie');
		show_menu('off','off','off');
		show_kontakt_formular('off');
		$('#menu_rand2').show();
		$('#menu_rand2').load('inc/philosophie_inc.php');
		//LoadContent('philosophie','inc/philosophie_inc.php');
		$('#kundenlogin').hide();
		philoaccess = 2;
		setTimeout("ChangePhilo();",8000);
		setTimeout("PhiloZusammen()",8000);
		return false;  
			}});
	
	$("#a_kundenlogin").click(function(){
		if(access == "deny")
			{
				return false; 
				
			}
		if(access == "allow")
			{
		philoaccess = 1;
		showwelc = 1; 
		
		ClearContent();
		SetHeadBox('Kundenlogin');
		ChangeImage('kundenlogin');

		show_menu('off','off','off');
		show_kontakt_formular('off');
		$('#menu_rand2').hide();
	
		$('#kundenlogin').show();
		return false;  
			}});
	$("#a_impressum").click(function(){
		if(access == "deny")
			{
				return false; 
				
			}
		if(access == "allow")
			{
		philoaccess = 1;
		showwelc = 1;
		
		ClearContent();
		show_menu('off','off','on');
		show_kontakt_formular('off');
		
		//$('#contentloader').hide();
		LoadContent('impressumx','inc/impressum_inc.php');
		//$('#contentloader').fadeIn(250);
		SetHeadBox('Impressum');
		$('#kundenlogin').hide();
		Initialize("li#menu_i1");
        return false;  // Verhindern, ass Link ausgeführt wird
									  }});
	$("#a_kontakt").click(function(){ 
		if(access == "deny")
			{
				return false; 
				
			}
		if(access == "allow")
			{
		philoaccess = 1;
		showwelc = 1;
		ClearContent();
		LoadContent('kontakt','inc/kontakt_inc.php');
		SetHeadBox('Kontakt');
		show_menu('off','off','off');
		$('#menu_rand2').hide();
		show_kontakt_formular('on');
		$('#kundenlogin').hide();
				
        return false;  // Verhindern, dass Link ausgeführt wird
			}});

$("#a_news").click(function(){
		if(access == "deny")
			{
				return false; 
				
			}
		if(access == "allow")
			{
		philoaccess = 1;
		showwelc = 1;
		ClearContent();
		ChangeImage('news');
		SetHeadBox('News');
		show_menu('off','off','off');
		$('#menu_rand2').hide();
		show_kontakt_formular('off');
		
		$('#contentloader').hide();
		newsreader(1);
		
		$('#kundenlogin').hide();
		$('#contentloader').fadeIn(250);
		
        return false;  // Verhindern, dass Link ausgeführt wird
							 }});
	  
	  
	  
	  $("li#menu_m1").click(function(){ 
	  $('.menu_mx').css("background-color","#000000");
	  $('#menu_m1').css("background-color","#454545");  
	  $('#menu_rand2').load('inc/menu_edv.php');

        return false;  // Verhindern, dass Link ausgeführt wird
      });
	  
	  $("li#menu_m2").click(function(){ 
	  $('.menu_mx').css("background-color","#000000");
	  $('#menu_m2').css("background-color","#454545");
	  $('#menu_rand2').load('inc/menu_business-support.php');
        return false;  // Verhindern, dass Link ausgeführt wird
      });
	   $("li#menu_m3").click(function(){ 
	  $('.menu_mx').css("background-color","#000000");
	  $('#menu_m3').css("background-color","#454545");
      $('#menu_rand2').load('inc/menu_it-consulting.php');
        return false;  // Verhindern, dass Link ausgeführt wird
      });
	    $("li#menu_m4").click(function(){ 
	  $('.menu_mx').css("background-color","#000000");
	  $('#menu_m4').css("background-color","#454545");
      $('#menu_rand2').load('inc/menu_it-security.php');
        return false;  // Verhindern, dass Link ausgeführt wird
      });
	 $("li#menu_m1").click();
	 
	 $("li#menu_l1").click(function(){ 
	  $('.menu_mx').css("background-color","#000000");
	  $('#menu_l1').css("background-color","#454545");
	  $('#menu_rand2').load('inc/lei_linux.php');

        return false;  // Verhindern, dass Link ausgeführt wird
      });
	  
	  $("li#menu_l2").click(function(){ 
	  $('.menu_mx').css("background-color","#000000");
	  $('#menu_l2').css("background-color","#454545");
	  $('#menu_rand2').load('inc/lei_novell.php');
        return false;  // Verhindern, dass Link ausgeführt wird
      });
	   $("li#menu_l3").click(function(){ 
	  $('.menu_mx').css("background-color","#000000");
	  $('#menu_l3').css("background-color","#454545");
      $('#menu_rand2').load('inc/lei_microsoft.php');
        return false;  // Verhindern, dass Link ausgeführt wird
      });
	    $("li#menu_l4").click(function(){ 
	  $('.menu_mx').css("background-color","#000000");
	  $('#menu_l4').css("background-color","#454545");
      $('#menu_rand2').load('inc/lei_vm.php');
        return false;  // Verhindern, dass Link ausgeführt wird
		 });
		$("li#menu_l5").click(function(){ 
	  $('.menu_mx').css("background-color","#000000");
	  $('#menu_l5').css("background-color","#454545");
      $('#menu_rand2').load('inc/lei_tka.php');
        return false;  // Verhindern, dass Link ausgeführt wird
      });
		
		$("li#menu_l6").click(function(){ 
	  $('.menu_mx').css("background-color","#000000");
	  $('#menu_l6').css("background-color","#454545");
	   //location.href="http://www.sachverstaendiger-edv.com"
        return true;  // Verhindern, dass Link ausgeführt wird
      });
	// $("li#menu_l1").click();
	 
	 $("li#menu_i1").click(function(){ 
	  $('.menu_mx').css("background-color","#000000");
	  $('#menu_i1').css("background-color","#454545");
	  $('#menu_rand2').load('inc/imp_verantwortliche.php');

        return false;  // Verhindern, dass Link ausgeführt wird
      });
	  
	  $("li#menu_i2").click(function(){ 
	  $('.menu_mx').css("background-color","#000000");
	  $('#menu_i2').css("background-color","#454545");
	  $('#menu_rand2').load('inc/imp_adressen.php');
        return false;  // Verhindern, dass Link ausgeführt wird
      });
	   $("li#menu_i3").click(function(){ 
	  $('.menu_mx').css("background-color","#000000");
	  $('#menu_i3').css("background-color","#454545");
      $('#menu_rand2').load('inc/imp_haftung.php');
        return false;  // Verhindern, dass Link ausgeführt wird
      });
	    $("li#menu_i4").click(function(){ 
	  $('.menu_mx').css("background-color","#000000");
	  $('#menu_i4').css("background-color","#454545");
      $('#menu_rand2').load('inc/imp_AGB.php');
        return false;  // Verhindern, dass Link ausgeführt wird
      });
	// $("li#menu_i1").click();
	 
	 
	var options = { 
        target:        '#kontaktform_status',   // target element(s) to be updated with server response 
        beforeSubmit:  showRequest,  // pre-submit callback 
        success:       showResponse,  // post-submit callback 
 
        // other available options: 
        //url:       url         // override for form's 'action' attribute 
        //type:      type        // 'get' or 'post', override for form's 'method' attribute 
        //dataType:  null        // 'xml', 'script', or 'json' (expected server response type) 
        //clearForm: true        // clear all form fields after successful submit 
        resetForm: true        // reset the form after successful submit 
 
        // $.ajax options can be used here too, for example: 
        //timeout:   3000 
    }; 
 
    // bind form using 'ajaxForm' 
    $('#emailerform').ajaxForm(options); 
 
// pre-submit callback 
function showRequest(formData, jqForm, options) {  
    return true; 
} 
 
// post-submit callback 
function showResponse(responseText, statusText)  { 
$('#emailerform').fadeOut('slow');
setTimeout("$('#kontaktform_status').fadeIn('slow');",1000);
setTimeout("$('#kontaktform_status').fadeOut('slow');",5000);
setTimeout("$('#emailerform').fadeIn('slow');",6000);
} 

	var loginopt = { 
        target:        '#contentloader',   // target element(s) to be updated with server response 
        beforeSubmit:  kl_showRequest,  // pre-submit callback 
        success:       kl_showResponse,  // post-submit callback 
 
        // other available options: 
        //url:       url         // override for form's 'action' attribute 
        //type:      type        // 'get' or 'post', override for form's 'method' attribute 
        //dataType:  null        // 'xml', 'script', or 'json' (expected server response type) 
        //clearForm: true        // clear all form fields after successful submit 
        resetForm: true        // reset the form after successful submit 
 
        // $.ajax options can be used here too, for example: 
        //timeout:   3000 
    }; 
 
    // bind form using 'ajaxForm' 
    $('#kl_form').ajaxForm(loginopt); 
 
// pre-submit callback 
function kl_showRequest(formData, jqForm, loginopt) {  
  return true;
}
 
// post-submit callback 
function kl_showResponse(responseText, statusText)  { $('#kundenlogin').hide();
$('#contentloader').text('');
$('#contentloader').load('kundenmenu/iframe_index.php');

}  


});

