open_pluim = '';
var gallery_moving = false;

function open_close_pluim(div_id){
	
	if(open_pluim == ''){
		Effect.BlindDown('pluim_'+div_id);
		open_pluim = div_id;
	}else if(open_pluim != div_id){
		Effect.BlindUp('pluim_'+open_pluim);
		Effect.BlindDown('pluim_'+div_id);
		open_pluim = div_id;
	}else{
		Effect.BlindUp('pluim_'+open_pluim);
		open_pluim = '';
	}
}

function test_voucher_code(code, pluim){
	new Ajax.Updater(
	'error',
	'ajax.php',
	{
		method: 'post',
		parameters: 'page=site/ajax/test_voucher_code.php&code='+code+'&pluim='+pluim,
		requestHeaders: ['Expires', 'Thu, 17 May 2001 10:17:17 GMT', 'Cache-Control', 'no-cache, must-revalidate', 'Pragma', 'no-cache'],
		evalScripts: true
	});

}

function send_ecard(){
	new Ajax.Updater(
	'middle_column',
	'ajax.php',
	{
		method: 'post',
		parameters: 'page=site/ajax/send_ecard.php&'+Form.serialize($('ecard_form')),
		requestHeaders: ['Expires', 'Thu, 17 May 2001 10:17:17 GMT', 'Cache-Control', 'no-cache, must-revalidate', 'Pragma', 'no-cache'],
		evalScripts: true
	});
}

function save_pluim(){

	new Ajax.Updater(
	'middle_column',
	'ajax.php',
	{
		method: 'post',
		parameters: 'page=site/ajax/pluim_save.php&'+Form.serialize($('p_form')),
		requestHeaders: ['Expires', 'Thu, 17 May 2001 10:17:17 GMT', 'Cache-Control', 'no-cache, must-revalidate', 'Pragma', 'no-cache'],
		evalScripts: true
	});
}

function move_media_gallery(moving_div, showing_div, direction_left_right) {
	// moving div propertys 
	//alert(parseInt($('moving_general').offsetWidth));
	//alert(parseInt($('moving_general').offsetHeight));
	
	var width_div = parseInt($(moving_div).offsetWidth);
		
	// if gallery is moving stop else set time out for moving gallery
	if (gallery_moving) return;
    gallery_moving = true;
    setTimeout('gallery_moving = false;', 600);
	 
	// get left , top pos 
	var left_pos = parseInt($(moving_div).style.left);
	
	// bereken te bewegen afstand 
	var distance = parseInt($(showing_div).offsetWidth);
	
	// dont move outside of range left right
	if (direction_left_right != 0){
		if (direction_left_right == 1 && left_pos >= 0){ 
			if($('arrow_left')){ $('arrow_left').src = "img/pijl_l_gre.gif";}	
			if($('arrow_right')){$('arrow_right').src = "img/pijl_r.gif";}
			return 
		}
		else if (direction_left_right == -1 && left_pos <= -1 * width_div + distance){ 
			if($('arrow_left')){$('arrow_left').src = "img/pijl_l.gif";	}
			if($('arrow_right')){$('arrow_right').src = "img/pijl_r_gre.gif";}
			return 
		}
		else {
			if($('arrow_left')) {$('arrow_left').src = "img/pijl_l.gif";}
			if($('arrow_right')) {$('arrow_right').src = "img/pijl_r.gif";}
		}
		
		Effect.MoveBy(moving_div, 0, distance * direction_left_right, { duration: 0.5} );
	}
}

