$(document).ready(function(){ 
    
	$("#1 a").click(function(){
		$("#security,#integration,#cost,#contact").hide();
		$("#about").show();
		$("#nav a").removeClass("selected");
		$(this).addClass("selected");
		return false;
	});	
	
	$("#2 a").click(function(){
		$("#about,#integration,#cost,#contact").hide();
		$("#security").show();
		$("#nav a").removeClass("selected");
		$(this).addClass("selected");
		return false;
	});					 

	$("#3 a").click(function(){
		$("#security,#about,#cost,#contact").hide();
		$("#integration").show();
		$("#nav a").removeClass("selected");
		$(this).addClass("selected");
		return false;
	});	
	
	$("#4 a").click(function(){
		$("#security,#about,#integration,#contact").hide();
		$("#cost").show();
		$("#nav a").removeClass("selected");
		$(this).addClass("selected");
		return false;
	});
		
	$("#5 a").click(function(){
		$("#security,#about,#integration,#cost").hide();
		$("#contact").show();
		$("#nav a").removeClass("selected");
		$(this).addClass("selected");
		return false;
	});
	
	$("#thumbs img").click(function(){
		//alert($(this).attr("title"));
		var movie = $(this).attr("rel");
		//var data="public/images/" + $(this).attr("title") + ("-large.jpg");
		playMovie(movie);
		//alert(data);
		//$("#movie img").attr('src',data);
		$(this).siblings().fadeTo(500,1); 
		$(this).fadeTo(1500,0.5);
	});
	
	$('#thumbs img:first').trigger('click');
	
});


function playMovie(mySwf){
	var fo = new FlashObject(mySwf, "movie", "480", "400", "3", "ffffff");
	fo.addParam("quality", "best");
	fo.addParam("scale", "noscale");
	fo.addParam("wmode", "transparent");								
	fo.write("movie");	
}


function submitForm(){
		$('#loader').show(); // Show the Loading...
		$('#rform').hide(); // Hide the drop down
$.post("processform.php",{name:$("#name").val(),email:$("#email").val(),enquiry:$("#enquiry").val()} ,function(data)
		{
			 clear_form_elements("#rform");	
			// alert(data);
			 $("#rform").html(data);
			 $('#loader').hide(); // Show the Loading...
			 $('#rform').show(); // Hide the drop down
			 
	   });
		return false;
			
}


function clear_form_elements(ele) {
    $(ele).find(':input').each(function() {
        switch(this.type) {
            case 'password':
            case 'select-multiple':
            case 'select-one':
            case 'text':
            case 'textarea':
                $(this).val('');
                break;
            case 'checkbox':
            case 'radio':
                this.checked = false;
        }
    });

}


rsv.onCompleteHandler =submitForm;
var rules = [];
rules.push("required,name,Please enter your name.");
rules.push("required,email,Please enter your email address.");
rules.push("valid_email,email,Please enter a valid email address.");
rules.push("required,enquiry,Please enter the enter the enquiry.");

