
$(document).ready(function() {
	 // hides the slickbox as soon as the DOM is ready
	 // (a little sooner than page load)
	  $('.hide').hide();
	  $('#popupContact').hide();
	  $('#backgroundPopup').hide();
	  
	  
	  		
			$('#addbulletinbtn').click(function(){
												
												//alert("This is the message");
												$.post("include/module/bulletin_board/ajax.php", $("#addbulletinform").serialize(),
														function (data){
															//alert("Data"+data);	
															$('#ajaxreply').html(data);
														}
																																  
																																  
																																  );

												
												});
	  
	  
	  		/****        BULLETIN POPUP */				
			var popupStatus = 0;  			
			//LOADING POPUP
			//Click the button event!
			$("#addbulletin").click(function(){
			//centering with css
			centerPopup();
			//load popup
			loadPopup();
			});
			//CLOSING POPUP
			//Click the x event!
			$("#popupContactClose").click(function(){
			disablePopup();
			});
			//Click out event!
			$("#backgroundPopup").click(function(){
			disablePopup();
			});
			//Press Escape event!
			$(document).keypress(function(e){
			if(e.keyCode==27 && popupStatus==1){
				disablePopup();
			}
			});

			
			//loading popup with jQuery magic!
			function loadPopup(){
				//loads popup only if it is disabled
				if(popupStatus==0){
					$("#backgroundPopup").css({
					"opacity": "0.7"
					});
					$("#backgroundPopup").fadeIn("slow");
					$("#popupContact").fadeIn("slow");
					popupStatus = 1;
				}
			}
			
			//disabling popup with jQuery magic!
			function disablePopup(){
				//disables popup only if it is enabled
				if(popupStatus==1){
					$("#backgroundPopup").fadeOut("slow");
					$("#popupContact").fadeOut("slow");
					popupStatus = 0;
				}
			}
			
			//centering popup
			function centerPopup(){
				//request data for centering
				var windowWidth = document.documentElement.clientWidth;
				var windowHeight = document.documentElement.clientHeight;
				var popupHeight = $("#popupContact").height();
				var popupWidth = $("#popupContact").width();
				//centering
				$("#popupContact").css({
				"position": "absolute",
				"top": 100,
				"left": windowWidth/2-popupWidth/2
				});
				//only need force for IE6
				
				$("#backgroundPopup").css({
				"height": windowHeight
				});			
			}



	  
		  
			if ($.browser.msie) {
				$('input:checkbox').click(function () {
					this.blur();
					this.focus();
				});
			}
		

		 
		
	
		
	  
	  
	  /*document.getElementById("filternow").onclick = function() {             refreshnow()        };
	  
	  function refreshnow(){
		  $.post("include/module/block/blocks/filter_ajax.php", $("#filterform").serialize(),
			function(data){
				// return de data in div producttotal
    			$('#producttotal').html(data);
  			});	  
	  }*/
	  /*$('.filternow').click(function () { 			
		 $.post("include/module/block/blocks/filter_ajax.php", $("#filterform").serialize(),
			function(data){
				// return de data in div producttotal
    			$('#producttotal').html(data);
  			});
      });*/
	  
	  // functie voor het block filterTour.php icm filter_ajax.php
	  /*$('.filternow').change(function () { 			
		 $.post("include/module/block/blocks/filter_ajax.php", $("#filterform").serialize(),
			function(data){
				// return de data in div producttotal
    			$('#producttotal').html(data);
  			});
      });	  $('.filternow').click(function () { 			
		 $.post("include/module/block/blocks/filter_ajax.php", $("#filterform").serialize(),
			function(data){
				// return de data in div producttotal
    			$('#producttotal').html(data);
  			});
      });
	  $('.filternow').keyup(function () { 			
		 $.post("include/module/block/blocks/filter_ajax.php", $("#filterform").serialize(),
			function(data){
				// return de data in div producttotal
    			$('#producttotal').html(data);
  			});
      });
	  $('.filternow').mouseup(function () { 			
		 $.post("include/module/block/blocks/filter_ajax.php", $("#filterform").serialize(),
			function(data){
				// return de data in div producttotal
    			$('#producttotal').html(data);
  			});
      });*/
	  
	 
	  

	  
	 
	 // toggles the slickbox on clicking the noted link
	  $('.clicktoggle').click(function() {
		 $('.togglethis').toggle(200);
	  });
	  
	  $('#checkAllAuto').click(
		   function()
		   {
			  $("INPUT[type='checkbox']").attr('checked', $('#checkAllAuto').is(':checked'));   
		   }
		)
	  
	  $('#showblock').click(function() {
		 $('#thisblock').slideToggle(500);
	  });
	  $('#showcontent').click(function() {
		 $('#thiscontent').slideToggle(500);
	  });
	  $('#showmenu').click(function() {
		 $('#thismenu').slideToggle(500);
	  });
	  
	  $(".tablebackground tr:odd").css("background", "#cccccc");
	  
	  
	  /*$("select").change(function () {
			var str = "";
			$("select option:selected").each(function () {
				str += $(this).text() + " ";
			});
			$("div").text(str);
		})*/

});


function ConfirmDel(msg) { 
	document.MM_returnValue = confirm(msg);
}

function reloadmain(){
	window.close(POPUP);
}

function toggle(layer,kind,task) {
    
    if (kind=="visibility"){
        if (task=="hide")
            vis_to = "hidden";
        else if (task=="show")
            vis_to = "visible";
        else {
            
            if (document.layers)
                vis_to = (document.layers[layer].visibility=="hide") ? "show" : "hide";
                
            else if (document.all)
                vis_to = (document.all[layer].style.visibility=="hidden") ? "visible" : "hidden";
                
            else if (document.getElementById)
                vis_to = (document.getElementById(layer).style.visibility=="hidden") ? "visible" : "hidden";
        }
    } else if (kind=="display"){
        if (task=="hide")
            dis_to = "none";
        else if (task=="show")
            dis_to = "block";
        else {
            if (document.layers)
                dis_to = (document.layers[layer].display=="none") ? "block" : "none";
                
            else if (document.all)
                dis_to = (document.all[layer].style.display=="none") ? "block" : "none";
                
            else if (document.getElementById)
                dis_to = (document.getElementById(layer).style.display=="none") ? "block" : "none";
        }
    }
    
    if (document.layers)
        (kind=="display") ? document.layers[layer].display = dis_to : document.layers[layer].visibility = vis_to;
        
    else if (document.all)
        (kind=="display") ? document.all[layer].style.display = dis_to : document.all[layer].style.visibility = vis_to;
        
    else if (document.getElementById)
        (kind=="display") ? document.getElementById(layer).style.display = dis_to : document.getElementById(layer).style.visibility = vis_to;
}

