//specify URLs to randomly select from and pop-under
var popunder=new Array()

popunder[0]="http://www.learntrapshooting.ca?id=afmvideo"
popunder[1]="http://www.allprettythings.ca?id=afmvideo"
popunder[2]="http://www.mylocalcall.com?id=afmvideo"



// These guys do not want to do business! Do not add to popups!
// popunder[3]="http://www.top_wedding_links.com" 

//popunder[0]="http://www.top100weddingsites.com/scripts/arp/rankem.cgi?id=afmvideo"
//popunder[1]="http://www.weddingtopsites.com/rank/in.php?id=afmvideo"
//popunder[3]="http://www.weddingcontests.com/scripts/arp/rankem.cgi?id=afmvideo"


//Pop-under only once per browser session? (0=no, 1=yes)
var once_per_session=1

// Specify the width and height of new popunder window (in pixels).
var width = '640';
var height = '480';

var p = 'scrollbars=yes,resizable=yes,toolbar=no,' + //these are obvious variables. set "yes" or "no".
'menubar=no,status=yes,location=no,left=320,top=240,height=' + //the location on the user's screen
height + ',width=' + width;

function get_cookie(Name) {
  var search = Name + "="
  var returnvalue = "";
  if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
    if (offset != -1) { // if cookie exists
      offset += search.length
      // set index of beginning of value
      end = document.cookie.indexOf(";", offset);
      // set index of end of cookie value
      if (end == -1)
         end = document.cookie.length;
      returnvalue=unescape(document.cookie.substring(offset, end))
      }
   }
  return returnvalue;
}

function loadornot(){
	if (get_cookie('popunder')==''){
		loadpopunder()
		document.cookie="popunder=yes"
	}
}

function loadpopunder(){
	// pop-up advertised site

	// window has a size! (for http://canada.topweddingsites.com/rank/rankem.cgi?id=afmvideo)
	// win2=window.open(popunder[Math.floor(Math.random()*(popunder.length))],"bw",p)	
	
	// popup window has default size (let windows choose) 
	win2=window.open(popunder[Math.floor(Math.random()*(popunder.length))])

	//win2.blur()

	// focus on our site
	window.focus()

	// When Contest is not current anymore comment this line
	// pop-up contest adv.
	//win2=window.open("/contest_popup.asp", "_blank", //"width=540,height=420,menubar=no,resizable=no,scrollbars=no,status=no,titlebra=no,toolbar=no")
}

