<!-- Begin

var uri = "";
var urlpage = "http://www.deviantclip.com/FreeSex.html"; //default url to pop under page
var pagename = "";
var windowprops = "toolbar=1,location=1,directories=0,status=1,menubar=1,width={width},height={height},scrollbars=1,resizable=1,top=0,left=0";

function GetCookie (name) {
    var arg = name + "=";
    var alen = arg.length;
    var clen = document.cookie.length;
    var i = 0;
    while (i < clen) {
        var j = i + alen;
        if (document.cookie.substring(i, j) == arg) {
            return getCookieVal (j);
        }
        i = document.cookie.indexOf(" ", i) + 1;
        if (i == 0) {
            break;
        }
    }
    return null;
}

function SetCookie (name, value) {
    var argv = SetCookie.arguments;
    var argc = SetCookie.arguments.length;
    
    var expires = (argc > 2) ? argv[2] : null;
    var path = (argc > 3) ? argv[3] : null;
    var domain = (argc > 4) ? argv[4] : null;
    var secure = (argc > 5) ? argv[5] : false;
    
    cookiestr = name + "=" + escape (value) +
    ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
    ((path == null) ? "" : ("; path=" + path)) +
    ((domain == null) ? "" : ("; domain=" + domain)) +
    ((secure == true) ? "; secure" : "");

    document.cookie = cookiestr;
}

function DeleteCookie (name) {
    var exp = new Date();
    var cval = GetCookie (name);
    exp.setTime(exp.getTime() - 1);
    document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

var exp = new Date();
exp.setHours(23);
exp.setMinutes(59);
exp.setSeconds(59);
exp.setMilliseconds(999);
   
function getCookieVal(offset) {
    var endstr = document.cookie.indexOf (";", offset);
    if (endstr == - 1) {
        endstr = document.cookie.length;
    }
    return unescape(document.cookie.substring(offset, endstr));
}

var exit = true;

function nextripop(url, page, props) {
    if(url) {
        uri = url;
    } else {
        uri = urlpage;
    }
    if(page) {
        pagename = page;
    }
    if(props) {
        windowprops = props;
    }
    winWidth = 800;
    winHeight = 600;
    if( parseInt(navigator.appVersion) > 3 ) {
        winWidth = screen.availWidth;
        winHeight = screen.availHeight;
    }
    windowprops = windowprops.replace("{width}", winWidth).replace("{height}", winHeight);

    var count = GetCookie('adultadworldcount');
    if (count == null) {
        count = 1;
        SetCookie('adultadworldcount', count, exp, "/");

        isXPSP2 = false;
        openedWindow = null;
        if( typeof(popedWindow) == "undefined" ) {
            popedWindow = false;
        }
        if( window.SymRealWinOpen ) {
            open = SymRealWinOpen;
        }
        if( window.NS_ActualOpen ) {
            open = NS_ActualOpen;
        }
        
        if (exit) {
            /*window_handle = window.open(uri, pagename, windowprops);
            if(window_handle) {
                // popped worked
                window_handle.blur();
            } else {

                checkXPSP2();
                if( ! isXPSP2) {
                    process_pop();
                } else {*/
                    if(window.Event && document.captureEvents)
                        document.captureEvents(Event.CLICK);
                    document.onclick = process_clickpop;
                /*}
                self.focus();
                process_clickpop();
            }*/
        }
    } else {
        count ++ ;
        SetCookie('adultadworldcount', count, exp, "/");
    }
}
/*function checkXPSP2() {
    isXPSP2 = (navigator.userAgent.indexOf("SV1") != - 1);
}
function process_pop() {
    if ( ! popedWindow ) {
        // alert(uri);
        openedWindow = open(uri, pagename, windowprops);

        if(openedWindow) {
            popedWindow = true;
            self.focus();
        }
    }
}*/

function process_clickpop() {
    if ( ! popedWindow ) {
        if( ! isXPSP2) {
            // alert(uri);
            openedWindow = open(uri, pagename, windowprops);

            self.focus();
            if(openedWindow) {
                popedWindow = true;
            }
        }
    }
/*
    if( ! popedWindow) {
        if( window.Event) {
            document.captureEvents(Event.CLICK);
        }
        document.onclick = process_pop;
        self.focus();
    }*/
}
//  End -->
