//alert( navigator.appCodeName + " : " + navigator.appMinorVersion + " : " + navigator.appName + " : " + navigator.appVersion + " : " + navigator.userAgent );

var myURL='http://www.sendthisnow.com/survey_300x250.htm'
var myWidth='300';
var myHeight='250';

var popV='width='+myWidth+',height='+myHeight+',titlebar=1,toolbar=0,location=0,menubar=0,';
    popV+='scrollbars=0,resizable=1,channelmode=0,directories=0,status=0'; var dz=document;

function popWindow() {
        var xwin = window.open("",'free', popV, true);
        xwin.blur();
        xwin.location=myURL;
        xwin.blur();
}

var was_here = getCookie("P1WH");

if( was_here == null ){
  document.cookie = "P1WH=TRUE";
  popWindow();//display promotion window
}


// P2WH hold the number of times we've exited a page
// each time we load the page we check to see if its been set and increment else we set it to 0
var p2whflag = getCookie("P2WH");
if ( p2whflag == null ) {
        p2whflag = 0;
} 
else {
        p2whflag = parseInt(p2whflag) + 1;
}
document.cookie = "P2WH=" + parseInt(p2whflag);


// when we exit the page only popup mini if the cookie wasn't found and we've never po
function exit() {
        //alert( parseInt(p2whflag) );
        if ( p2whflag==0 ) {
                window.open('http://www.sendthisnow.com/html/minipop.html', 'popwin0','width=400,height=300');
        }

        // reset the popup after the 5th time we don't show it
        if ( p2whflag==5 ) {
                document.cookie = "P2WH=-1" ;
        } 
        else {
                document.cookie = "P2WH=" + (parseInt(p2whflag)) ;
        }
}

// once we submit the form we make sure this never pops up - will just keep incrementing
function dostuff() {
        p2whflag = 99;
}




function getCookie(name) {
   var dc = document.cookie;
   var prefix = name + "=";
   var begin = dc.indexOf("; " + prefix);
   if (begin == -1) {
     begin = dc.indexOf(prefix);
     if (begin != 0) return null;
   } else
     begin += 2;
   var end = document.cookie.indexOf(";", begin);
   if (end == -1)
     end = dc.length;
   return unescape(dc.substring(begin + prefix.length, end));
/*
if (parseFloat(navigator.appVersion)>=4){
        var myTI=screen.height/2-myHeight/2;
        var myLI=screen.width/2-myWidth/2;popV+=',top='+myTI+',left='+myLI;
}
*/
 }












