function goLite(FRM,BTN)
{
   FRM.elements[BTN].style.backgroundColor = "#2888D8";
   FRM.elements[BTN].style.borderTopColor = "#2888D8";
   FRM.elements[BTN].style.borderBottomColor = "#2888D8";
   FRM.elements[BTN].style.borderLeftColor = "#1864D0";
   FRM.elements[BTN].style.borderRightColor = "#58A4E0";
}

function goDim(FRM,BTN)
{
   FRM.elements[BTN].style.backgroundColor = "#2878C0";
   FRM.elements[BTN].style.borderTopColor = "#2878C0";
   FRM.elements[BTN].style.borderBottomColor = "#2878C0";
   FRM.elements[BTN].style.borderLeftColor = "#1858B8";
   FRM.elements[BTN].style.borderRightColor = "#508CC0";
}


function clearSelected( objName){
  	var someNodeList = $(objName).getElementsByTagName('a');
  	var nodes = $A(someNodeList);
  
  	nodes.each(function(node){
  			node.id = null;
  		});
}

  resetFForm = function ( fname){
		var ntlist = Form.getElements(fname);
		var nlist = $A(ntlist);

		nlist.each(function(node){
      Try.these(
      		function() { node.value = ''; },
      		function() { node.innerHTTML = ''; }
      );   
      
	  });            
  }

addLoadEvent(function() {
    /// rounded corners enabled
});

////////////////////////////////////////////////////////////
//## autorefresh

var ar_executing = false;

autorefresh_auction = function ( aid, tperiod, mmode){
  can_execute = false;
  try{
    tc = new Cookie('run_automatic_refresh'); 
    if (tc.getValue()=="1") can_execute=true;
  }
  catch(e){}

  if ($('auction_indi_2') && can_execute){
    setTimeout(' autorefresh_auction_action('+aid+', '+tperiod+', '+mmode+'); ', tperiod);
  }
  else{
    ar_executing = false;
  }
}


autorefresh_auction_action = function ( aid, tperiod, mmode){
  can_execute = false;
  try{
    tc = new Cookie('run_automatic_refresh'); 
    if (tc.getValue()=="1") can_execute=true;
  }
  catch(e){}
  
  if ($('auction_indi_2') && can_execute){
    ar_executing = true;
    new Ajax.Updater('' ,'/category/show_details_autorefresh/'+aid+'?mmode='+mmode, { 
      asynchronous:true, evalScripts: true, 
      onLoading:function(request){ 
        if ($('auction_indi_2')){ 
          Element.show('auction_indi_2');
        }
      }, 
      onComplete:function(request){ 
        if ($('auction_indi_2')){ 
          Element.hide('auction_indi_2');
        }
      }   
    });
    autorefresh_auction( aid, tperiod, mmode );
  }
  else{
    ar_executing = false;
  }
}




var Cookie = Class.create();
Cookie.prototype = {
    initialize: function(name) {
        this.name = name;
    },
    
    getValue: function() {
        var start = document.cookie.indexOf( this.name + "=" );
        var len = start + this.name.length + 1;
        if ( ( !start ) && ( this.name != document.cookie.substring( 0, this.name.length ) ) ) {
            return null;
        }
        if ( start == -1 ) return null;
        var end = document.cookie.indexOf( ";", len );
        if ( end == -1 ) end = document.cookie.length;
        return unescape( document.cookie.substring( len, end ) );
    },

    setValue: function(value, expires, path, domain, secure ) {
        var today = new Date();
        today.setTime( today.getTime() );
        if ( expires ) {
            expires = expires * 1000 * 60 * 60 * 24;
        }
        var expires_date = new Date( today.getTime() + (expires) );
        document.cookie = this.name+"="+escape( value ) +
		( ( expires ) ? ";expires="+expires_date.toGMTString() : "" ) + //expires.toGMTString()
		( ( path ) ? ";path=" + path : "" ) +
		( ( domain ) ? ";domain=" + domain : "" ) +
		( ( secure ) ? ";secure" : "" );
    },

    clear: function(path, domain ) {
        if ( getCookie( this.name ) ) {
            document.cookie = this.name + "=" +
            ( ( path ) ? ";path=" + path : "") +
            ( ( domain ) ? ";domain=" + domain : "" ) +
            ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
        }
    }
}


