 $(document).ready(function() {
   $("a").click(function() {
     var tappend = $(form).serialize();

var out_url = this.href;
var fwin = out_url.search("#N");
if (fwin == '-1'){
checklink(this.href,tappend);
}
else
{
out_url = out_url.replace("#N","");
out_url = encodeURIComponent(out_url);
etappend = encodeURIComponent(tappend);
window.open("/newwin.php?turl=" + out_url + "&etappend=" + etappend,'_blank');
}
    return false; 
   });

});


function sendoff(dest){
var tappend = $(form).serialize();
var out_url = dest;
var fwin = out_url.search("#N");
if (fwin == '-1'){
checklink(dest,tappend);
}
else
{
var out_url = dest;
out_url = out_url.replace("#N","");
out_url = encodeURIComponent(out_url);
etappend = encodeURIComponent(tappend);

window.open("/newwin.php?turl=" + out_url + "&etappend=" + etappend,'_blank');
}
     return false;
}


function pdata(destx){
var tappendx = $(form).serialize();
var out_urlx = destx;
checklinkpost(destx,tappendx);
}


function newwinoff(tgurl,tfd){
checklink(tgurl,tfd);
return false;
}

function createObject() {
var request_type;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
request_type = new ActiveXObject("Microsoft.XMLHTTP");
}else{
request_type = new XMLHttpRequest();
}
return request_type;
}




var http = createObject();

var nocache = 0;
function checklink(ourl,fdata) {
var out_url = ourl;
out_url = encodeURIComponent(out_url);

var theformdata = fdata;
nocache = Math.random();
http.open('get', '/pass.php?t=' + out_url + '&ce=' + nocache + '&' + theformdata);
http.onreadystatechange = insertReply;
http.send(null);
}

function checklinkpost(ourl,fdata) {
var out_url = ourl;
out_url = encodeURIComponent(out_url);
var theformdata = fdata;
nocache = Math.random();
$.ajax({  
type: "GET",
url: '/pass.php?t=' + out_url + '&ce=' + nocache + '&' + theformdata,
success: function(tdta){
insertReplyx(tdta);
}
});
}

function insertReply(){
if(http.readyState == 4){
var response = http.responseText;
window.location = response;
}
}

function insertReplyx(ffv){
tldata = ffv;
var thefullurl = encodeURIComponent(tldata);
$.ajax({  
type: "GET",  
url: '/post.php?t=' + thefullurl,
success: function(whasay){
offergo();
}
});
}
