var fullscreen = true;
var curframe = window;
var counter = 0;
var dialer = "www";
var trquery = "";
var plugins = new Array();

function err(url,name,attr) {
	curframe.location.href = plugins[dialer];
	return true;
}

function trailer(tid,wnd,closeme) {
	trquery = "&tr=1";
	access(tid,wnd,closeme);
}

function trailerfp(tid,wnd,closeme) {
	trquery = "&tr=2";
	access(tid,wnd,closeme);
}

function insideframe() {
    if(top.frames.length == 0) {
        return false;
    } else {
        return true;
    }
}

function access(tid,wnd,closeme) {
    window.onerror = err;
	
    var wn = "asiandiapers";
	var p = "4481";
    var pi = "breakcode";
   
	var trailerquery = "";
    var promoquery = ""; 
    
    wn = (wn) ? wn : "pornxs";
    trailerquery = (tid) ? "tid=" + tid + trquery : "";

    if (p != "") {
    	promoquery += "p=" + p;
    }
    
    if (pi != "") {
    	if (promoquery != "") promoquery += "&";
        promoquery += "pi=" + pi;
    }
    
    if (trailerquery != "") {
    	if (promoquery != "") promoquery += "&";
        promoquery += trailerquery;
    }
        
    if (promoquery != "") promoquery = "?" + promoquery; 
	
    plugins["dialxs"] = "http://" + wn + ".isveilig.nl/" + promoquery;
  
    if (!plugins[dialer]) {
		dialer = "dialxs";
	}
	
    curframe = (wnd) ? wnd : window;
    inframe = insideframe();

    if (inframe) {
        window.open(plugins[dialer]);
    } else {
        if (fullscreen) {
            curframe.ignore = true;
            curframe.location.href= plugins[dialer];

            if (closeme) {
                window.close();
			}
			
            return fullscreen;
        }

        if (closeme) {
            window.close();
		}
    }
}

function accessps(psid,wnd,closeme) {

    window.onerror = err;

    var wn = "asiandiapers";
	var p = "4481";
    var pi = "breakcode";
	var promoquery = ""; 
    wn = (wn) ? wn : "pornxs";
    picturesetquery = (psid) ? "psid=" + psid : "";
    
	if (p != "") {
    	promoquery += "p=" + p;
    }
    
    if (pi != "") {
    	if (promoquery != "") promoquery += "&";
        promoquery += "pi=" + pi;
    }
    
    if (picturesetquery != "") {
    	if (promoquery != "") promoquery += "&";
        promoquery += picturesetquery;
    }
    
    if (promoquery != "") promoquery = "?" + promoquery; 

    plugins["dialxs"] = "http://" + wn + ".isveilig.nl/" + promoquery;
  
    if (!plugins[dialer]) {
		dialer = "dialxs";
	}
	
    curframe = (wnd) ? wnd : window;

    inframe = insideframe();

    if (inframe) {
        window.open(plugins[dialer]);
    } else {
        if (fullscreen) {
            curframe.ignore = true;
            curframe.location.href= plugins[dialer];

            if (closeme) {
                window.close();
			}
			
            return fullscreen;
        }

        if (closeme) {
            window.close();
		}
    }
}