function FlashFix() {
   if (document.getElementsByTagName("object")) {
      theObjects = document.getElementsByTagName("object"); 
      for (var i = 0; i < theObjects.length; i++) { 
          theObjects[i].outerHTML = theObjects[i].outerHTML; 
        }
    }
}


function Zoom() {
   var links = document.getElementsByTagName("a");
   for (var i=0; i< links.length; i++) {

      if (links[i].className.match("zoom")) {
          links[i].onclick = function() {
	         var imgId = this.getAttribute("href");
	         var divvy = /(.*)\/(.*)/;
	         var result = imgId.match(divvy);
	         var image = result[2];
		
		     var imgStats = this.getAttribute("rel");
		     var fivvy = /(\d*)#(\d*)/;
		     var imgresult = imgStats.match(fivvy);
		     var imgWidth = imgresult[1];
		     var imgHeight = imgresult[2];
		
		     var imgAlt = this.getAttribute("alt");
		
	         var zoomed = '<div class="zoom" id="closeform"><img src="./images/'+image+'" width="'+imgWidth+'" height="'+imgHeight+ '" alt="'+imgAlt+'" title="Click to close" /></div>';
		
		     var imgWidth = parseInt(imgWidth);
		     var booWidth = imgWidth + 40;
		     var lefty = (document.body.clientWidth - booWidth)/2;
		     if (lefty <= 0) { lefty = 0;}
		
		     var imgHeight = parseInt(imgHeight);
		     var booHeight = imgHeight + 20;
		     var topy = (document.body.clientHeight - booHeight)/2;
		     if (topy <= 0) { topy = 0;}
		
		     var boo = document.getElementById("zoomed");
             boo.style.position = 'absolute';
             boo.style.left = lefty+'px'; 
            // boo.style.top = topy+'px';
             boo.style.background = 'url("http://www.picotech.com/images/closex.png") top right no-repeat #F1F1F1';
             boo.innerHTML = zoomed;
             boo.style.display = "block";
	
             // close form
            var closeform = document.getElementById("closeform");
  
            closeform.onclick = function() {
               boo.style.display = "none";
	           return false;
	           }

		    return false;
            }
        }
    }
   
}


function Zebra() {
var even = false;
  
    var evenColor = arguments[1] ? arguments[1] : "#FBF9F9"; 
    var oddColor = arguments[2] ? arguments[2] : "#EBF5FF";
  
    var tables = document.getElementsByTagName("table");
    for (var i=0; i< tables.length; i++) {

        if (tables[i].className.match("specs")) {
    
        var tbodies = tables[i].getElementsByTagName("tbody");
		

          for (var h = 0; h < tbodies.length; h++) {
             var trs = tbodies[h].getElementsByTagName("tr");
 
             for (var k = 0; k < trs.length; k++) {

                 var tds = trs[k].getElementsByTagName("td");
                 var ths = trs[k].getElementsByTagName("th");

                 for (var j = 0; j < tds.length; j++) {
        
                    var mytd = tds[j];
					 mytd.style.backgroundColor = even ? evenColor : oddColor;  
                     }
					 
                 for (var j = 0; j < ths.length; j++) {
                     var mytd = ths[j];
                     mytd.style.backgroundColor = even ? evenColor : oddColor;
                     }
			
				
        
                 even =  ! even;
             }
	     }
	  }
    }
}


function JLinks() {

   var imgs = document.getElementsByTagName("img");
   for (var i=0; i< imgs.length; i++) {
      if (imgs[i].className.match("jlink")) {
	  imgs[i].style.cursor = "pointer";
	     imgs[i].onclick = function() {
		     var gourl = this.getAttribute("title");
			 document.location.href=gourl;
			 }
		}	 
    }
	 var divs = document.getElementsByTagName("div");
   for (var i=0; i< divs.length; i++) {
      if (divs[i].className.match("jlink")) {
	  divs[i].style.cursor = "pointer";
	     divs[i].onclick = function() {
		     var gourl = this.getAttribute("title");
			 document.location.href=gourl;
			 }
		}	 
    }
}

function Search() {

   var searchform = document.forms['search'];
   var submitform = searchform.ssubmit;

   submitform.onclick = function() {
      
	  submitform.value="Wait...";
 
      if (searchform.q.value == "") { 
      alert('Please enter one or more words to search for'); 
      searchform.q.focus(); 
      searchform.q.style.border = "1px solid red";
  
      submitform.value="Try again";
  
      return false; } 
   return true;
   }
}

defaultStatus='Pico Technology PC oscilloscopes and data acquisition products';


window.onload = StartUp;


function StartUp() {
   JLinks();
   Zebra();
   FlashFix();
   Zoom();
   Search();
}


/* ------ the point of no return ------- */



function Go(there) {
window.location.href=there;
}

function JumpPage(whereto) {
newpage = whereto.options[whereto.selectedIndex].value;

if (newpage == "idiot") { alert('Please select where you want to go to');
      return false; }
window.location.href = newpage;
}


function NoButt(theButton)
{
 theButton.value="Wait...";
 theButton.disabled = true;
 theButton.form.submit();
}




