jQuery.fn.delay = function(time, callback){
    // Empty function:
    jQuery.fx.step.delay = function(){};
    // Return meaningless animation, (will be added to queue)
    return this.animate({delay:1}, time, callback);
}
jQuery(document).ready(function(){
 
//Page Flip on hover
	jQuery("#pageflip")
	
	.hover(function() {
jQuery("#clickhere").stop()
			.delay (25)
			.fadeOut(1);
		
		jQuery("#pageflip, #peel").stop()
			.animate({
				width: '500px', 
				height: '500px'
			},{queue: false, duration:400}, {easing: 'easeInOutExpo'})
		

	jQuery(".msg_block").stop()
			.fadeIn (50)
			.animate({
				width: '500px', 
				height: '500px'
			},{queue: true, duration:350}, {easing: 'easeInOutExpo'})
			
		

		} , function() {
		jQuery("#pageflip, #peel").stop()
			.animate({
				width: '85px', 
				height: '85px',
				backgroundColor: '#fff'
			}, {queue: false, duration:250})
		
		jQuery(".msg_block").stop()
			.animate({
				width: '85px', 
				height: '85px'
			},144)
			.delay(1)
			.fadeOut (1)
		
		
		jQuery("#clickhere").stop()
			.delay ({queue: true, duration: 100})
			.fadeIn({queue: true, duration: 50});
		
		
	
	});
 
	
});


function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function read_write_cookie(){
  if(document.getElementById('membership_welcome') != null){
    getVar('Contact0Email');
  }
}

// Drop-in content box- By Dynamic Drive
// For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
// This credit MUST stay intact for use
 
var ie=document.all
var dom=document.getElementById
var ns4=document.layers
var calunits=document.layers? "" : "px"
 
var bouncelimit=32 //(must be divisible by 8)
var direction="up"

function validateform(theForm){
	var why = "";
	var why1 = "The following items need to be filled in:\n";
	if (theForm.Contact0FirstName.value == "") why += "First Name\n";
	if (theForm.Contact0LastName.value == "") why += "Last Name\n";
	if (theForm.Contact0Email.value == "") why += "Email Address\n";
	if(why != ""){
		alert(why1 + why);
		return false;
	}
	else {
                var date = new Date();
		date.setTime(date.getTime()+(730*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
                document.cookie="droppedin=yes"+expires+"; path=/";
   		return true;
	}
}

function initbox(){
        read_write_cookie();
	if (!dom&&!ie&&!ns4)
		return
	crossobj=(dom)?document.getElementById("dropin").style : ie? document.all.dropin : document.dropin
	scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
	crossobj.top=scroll_top-250+calunits
	crossobj.visibility=(dom||ie)? "visible" : "show";
	crossobj.display=(dom||ie)? "block" : "block";
	dropstart=setInterval("dropin()",50)
}
 
function dropin(){
	scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
	if (parseInt(crossobj.top)<100+scroll_top)
		crossobj.top=parseInt(crossobj.top)+40+calunits
	else{
		clearInterval(dropstart)
		bouncestart=setInterval("bouncein()",50)
	}
}
 
function bouncein(){
	crossobj.top=parseInt(crossobj.top)-bouncelimit+calunits
	if (bouncelimit<0)
		bouncelimit+=8
	bouncelimit=bouncelimit*-1
	if (bouncelimit==0){
		clearInterval(bouncestart)
	}
}
 
function dismissbox(){
	if (window.bouncestart) clearInterval(bouncestart)
		crossobj.visibility="hidden"
}
 
function truebody(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function get_cookie(Name) {
	var search = Name + "="
	var returnvalue = ""
	if (document.cookie.length > 0) {
		offset = document.cookie.indexOf(search)
		if (offset != -1) {
			offset += search.length
			end = document.cookie.indexOf(";", offset)
			if (end == -1)
				end = document.cookie.length;
			returnvalue=unescape(document.cookie.substring(offset, end))
		}
	}
	return returnvalue;
}
 
function dropornot(){
        var numdrop = get_cookie("numdrop");
	if (numdrop < 2){
                if(numdrop == "")
                  numdrop = 1;
                else 
                  numdrop = 2;

	if ((get_cookie("droppedin")=="")&&(get_cookie("dropcount")<1)){
		window.onload=initbox;
                var dropcount = get_cookie("dropcount");
                var date = new Date();
                if(dropcount == "") {
                  dropcount = 1;
                  date.setTime(date.getTime()+(10*60*1000));
                }
                if(numdrop==2){
                  dropcount = 1;
                  date.setTime(date.getTime()+(1*16*60*60*1000));
                }

		//date.setTime(date.getTime()+(7*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
                document.cookie="dropcount="+dropcount+expires+"; path=/";
                document.cookie="numdrop="+numdrop+"; path=/";

                //document.cookie="dropcount="+dropcount;
		//document.cookie="droppedin=yes"
	}
        }
}
dropornot();