﻿var time = 3000;


function addOnloadEvent(){

  if ( typeof window.addEventListener != "undefined" ) {
    window.addEventListener( "load", initTO, false );
  }
  else if ( typeof window.attachEvent != "undefined" ) {
    window.attachEvent( "onload", initTO );
  }
  else {
    if ( window.onload != null ) {
      var oldOnload = window.onload;
      window.onload = function ( e ) {
        oldOnload( e );
        window[initTO]();
      };
    }
    else {
      window.onload = initTO;
	}
}
}

// properties timeout (product_desc)

function initTO() {
    if(document.getElementById("knowmore-box")) {
	    var b = 0;
	    for (r=1;r<100;r++) {
            if (document.getElementById("opt"+r)) {
                b = b+1;
            } else {
                break;
            }
	    }
        //alert(b);
		var classname = document.getElementById("knowmore-box").className;
		//alert(classname);
		var id = Number(classname.replace('opaa',''));
		//alert(id);
		if (id < b) {
			
			var idN = id + 1;
			
			//alert(idN);
				if(document.getElementById('opt'+idN)) {
					document.getElementById("knowmore-box").className = "opaa" + idN;
					document.getElementById('opt'+id).style.display = 'none';
					document.getElementById('opt'+idN).style.display = '';
				} else {
					var idN = 1;
					document.getElementById("knowmore-box").className = "opaa" + idN;
					document.getElementById('opt'+id).style.display = 'none';
					document.getElementById('opt'+idN).style.display = '';
				}
		} else {
			var idN = 1;
			//alert(idN);
			document.getElementById("knowmore-box").className = "opaa" + idN;
			document.getElementById('opt'+id).style.display = 'none';
			document.getElementById('opt'+idN).style.display = '';
		}

		timeout = setTimeout("initTO()", time);
		
	}
}

//
addOnloadEvent();