/*---------------------------------------------|
|    COMMON FUNCTIONS  ::  ENGLISH MODULE       |
|    BY PASCAL CARDINAL                        |
|    (c)2002 CYBER2000                         |
|    pascal@cyber2000.qc.ca                    |
|---------------------------------------------*/
top.exit = true;
var no=0;
var site = "36" // Define 4hardporn by default
var oldLink = true;
var rpage=new Array;
var nbpop = new Number(2);
re = /&amp\;/gi
newstr=QueryString.replace(re, "&");    // replace &amp; by &
var SplitString = newstr.substring(1).split("&")    // Split the query string into an array
var defurl=false;
var trace="";

// This array contains the list of sites that will appear when the BACK button is clicked
//rpage[0]='welcome.shtml' + QueryString;
//rpage[1]='http://exit.4hardporn.com/welcome.shtml' + QueryString;
//rpage[2]='http://exit.asia3x.com/welcome.shtml' + QueryString;
//rpage[3]='http://exit.agedream.com/welcome.shtml' + QueryString;
//rpage[4]='http://exit.toon69.com/welcome.shtml' + QueryString;
//rpage[5]='http://exit.gayvirtual.com/welcome.shtml' + QueryString;
//rpage[6]='http://exit.seek69.com';

// Resize the browser window to max width and max height
// set the doResize flag to false in case you do not want to resize the window ex .: popup windows
if (doResize==true) {
   parent.moveTo(0,0);
   parent.resizeTo(screen.availWidth,screen.availHeight);
}
// If no resize is needed, align the window in the center of the screen
if (doResize==false){
   xall = (screen.availWidth / 2);
   yall = (screen.availHeight / 2);
   self.moveTo(xall - (250), yall - (200));
}

// Load the document so that the BACK button loads another page
//function start(){
   //content.document.location='welcome.shtml' + QueryString;
   //n=no;
   //goLocation = rpage[n++];
   //no = n%10;
   //content.document.location.href = goLocation;
//}

// Find out from what site number the visitor came
for (i=0;i<SplitString.length;i++) {
  if (SplitString[i].substring(0,4) == "site") {
     site = SplitString[i].substring(5);
  }
}

// Load a popup window on exit
function ExitPopup(){
   QueryString = "?";
   for (i=0;i<SplitString.length;i++) {

      if (SplitString[i].substring(0,5) == "trace") {
         trace = SplitString[i].substring(6);
      }
      else if (SplitString[i].substring(0,6) == "popurl") {
         
         defurl = SplitString[i].substring(7);
         
         if (defurl.length>7) {
            popwidth=screen.availWidth;
            popheight=screen.availHeight;
            popresize="yes";
            popstatus="yes";
            popscroll = "yes";
            popmenubar = "yes";
            poplocationbar = "yes";
            poptoolbar = "yes";
            nbpop="-1";

            for (i=0;i<SplitString.length;i++) {

               if (SplitString[i].substring(0,8) == "popwidth") {
                  popwidth = SplitString[i].substring(9);
               }
               else if (SplitString[i].substring(0,9) == "popheight") {
                  popheight = SplitString[i].substring(10);
               }
               else if (SplitString[i].substring(0,9) == "popresize") {
                  popresize = SplitString[i].substring(10);
               }
               else if (SplitString[i].substring(0,9) == "popstatus") {
                  popstatus = SplitString[i].substring(10);
               }
               else if (SplitString[i].substring(0,9) == "popscroll") {
                  popscroll = SplitString[i].substring(10);
               }
               else if (SplitString[i].substring(0,7) == "popmenubar") {
                  popmenubar = SplitString[i].substring(8);
               }
               else if (SplitString[i].substring(0,14) == "poplocationbar") {
                  poplocationbar = SplitString[i].substring(15);
               }
               else if (SplitString[i].substring(0,10) == "poptoolbar") {
                  poptoolbar = SplitString[i].substring(11);
               }
            }
         }
         else {
           defurl=false
         }
      }

      else if (SplitString[i].substring(0,5) == "nbpop") {
         oldLink = false;
         nbpop = Number(SplitString[i].substring(6,7));

         // no more than 3 consecutive popups
         if (nbpop > "3") {
            nbpop = "3";
         }
         nb = eval("/"+nbpop+"/gi");
         nb2 = --nbpop;
         SplitString[i]=SplitString[i].replace(nb, nb2);
      }
      QueryString += SplitString[i] + "&";
   }
   
   // top.exit flag can be used to block the popup  ex .: Set on member section links
   if ( top.exit==true ) {

      // popup if popups are still remaining to be displayed
      if (nbpop != "-1") {

         // oldLink flag is set to true for compatibility with unexisting query string
         if (oldLink == true) {
            QueryString += "nbpop=1";
         }if (QueryString.search('partenaire') == '-1') {
            if (nbpop == "0")
			{
			}
			else
			{
				siteURL = String(document.location)
            	if (siteURL.search("gay") != "-1"){
               		window.open("http://www.powereraser.com/?partenaire=9612");
            	}
            	else {
               		window.open("http://www.powereraser.com/?partenaire=9612");
            	}
			 }
         }
         else {
		 	window.open(popurl+QueryString,nbpop,'resizable='+popresize+',scrollbars='+popscroll+'menubar='+popmenubar+',location='+poplocationbar+',toolbar='+poptoolbar+',width='+popwidth+',height='+popheight);
		 }
      }
      // if the user defined a URL, the defurl flag will contain the URL to be opened
      else if ( defurl!=false ) {
         window.open(defurl,'popup','resizable='+popresize+',menubar='+popmenubar+',location='+poplocationbar+',toolbar='+poptoolbar+',resize=' + popresize + ',scrollbars=' + popscroll + 'status=' + popstatus +',width='+popwidth+',height='+popheight);
      }
   }
}
	//if (siteURL.search("gay") != "-1"){
    //window.open("http://exit.nocreditcardgay.com/public/index.ncc?brokerid=29464&extlogin=86654");
    //}
    //else {
    //window.open("http://live.sex-explorer.com/?brokerid=29464&extlogin=86654");
    //}
