var el, btn, ttl, lbl, frm, mainForm, visel;
function extendClicks(c){
if(c.search(/AW_CMD=/)==0){
var a=c.split("AW_CMD=",2);
try{eval(a[1])}
catch(err){alert(err.description+" - "+c)}
return false;
}
if(c.search(/AW_LINK=/)==0){
var a=c.split("AW_LINK=",2);
try{location=a[1]}
catch(err){alert(err.description+" - "+c)}
return false;
}
return false;
}
function seekey(k){
// alert(k.keyCode);
if(k.keyCode==10){snipto("
\n");}
}
function storeCaret (El){
if (El.createTextRange){
El.caretPos = document.selection.createRange().duplicate();
}
}
function snipto(v){
if(v.search(/AW_/)==0){
return extendClicks(v); // not an insert
}
var ms;
var gt=">"; var lt="<";
v=v.replace(/</gi,'<');
mainTX.focus(mainTX.caretPos);
if (mainTX.createTextRange){ // && mainTX.caretPos
var a=v.split(gt+lt);
var caretPos=mainTX.caretPos;
if(a.length==2 && caretPos.text.length >0){
caretPos.text =a[0]+gt+caretPos.text+lt+a[1];
}else{
if(caretPos){caretPos.text=v;}
}
}else{
alert("place the cursor at the insertion point or select the text to be wrapped");
}
} /////////////////////////////////////////////
function snipport(){
if(document.forms.frm1.snips_from.value==""){
alert("a user id is required"); return false;
}
self.location='index.php?isf='+
escape(document.forms.frm1.snips_from.value);
} /////////////////////////////////////////////
function savesnip(){
document.forms.frm1.context.value="saveClicker";
document.forms.frm1.submit();
} /////////////////////////////////////////////
function prevue(){
document.forms.frm1.action="#pv";
document.forms.frm1.context.value="preview";
document.forms.frm1.submit();
} /////////////////////////////////////////////
function encodeit(){
document.forms.frm1.action="#pv";
document.forms.frm1.context.value="encode";
document.forms.frm1.submit();
} /////////////////////////////////////////////
function stripit(){
document.forms.frm1.context.value="stripit";
document.forms.frm1.submit();
} /////////////////////////////////////////////
function valid_W3(){
document.forms.frm1.action="index.php";
document.forms.frm1.target="_blank";
document.forms.frm1.context.value="validate";
document.forms.frm1.submit();
} /////////////////////////////////////////////
function postIT(){
if(doc_id){
location="/forum/post.php?action=newthread&fid=7&doc="+doc_id;
}
}
function saveit(){
if(!getCookie("nickname")){
showit("getnick",0);
return false;
}
document.forms.frm1.context.value="save";
document.forms.frm1.submit();
} /////////////////////////////////////////////
function saveas(){
document.forms.frm1.context.value="save";
document.forms.frm1.submit();
} /////////////////////////////////////////////
function loadLAST(){
if(confirm("abandon the current document?")){
document.forms.frm1.context.value="loadlast";
document.forms.frm1.submit();
}
} /////////////////////////////////////////////
function S_Click(el,d){
var a=el.id.split("_"); var num=a[1];
el.className='xpand';
btn=event.button;
ttl=el.title;
lbl=el.innerHTML;
if(btn==2){
frm=document.forms.frm1;
frm.snip_number.value=num;
frm.sniplabel.value=lbl;
frm.sniptitle.value=ttl;
showit('scpanel',1);
el.oncontextmenu=function(){return false}
}else{ // any translations here
var fxed=sct[num].replace(/s_cript_/ig,"script");
snipto(fxed);
//alert(el.id+event.button+" "+ttl+" "+lbl+" "+event.x+" "+event.y)
}
}///////////////////////////////////////////////
function showit(e,r){
if(userid=="1" && r==1){
alert("You must be logged in as a member to use this feature.");
return false;
}
self.scrollTo(0,0);
var ev=document.getElementById(e);
if(visel==e){hideit(e);return false;}
ev.style.position="absolute";
ev.style.visibility="visible";
ev.style.display="";
ev.className="";
visel=e
return false;
}
function hideit(e){
var ev=document.getElementById(e);
ev.style.visibility="hidden";
ev.style.display="none";
ev.className="nosho";
visel="";
return false;
}
function noclick(){
event.cancelBubble=true;
return "";
}
function sendremote(){
var frm=document.forms.frm1;
var fmtar=frm.target;
var fmact=frm.action
frm.target="remoterespwin";
frm.action=frm.awsave_url.value;
frm.submit();
frm.target=fmtar;
frm.action=fmact;
}
///////////////////////////////////////////////// cookies
function getCookie(name) {
var bites = document.cookie.split("; ");
for (var i=0; i < bites.length; i++) {
nextbite = bites[i].split("=");
if (nextbite[0] == name)
return unescape(nextbite[1]);
}
return "";
}
function setCookie(name, value) {
var d=new Date(); var expire=new Date(d.valueOf() + (86400000 * 365));
if (value != null && value != "")
document.cookie=name + "=" + escape(value) +
"; expires="+expire.toGMTString()+
"; path=/;";
}
// ruler code ///////////////////////////////////////////////////////
var Clk1=0;
function sholine(x,y){
document.images.vline.style.left=x-4
document.images.vline.style.top=y+document.body.scrollTop;
status=x;
}
function markline(x,y){
if(Clk1){
var n=Math.abs(x-Clk1);
alert("mark 1= "+(Clk1-11)+" mark 2="+(x-11)+" = difference="+n);
document.images.vmark.style.visibility='hidden';
Clk1=0;
}else{
document.images.vmark.style.visibility='visible';
document.images.vmark.style.top=y+document.body.scrollTop;
document.images.vmark.style.left=x-4
Clk1=x
status="mark= "+x;
}
}/////////////////////////////////////////
function lftoBR(){
var tx=document.forms.frm1.content.value;
//var dlf="\\n";
//var a=tx.match(/[\n\r]/g);
//alert(a.length);
document.forms.frm1.content.value=tx.replace(/[\n\r]{2}/g,"
\n");
return true;
}/////////////////////////////////////
function find_replace(s,r,i){
if(s=="" || r==""){
alert("both fields are required")
return false;
}
var tx=document.forms.frm1.content.value;
if(i){
eval("document.forms.frm1.content.value=tx.replace(/"+s+"/gi,r);");
}else{
eval("document.forms.frm1.content.value=tx.replace(/"+s+"/g,r);");
}
hideit('srchpanel')
return true;
}/////////////////////////////////////
var http="http://auctionwriter.com";
function showRELATED(i){
var u=http+"/tools/showdoc.php?id="+i;
var zwin=window.open(u,"popCM","width=600,height=450,left=200,top=50 menubar=no scrollbars=yes");
zwin.opener=self
}
function showCHART(){
hideit('toolspanel');
var u=http+"/tools/chart/";
var zwin=window.open(u,"popCM","width=600,height=450,left=100,top=100 menubar=no scrollbars=yes");
zwin.opener=self
}
function showTCS(){
hideit('toolspanel');
var u=http+"/tools/tcs.html";
var zwin=window.open(u,"popTCS","width=600,height=450,left=100,top=100 menubar=no scrollbars=yes");
zwin.opener=self
}
function showUPL(){
hideit('toolspanel');
var u=http+"/imgs/temp";
var zwin=window.open(u,"popUPL","width=500,height=350,left=100,top=100 menubar=no scrollbars=yes");
zwin.opener=self
}
function showBTN(){
hideit('toolspanel');
var u=http+"/tools/btnbar";
var zwin=window.open(u,"popBTN","width=600,height=380,left=100,top=100 menubar=no scrollbars=yes");
zwin.opener=self
}
function showBGS(){
hideit('toolspanel');
var u=http+"/tools/bglist.php";
var zwin=window.open(u,"popBG","width=600,height=440,left=100,top=100 menubar=no scrollbars=yes");
zwin.opener=self
} /////////////////////////
function docSTAT(){
if(doc_id==""){
alert("No stats available. The current document is empty or unsaved");
}else{
var u=http+"/tools/docstat.php?id="+doc_id; // docid global?
var zwin=window.open(u,"popDS","width=500,height=300,left=100,top=100 menubar=no scrollbars=yes");
zwin.opener=self
}
}//////////////////////
function docSTATR(doc){
var u=http+"/tools/docstat.php?id="+doc; // docid global?
var zwin=window.open(u,"popDS","width=500,height=300,left=100,top=100 menubar=no scrollbars=yes");
zwin.opener=self
}//////////////////////
function showDIVER(){
hideit('toolspanel');
var a=mainForm.content.value.split(/src=\"/i);
if(a.length >1){
if(a.length>1){var b=a[1].split(/\"/);}
if(b[0].search(/http/i)>-1 && ((b[0].search(/jpg/i)>0)) || (b[0].search(/gif/i)>0)){
var u=http+"/tools/diver/diver.php?url="+escape(b[0]);
zwin=window.open(u,"popDive","width=500,height=400,left=100,top=100, menubar=no, scrollbars=no");
zwin.opener=self
}else{
alert("could not identify a jpg or gif image link in the current document!\\n(you can upload a temporary image for this tool)");
}
}else{
alert("the current document is empty");
}
} /////////////////////////
function insertThis(ttxt){ // callback from external tools
// checking ??
snipto(ttxt);
} /////////////////////////////////////////////////