// JavaScript Document
var flag = false;
jQuery(window).load(function()
{
	//if(getCookie('email') == null)
	 {
		setTimeout('showpopup()','24000');
	 }
});

jQuery(window).scroll(function(){
	 jQuery("#popup-box")
		 .stop()

	  .animate({"top": (jQuery(window).scrollTop() + 100) + "px"}, "slow" );
});
		
 function hide_popup()
 {
	
  jQuery('#mask').hide();
 
 }
 
 function showThanks()
 {
	jQuery("#popup-form").hide();
	
	jQuery("#popup-thanks").text("Thanks for sign up!");
	jQuery("#popup-thanks").show();
 }
		 

function showpopup()
{	
	//jQuery('#popup-box').append('<iframe name="capture" id="capture" width="1" height="1" style="display:none;"  onload="if(flag) hide_popup();"}"}"></iframe>');
	
		jQuery('#from').val('');
		jQuery('#name').val('');
		jQuery('#popup-box').show();
		 flag = true;
		 jQuery('#mask').fadeTo('fast', 0.8);
		 jQuery('#popup-box').fadeTo('fast', 1.0);
		 var maskHeight = jQuery(document).height();
		 var maskWidth = jQuery(window).width();
		
		//half the screen width minus half the new window width (plus 5 pixel borders).
		iMyWidth = (window.screen.width/2) - 200 ;
		
		//half the screen height minus half the new window height (plus title and status bars).
		iMyHeight = (window.screen.height/2) - 300;
		
		jQuery('#popup-box').css({'left':iMyWidth,'top':iMyHeight});
			//Set heigth and width to exit-popup-box-div to fill up the whole screen
		jQuery('#mask').css({'width':maskWidth,'height':maskHeight});
			
		//transition effect		
		jQuery('#mask').fadeIn(1000);	
		jQuery('#mask').fadeTo("slow",0.9);	
		jQuery('#popup-box').fadeIn(2000);
			
	  
	
}
function checksubmit()
{

	var email = jQuery('#from').val(); 
	if(email == "")
	{
		alert('Please enter emai!');	
		return false;
	}
	//if(email != "")
		//setCookie('email', email);
	
}


function setCookie(key, value) {
   var expires = new Date();
   expires.setTime(expires.getTime() + 60000); 
   document.cookie = key + '=' + value + ';expires=' + expires.toUTCString();
   }

function getCookie(key) {
   var keyValue = document.cookie.match('(^|;) ?' + key + '=([^;]*)(;|$)');
   return keyValue ? keyValue[2] : null;
   }




