	/*
 * jQuery Reveal Plugin 1.0
 * www.ZURB.com
 * Copyright 2010, ZURB
 * Free to use under the MIT license.
 * http://www.opensource.org/licenses/mit-license.php
*/


(function($) {

/*---------------------------
 Defaults for Reveal
----------------------------*/
	 
/*---------------------------
 Listener for data-reveal-id attributes
----------------------------*/

	$('a[data-reveal-id]').live('click', function(e) {
		e.preventDefault();
		var modalLocation = $(this).attr('data-reveal-id');
		$('#'+modalLocation).reveal($(this).data());
	});

/*---------------------------
 Extend and Execute
----------------------------*/

    $.fn.reveal = function(options) {
        
        
        var defaults = {  
	    	animation: 'fade', //fade, fadeAndPop, none
		    animationspeed: 300, //how fast animtions are
		    closeonbackgroundclick: true, //if you click background will modal close?
		    dismissmodalclass: 'close-reveal-modal' //the class of a button or element that will close an open modal
    	}; 
    	
        //Extend dem' options
        var options = $.extend({}, defaults, options); 
	
        return this.each(function() {
        
/*---------------------------
 Global Variables
----------------------------*/
        	var modal = $(this),
        		topMeasure  = parseInt(modal.css('top')),
				topOffset = modal.height() + topMeasure,
          		locked = false,
				modalBG = $('.reveal-modal-bg');

/*---------------------------
 Create Modal BG
----------------------------*/
			if(modalBG.length == 0) {
				modalBG = $('<div class="reveal-modal-bg" />').insertAfter(modal);
			}		    
     
/*---------------------------
 Open & Close Animations
----------------------------*/
			//Entrance Animations
			modal.bind('reveal:open', function () {
			  modalBG.unbind('click.modalEvent');
				$('.' + options.dismissmodalclass).unbind('click.modalEvent');
				if(!locked) {
					lockModal();
					if(options.animation == "fadeAndPop") {
						modal.css({'top': $(document).scrollTop()-topOffset, 'opacity' : 0, 'visibility' : 'visible'});
						modalBG.fadeIn(options.animationspeed/2);
						modal.delay(options.animationspeed/2).animate({
							"top": $(document).scrollTop()+topMeasure + 'px',
							"opacity" : 1
						}, options.animationspeed,unlockModal());					
					}
					if(options.animation == "fade") {
						modal.css({'opacity' : 0, 'visibility' : 'visible', 'top': $(document).scrollTop()+topMeasure});
						modalBG.fadeIn(options.animationspeed/2);
						modal.delay(options.animationspeed/2).animate({
							"opacity" : 1
						}, options.animationspeed,unlockModal());					
					} 
					if(options.animation == "none") {
						modal.css({'visibility' : 'visible', 'top':$(document).scrollTop()+topMeasure});
						modalBG.css({"display":"block"});	
						unlockModal()				
					}
				}
				modal.unbind('reveal:open');
			}); 	

			//Closing Animation
			modal.bind('reveal:close', function () {
			  if(!locked) {
					lockModal();
					if(options.animation == "fadeAndPop") {
						modalBG.delay(options.animationspeed).fadeOut(options.animationspeed);
						modal.animate({
							"top":  $(document).scrollTop()-topOffset + 'px',
							"opacity" : 0
						}, options.animationspeed/2, function() {
							modal.css({'top':topMeasure, 'opacity' : 1, 'visibility' : 'hidden'});
							unlockModal();
						});					
					}  	
					if(options.animation == "fade") {
						modalBG.delay(options.animationspeed).fadeOut(options.animationspeed);
						modal.animate({
							"opacity" : 0
						}, options.animationspeed, function() {
							modal.css({'opacity' : 1, 'visibility' : 'hidden', 'top' : topMeasure});
							unlockModal();
						});					
					}  	
					if(options.animation == "none") {
						modal.css({'visibility' : 'hidden', 'top' : topMeasure});
						modalBG.css({'display' : 'none'});	
					}		
				}
				modal.unbind('reveal:close');
			});     
   	
/*---------------------------
 Open and add Closing Listeners
----------------------------*/
        	//Open Modal Immediately
    	modal.trigger('reveal:open')
			
			//Close Modal Listeners
			var closeButton = $('.' + options.dismissmodalclass).bind('click.modalEvent', function () {
			  modal.trigger('reveal:close')
			});
			
			$('body').keyup(function(e) {
        		if(e.which===27){ modal.trigger('reveal:close'); } // 27 is the keycode for the Escape key
			});
			
			
/*---------------------------
 Animations Locks
----------------------------*/
			function unlockModal() { 
				locked = false;
			}
			function lockModal() {
				locked = true;
			}	
			
        });//each call
    }//orbit plugin call
})(jQuery);	
		
		
        
var win=null;

<!-- LEAD GEN - Script Verifie si le formualire a ete rempli // Permet d'interger un Set Cookie Parsonnalise -->

