var baseUrl = 'http://cashlantis.com/'; function loadRemote(myId, remoteUrl) { $.get(baseUrl + 's5proxy.php?a=' + remoteUrl, function(r) { if (r == 'LOGIN') { location.href = baseUrl + 'login.php'; } else { $("#" + myId).html(r); $("#" + myId + " form").each(function() { var myFormId = $(this).attr('id'); var myAction = $(this).attr('action').replace('http://remote.script5.com/', baseUrl + 's5proxy.php?a='); $(this).attr('action', myAction); if ($(this).attr('rel') != 'noajax') { $(this).ajaxForm(function(r) { if (r == 1) { location.href=location.href; } else { $("#" + myFormId + " .feedback").html(r).show(); setTimeout('$("#' + myFormId + ' .feedback").html("").hide();', 5000); } }); } }); $(".remote").click(function(e) { var myHref = $(this).attr('href'); loadRemote(myId, myHref); e.preventDefault(); }); $(".dremote").click(function(e) { var myUrl = 'http://remote.script5.com' + $(this).attr('href'); location.href=myUrl; e.preventDefault(); }); $(".cancelBtn").click(function(e) { var myHref = $(this).attr('rel'); loadRemote(myId, myHref); }); } }); } $(document).ready(function() { $(".script5").each(function() { var myId = $(this).attr('id'); var myHref = $(this).attr('rel'); loadRemote(myId, myHref); }); $(".s5form").each(function() { var myFormId = $(this).attr('id'); var myAction = $(this).attr('action').replace('http://remote.script5.com/', baseUrl + 's5proxy.php?a='); // alert(myFormId + ' - ' + myAction); $(this).attr('action', myAction); $(this).ajaxForm(function(r) { if (r == 1) { location.href=baseUrl; } else { $("#" + myFormId + " .feedback").html(r).show(); setTimeout('$("#' + myFormId + ' .feedback").html("").hide();', 5000); } }); }); $.get(baseUrl + 's5proxy.php?a=users/index', function(r) { if (r !== 'LOGIN') { $(".s5logincontainer").hide(); $(".s5loggedincontainer").show(); } else { $(".s5logincontainer").show(); $(".s5loggedincontainer").hide(); } }); });