
//##############################################################
//EXTEND OBLONGTECH.JS
/*backcompatibility.js*/

function show(){ setStyles(arguments,{'display':'block'}); }//REDEFINED
function visibilityon(){ setStyles(arguments,{'visibility':'visible'}); }
function visibilityoff(){ setStyles(arguments,{'visibility':'hidden'}); }

//##############################################################
//CLIENT FUNCTIONS
function productpreview(department,category,productid,productcode,image){
 getElem('productinfo').innerHTML = getElem('info'+productid).innerHTML;
 getElem('productimage').innerHTML = '<img src="images/_thumbimage.php?width=394&height=391&type=preview3x2&department='+department+'&category='+category+'&image='+image+'">';
 show('productpreview');
 }
 
function fixmenuheight(){
 getElem('menudivide').style.height = getElem('menu').offsetHeight - 10 + 'px';
 }
 
function checkbox(elemID){
 if(getElem(elemID+'check').innerHTML=='yes'){
  getElem(elemID).style.backgroundImage = "url('gfx/checkbox-off.png')";
  getElem(elemID+'check').innerHTML = 'no';
  getElem(elemID+'input').checked = false;
 }
 else{
  getElem(elemID).style.backgroundImage = "url('gfx/checkbox-on.png')";
  getElem(elemID+'check').innerHTML = 'yes';
  getElem(elemID+'input').checked = true;
  }
 }

function movepreview(direction){
 var productpreview = getElem("productpreview");
 switch(direction) {
  case 'up': productpreview.style.top = '16px'; break;
  case 'left': productpreview.style.left = '16px'; break;
  case 'right': productpreview.style.left = '215px'; break;
  case 'down': productpreview.style.top = '179px'; break;
  default: break;
  }
 }

//##############################################################
//ADMIN FUNCTIONS
var uploaderhtml = '<div class="button" style="float:left;"><div class="btn-lhs">UPLOADING...PLEASE WAIT</div><div class="btn-rhs"></div></div><img src="gfx/ajax-loader2-black-bgnd.gif" style="margin:5px 6px 0px 6px;float:left;" />';
var loaderhtmllg = '<div class="button" style="float:left;"><div class="btn-lhs">LOADING...PLEASE WAIT</div><div class="btn-rhs"></div></div><img src="gfx/ajax-loader2-black-bgnd.gif" style="margin:5px 6px 0px 6px;float:left;" />';
var loaderhtmlsm = '<div class="sm-button"><div class="btn-lhs">LOADING...PLEASE WAIT</div><div class="btn-rhs"></div></div><img src="gfx/ajax-loader2-black-bgnd.gif" style="margin:0px 2px 0px 2px;float:right;" />';

var docname= "";
var url = window.location.href.toString();
docname = url.substring(url.lastIndexOf("/")+1,999);
var docnameq = docname;
if(docname.lastIndexOf("#")>0){ docname= docname.substring(0, docname.indexOf("#")); }
if(docname.lastIndexOf("?")>0){ docname= docname.substring(0, docname.indexOf("?")); }

function init(){ /**/ }

var tmpHTML = '';

function submitform(){
 openpopup(uploaderhtml);
 return true;
 }
function edititemform(nameid){
 getElem('cmsform').innerHTML = getElem(nameid).innerHTML;
 getElem('itemform').className = 'edititemform';
 getElem('btn-new').innerHTML = '<font class="button" onclick="reseteditform();">CANCEL</font><font class="button" onclick="document.forms[\'cms\'].submit();">UPDATE</font>';
 }
function deleteitem(title,table,id){
 title = 'Are you sure you wish to DELETE "'+title+'"?';
 if(confirm(title)){ ajaxload(docname,'delete='+id+'&table='+table,'',"window.location='"+docnameq+"'"); }
 }
function confirmdelete(title,url){
 title = 'Are you sure you wish to DELETE "'+title+'"?';
 if (confirm(title)){
  ajaxload(docname,url,'',"window.location='"+docnameq+"'");
  }
 }

function optional_edit(id){
 //alert(id);
 }
function deletefile(table,id,param,department,category){
 var title = 'Are you sure you wish to DELETE this file. WARNING: This operation CANNOT be undone.';
 catquery = (category!='') ? '&category='+category : "";
 if(confirm(title)){
  ajaxload(docname,'deletefile=true&table='+table+'&id='+id+'&param='+param+'&department='+department+catquery, false,"window.location='"+docnameq+"'");
  }
 }
function updatethumbs(title,id){ ajaxload(docname,'updatethumbs=true&id='+id, false,alert('Thumb Images Updated for: '+title+'.')); }
function play(){ /**/ }

//##############################################################