function SetInputTitle() {
    
	var event = document.title;	
    document.forms['aspnetForm'].elements['ctl00_centreContentPlaceHolder_formControl_LeadGenName'].value = event;
	document.forms['aspnetForm'].elements['ctl00_centreContentPlaceHolder_formControl_LeadGenName'].style.visibility = "hidden";
	}

function validMIPCOM(aspnetForm) {
		var pathname=location.pathname;
		var myDomain='/';		
		var date_exp = new Date(2012,12,31);
		var title = document.title;	

	 if (		 
		 
		(aspnetForm.ctl00$centreContentPlaceHolder$formControl$LastName.value == "") ||
		(aspnetForm.ctl00$centreContentPlaceHolder$formControl$FirstName.value == "") ||
		(aspnetForm.ctl00$centreContentPlaceHolder$formControl$EmailAddress.value == "") ||
		(aspnetForm.ctl00$centreContentPlaceHolder$formControl$CompanyName.value == "") ||
		(aspnetForm.ctl00$centreContentPlaceHolder$formControl$JobTitle == "") ||
		(aspnetForm.ctl00$centreContentPlaceHolder$formControl$Country.selected == "")
		)

   alert("Please complete fields marked in red");

else {    
		//Enregistre le cookie pour une dur?e de 24 heures
		SetTheCookie("MIPCOMExhibitorSearch","Ok",date_exp,myDomain);		
		window.parent.CloseTheModal();
  }
}
// -->

function validMIPJunior(aspnetForm) {
		var pathname=location.pathname;
		var myDomain='/';		
		var date_exp = new Date(2012,12,31);
		var title = document.title;	

	 if (		 
		 
		(aspnetForm.ctl00$centreContentPlaceHolder$formControl$LastName.value == "") ||
		(aspnetForm.ctl00$centreContentPlaceHolder$formControl$FirstName.value == "") ||
		(aspnetForm.ctl00$centreContentPlaceHolder$formControl$EmailAddress.value == "") ||
		(aspnetForm.ctl00$centreContentPlaceHolder$formControl$CompanyName.value == "") ||
		(aspnetForm.ctl00$centreContentPlaceHolder$formControl$JobTitle == "") ||
		(aspnetForm.ctl00$centreContentPlaceHolder$formControl$Country.selected == "")
		)

   alert("Please complete fields marked in red");

else {    
		//Enregistre le cookie pour une dur?e de 24 heures
		SetTheCookie("MIPJuniorExhibitorSearch","Ok",date_exp,myDomain);		
		window.parent.CloseTheModal();
  }
}
// -->

<!-- LEAD GEN - Check Cookie // Affiche / Cache le bloc en fonction de la presence du Cookie -->
function checkTheCookieMIPCOM()
{
var username=GetCookie("MIPCOMExhibitorSearch");

if (username!=null && username!="")
  { 
  }
else
  {
	  jQuery('#myModal').reveal();

  }
}

<!-- LEAD GEN - Check Cookie // Affiche / Cache le bloc en fonction de la presence du Cookie -->
function checkTheCookieMIPJunior()
{
var username=GetCookie("MIPJuniorExhibitorSearch");

if (username!=null && username!="")
  { 
  }
else
  {
	  jQuery('#myModal').reveal();

  }
}

<!-- LEAD GEN - Referme la fenêtre Modale -->
function CloseTheModal() {
var username=GetCookie("MIPCOMExhibitorSearch");
var username2=GetCookie("MIPJuniorExhibitorSearch");

if ((username!=null && username!="") || (username2!=null && username2!=""))
  { 
   jQuery('#myModal').trigger('reveal:close');
  }
else
  {
	window.location="/online-services/user-login/";  

  }
}

<!-- LEAD GEN - Get Cookie // Recupere le cookie -->
function SetTheCookie (name, value) {
	var argv=SetTheCookie.arguments;
	var argc=SetTheCookie.arguments.length;
	var expires=(argc > 2) ? argv[2] : null;
	var path=(argc > 3) ? argv[3] : null;
	var domain=(argc > 4) ? argv[4] : null;
	var secure=(argc > 5) ? argv[5] : false;
	document.cookie=name+"="+escape(value)+
		((expires==null) ? "" : ("; expires="+expires.toGMTString()))+
		((path==null) ? "" : ("; path="+path))+
		((domain==null) ? "" : ("; domain="+domain))+
		((secure==true) ? "; secure" : "");
}

function getCookieVal(offset) {
	var endstr=document.cookie.indexOf (";", offset);
	if (endstr==-1)
      		endstr=document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name) {
	var arg=name+"=";
	var alen=arg.length;
	var clen=document.cookie.length;
	var i=0;
	while (i<clen) {
		var j=i+alen;
		if (document.cookie.substring(i, j)==arg)
                        return getCookieVal (j);
                i=document.cookie.indexOf(" ",i)+1;
                        if (i==0) break;}
	return null;
}
