function seleca(inbx)
{
var theForm=document.inbxact;
for(i=0;i<theForm.elements.length; i++)
	{
	if(theForm.elements[i].name=='messact[]')
	theForm.elements[i].checked=inbx;
	}
}
function selecb(sent)
{
var theForm=document.verzact;
for(i=0;i<theForm.elements.length; i++)
	{
	if(theForm.elements[i].name=='messact[]')
	theForm.elements[i].checked=sent;
	}
}
function selecc(saved)
{
var theForm=document.saveact;
for(i=0;i<theForm.elements.length; i++)
	{
	if(theForm.elements[i].name=='messact[]')
	theForm.elements[i].checked=saved;
	}
}
function selecd(read)
{
var theForm=document.readact;
for(i=0;i<theForm.elements.length; i++)
	{
	if(theForm.elements[i].name=='messact[]')
	theForm.elements[i].checked=read;
	}
}
function selece(imgs)
{
var theForm=document.bulk;
for(i=0;i<theForm.elements.length; i++)
	{
	if(theForm.elements[i].name=='selti[]')
	theForm.elements[i].checked=imgs;
	}
}

function pseleca(inbx)
{
var theForm=document.pinbxact;
for(i=0;i<theForm.elements.length; i++)
	{
	if(theForm.elements[i].name=='messact[]')
	theForm.elements[i].checked=inbx;
	}
}
function pselecb(sent)
{
var theForm=document.pverzact;
for(i=0;i<theForm.elements.length; i++)
	{
	if(theForm.elements[i].name=='messact[]')
	theForm.elements[i].checked=sent;
	}
}
function pselecc(saved)
{
var theForm=document.psaveact;
for(i=0;i<theForm.elements.length; i++)
	{
	if(theForm.elements[i].name=='messact[]')
	theForm.elements[i].checked=saved;
	}
}
function pselecd(read)
{
var theForm=document.preadact;
for(i=0;i<theForm.elements.length; i++)
	{
	if(theForm.elements[i].name=='messact[]')
	theForm.elements[i].checked=read;
	}
}
function pselecx(imgs)
{
var theForm=document.pbulk;
for(i=0;i<theForm.elements.length; i++)
	{
	if(theForm.elements[i].name=='pseltix[]')
	theForm.elements[i].checked=imgs;
	}
}

