document.write("<style>\n")
document.write("td.coolButton {\n")
document.write("background-color:grey;\n")
document.write("font-family: arial;\n")
document.write("font-size: 14px;\n")
document.write("width: 16px;\n")
document.write("height: 16px;\n")
document.write("font: menu;\n")
document.write("}\n")
document.write(".creatable {background-color:#CCCCCC; }\n")
document.write("</style>\n")

var m;

function movetoedit(){
	document.forms.listingform.postprocess.value = 1;
	submitListForm();
	document.forms.listingform.submit();
}

function setselval(theid,fname,astring){
	
	
	//set the text value
	if (document.all){
		if (document.all("s" + fname)){
			document.all("s" + fname).innerHTML = "<b>[" + astring + "]</b> - ";
		}	
	}
	
	// set the form variable
	var listobj = document.listingform(fname);
	if (listobj.options){
		listobj.options[listobj.options.length] = new Option(astring,theid,false,true);
	}else{
		listobj.value = theid;
	}	
	
}

function setmselval(theid,fname,astring){
		
	//set the text value
	if (document.all){
		// set the form variable
		document.frames("fr" + fname).setmselval(theid,fname,astring);
		
	}
}



function checknum(val,thelow,thehigh){
if (isNaN(val.value)){
	alert('you must enter a Numeric value between ' + thelow + " and " + thehigh);
	val.focus();
	return false;
}else{	
	if (!(thelow == thehigh)){
		if ( val.value < thelow || val.value > thehigh ){
			alert('you must enter a Numeric  value between ' + thelow + " and " + thehigh);
			val.focus();
			return false;
		}
	}
}
}

function doConfPswd() { 
	var listform = document.forms.listingform;
	if(listform.PassWord.value == listform.cPassWord.value) return true;
	else{ window.alert("Password and Confirmation are not the same"); return false;}
}



var m; 
var txt_a = new Array();

function closeit(){
  m.close(); 
}


function setafield(fieldname,val){
 if(val.indexOf('<P>') == 0) 
    val = val.slice(3);
  if(val.lastIndexOf('</P>') == val.length - 4) 
    val = val.slice(0, val.length - 4);
  document.forms.listingform[fieldname].value = val; 
}

function setafield2(fieldname,val){
  if(val.indexOf('<P>') == 0) 
    val = val.slice(3);
  if(val.lastIndexOf('</P>') == val.length - 4) 
    val = val.slice(0, val.length - 4);
  document.forms.h_form1[fieldname].value = val; 
}

 function setafield3(fieldname,val){
   frames.edit.document.all('fld_' + fieldname).innerHTML = '<P>' + val + ''; 
 }

 function getafield(fieldname){
   return document.forms.listingform[fieldname].value ; 
 }

function showtemplate(){
document.all.edit.style.width = '700px'; 
  settemplatecontent(); 
  document.all.template01.style.visibility = 'visible' ; 
}

function unshowtemplate(){
document.all.edit.style.width = '1px'; 
  document.all.template01.style.visibility = 'hidden' ; 
}

function checksize(control,maxsize){
var thestring = new String(control.value);
  if (thestring.length > maxsize){
    alert('You have exceded the maximum size for this entry : ' + maxsize + ' characters');
  }
} 

function setcontent(){
	var thehtml; 
	var i = frames.edit.document.all.length
	var thestring = new String; 
	for (j=0;j< i;j++){
		thestring = frames.edit.document.all(j).id
		if (thestring == ('fld_' + frames.edit.document.all(j).name)) {
			setafield(frames.edit.document.all(j).name,frames.edit.document.all(j).innerHTML);		
		}	
	}
	document.forms.h_form1.submit()
}	

function settemplatecontent(){
	var thehtml; 
	var i = frames.edit.document.all.length
	var thestring = new String 
	for (j=0;j< i;j++){
		thestring = frames.edit.document.all(j).name
		if ('fld_' + thestring == (frames.edit.document.all(j).id)) {
			setafield3(thestring,document.forms.listingform[thestring].value);		
		}	
	}
}	

function showtable() {
	dtable.style.display='';	
	dtable1.style.display='';	
}	
function unshowtable() {
	dtable.style.display='none';	
	dtable1.style.display='none';	
}	


function dosubmit_listForm(){
 var temp = '';
 if(document.forms.listingform.cPassWord != null){
 	if(!doConfPswd()) return false;
 }
 for(var i=0; i<mandat_f.length; i++) {
   temp = document.listingform[mandat_f[i]].value;
   if (temp == "" || temp == 0) {
     window.alert('Please complete all required fields.');
     return false;
   }
 }
 return true;
}


function submitListForm() {
	var temp = ''; temp1 = ''; temp2 = '';
	var lenStr;
	for(var i=0; i<txt_a.length; i++) {
		document.forms.listingform[txt_a[i]].blur();
		temp = document.forms.listingform[txt_a[i]].value;

		lenStr = temp.length;
		if(lenStr > 64000){
			temp1 = temp.substr(0,64000);
			temp2 = temp.substr(64000,64000);
			temp3 = temp.substr(128000);
			document.forms.listingform[txt_a[i]+'1'].value = temp1;
			document.forms.listingform[txt_a[i]+'2'].value = temp2;
			document.forms.listingform[txt_a[i]+'3'].value = temp3;
		} else {
			document.forms.listingform[txt_a[i]+'1'].value = temp;
			//alert('temp is:' + temp + ':');
		}
	}
	return true;
}



document.write('<!--#include file = "/0000/coolbuttons.js"-->')
