var stPrefix="tpcURL";
var iPreLen=6;
function isTwoPalmsLink(_1){
return (_1.length>=iPreLen&&stPrefix==_1.substring(0,iPreLen));
}
function deleteAllCookies(){
var s=document.cookie;
var i;
while((i=s.indexOf("="))>0){
var _4=s.substring(0,i);
while(_4.charAt(0)==" "||_4.charAt(0)==";"){
_4=_4.substring(1,_4.length);
}
if(isTwoPalmsLink(_4)){
deleteCookie(_4);
}
var e=s.indexOf("; ");
if(e>0){
s=s.substring(e+2,s.length);
}else{
break;
}
}
window.location.reload();
}
function showCookies(){
var re=new RegExp("; ","g");
alert(document.cookie.replace(re,"\n"));
}
function makeChanges(_7){
var _8;
var _9;
var _a;
var _b=document.getElementById("LinkEditor");
if(_b==null){
alert("We are sorry for the inconvenience, but we could not add this link.");
return false;
}
if(_b.newCookie.value!=null&&_b.newValue.value!=null){
_9=escape(_b.newValue.value);
_8=_b.newCookie.value;
while(_8.charAt(0)==" "||_8.charAt(0)==";"){
_8=_8.substring(1,_8.length);
}
_8=stPrefix+escape(_8);
createCookie(_8,_9,365);
_b.newCookie.value=_b.newValue.value="";
}
for(var i=0;i<_b.elements.length;i++){
var _d=_b.elements[i];
if(_d.type=="text"){
if(_d!=_b.newCookie&&_d!=_b.newValue){
_8=_d.name;
while(_8.charAt(0)==" "||_8.charAt(0)==";"){
_8=_8.substring(1,_8.length);
}
_8=stPrefix+escape(_8);
_9=escape(_d.value);
_a=readCookie(_8);
if(_a!=null&&_a!=_9&&_9!=null){
createCookie(_8,_9,365);
}
}
}
}
if(_7!=0){
window.location.reload();
}
}
function makeCookieTable(){
try{
var s=document.cookie;
var i;
var _10;
var _11;
var _12;
var _13;
var _14="<form id=\"LinkEditor\" method=\"post\" name=\"cookies\" onsubmit=\"return false;\">"+"<table border=\"1\"><tr bgcolor=\"#99bbff\"><th>&nbsp;</th><th>Link Name</th><th>Web Page Address</th><th>&nbsp;</th></tr>\n";
i=s.indexOf("[object]");
if(i>-1){
_11=s.indexOf(";",i+6);
if(_11>-1){
s=s.substring(_11+1,s.length);
}
}
for(_10=0;(i=s.indexOf("="))>0;s=s.substring(_11+2,s.length)){
_11=s.indexOf(";");
if(_11<0){
_11=s.length;
}
_12=s.substring(0,i);
while(_12.charAt(0)==" "){
_12=_12.substring(1,_12.length);
}
if(isTwoPalmsLink(_12)){
_10++;
_12=unescape(_12.substring(iPreLen,_12.length));
_13=s.substring(i+1,_11);
while(_13.charAt(0)==" "){
_13=_13.substring(1,_13.length);
}
_13=unescape(_13);
_14+="<tr><td align=\"center\" bgcolor=\"d7eeff\"><input type=\"button\" value=\"Delete\" onclick=\"deleteCookieRL('"+stPrefix+escape(_12)+"')\">\n";
_14+="<td align=\"center\" bgcolor=\"d7eeff\">"+_12;
_14+="<td align=\"center\"><input name=\""+_12+"\" type=\"text\" size=\"80\" value=\""+_13+"\">\n";
_14+="<td align=\"center\" bgcolor=\"d7eeff\"><input type=\"button\" value=\"Test Link\" onclick=\"testCookieURL('"+_13+"')\"></tr>\n";
}
}
if(_10==0){
_14+="<tr><td align=\"center\" bgcolor=\"d7eeff\">New:"+"</td>\n<td><input name=\"newCookie\" type=\"text\" value=\"Custom Link\" size=\"24\"></td>\n";
_14+="<td align=\"center\"><input name=\"newValue\" type=\"text\" value=\"http://www.twopalms.com/\" size=\"80\"></td>\n";
}else{
_14+="<tr><td align=\"center\" bgcolor=\"d7eeff\">New:"+"</td>\n<td><input name=\"newCookie\" type=\"text\" value=\"\" size=\"24\"></td>\n";
_14+="<td align=\"center\"><input name=\"newValue\" type=\"text\" value=\"\" size=\"80\"></td>\n";
}
_14+="<td align=\"center\" bgcolor=\"d7eeff\"><input type=\"button\" value=\"Test Link\" onclick=\"testFormURL()\"></tr>\n";
_14+="<tr bgcolor=\"d7eeff\"><td align=\"center\" colspan=\"4\">";
_14+="<input type=\"button\" value=\"Save TwoPalms Custom Links\" onclick=\"makeChanges(1)\"></td></tr>\n";
_14+="<tr bgcolor=\"d7eeff\"><td align=\"center\" colspan=\"4\">";
_14+="<input type=\"button\" value=\"Back to TwoPalms Home\" onclick=\"goHome()\"></td></tr>\n";
_14+="</table></table></form>\n";
document.write(_14);
}
catch(err){
alert("We are sorry for the inconvenience, but we could not process your request correctly.");
}
}
function goHome(){
try{
var _15=document.getElementById("LinkEditor");
if(_15!=null){
if(_15.newCookie!=null&&_15.newCookie.value!=""){
if(_15.newValue!=null&&_15.newValue.value.length>5){
var _16=confirm("Save new menu link '"+_15.newCookie.value+"' before returning to TwoPalms.com?");
if(_16){
makeChanges(0);
}
}
}
}
}
catch(err){
alert("We are sorry, but we could not update your TwoPalms custom menu links. "+err.description);
}
window.location="http://www.twopalms.com/";
}
function deleteCookieRL(_17){
deleteCookie(_17);
window.location.reload();
}
function testCookieURL(_18){
try{
alert("Attempting to open web page:\n\n"+_18);
window.open(_18,"NewWindow");
}
catch(err){
alert("We are sorry, but we could not open that web page.  Please check the URL to see if it is in the correct format.  You might want to copy a link from your browser address window and paste it here to make sure that it is correct.");
}
}
function testFormURL(){
try{
var _19=document.getElementById("LinkEditor");
if(_19==null){
alert("We are sorry for the inconvenience, but we could not test that link.");
return false;
}
if(_19.newValue.value!=null){
var s=_19.newValue.value;
if(s.length>5){
alert("Attempting to open web page:\n\n"+s);
window.open(s,"NewWindow");
}else{
alert("The text '"+s+"' does not appear to be a URL.  Please enter the correct URL for any web page.");
}
}
}
catch(err){
alert("We are sorry, but we could not open that web page.  Please verify that the URL is correct.   While visiting the web page, you can copy the web address from your browser address window and paste it here to make sure that it works.");
}
}
function viewSource(){
window.location="view-source:"+window.location.href;
}


