// js
var bgHi="#f7f7ff";
var bgLo="#ffffff";
Element.extend({
	'hide': function() {
		this.setStyles({'display':'none','visibility':'hidden'});
	},
	'show': function() {
		this.setStyles({'display':'inline','visibility':'visible'});
	},
	'toggle': function(){
            if (this.getStyle('display') != 'inline')
                this.setStyles({'display':'inline','visibility':'visible'});
            else this.setStyles({'display':'none','visibility':'hidden'});
	}
});
function setHi(el) {$(el).setStyles({backgroundColor:bgHi});}
function setLo(el) {$(el).setStyles({backgroundColor:bgLo});}
function is_defined(varname) { return (eval("typeof("+ varname +")") != "undefined"); }
if (!is_defined("elget")) { function elget(elid) { return $(elid); } }
function setPointer(theRow, theRowNum, theAction, theDefaultColor, thePointerColor, numofCols)
{
  var theCells = null;
  if((thePointerColor == '') || typeof(theRow.style) == 'undefined') 
    return false;
  if(typeof(document.getElementsByTagName) != 'undefined') 
      theCells = theRow.getElementsByTagName('td');
  else if(typeof(theRow.cells) != 'undefined') 
    theCells = theRow.cells;
  else return false;
  
  var rowCellsCnt  = theCells.length;
  if(numofCols != 0) rowCellsCnt=numofCols; 
  var domDetect    = null;
  var currentColor = null;
  var newColor     = null;

  if (typeof(window.opera) == 'undefined'
      && typeof(theCells[0].getAttribute) != 'undefined') 
    {
      currentColor = theCells[0].getAttribute('bgcolor');
      domDetect = true;
    }
  else 
    {
      currentColor = theCells[0].style.backgroundColor;
      domDetect = false;
    }
  // currentColor=theCells[0].getStyle('background-color');
  if(theAction == 'over' && thePointerColor != '') 
    newColor = thePointerColor;
  if(theAction == 'out') 
    newColor = theDefaultColor;
  if(newColor) 
    {
      var c = null;
      //for(c = 0; c < rowCellsCnt; c++) 
      //    theCells[c].setStyles({'background-color':newColor});
      if(domDetect) 
	{
	  for(c = 0; c < rowCellsCnt; c++) 
	    theCells[c].setAttribute('bgcolor', newColor, 0);
        }
        else 
	  {
            for(c = 0; c < rowCellsCnt; c++) 
	      theCells[c].style.backgroundColor = newColor;
	  }
    }
  return true;
}
function MM_preloadImages() {
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) {
 var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} }
function MM_swapImgRestore() { var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; }
function MM_openBrWindow(theURL,winName,features) { window.open(theURL,winName,features); }
function externalWindow(theURL,winName,features) { window.open(theURL,winName,features); }          
function WK_Confirm(theText,theUrl) { if(confirm(theText) == true) location.href=theUrl; return; }
function is_https() { return (self.location.href.indexOf("https://")!=-1)?(true):(false); }
function toggleSwap(el) { el.style.display=((el.style.display=='block')?'none':'block'); }
function BmHelp(site, imgid, state) { 
    var imgel=$(imgid); var el=$('BookmarksTxt'); if(! el || ! imgel) { return; } else if(state==1 && site == "favourites") { el.innerHTML='Dieses Produkt als Bookmark in Ihrem Browser hinzufügen'; imgel.style.border='1px solid #8080F0';return; } else if(state==1 && site == "twitter") { el.innerHTML='adero Design bei twitter'; imgel.style.border='1px solid #8080F0';return; } else if(state==1) { el.innerHTML='Dieses Produkt bei "'+site+'" bookmarken'; imgel.style.border='1px solid #8080F0';return; } else el.innerHTML='&nbsp;'; imgel.style.border='1px solid #D0D0D0'; }
function BookM(site, desc, pid) { 
    if(site.length==0) return; if(desc.length==0) desc='exklusive Designermöbel und Wohnaccessoires';var bmurl= encodeURIComponent('http://www.adero.de/'+pid);var bmtitle= encodeURIComponent('adero Design - '+desc);
    switch(site) {
    case 'favourites': 
        return addFav('http://www.adero.de/'+pid, 'adero Design - '+desc);
    case 'twitter': 
        return window.open('http://twitter.com/aderodesign');
    case 'blinklist': 
        return window.open('http://www.blinklist.com/index.php?Action=Blink/addblink.php&Description=&Url='+bmurl+'&Title='+bmtitle);
    case 'delicious': 
        return window.open('http://del.icio.us/post?url='+bmurl+'&title='+bmtitle);
    case 'furl': 
        return window.open('http://www.furl.net/storeIt.jsp?u='+bmurl+'&t='+bmtitle);
    case 'google': 		
        return window.open('http://www.google.com/bookmarks/mark?op=add&hl=de&bkmk='+bmurl+'&title='+bmtitle);
    case 'linkarena':	
        return window.open('http://linkarena.com/bookmarks/addlink/?url='+bmurl+'&title='+bmtitle+'&desc=&tags=');
    case 'mrwong':
        return window.open('http://www.mister-wong.de/index.php?action=addurl&bm_url='+bmurl+'&bm_description='+bmtitle);
    case 'oneview': 
        return window.open('http://beta.oneview.de/quickadd/neu/addBookmark.jsf?URL='+bmurl+'&title='+bmtitle);
    case 'yahoo': 
        return window.open('http://myweb2.search.yahoo.com/myresults/bookmarklet?u='+bmurl+'&t='+bmtitle);
    case 'yigg':
        return window.open('http://yigg.de/neu?exturl='+bmurl+'&exttitle='+bmtitle);
    case 'digg':
        return window.open('http://digg.com/submit?phase=2&url='+bmurl+'&title='+bmtitle);
    case 'webnews':
        return window.open('http://www.webnews.de/einstellen?url='+bmurl+'&title='+bmtitle);
    case 'folkd':
        return window.open('http://www.folkd.com/page/submit.html?step1_sent=1&check=page&url='+bmurl+'&title='+bmtitle);
    case 'technorati':
        return window.open('http://technorati.com/faves?add='+bmurl+'&title='+bmtitle);
    case 'reddit':
        return window.open('http://reddit.com/submit?url='+bmurl+'&title='+bmtitle);
    case 'facebook':
		return window.open('http://www.facebook.com/sharer.php?u='+bmurl+'&t='+bmtitle);
    }
}
function addFav(url, title) { if (window.sidebar) window.sidebar.addPanel(title, url,""); else if( window.external ) window.external.AddFavorite( url, title); return; }
/* cats binds */
window.addEvent('domready',function(evnt){
        $$(".mainCatsTable td[class^=mainCat]").each(function (el) { 
                if(! el.hasClass('over')) {
                    el.setStyles({cursor:"pointer"});
                    el.addEvent('mouseenter', function(e) {
                            el.addClass('over');
                        }.bindWithEvent(this));
                    el.addEvent('mouseleave', function(e) {
                            el.removeClass('over');
                        }.bindWithEvent(this));
                }
            });
    });
/* END cats binds */
/* Ucats binds */
window.addEvent('domready',function(evnt){
        if($("ucatBlock")) {
            $$("#ucatBlock div").each(function (el) { 
                    el.setStyles({cursor:"pointer"});
                    el.addEvent('mouseenter', function(e) {
                            el.addClass('over');
                        }.bindWithEvent(this));
                    el.addEvent('mouseleave', function(e) {
                            el.removeClass('over');
                        }.bindWithEvent(this));
                });
        }
    });
/* END Ucats binds */