$(document).ready(function () {
	
$('#heros').cycle({ 
    fx:    'fade', 
    speed:  2500,
	timeout: 6500,
	random: 1
 });
 
 $('#projects').cycle({ 
    fx:    'fade', 
    speed:  2500,
	timeout: 5000 
 });
 
$('#captions').cycle({
	fx: 'scrollDown',
	cleartypeNoBg: true
});

/* client login panel */

$('#client-btn').toggle(function() {
  $('#client-btn').removeClass('closed');
  $('#client-btn').addClass('opened');
  $("#client-login-wrap").animate({"top": "+=145px"}, "fast");
}, function() {
  $("#client-login-wrap").animate({"top": "-=145px"}, "fast");
  $('#client-btn').removeClass('opened');
  $('#client-btn').addClass('closed');
});

/* end client login panel */

/* custom select dropdown */

createDropDown();
            
            $(".dropdown dt a").click(function() {
                $(".dropdown dd ul").toggle();
            });

            $(document).bind('click', function(e) {
                var $clicked = $(e.target);
                if (! $clicked.parents().hasClass("dropdown"))
                    $(".dropdown dd ul").hide();
            });
                        
            $(".dropdown dd ul li a").click(function() {
                var text = $(this).html();
                $(".dropdown dt a").html(text);
                $(".dropdown dd ul").hide();
                
                var source = $("#source");
                source.val($(this).find("span.value").html())
            });
   
        
        function createDropDown(){
            var source = $("#source");
            var selected = source.find("option[selected]");
            var options = $("option", source);
            
            $("#custom-d").append('<dl id="target" class="dropdown"></dl>')
            $("#target").append('<dt><a href="javascript:void(0);">' + selected.text() + 
                '<span class="value">' + selected.val() + 
                '</span></a><div class="sbtn-arrow"></div></dt>')
            $("#target").append('<dd><ul></ul></dd>')

            options.each(function(){
                $("#target dd ul").append('<li><a href="javascript:void(0);">' + 
                    $(this).text() + '<span class="value">' + 
                    $(this).val() + '</span></a></li>');
            });
			$('#source').hide();
        }
		
		

});


/* end custom select dropdown */


/* contact form */

<!-- careers -->

function submitForm(id,form){

var str = $(id).serialize();
   $.ajax({
   type: "POST",
   url: "http://resbuild.com.au/php/"+form+"Form.php",
   data: str,
   success: function(amsg){
$("#error").ajaxComplete(function(event, request, settings){
if(amsg == 'OK') // Message Sent? Show the 'Thank You' message and hide the form
{
$('#error').hide();
$('#form-wrap').hide();
$('#thanks').show();
}
else
{
$('#error').fadeIn(800);
result = amsg;
}
$(this).html(result);
});
}
});
return false;
};
<!-- end careers -->

/* end contact form */


