var currentpage = 1;
var gallery_filter = new Array();
var gallery_width = 780;
var gallery_moving = false;

function move_media_gallery(direction, length, moving_div, showing_div ) {
    if (gallery_moving) return;
    gallery_moving = true;
    setTimeout('gallery_moving = false;', 600);
	                
    left = parseInt($(moving_div).style.left);
    distance = parseInt($(showing_div).style.width);

    // dont move outside of range
    if (direction == 1 && left >= 0) return;
    if (direction == -1 && left <= -1 * length + distance) return;
                
    Effect.MoveBy(moving_div, 0, distance * direction, { duration: 0.5 } );
	
	//alert($('foto_move').style.left);
}

function show_ajax(page) {

	new Ajax.Updater(
		'main_content',
		'site/'+page,
		{
			method: 'get',
			parameters: '',
			requestHeaders: ['Expires', 'Thu, 17 May 2001 10:17:17 GMT', 'Cache-Control', 'no-cache, must-revalidate', 'Pragma', 'no-cache']
		});
}

function show_concept_devo(devol_id){

	new Ajax.Updater(
		'main_content',
		'site/concept_devolopment.php ',
		{
			method: 'post',
			parameters: '&devolop_id='+devol_id,
			requestHeaders: ['Expires', 'Thu, 17 May 2001 10:17:17 GMT', 'Cache-Control', 'no-cache, must-revalidate', 'Pragma', 'no-cache']
		});
}

function get_client(client_id) {
	
	new Ajax.Updater(
		'main_content',
		'site/clients_sub.php',
		{
			method: 'get',
			parameters: '&client_id='+client_id,
			requestHeaders: ['Expires', 'Thu, 17 May 2001 10:17:17 GMT', 'Cache-Control', 'no-cache, must-revalidate', 'Pragma', 'no-cache']
		});

}

function showpaging(page, maxpage, lengt){
	
	if(page > 0 && page <= maxpage){ 
		
		// go to page 
		page_move = currentpage - page;
		move_media_gallery(page_move, lengt ,"foto_move", "foto_visable" );
	
		// collering page
		$("paging-"+currentpage).style.background = "#c6c6c6" ;
		$("paging-"+page).style.background = "#6b6a6a" ;
		currentpage = page;
	}
}

function onback(){
		
	var left = (currentpage * gallery_width)-gallery_width; 
	$("foto_move").style.left = -left + "px";
		
	$("paging-"+1).style.background = "#c6c6c6" ;
	$("paging-"+currentpage).style.background = "#6b6a6a" ;
}


function set_gallery_gender(gender) {	
	new Ajax.Updater(
		'main_content',
		'site/model_search.php',
		{
			method: 'get',
			parameters: '&gender='+gender,
			requestHeaders: ['Expires', 'Thu, 17 May 2001 10:17:17 GMT', 'Cache-Control', 'no-cache, must-revalidate', 'Pragma', 'no-cache'],
			onComplete: function() { onback(); }
	});
}

function set_gallery_search(country, language, experience, name) {
	//alert(country + language + experience + name);	
	new Ajax.Updater(
		'main_content',
		'site/model_search.php',
		{
			method: 'get',
			parameters: '&country='+country+'&language='+language+'&ervaring='+experience+'&name='+name,
			requestHeaders: ['Expires', 'Thu, 17 May 2001 10:17:17 GMT', 'Cache-Control', 'no-cache, must-revalidate', 'Pragma', 'no-cache'],
			onComplete: function() { onback(); }
	});
	//show_gallery_ajax();
}

function show_gallery_ajax() {
	/*alert(""+value_select);*/
		new Ajax.Updater(
		'main_content',
		'site/'+gallery_filter['page'],
		{
			method: 'get',
			parameters: '&'+gallery_filter['value_name']+'='+gallery_filter['value_select'],
			requestHeaders: ['Expires', 'Thu, 17 May 2001 10:17:17 GMT', 'Cache-Control', 'no-cache, must-revalidate', 'Pragma', 'no-cache'],
			onComplete: function() { onback(); }
		});
}

function book_model(page, model_name) {

	//alert(model_name);

	new Ajax.Updater(
		'main_content',
		'site/'+page,
		{
			method: 'post',
			parameters: '&model_name='+model_name,
			requestHeaders: ['Expires', 'Thu, 17 May 2001 10:17:17 GMT', 'Cache-Control', 'no-cache, must-revalidate', 'Pragma', 'no-cache']
		});
}

function show_gallery_new(){
	
	$('search_gallery_models').style.display = 	"none";
	$('search_gallery_div').style.display = 	"";
}

function show_model(page, model_id) {
	
	$('search_gallery_models').innerHTML = '<div id="model_content_right" >Loading</div>';
	
	$('search_gallery_models').style.display = "";
	$('search_gallery_div').style.display = "none";

	new Ajax.Updater(
		'search_gallery_models',
		'site/'+page,
		{
			method: 'post',
			parameters: '&model_id='+model_id,
			requestHeaders: ['Expires', 'Thu, 17 May 2001 10:17:17 GMT', 'Cache-Control', 'no-cache, must-revalidate', 'Pragma', 'no-cache']
		});
}

function post_aanvraag() {
	new Ajax.Updater(
		'main_content',
		'site/prijsaanvraag.php' ,
		{
			method: 'post',
			evalScripts: true,
			parameters: Form.serialize('Request'),
			requestHeaders: ['Expires', 'Thu, 17 May 2001 10:17:17 GMT', 'Cache-Control', 'no-cache, must-revalidate', 'Pragma', 'no-cache']
			//onComplete: function() { nextform(); }
		});
}
function post_aanvraag2() {
	new Ajax.Updater(
		'main_content',
		'site/prijsaanvraag.php' ,
		{
			method: 'post',
			evalScripts: true,
			parameters: Form.serialize('Request2'),
			requestHeaders: ['Expires', 'Thu, 17 May 2001 10:17:17 GMT', 'Cache-Control', 'no-cache, must-revalidate', 'Pragma', 'no-cache']
			//onComplete: function() { nextform(); }
		});
}


function nextform() {
	Effect.Fade('home_main_content', {duration: 1});
	Effect.Appear('home_main_content2', {duration: 1});
}

function endform() {
	$('home_main_content').hide();
	Effect.Fade('home_main_content2', {duration: 1});
	Effect.Appear('thanx', {duration: 1});
}

function confirm() {
	Effect.Appear('confirmation', {duration: 1});
	setTimeout (hideconfirm, 5000)
	
}

function hideconfirm() {
	window.location="contact.html";
}