$(document).ready(function()
{
$(".module").fadeOut('fast',function(){$(".module").fadeIn('slow')});
$("#hoverlay").show("slide",{direction:"right"},1000);
$("#contact,#matenhulp").draggable();
var max=$('#xmax').val();
var client=$('#xclient').val();
var rurl=$('#redir').val();
	$(function()
	{
	$('#sorter,#goprosorter').sortable({
	opacity	: 0.6,
	cursor	: 'move',
	update	: function(){var order = $(this).sortable('serialize') + '&action=updateRecordsListings&k=+client';
		$.post('!!js/update.php?cl='+client,order,function(theResponse){
		$('#sorter,#goprosorter').fadeOut('slow');
		$('#sorter,#goprosorter').fadeIn('slow');
		});
		}															 
	});
	});
$('#file_upload').uploadify({
	'method'		: 'POST',
	'onSelect'		: function(){$('#file_upload').uploadifySettings('scriptData',
		{'xclient':$('#xclient').val()})},
	'uploader'		: '/!!swf/uploadify.swf',
	'script'		: '/!!js/uploader.php',
	'wmode'		: 'transparent',
	'multi'		: true,
	'sizeLimit'	: 2097152,
	'buttonImg'	: '/!!imgs/g-select.png',
	'cancelImg'	: '/!!imgs/cancel.png',
	'folder'		: '/!profiler/temp/',
	'fileDesc'		: '*.jpg;*.jpeg;*.png;*.gif;*.bmp',
	'fileExt'		: '*.jpg;*.jpeg;*.png;*.gif;*.bmp',
	'queueID'		: 'que',
	'queueSizeLimit'	: +max,
	'auto'		: false,
	'onAllComplete'	: function(){$('.floatimgs').slideUp('fast');window.location=rurl;}
	});

$("a[rel=group],a.grouped_elements").fancybox({
	'overlayShow'	: true,
	'transitionIn'	: 'fade',
	'transitionOut'	: 'fade',
	'titlePosition' 	: 'over',
	'titleFormat'	: function(title, currentArray, currentIndex, currentOpts) {
		return '<span id="fancybox-title-over"> ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '<\/span>';
		}
	});

$('body').click(function(event){
	if ($(event.target).closest('#mod,#modmenu').length == 0)
             		$('#modmenu').slideUp('fast');
    	   if ($(event.target).closest('#fot,#fotmenu').length == 0)
             		$('#fotmenu').slideUp('fast');
    	   if ($(event.target).closest('#lin,#linkmenu').length == 0)
             		$('#linkmenu').slideUp('fast');
	});
$(".title,#homeico").click(function(){
		$('#signupsel,#msearch,#psearch,#amodels,#tmodels,#signmodel,#fotografen,#tfot,#signphotographer,#links,#profiler,#gopro,#photo').hide('fast', function() {var url="index.php";window.location=url;});
	});
	$("html").mouseenter(function(){
		$('#modmenu,#fotmenu,#linkmenu').slideUp('fast');});

	$("#mod").mouseenter(function(){
		$('#fotmenu,#linkmenu').slideUp('fast');
		$('#modmenu').slideDown('fast').mouseleave(function(){
		$('#modmenu').slideUp('fast');
		});
	});
		$("#all,#mod").click(function(){
			$('#modmenu').slideUp('fast',function(){
			$('#home,#signupsel,#msearch,#psearch,#tmodels,#signmodel,#fotografen,#tfot,#signphotographer,#links,#profiler,#gopro,#photo').hide('fast',function(){var url="?p=amodels";window.location=url;});
			});
		});
		$("#topm").click(function(){
			$('#modmenu').slideUp('fast',function(){
			$('#home,#signupsel,#msearch,#psearch,#amodels,#signmodel,#fotografen,#tfot,#signphotographer,#links,#profiler,#gopro,#photo').hide('fast',function(){var url="?p=tmodels";window.location=url;});
			});
		});
		$("#msignup").click(function(){
			$('#modmenu').slideUp('fast',function(){
			$('#home,#signupsel,#msearch,#psearch,#amodels,#tmodels,#fotografen,#tfot,#signphotographer,#links,#profiler,#gopro,#photo').hide('fast',function(){var url="?p=signup";window.location=url;});
			});
		});
		$(".signup").click(function(){var url="?p=select";window.location=url;});

		$("#modelsign").click(function(){
			$('#signupsel').hide('fast',function(){var url="?p=signup";window.location=url;});
		});
		$("#photosign").click(function(){
			$('#signupsel').hide('fast',function(){var url="?p=psignup";window.location=url;});
		});

	$("#fot").mouseenter(function(){
		$('#modmenu,#linkmenu').slideUp('fast');
		$('#fotmenu').slideDown('fast').mouseleave(function(){
		$('#fotmenu').slideUp('fast');
		});
	});
		$("#allf,#fot").click(function(){
			$('#fotmenu').slideUp('fast',function(){
			$('#home,#signupsel,#msearch,#psearch,#amodels,#tmodels,#signmodel,#tfot,#signphotographer,#links,#profiler,#gopro,#photo').hide('fast',function(){var url="?p=photographers";window.location=url;});
			});
		});
		$("#topf").click(function(){
			$('#fotmenu').slideUp('fast',function(){
			$('#home,#signupsel,#msearch,#psearch,#amodels,#tmodels,#signmodel,#fotografen,#signphotographer,#links,#profiler,#gopro,#photo').hide('fast',function(){var url="?p=tfot";window.location=url;});
			});
		});
		$("#phsignup").click(function(){
			$('#fotmenu').slideUp('fast',function(){
			$('#home,#signupsel,#msearch,#psearch,#amodels,#tmodels,#signmodel,#fotografen,#tfot,#links,#profiler,#gopro,#photo').hide('fast',function(){var url="?p=psignup";window.location=url;});
			});
		});

	$("#lin").mouseenter(function(){
		$('#modmenu,#fotmenu').slideUp('fast');
		$('#linkmenu').slideDown('fast').mouseleave(function(){
		$('#linkmenu').slideUp('fast');
		});
	});
		$("#lall,#lin").click(function(){
			$('#linkmenu').slideUp('fast',function(){
			$('#home,#signupsel,#msearch,#psearch,#amodels,#tmodels,#signmodel,#fotografen,#tfot,#signphotographer,#profiler,#gopro,#photo').hide('fast',function(){var url="?p=links";window.location=url;});
			});
		});

	$("#login,#my,#myp").mouseenter(function(){
		$('#modmenu,#fotmenu,#linkmenu').slideUp('fast');
		});

	$("#login").click(function(){var url="https://bbabes-secure.argewebhosting.nl/client.php";window.location=url;});
		var id=$('.gid').val();
		var lurl="?p=profiler&pid="+id;

		$("#accprofiel").click(function(){
			$('.floatmess,.propass,.floatimgs,#promess,#proimgs,#ppass').hide('fast',function(){$('.floatpro').fadeIn('fast',function(){$(this).fadeTo("fast", 0.9);});
			$('#proinfo').show('slow');
			});
		});
			$("#pclose").click(function(){$('.floatpro').hide('fast',function(){window.location=lurl;});});

		$("#accmessages").click(function(){
			$('.floatpro,.propass,.floatimgs,#proinfo,#proimgs,#ppass').hide('fast',function(){$('.floatmess').fadeIn('fast',function(){$(this).fadeTo("fast",0.9,function(){$('#verbox,#savebox,#ireader').slideUp('fast',function(){$('#inbox').show('fast');});});});
			$('#promess').show('slow');
			});
		});
			$("#mclose").click(function(){$('.floatmess').hide('fast',function(){window.location=lurl;});});

		$("#prpass").click(function(){
			$('.floatpro,.floatmess,.floatimgs,#proinfo,#promess,#proimgs').hide('fast',function(){$('.propass').fadeIn('fast',function(){$(this).fadeTo("fast", 0.9);});
			$('#ppass').show('slow');
			});
		});
			$("#propassclose").click(function(){$('.propass').hide('fast',function(){window.location=lurl;});});

		$("#accimgs").click(function(){
			$('.floatpro,.floatmess,.propass,#proinfo,#promess,#ppass').hide('fast',function(){$('.floatimgs').fadeIn('fast',function(){$(this).fadeTo("fast", 0.9);});
			$('#proimgs').show('slow');
			});
		});
			$("#imclose").click(function(){$('.floatimgs').hide('fast',function(){window.location=lurl;});});

	$('.logged').fadeTo("fast", 0.9);
	$('#inbx,#vbox,#sbox').hover(function(){$(this).css({'background-color':'#dddddd','font-weight':'bolder','color':'orange'});},function(){ 
    	var cssObj={'background-color':'','font-weight':'','color':'#111111'} 
	$(this).css(cssObj);}); 

	$('#inbx').click(function(){$('#verbox,#savebox,#ireader,#reply').slideUp('fast',function(){$('#inbox').show('fast');});});
	$('#vbox').click(function(){$('#inbox,#savebox,#ireader,#reply').slideUp('fast',function(){$('#verbox').show('fast');});});
	$('#sbox').click(function(){$('#inbox,#verbox,#ireader,#reply').slideUp('fast',function(){$('#savebox').show('fast');});});
	$('#prreply,#creply').click(function(e){e.preventDefault();$('#ireader').slideUp('fast',function(){$('#reply').slideDown('fast');});});

	var fid=$('.fid').val();
	var furl="?p=photo&pid="+fid;

	$("#phinfo").click(function(e){
		$('.phfloatmess,.phfloatimgs,.phfloatlogo,.phfloatpass,#promess,#proimgs,#ppass,#pplogo').hide('fast',function(){$('.phfloatinfo').fadeIn('fast',function(){$(this).fadeTo("fast", 0.9);});});
		$('#proinfo').show('slow');
	});
		$("#phiclose").click(function(){$('.phfloatinfo').hide('fast',function(){window.location=furl;});});

	$("#phmessages").click(function(){
		$('.phfloatinfo,.phfloatimgs,.phfloatlogo,.phfloatpass,#proinfo,#proimgs,#ppass,#pplogo').hide('fast',function(){$('.phfloatmess').fadeIn('fast',function(){$('#verbox,#savebox,#ireader').slideUp('fast',function(){$('#inbox').show('fast');});});});
		$('#promess').show('slow');
	});
		$("#phmclose").click(function(){$('.phfloatmess').hide('fast',function(){window.location=furl;});});
		
	$("#phimgs").click(function(){
		$('.phfloatinfo,.phfloatmess,.phfloatlogo,.phfloatpass,#proinfo,#promess,#ppass,#pplogo').hide('fast',function(){$('.phfloatimgs').fadeIn('fast',function(){});});
		$('#proimgs').show('slow');
	});
		$("#phfclose").click(function(){$('.phfloatimgs').hide('fast',function(){window.location=furl;});});

	$("#phlogo").click(function(){
		$('.phfloatinfo,.phfloatmess,.phfloatimgs,.phfloatpass,#proinfo,#promess,#proimgs,#ppass').hide('fast',function(){$('.phfloatlogo').fadeIn('fast',function(){});});
		$('#pplogo').show('slow');
	});
		$("#phlclose").click(function(){$('.phfloatlogo').hide('fast',function(){window.location=furl;});});

	$("#phpass").click(function(){
		$('.phfloatinfo,.phfloatmess,.phfloatimgs,.phfloatlogo,#proinfo,#promess,#proimgs,#pplogo').hide('fast',function(){$('.phfloatpass').fadeIn('fast',function(){});});
		$('#ppass').show('slow');
	});
		$("#ppassclose").click(function(){$('.phfloatpass').hide('fast',function(){window.location=furl;});});
});
