// JavaScript Document

//MEGADROPDOWN

$(function() {
			// If no JS CSS menu will still work
			$("#menu1").removeClass("cssonly");
			
			// Find subnav menus and fade them in
			$("#menu1 li a").hover(function(){ 
				$(this).parent().find("div.wrap").fadeIn(300);
				$(this).parent().hover(function() {
				}, function() {
					// On hovering out subnav menus fade out
					$(this).parent().find("div.wrap").fadeOut(150);
				})
			});
		});
    
		$(function() {
			// If no JS CSS menu will still work
			$("#menu2").removeClass("cssonly");
			
			// Find subnav menus and fade them in
			$("#menu2 li a").hover(function(){ 
				$(this).parent().find("div.wrap").fadeIn(300);
				$(this).parent().hover(function() {
				}, function() {
					// On hovering out subnav menus fade out
					$(this).parent().find("div.wrap").fadeOut(150);
				})
			});
		});
    
 

// INPUT FIELDS FOCUS-BLUR

   function myFocus(element) {
     if (element.value == element.defaultValue) {
       element.value = '';
     }
   }
   function myBlur(element) {
     if (element.value == '') {
       element.value = element.defaultValue;
     }
   }
   
   
   // FORM CAMPAIGN MONITOR english   
   
   var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
	document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

	$(function()
	{
		$("#subForm :image").click(function() {	
			
			// First, disable the form from submitting
			$('form#subForm').submit(function() { return false; });
			
			// Grab form action
			formAction = $("form#subForm").attr("action");
			
			// Replace the xxxxx below:
			// If your form action were http://mysiteaddress.createsend.com/t/r/s/abcde/, then you'd enter "abcde" below
			emailId = "jhdljj";
			emailId = emailId.replace("/", "");
			emailId = emailId + "-" + emailId;
			
			// Validate email address with regex
			if (!checkEmail(emailId)) 
			{
				alert("Please enter a valid email address");
				return;
			}
			
			// Serialize form values to be submitted with POST
			var str = $("form#subForm").serialize();
			
			// Add form action to end of serialized data
			final = str + "&action=" + formAction;
			
			// Submit the form via ajax
			$.ajax({
				url: "../proxy.php",
				type: "POST",
				data: final,
				success: function(html){
					// If successfully submitted hides the form
					$("#theForm").hide();
					// Shows "Thanks for subscribing" div
					$("#confirmation").fadeIn("300");
					
					// Fire off Google Analytics fake pageview
					var pageTracker = _gat._getTracker("UA-2112278-3");
					pageTracker._trackPageview("/newsletter_signup");
				}
			});
		});
	});
	function checkEmail(email)
	{	
		var pattern = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		var emailVal = $("#" + email).val();
		return pattern.test(emailVal);
	}
	
	
	// FORM CAMPAIGN MONITOR francais   
   
   var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
	document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

	$(function()
	{
		$("#subFormFr :image").click(function() {	
			
			// First, disable the form from submitting
			$('form#subFormFr').submit(function() { return false; });
			
			// Grab form action
			formAction = $("form#subFormFr").attr("action");
			
			// Replace the xxxxx below:
			// If your form action were http://mysiteaddress.createsend.com/t/r/s/abcde/, then you'd enter "abcde" below
			emailId = "jkkhlr";
			emailId = emailId.replace("/", "");
			emailId = emailId + "-" + emailId;
			
			// Validate email address with regex
			if (!checkEmail(emailId)) 
			{
				alert("Please enter a valid email address");
				return;
			}
			
			// Serialize form values to be submitted with POST
			var str = $("form#subFormFr").serialize();
			
			// Add form action to end of serialized data
			final = str + "&action=" + formAction;
			
			// Submit the form via ajax
			$.ajax({
				url: "../proxy.php",
				type: "POST",
				data: final,
				success: function(html){
					// If successfully submitted hides the form
					$("#theForm").hide();
					// Shows "Thanks for subscribing" div
					$("#confirmation").fadeIn("300");
					
					// Fire off Google Analytics fake pageview
					var pageTracker = _gat._getTracker("UA-2112278-3");
					pageTracker._trackPageview("/newsletter_signup");
				}
			});
		});
	});
	function checkEmail(email)
	{	
		var pattern = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		var emailVal = $("#" + email).val();
		return pattern.test(emailVal);
	}