$(document).ready(function()	{
	
	$('p#uploadmess').hide();
	$('#careerform').hide();
	
	$('a#showform').click(function() {
		$('#careerform').show();
		
	});
	
$('a#showform1').click(function() {
		$('#careerform').show();
		
	});


	//contact form
	$("#ajax-contact-form").submit(function(){
	
	var str = $(this).serialize();
	
	   $.ajax({
	   type: "POST",
	   url: "feedback.php",
	   data: str,
	   success: function(msg){
		
	$("#note").ajaxComplete(function(event, request, settings){
	
	if(msg == 'OK') // Message Sent? Show the 'Thank You' message and hide the form
	{
	result = '<div class="notification_ok">Your message has been sent. Thank you!</div>';
	$("#fields").hide();
	}
	else
	{
	result = msg;
	}
	
	$(this).html(result);
	
	});
	
	}
	
	 });
	
	return false;
	
	});
	//end contact form
	
	
	//upload button	
	
	var button = $('#button1'), interval;
	new AjaxUpload(button,{
		action: 'upload.asp', 
		//action: 'upload.htm', 
		name: 'myfile',
		onSubmit : function(file, ext){
			// change button text, when user selects file			
			button.text('Uploading');
			
			// If you want to allow uploading only 1 file at time,
			// you can disable upload button
			this.disable();
			
			// Uploding -> Uploading. -> Uploading...
			interval = window.setInterval(function(){
				var text = button.text();
				if (text.length < 13){
					button.text(text + '.');					
				} else {
					button.text('Uploading');				
				}
			}, 200);
			
			//test for doc
			if (! (ext && /^(pdf)$/.test(ext))){
			// extension is not allowed
			alert('Error: invalid file extension');
			// cancel upload
			window.clearInterval(interval);
			this.enable();
			return false;
			}
			
		},
		onComplete: function(file, response){
			button.hide();
			
			// add file to the list
			$('p#uploadmess').show();
			$('<span></span>').appendTo('#uploadmess .files').text(file);						
		}
	});


});
