	function myAjaxMain(url,_datastr){
		// variable insert...
		//$(window).scrollTop(0);
		
		return $.ajax({
			type    : "POST",
			url     : url,
			data    : _datastr,
			async	: false
		}).responseText;
	}
	
	function myAjaxReturn(url,_datastr){
		return $.ajax({
			type    : "POST",
			url     : url,
			data    : _datastr,
			async	: false,
			success : function(msg){
				url = url.split("/");
				if ( url[1]=='profilefr.php'){

					$save  = $('#jQuery_history');
					//$(document.body).empty().prepend($save).append(msg);
					$(document.body).empty().prepend($save).hide().append(msg).fadeIn("slow");
				}else{
					//$('#alltable').empty().append(msg);
					$('#alltable').empty().hide().append(msg).fadeIn("slow");
				}
				
			} 
		}).responseText;
	}
	
	

    // shadow theory
    (function($){
        // my briefcase
        var _opt;
        var _css;
        var _html;

        // in to out
        $.fn.shshadow = function(param){
            // hold main request.
            _root = $(this);
            _shadow = _root.attr('id');
            // class extend
            _opt = $.extend( {} , param, $.fn.shshadow.defaults );
            // generate the law
            _html = '<div class="' +  _shadow  + '" \
                style ="width:atuo;height:auto;padding:5px;background-color:#AAB8C3;\
                "></div>';
            // apply the plane
            $(this).before(_html).appendTo( '.' + _shadow ).css({
                        'margin-top': '-15px',
                        'margin-left':'-2px',
                        'margin-bottom':'-1px',
                        'margin-right':'-2px',
                        'border': 'solid 1px #000000',
                        'opacity': '0.90'
            });
            // for future access.
            return _opt;
        }

        // out to in
        $.fn.shshadow.defaults = {

        };

    })(jQuery);

    

	// Hiding the front page advertisement.
	$(".partner").hide();

	// Applying the options for the myAccount click event
	$("#myaccount1 span").click(function () {
		$(".browse").attr('src', 'images/sample4.jpg');
		$("#fashions").hide("slow");
		$("#fashions").toggle("slow", function() {
				$(this).css('background-image','url(images/tooltips.png)');
		});
	});


	$("#myaccount2 span").click(function () {
					$(".browse").attr('src', 'images/sample5.jpg');
					$("#fashions").hide("slow");
					$("#fashions").toggle("slow", function() {
							$(this).css('background-image','none');
					});
		
	});

	
	$("#myaccount3 span").click(function () {
					$(".browse").attr('src', 'images/sample6.jpg');
					$("#fashions").hide("slow");
					$("#fashions").toggle("slow", function() {
							$(this).css('background-image','none');
					});
	});
	
	
	$(".productbrowser").click(function () {
		// industry5.jpg
		 //$(".browse").attr('src', 'images/mechanic.jpg');
		 //$("#fashions").hide( "slow" );
		 //$("#fashions").toggle("slow", function() {
			//$(this).css('background-image','url(images/tooltips3.png)');
		 //});

	});
	
	
	
	

	$(".partners").click(function() {
		$(".browse").attr('src', 'images/sample4.jpg');
		$("#fashions").hide("slow");
		$(".accounts").hide("slow");
		$(".partner").show("slow");

		$("#fashions").toggle("slow", function() {
			$(this).css('background-image','url(images/tooltips.png)');
		});

	});


	/*
	 *
	 * My Account
	 *
	 *
	 *
	 *
	 */
	$("#myaccount,#account").click ( function () {
		//$('#alltable').html('').load('include/link_mijnaccount.php');
		$.historyLoad('include/link_mijnaccount.php');
		return false;
	});

	/*
	 *  My acount
	 *
	 *
	 *
	 */
	$('#mijnaccount').click (function () {
		//counter++;

		$.historyLoad('include/link_mijnaccount.php');
		//window.location.href='http://www.directnews.be/dn/index.php?g=1';
		return false;

}).hover( function () {
					var _html;
					_html = '<div id="jony" >' +
						'<img src="images/tips1.png" width="100%" height="100%" />'  +
						'<ul style="position:absolute;top:2px;left:0px">' +
						'<li class="info" style="cursor:pointer;">Demande d\'infos</li>' +
						//'<li class="blad" style="cursor:pointer;">Bald in pdf</li>' +
						'<li class="zoek" style="cursor:pointer;">Recherche rapide</li>' +
					'</ul></div>';
					$('#jony').remove();

					$(document.body).append(_html); 

          // For other browsers..... FF, Opera, Chrome
          var rl = $('#mijnaccount').offset().left+3;
          $('#jony').css({
              'position':'absolute',  'top':'129px',
              'left':  rl + 'px',    'width': '220px',
              'height': '150px',    'color': '#222222'
          }).show("fast");

					

					$('div:not(#jony,#toolbar,#page,#contents)').mouseover (function() {
            //alert ($(this).attr('id'));
						$('#jony').remove();
						$('.menu #mijnaccount').css('background-image', 'none');
					});



					// all clear
					//$('.menu > li').css('background-image', 'url(images/menus.png)');
					$('.menu #mijnaccount').css('background-image', 'url(images/menus1.png)');

					// Apply the menu click events
					$('#jony').find('li').click(function(){
						var _temp = $(this).attr( 'class' );
						switch( _temp ){
							case 'info':
									// load the magazine module
									//$('#alltable').html('').load('include/link_magazines.php');
									$.historyLoad('include/link_magazines.php');
									//window.location.href='http://www.directnews.be/dn/index.php?g=1';
									//$('#alltable').css('zoom','100%');
									return false;
								break;

							case 'blad':
									// load the magazine module
									//$('#alltable').html('').load('include/link_magazines.php');
									$.historyLoad('include/link_magazines.php');
									//window.location.href='http://www.directnews.be/dn/index.php?g=1';
									//$('#alltable').css('zoom','100%');

									return false;
								break;

							case 'zoek':
									//// load the magazine and editie zoek options
									//$('#alltable').html('').load('include/link_zoek.php');
									// load the magazine module
									//$('#alltable').html('').load('include/link_zoek.php');
									$.historyLoad('include/link_zoek.php');
									//$('#alltable').css('zoom','100%');
									return false;
								break;
						}
					});



			}, function () {

	});

	


	/*
	 *  Welkom
	 *
	 *
	 *
	 */
	$('#menu0').click (function () {
		$.historyLoad('include/profilefr.php');
		//window.location.href='http://www.directnews.be/dn/index.php?g=1';
		return false;	
	}).hover( function () {
					// All menu clear
					$('.menu > li').css('background-image', 'none');
					// Apply correct one
					$('.menu .lia').css('background-image', 'url(images/menus1.png)');
					// remove
					$('#jony').remove();

			}, function () {
					//$('.menu > li').css('background-image', 'url(images/menus.png)');
					//$('.menu .lia').css('background-image', 'url(images/menus.png)');
					$('.menu .lia').css('background-image', 'none');
			});

	/*
	 * Magazine
	 *
	 *
	 *
	 *
	 */
	// Magazine
	$('#menu1').click (function () {
		//counter++;
		
		//$('#alltable').html('').load('include/link_magazines.php');
		//window.location.href='http://www.directnews.be/app/webroot/dn/index.php?g=1&p=magazine';
			
		//$('#logs span:last-child').after('<span class="histor">magazine</span>');
		
		$.historyLoad('include/link_magazines.php');
		//$('#alltable').css('zoom','100%');
		return false;		
			
	}).hover( function () {
					var _html;
					_html = '<div id="jony" >' +
						'<img src="images/tips1.png" width="100%" height="100%" />'  +
						'<ul style="position:absolute;top:2px;left:0px">' +
						'<li class="info" style="cursor:pointer;">Demande d\'infos</li>' +
						//'<li class="blad" style="cursor:pointer;">Bald in pdf</li>' +
						'<li class="zoek" style="cursor:pointer;">Recherche rapide</li>' +
					'</ul></div>';
					$('#jony').remove();

					$(document.body).append(_html); 

          // For other browsers..... FF, Opera, Chrome
          var rl = $('.lib').offset().left+3;
          $('#jony').css({
              'position':'absolute',  'top':'129px',
              'left':  rl + 'px',    'width': '220px',
              'height': '150px',    'color': '#222222'
          }).show("fast");

					

					$('div:not(#jony,#toolbar,#page,#contents)').mouseover (function() {
            //alert ($(this).attr('id'));
						$('#jony').remove();
						$('.menu .lib').css('background-image', 'none');
					});



					// all clear
					//$('.menu > li').css('background-image', 'url(images/menus.png)');
					$('.menu .lib').css('background-image', 'url(images/menus1.png)');

					// Apply the menu click events
					$('#jony').find('li').click(function(){
						var _temp = $(this).attr( 'class' );
						switch( _temp ){
							case 'info':
									// load the magazine module
									//$('#alltable').html('').load('include/link_magazines.php');
									$.historyLoad('include/link_magazines.php');
									//window.location.href='http://www.directnews.be/dn/index.php?g=1';
									//$('#alltable').css('zoom','100%');
									return false;
								break;

							case 'blad':
									// load the magazine module
									//$('#alltable').html('').load('include/link_magazines.php');
									$.historyLoad('include/link_magazines.php');
									//window.location.href='http://www.directnews.be/dn/index.php?g=1';
									//$('#alltable').css('zoom','100%');

									return false;
								break;

							case 'zoek':
									//// load the magazine and editie zoek options
									//$('#alltable').html('').load('include/link_zoek.php');
									// load the magazine module
									//$('#alltable').html('').load('include/link_zoek.php');
									$.historyLoad('include/link_zoek.php');
									//$('#alltable').css('zoom','100%');
									return false;
								break;
						}
					});



			}, function () {

	});
	
	
	
	
	
	/*
	 * Taal
	 *
	 *
	 *
	 *
	 */
	// Magazine
	$('.lih').click (function () {
		return false;

	}).hover( function () {
					var _html;
					_html = '<div id="jony" >' +
						'<img src="images/tips1.png" width="100%" height="100%" />'  +
						'<ul style="position:absolute;top:2px;left:0px">' +
						'<li class="info" style="cursor:pointer;"><a href="index.php?g=1#include/link_magazines.php">NL</a></li>' +
						'<li class="zoek" style="cursor:pointer;"><a href="index.php?g=2#include/link_magazines.php">FR</a></li>' +
					'</ul></div>';
					$('#jony').remove();

          //alert('what..');

					$(document.body).append(_html);


          // For other browsers..... FF, Opera, Chrome
          var rl = $('.lih').offset().left+3;
          $('#jony').css({
              'position':'absolute',  'top':'129px',
              'left':  rl + 'px',    'width': '150px',
              'height': '100px',    'color': '#222222'
          }).show("fast");

					

					$('div:not(#jony,#toolbar,#page,#contents)').mouseover (function() {
            //alert ($(this).attr('id'));
						$('#jony').remove();
						$('.menu .lib').css('background-image', 'none');
					});



					// all clear
					//$('.menu > li').css('background-image', 'url(images/menus.png)');
					$('.menu .lih').css('background-image', 'url(images/menus1.png)');

					// Apply the menu click events
					/*
					$('#jony').find('li').click(function(){
						var _temp = $(this).attr( 'class' );
						switch( _temp ){
							case 'info':
									//$.historyLoad('include/link_magazines.php');
									//$.historyLoad('include/profile.php');
									window.navigate("index.php?g=1");
									
									//return false;
								break;

							case 'zoek':
									//$.historyLoad('include/link_zoek.php');
									//$.historyLoad('include/profilefr.php');
									window.navigate("index.php?g=2");
									//return false;
								break;
						}
					});
					*/


			}, function () {

	});	
	


	
	
	
	/**
	 * Offertes
	 *
	 *
	 *
	 *
	 */
	$('#menu2').click (function () {
	
			$.historyLoad('include/link_newuser.php');
			return false;
			
		}).hover( function () {
					// All menu clear
					//$('.menu > li').css('background-image', 'url(images/menus.png)');
					$('.menu > li').css('background-image', 'none');
					$('.menu .lic').css('background-image', 'url(images/menus1.png)');
					// remove pop
					$('#jony').remove();
			}, function () {
					//$('.menu .lic').css('background-image', 'url(images/menus.png)');
					$('.menu .lic').css('background-image', 'none');
	});





	/**
	 * Over onze
	 *
	 *
	 *
	 *
	 */
	$('#menu3').click (function () {
			$.historyLoad('include/over.php');
			return false;
		}).hover( function () {
				$('.menu .lid').css('background-image', 'url(images/menus1.png)');
				// remove pop
				$('#jony').remove();
			}, function () {
				//$('.menu .lid').css('background-image', 'url(images/menus.png)');
				$('.menu .lid').css('background-image', 'none');
	});

		
		
		
		
	/*
	 *  Contact
	 *
	 *
	 *
	 */
	$('#contacts').click (function () {
			$.historyLoad('include/link_contact.php');
			return false;

	}).hover( function () {
					// All menu clear
					//$('.menu > li').css('background-image', 'url(images/menus.png)');
					// Apply correct one
					$('.menu > li').css('background-image', 'none');
					$('.menu .lif').css('background-image', 'url(images/menus1.png)');
					// remove
					$('#jony').remove();

			}, function () {
					//$('.menu > li').css('background-image', 'url(images/menus.png)');
					$('.menu .lif').css('background-image', 'none');
			});		


	/**
	 * Contact us
	 *
	 *
	 *
	 *
	 */
	$('#btncontact').click(function(){
			$.historyLoad('include/link_contact.php');
			return false;
		}).hover( function () {
			//$('.menu .lid').css('background-image', 'url(images/menus1.png)');
			// remove pop
			//$('#jony').remove();
			}, function () {
				//$('.menu .lid').css('background-image', 'url(images/menus.png)');
	});

	/**
	 * Disclaimer
	 *
	 *
	 *
	 *
	 */
	$('#btndisclaimer').click(function(){
			$.historyLoad('include/link_disclaimer.php');
			return false;
		}).hover( function () {
			//$('.menu .lid').css('background-image', 'url(images/menus1.png)');
			// remove pop
				//$('#jony').remove();
			}, function () {
			  //$('.menu .lid').css('background-image', 'url(images/menus.png)');
	});





	/**
	 * FAQ
	 *
	 *
	 *
	 *
	 */
	$('#faq_menu').click (function () {
			$.historyLoad('include/link_faq.php');
			return false;	
		}).hover( function () {
				$('.menu .licc').css('background-image', 'url(images/menus1.png)');
				// remove pop
				$('#jony').remove();
			}, function () {
				//$('.menu .licc').css('background-image', 'url(images/menus.png)');\
				$('.menu .licc').css('background-image', 'none');
	});






	// Front page - newsletter / new users tasks
	// remove inline css , on fly use
	$(document.body).append (
		'<style type="text/css" >\
			.ohilit { height:90px; } .shilit { height:auto; }\
			.stablehilit { display:none; } .otablehilit { display:block; }\
		</style>'
	);
	// Default arrange
	$('#moderner').toggleClass( "ohilit" );
	
	
	
	
		/**
	 * Help tips..........................
	 * ...
	 *
	 */
	 $('[name="bedrijftelefoon"],[name="bedrijffax"],[name="ptel"],[name="pfax"],[name="pgsm"],[name="bedrijfbtw"]').focus(function(){
				$(this).next("div").css('display','block').fadeOut(5000);
		});
	 
	 
	 
	 
	
	
	
	
	
	/** 
	 * Gratis abonnment show / hide 
	 *
	 *
	 */
	var i;
	$('#register,#registers').click (function(){
		counter++;
		//$('#logs span:last-child').after('<span class="histor">signup</span>');
		//alert(modules[0]);
		
		$('#shadow').show();
		
		if ($.browser.msie){
			switch($.browser.version)
			{
				case '9.0':
					$('#tableregister').css({
						'margin-left':'-2px',
						'margin-right':'0px',
						'border': 'solid 1px #000000'
						
					});
					
					//$('#one').css('zoom','95%');

					
				break;
				
				case '8.0':
					$('#tableregister').css({
						'margin-left':'-2px',
						'margin-right':'0px',
						'border': 'solid 1px #000000',
						'zoom':'100%'
					});					
				break;
				
				case '7.0':
					$('#tableregister').css({
						'margin-left':'-2px',
						'margin-right':'0px',
						'border': 'solid 1px #000000',
						'zoom':'95%'
					});					
				break;
				
				
				default:
					$('#tableregister').css({
						'margin-left':'-2px',
						'margin-right':'0px',
						'border': 'solid 1px #000000',
						'zoom':'100%'
					});					
				break;
			}
		
		}else{
			$('#tableregister').css({
				'margin-left':'-2px',
				'margin-right':'0px',
				'border': 'solid 1px #000000'
			});
		
		}
				
		i = 0;
		
		// move to correct eye point.
		//$(window).scrollTop(120);
		
		// [transparent] - background
		{
			$('html,body').animate({scrollTop:0}, 'slow');
			var h = 'height:' + ( $(document.body).height() + screen.height ) + 'px;' ;
			var w = 'width:' + screen.width + 'px;' ;
			var html = '<div id="backs" style="z-index:99;position:absolute; top:0;background-color:black; ' + w + h + '" ></div';
			
			$('#backs').remove();
			$(document.body).append(html);
			$('#backs').css('opacity','0.80');
		}// End of transparent background 		

	});

	
	
	/**
	 * Users sing up ....
	 *
	 *
	 */
	$('.newaccount_add').click(function(){
	
	
		// All inputs are done, then allow
		var allInputs = $("#one .notnull");

		for (var _j=0 ; _j<allInputs.length; _j++){
			if (allInputs[_j].value == '') {
					$('[name="'  + allInputs[_j].name + '"]').css({'background-color': 'red'});
					alert( 'Alert! Invalide');
					return false;
			}
		}				
		
		//if ( $('#one [name="werknemers"] option:selected').val() == ''){
			//$('#one [name="werknemers"]').css({'background-color': 'red'});
			//return false;
		//}
		
		
		// A - this inputs has to be fill up
		var allInputs = $("#two .notnull");

		for (var _j=0 ; _j<allInputs.length; _j++){
			if (allInputs[_j].value == '') {
					$('[name="'  + allInputs[_j].name + '"]').css({'background-color': 'red'});
					alert( 'Alert! Invalide');
					return false;
			}
		}

		if ( $('#ftwo [name="aanspreektitel"] option:selected').val() == ''){
			$('#ftwo [name="aanspreektitel"]').css({'background-color': 'red'});
			return false;
		}
		if ( $('#ftwo [name="decision"] option:selected').val() == ''){
			$('#ftwo [name="decision"]').css({'background-color': 'red'});
			return false;
		}	
		// all inputs are checked, so then allowed next.





		
		var onbutton_press  = $(this);

		var a, b,c,d,e,f,g,h,i,j,k,l,m,n,o,p;
		// companies - adressen
		c = $('[name="bedrijfadres"]').val();
		d = $('[name="bedrijfpostcode"]').val();
		e = $('[name="bedrijfplaats"]').val();	
		var bland = $('[name="bedrijfland"]').val();		
		// contacts - adressen
		var padres = $('[name="adres"]').val();
		var postcode = $('[name="postcode"]').val();
		var plaats = $('[name="plaats"]').val();	
		var landcode = $('[name="landcode"]').val();
		
		var adres = 'adressen_comp[]=' + c +
		'&adressen_comp[]=' + d + 
		'&adressen_comp[]=' + e + 
		'&adressen_comp[]=' + bland
		;
		
		adres += '&adressen_contact[]=' + padres +
		'&adressen_contact[]=' + postcode + 
		'&adressen_contact[]=' + plaats + 
		'&adressen_contact[]=' + landcode
		;	
		
		// companies
		a = $('[name="bedrijfemail"]').val();
		 b = $('[name="bedrijfnaam"]').val();
		c = $('[name="bedrijftelefoon"]').val();
		d = $('[name="bedrijffax"]').val();
		 e = $('[name="bedrijfwebsite"]').val();
		 f = $('[name="bedrijfbtw"]').val();
		 g = $('[name="bedrijfnacecode"]').val();	
		 h = $('[name="bron"] option:selected').attr('value');	
		 i = $('[name="type"] option:selected').attr('value');
		 j = $('[name="activiteiten"]').val();	
		 k = $('[name="werknemers"] option:selected').attr('value');
		 l = $('[name="groep"]').val();
		 m = $('[name="federatie"]').val();
		
		var comp = '&comp[]=' + a +
			'&comp[]=' + b + 
			'&comp[]=' + c + 
			'&comp[]=' + d + 
			'&comp[]=' + e + 
			'&comp[]=' + f + 
			'&comp[]=' + g + 
			'&comp[]=' + h + 
			'&comp[]=' + i + 
			'&comp[]=' + j + 
			'&comp[]=' + k + 
			'&comp[]=' + l + 
			'&comp[]=' + m 
		;		
		
		// lezers
		a = $('[name="aanspreektitel"] option:selected').attr('value');	
		b = $('[name="naam"]').val();
		c = $('[name="voornaam"]').val();
		d = $('[name="ptel"]').val();
		e = $('[name="pfax"]').val();
		f = $('[name="pgsm"]').val();
		g = $('[name="pemail"]').val();
		h = $('[name="functie"]').val();
		i = $('[name="afdeling"]').val();	
		j = $('[name="decision"] option:selected').attr('value');
		k = $('[name="verzending"] option:selected').attr('value');	
		
		var extra = '';
		if ( $('[name="newsletter"]').attr('checked') == true ){ 
			extra = 'ja';
		}else{ 	extra = 'neen'; }
		
		// new electornic, post 
		var electro;
		var post;
		if ( $('[name="electronishs"]').attr('checked') == true ){ 
			electro = 'ja';
		}else{ 	electro = 'neen'; }
		
		if ( $('[name="post"]').attr('checked') == true ){ 
			post = 'ja';
		}else{ 	post = 'neen'; }		
		
		var contacts = '&cont[]=' + a +
			'&cont[]=' + b + 
			'&cont[]=' + c + 
			'&cont[]=' + d + 
			'&cont[]=' + e + 
			'&cont[]=' + f + 
			'&cont[]=' + g + 
			'&cont[]=' + h + 
			'&cont[]=' + i + 
			'&cont[]=' + j + 
			'&cont[]=' + k + 
			'&cont[]=' + extra +
			'&electronishs=' + electro +
			'&post=' + post + 
			'&taal=fr'
		;
		
		
		
		// Abonnement table 
		var abonnement = '';
		if ( $( '[name="A21"]' ).attr('checked') == true ){ 
			abonnement += '&A[]=21';
		}
		if ( $( '[name="A22"]' ).attr('checked') == true ){ 
			abonnement += '&A[]=22';
		}
		if ( $( '[name="A23"]' ).attr('checked') == true ){ 
			abonnement += '&A[]=23';
		}	
		
		
		// check some basic needs like email/firma naam, telephone etc... then allow to sign up
		
		
		// insert it
		var post = 'oper=add&' + adres + comp + contacts + abonnement ;
		
		$.ajax({
			type    : "POST",
			url     : "../../dn0/include/add_edit_del.php?model=online_signup",
			data    : post,
			async: false,
			success : function(msg){			
				$putthis = '<div style="color:white;border-top:solid 4px black; background-color:green; padding: 5px; ">';
				$putthis += msg;
				$putthis += '</div>';				
				$('#msg').show().empty().append( $putthis	);				
				// clear the input boxes.... 
				//$('.newaccount_clear').trigger('click');
				cls();
			}
		});
		
	}).hover(function(){
		// put a border
		$(this).css('border-bottom', 'solid 4px red');
	},function(){
		// remove the given underline
		$(this).css('border-bottom', 'none');
	});

	/**
	 * Users sing up ....
	 * - clear
	 *
	 */
	function cls(){

				
		//alert('clearingllll');
		// clear the input for first tab
		$('input').each(function(i,v){
			if ( $(this).attr('class') =='newaccount_add' ) {
				// button not..
				//alert( 'button' );
			}else{
				$(this).val('');
			}
		});
		
		
		$('select').each(function(i,v){
			$(this).val('');
		});
		$('textarea').each(function(i,v){
			$(this).val('');
		});
	
		
	}



	$('#menu4').click (function () {
		$('#contents').html('').load( 'include/nieuw.php' );
						 
	}).hover( function () {
					$('.menu .lie').css('background-image', 'url(images/menus1.png)' );
			}, function () {
					//$('.menu .lie').css('background-image', 'url(images/menus.png)');
					$('.menu .lie').css('background-image', 'none');
	});











	
	// select elements 
	// return select_element( 'taal' , 'index' , 'subject' , 'table1' );
	function select_element( ele_name, value, naam, table){
		var _a 		= '<select name="' + ele_name + '">';
		var _data 	= 'oper=search&table=' + table + '&value=' + value  + '&naam=' + naam; 
		// Read from cookies 
		$.ajax({
						type    : "POST",
						url     : "../../dn0/include/add_edit_del.php?model=element_select",
						data    : _data,
						async: false,						
						success : function(msg){
							_a += msg;		
						}
		});
		_a += '</select>';
		return _a;
	}
	
	// query database
	var bron = select_element('bron', 'bronid' , 'omschrijving' , 'bronnen')  ;
	var types = select_element('type', 'typeid' , 'omschrijvingnl' , 'types')  ;
	var werknemer = select_element('werknemers', 'employeeid' , 'omschrijving' , 'employees')  ;
	
	var dhr = select_element('aanspreektitel', 'titelid' , 'omschrijving' , 'aanspreektitels')  ;	
	var decisions = select_element('decision', 'decisionid' , 'omschrijvingfr' , 'decisions')  ;
	
	// input to form
	$('#brones').append( bron );
	$('#types').append( types);
	$('#werknemer').append( werknemer);
	
	$('#dhr').append( dhr);
	$('#decision').append( decisions);
	
	
	
	// Step 1, 2, 3
	
	$('#one').show();
	$('#two').hide();
	$('#three').hide();	
	
	
	$('#next').click(function(){
	
		//alert ( i );
		if (i==0){
			
				// A - this inputs has to be fill up
				var allInputs = $("#one .notnull");

				for (var _j=0 ; _j<allInputs.length; _j++){
					if (allInputs[_j].value == '') {
							$('[name="'  + allInputs[_j].name + '"]').css({'background-color': 'red'});
							alert( 'Alerte! rouge article est mise en forme');
							return false;
					}
				}				
				
				//if ( $('#one [name="werknemers"] option:selected').val() == ''){
					//$('#one [name="werknemers"]').css({'background-color': 'red'});
					//return false;
				//}

				
		
				$('#one').hide();
				$('#two').show();
				$('#three').hide();

		}
		
		if (i==1){
			
				// A - this inputs has to be fill up
				var allInputs = $("#two .notnull");

				for (var _j=0 ; _j<allInputs.length; _j++){
					if (allInputs[_j].value == '') {
							$('[name="'  + allInputs[_j].name + '"]').css({'background-color': 'red'});
							alert( 'Alerte! rouge article est mise en forme');
							return false;
					}
				}

				if ( $('#two [name="aanspreektitel"] option:selected').val() == ''){
					$('#two [name="aanspreektitel"]').css({'background-color': 'red'});
					return false;
				}
				if ( $('#two [name="decision"] option:selected').val() == ''){
					$('#two [name="decision"]').css({'background-color': 'red'});
					return false;
				}				
				
				
				
				$('#one').hide();
				$('#two').hide();
				$('#three').show();				
		}

			
		
		if (i==2){
		
				// A - this inputs has to be fill up
				var allInputs = $("#two .notnull");
	
				for (var _j=0 ; _j<allInputs.length; _j++){
					if (allInputs[_j].value == '') {
							$('[name="'  + allInputs[_j].name + '"]').css({'background-color': 'red'});
							alert( 'Alerte! rouge article est mise en forme');
							return false;
					}
				}

				if ( $('#two [name="aanspreektitel"] option:selected').val() == ''){
					$('#two [name="aanspreektitel"]').css({'background-color': 'red'});
					return false;
				}
				if ( $('#two [name="decision"] option:selected').val() == ''){
					$('#two [name="decision"]').css({'background-color': 'red'});
					return false;
				}
				
				$('#one').hide();
				$('#two').hide();
				$('#three').show();				
		}		

		i++;
		if (i>2){ i =2; }
		
	}).hover(function(){
			// put a border
			$(this).css('border-bottom', 'solid 4px red');
		},function(){
			// remove the given underline
			$(this).css('border-bottom', 'none');
		});
	
	/**
	 * Prev - for gratis abonnement
	 *
	 */
	$('#prev').click(function(){	
		//alert ( i );
		if (i==0){
				$('#one').show();
				$('#two').hide();
				$('#three').hide();

		}
		
		if (i==1){
				$('#one').show();
				$('#two').hide();
				$('#three').hide();				
		}
		
		if (i==2){
				$('#one').hide();
				$('#two').show();
				$('#three').hide();				
		}		
		
		i--;
		if (i<0){ i =0; }
	}).hover(function(){
		// put a border
		$(this).css('border-bottom', 'solid 4px red');
	},function(){
		// remove the given underline
		$(this).css('border-bottom', 'none');
	});
	
	
	/**
	 *
	 *
	 */
	$('[name="verzending"]').change(function(){
	
		
		if ( $(this).find('option:selected').val() =='prive' ){
			$('.priveadress').show();
			
		}else{
			$('.priveadress').hide();
		}
	});
	
	
	/**
	 * Close the Gratis aboncement
	 *
	 */
	$('#close').click(function(){
		$('#shadow').hide();
		$('#backs').remove();	
		$('#loginprompt').hide();
	});	



	

	$(window).unload(function(){
		if (counter > 0 ){
			//alert ('Go back: -1 ' + counter );
			//$("#myaccount").trigger('click');
			
			//return false;
		}else{
			//alert ('Go back: main page' );
			
		}
	});
	
	
	
	/**
	 * Emagazine/ Edities used this button.
	 */
	$('.request_send').click(function(){
							
		// reject if not found
		if ( (session_contactid=='undefined') || (session_contactid=='') || (session_contactid=='0') ){

			//$("#myaccount").click ( function () {
				//$('#alltable').html('').load('include/link_mijnaccount.php');
			///});	
			//$.historyLoad('include/link_mijnaccount.php');
			
			
			
				var dummylogin ='<span>Numéro de lecteur:</span> <span> <input type="text" name="users" />  </span>' + 
												'<span>Mot de passe:</span> <span> <input type="password" name="passs" /></span>' +					
												'<input type="button" id="logins" name="logins" value="Entrez" style="height:auto;" />';
												
						dummylogin+='<br/><br/> Aucun numéro de lecteur? <input type="button" id="registernew" value="Enregistrer" />';
			
				$('#iffails').empty().append(dummylogin);
				
				
				//alert();
				
				$('#logins').live('click',function() 
			  {
						var username =  $('[name="users"]').val();
						var password =  $('[name="passs"]').val();
						var post = 'oper=add&username=' + username + 
						'&password=' + password;
						
						
						
						if (username=='' || password ==''){ return false; }
						
						$.ajax({
							type    : "POST",
							url     : "../../dn0/include/add_edit_del.php?model=online_passwordcheck_new",
							data    : post,
							async: false,						
							success : function(msg){
								//alert ( msg ) ;
								if (msg.length > 0){

																	
										session_contactid = msg;
										//alert ( session_contactid ) ;
										// prepare the
										var row = '';
										var comm='';
										var opmerk =  $('.opmerks').val() ;
							
										$('#request_store').find('table tbody').each(function(i,v){
											// take the needed
											var selection = $(this).attr('id');
											var selection_split = selection.split('_');
											var bladid = selection_split[1];
											var annonce = selection_split[2];
							
												// secondloop
												if ( $(this).find('.a').attr('checked') == true ) {
													var doc = 'ja';
												}else {var doc = 'neen';}
							
												// secondloop
												if ( $(this).find('.b').attr('checked') == true) {
													var prijs = 'ja';
												}else {var prijs = 'neen';}
												// secondloop
												if ( $(this).find('.c').attr('checked') == true ) {
													var bezoek = 'ja';
												}else {var bezoek = 'neen';}
												// secondloop
												if ( $(this).find('.d').attr('checked') == true ) {
													var urgent = 'ja';
												}else {var urgent = 'neen';}
							
												// create the columns
												var secondloop = '\'neen\',\'' + urgent + '\',\'' +
												bezoek + '\',\'' + prijs + '\',\'' + doc + '\'';
							
												row += comm + '(\'0\',\'0\',\'' +
													msg + '\',\'' +
													session_date + '\',\'' +
													session_time + '\',\'' +
													annonce + '\',' +
													secondloop + ',\'' + opmerk + '\',\'neen\',\'ja\',\'' +
													bladid + '\',\'1\')';
													comm ='-00000-';
							
							
										});// end of selection
							
										// Check if he selected anything.
										if ( row==''){
											alert('Gelieve eerst een selectie te maken van de informatie die u wenst.');
							
											return false;
										}else{
							
											// send the reqeust.
											var _data = 'oper=add&values=' + row;
											//alert( row );
											row='';
							
							
											$.ajax({
												type    : "POST",
												url     : "../../dn0/include/add_edit_del.php?model=web_annonce_add",
												data    : _data,
												async: true,
												success : function(msg){
							
													$('.subtable').hide();
													$('#backs').remove();
													$('.request_selected').remove();
							
													alert ( msg);
												}//end of annonce request adding
											});// database entry end
							
							
										}//end of selection
										
			
			
			
										
										return false;
						
								}else{
									$('.reporter').empty().append('Fail: Login/password try again.').show('clip');
								}   
							}
						});
						
						
												
				});
					

				
				
			
				/* Register if no account */
				$('#registernew').click(function(){
						$('.close_cart').trigger('click');
						$('#registers').trigger('click');
				});			
			
			
			return false;
			
		}else{
			//alert ( session_contactid ) ;
			// prepare the 	
			var row = '';
			var comm='';	
			var opmerk =  $('.opmerks').val() ;
			
			$('#request_store').find('table tbody').each(function(i,v){
				// take the needed
				var selection = $(this).attr('id');
				var selection_split = selection.split('_');
				var bladid = selection_split[1];
				var annonce = selection_split[2];
				
					// secondloop
					if ( $(this).find('.a').attr('checked') == true ) {
						var doc = 'ja';
					}else { var doc = 'neen'; }						
					
					// secondloop
					if ( $(this).find('.b').attr('checked') == true) {
						var prijs = 'ja';
					}else { var prijs = 'neen'; }												
					// secondloop
					if ( $(this).find('.c').attr('checked') == true ) {
						var bezoek = 'ja';
					}else { var bezoek = 'neen'; }												
					// secondloop
					if ( $(this).find('.d').attr('checked') == true ) {
						var urgent = 'ja';
					}else { var urgent = 'neen'; }						
					
					// create the columns
					var secondloop = '\'neen\',\'' + urgent + '\',\'' + 
					bezoek + '\',\'' + prijs + '\',\'' + doc + '\'';
					// create the row
					//row += comm + '(\'0\',\'0\',\'' + 
						//session_contactid + '\',\'' + 
						//session_date + '\',\'' + 
						//session_time + '\',\'' + 	
						//annonce + '\',' + 
						//secondloop + ',"' + opmerk + '",\'neen\',\'ja\',\'' + 
						//bladid + '\',\'1\')';
						//comm =',';
					row += comm + '(\'0\',\'0\',\'' + 
						session_contactid + '\',\'' + 
						session_date + '\',\'' + 
						session_time + '\',\'' + 	
						annonce + '\',' + 
						secondloop + ',\'' + opmerk + '\',\'neen\',\'ja\',\'' + 
						bladid + '\',\'1\')';
						comm ='-00000-';
				
			});// end of selection 
			
			// Check if he selected anything.
			if ( row==''){
				alert('Gelieve eerst een selectie te maken van de informatie die u wenst.');
				
				return false;
			}else{

				// send the reqeust.
				var _data = 'oper=add&values=' + row;
				//alert( row );
				row='';
						
				
				$.ajax({
					type    : "POST",
					url     : "../../dn0/include/add_edit_del.php?model=web_annonce_add",
					data    : _data,
					async: true,						
					success : function(msg){
					
						$('.subtable').hide();
						$('#backs').remove();						
						$('.request_selected').remove();				
					
						alert ( msg);
					}//end of annonce request adding
				});// database entry end
				
				
			}//end of selection 

			
		}

	});		

