ExitPopup = {
flag1:false,
flag2:false,
corner:null,
init:function(){   
  if (rei.Browser.trident && rei.Browser.version<7){
    this.sensor1 = this.createElement('img',{position:'absolute',background:'none',width:'100%',top:document.body.parentNode.scrollTop+'px',overflow:'hidden',height:'8px'});
    this.sensor1.src = '/images/spacer.gif';
    this.sensor2 = this.createElement('img',{position:'absolute',background:'none',width:'100%',top:(document.body.parentNode.scrollTop+20)+'px',overflow:'hidden',height:'20px'});
    this.sensor2.src = '/images/spacer.gif';
    this.corner = this.createElement('div',{position:'absolute',overflow:'hidden',top:document.body.parentNode.scrollTop+'px',zIndex:'999',width:'1px',height:'1px'});
    window.onscroll = function(){
      ExitPopup.sensor1.style.top = document.body.parentNode.scrollTop+'px';
      ExitPopup.sensor2.style.top = (document.body.parentNode.scrollTop+20)+'px';
      ExitPopup.corner.style.top = document.body.parentNode.scrollTop+'px';        
    }    
  }
  else {
    this.sensor1 = this.createElement('img',{position:'fixed',background:'none',width:'100%',top:'0px',overflow:'hidden',height:'8px',left:'0'});
    this.sensor1.src = '/images/spacer.gif';
    this.sensor2 = this.createElement('img',{position:'fixed',background:'none',width:'100%',top:'20px',overflow:'hidden',height:'20px',left:'0'});
    this.sensor2.src = '/images/spacer.gif';
    this.corner = this.createElement('div',{position:'fixed',overflow:'hidden',top:'0px',zIndex:'999',width:'1px',height:'1px'});
  }
  
  this.sensor1.onmouseover = function(){ExitPopup.onStep1()};
  this.sensor2.onmouseover = function(){ExitPopup.onStep2()};
  document.body.appendChild(this.sensor1);
  document.body.appendChild(this.sensor2);

  if (rei.Browser.trident){
  	 swf = 
  		'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="400" height="400" name="corner" id="corner" align="middle">'+
  		'<param name="allowScriptAccess" value="sameDomain" />'+
  		'<param name="movie" value="/images/corner.swf?img=corner2" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#ffffff" />'+
  		'</object>'+
  		'<script type="text/javascript" event="FSCommand(command,args)" for="corner">ExitPopup.doFSCommand(command,args)</script>';
  }
  else {
  	swf =
		'<embed src="/images/corner.swf?img=corner2" swLiveConnect="true" quality="high" wmode="transparent" bgcolor="#ffffff" width="400" height="400" name="corner" id="corner" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';  
  }
  this.corner.innerHTML = swf;
  document.body.appendChild(this.corner);
  
},
createElement:function(name,style){
   var el = document.createElement(name);
   for(key in style){
     if (typeof(style[key])!='function'){
       el.style[key] = style[key]; 
     }
   }
   return el;
},
onStep1:function(){
  if (this.flag2 == true){
  	this.flag1 = false;
  	this.flag2 = false;
  	this.showWindow();
  }
  else {
    this.flag1 = true;
  	this.flag2 = false;	
  }
  
},
onStep2:function(){
  if (this.flag1 == true){
    this.flag2 = false;
    this.flag1 = false;
  }
  else {
  	this.flag2 = true;
  	this.flag1 = false;
  }
},
showWindow:function(){
  var formtext = '<div style="width:600px;margin:1em auto;">'+
  				 '<h1 class="red" style="margin-top:10px;text-align: center !important;line-height:20px;"><small>Whoa!  You almost missed this once in a lifetime<br/> opportunity to let our team go to work for <u>you</u>!</small></h1>'+
                 '<p style="font-size:1.2em !important;text-align: center"><a style="font-size:1.2em !important" href="/elite/">Click here to read more about what Web 3.0 has to offer!</a></p>'+
                 '<p style=""><img src="/elite/images/label_64.png" width="64" height="64" border=0 style="float:left;margin-top:1em;margin-right: 20px;">We want everyone to take advantage of our groundbreaking "Web 3.0 Wealth" service. '+
                 'If you are ready to get started with the Web 3.0 program, but are tight on money, we have a wayfor you to get started right now for just <b>$549</b> today - that\'s a full $2,948.00 off the "regular" initial investment. '+
                 '<a href="/elite/activation/">Click here for payment plan details.</a></p>'+
  				 '</div>';
  ShowModalWindow(this.corner,'text',formtext,'Title','Payment Plan Available','width',600);
},

openCorner:function(){
  var corner = $('corner');
  try {
    //corner.TGotoFrame('switcher',1);
    this.corner.style.width  = '400px';
    this.corner.style.height = '400px';
  }
  catch(e){}
  
  
},
closeCorner:function(){
  var corner = $('corner');
  //corner.TGotoFrame('switcher',2);
},
doFSCommand:function(command,args){
  this.corner.style.width  = '1px';
  this.corner.style.height = '1px';
}

}

function corner_DoFSCommand(command,args){
  ExitPopup.doFSCommand(command,args);
}

function validateSqueezeForm(f) {
	if(f.first_name.value=="") {
	   	alert("Please Enter First name");
	   	f.first_name.focus();
	   	return false;
    }
	
	if(f.email.value==""){
		alert("Please Enter Email");
	   	f.email.focus();
   		return false;
	}
	else {
		var eid=f.email.value; 
		if (echeck(eid)==false) {
			alert("Invalid Email")
			f.email.focus();
	  		return false;
		}
		else {
			return true;
		}
	}
 }
function echeck(str) {
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1){
	   return false
	}
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   return false
	}
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
	   return false
	}
	if (str.indexOf(at,(lat+1))!=-1){
	   return false
	}
	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
	   return false
	}
	if (str.indexOf(dot,(lat+2))==-1){
	   return false
	}
	if (str.indexOf(" ")!=-1){
	   return false
	}
 	return true					
}

rei.Document.ready(function(){ExitPopup.init()}); 



