// JavaScript Document
	$(document).ready(function(){
	
		// generateSprites arguments: 
		// 1st - parent class (the main class on the parent ul), with preceding period
		// 2nd - selected prefix (eg. for a selected class of "selected-about", use "selected-" as the value)
		// 3rd - :active state toggle, set to true if you've defined :active states (and the jQuery equivalent) in your CSS
		// 4th - animation speed, in milliseconds (eg. 300 = 0.3 seconds)
		// 5th - animation style, as a string. Set to "slide" or "fade" (defaults to "fade")
		
		// example usage:
		// generateSprites(".navigation", "selected-", true, 300, "fade");
		// generateSprites(".top-nav", "position-", true, 200, "slide");
		// generateSprites(".sidebar-nav", "current-", false, 150, "fade");

		
		generateSprites(".nav", "current-", true, 600, "fade");

	});

	$(document).ready(function() {
			$("#sub-link-bar").hide();
		$("#topnav .licont a").click(function(){
			$('#scontent').fadeTo('slow', 1.0);										 
			$("#sub-link-bar").animate({
				height: "182px"					   
			},800 );
			$('#scontent').css({'visibility' : 'visible', 'display' : 'inline'});
			$('#dhead').css({'visibility' : 'visible', 'display' : 'inline'});
			$('#dmess').css({'visibility' : 'visible', 'display' : 'inline'});
			$('#pcont').css({'visibility' : 'visible', 'display' : 'inline'});
			$('#ptwit').css({'visibility' : 'visible', 'display' : 'inline'});
			$(".sub-links").hide();
			$("#sub-link-bar #hideme a.close").fadeOut(1000).fadeTo(1000, 1).fadeIn(1000);
			$(this).siblings(".sub-links").fadeIn();
		});
		$("#sub-link-bar #hideme a.close").click(function(){
			$(".sub-links").fadeOut(500);
			$("#sub-link-bar #hideme a.close").hide();
			$('#scontent').fadeTo('slow', 0.0);
			$("#sub-link-bar").animate({
				height: "0px"					   
			}, 800);		
		$('#scontent').css({'visibility' : 'hidden', 'display' : 'none'});
			$("#sub-link-bar #hideme a.close").fadeOut();
		});
		
		
	});
	
// JavaScript Document
$(document).ready(function() {
	
	//if submit button is clicked
	$('#submit').click(function () {		
		
		//Get the data from all the fields
		var name = $('input[name=name]');
		var email = $('input[name=email]');
		var company = $('input[name=company]');
		var comment = $('textarea[name=comment]');

		//Simple validation to make sure user entered something
		//If error found, add hightlight class to the text field
		if (name.val()=='') {
			name.addClass('hightlight');
			return false;
		} else name.removeClass('hightlight');
		
		if (email.val()=='') {
			email.addClass('hightlight');
			return false;
		} else email.removeClass('hightlight');

		//organize the data properly
		var data = 'name=' + name.val() + '&email=' + email.val() + '&company=' + 
		company.val() + '&comment='  + encodeURIComponent(comment.val());		

		//disabled all the text fields
		$('.ip').attr('disabled','true');
		
		//show the loading sign
		$('.loading').show();
		
		
		//start the ajax
		$.ajax({
			//this is the php file that processes the data and send mail
			url: "form/process.php",	
			
			//GET method is used
			type: "GET",

			//pass the data			
			data: data,		
			
			//Do not cache the page
			cache: false,
			
			//success
			success: function (html) {				
				//if process.php returned 1/true (send mail success)
				if (html==1) {					
					//hide the form
					$('.form').fadeOut('slow');					
					
					//show the success message
					$('.done').fadeOut(300).fadeTo(600, 1).fadeIn(1000);
					
				//if process.php returned 0/false (send mail failed)
				} else alert('Sorry, unexpected error. Please try again later.');				
			}		
		});
		
		//cancel the submit button default behaviours
		return false;
	});	
});	

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


