//Browser abfragen############################################################################/
function detectBrowser() { 
    var BO = new Object(); 
    BO["ie"]        = false /*@cc_on || true @*/; 
    BO["ie4"]       = BO["ie"] && (document.getElementById == null); 
    BO["ie5"]       = BO["ie"] && (document.namespaces == null) && (!BO["ie4"]); 
    BO["ie6"]       = BO["ie"] && (document.implementation != null) && (document.implementation.hasFeature != null); 
    BO["ie55"]      = BO["ie"] && (document.namespaces != null) && (!BO["ie6"]); 
    /*@cc_on
    BO["ie7"]       = @_jscript_version == '5.7';
    @*/ 
    BO["ns4"]       = !BO["ie"] &&  (document.layers != null) &&  (window.confirm != null) && (document.createElement == null); 
    BO["opera"]     = (self.opera != null); 
    BO["gecko"]     = (document.getBoxObjectFor != null); 
    BO["khtml"]     = (navigator.vendor == "KDE"); 
    BO["konq"]      = ((navigator.vendor == 'KDE') || (document.childNodes) && (!document.all) && (!navigator.taintEnabled)); 
    BO["safari"]    = (document.childNodes) && (!document.all) && (!navigator.taintEnabled) && (!navigator.accentColorName); 
    BO["safari1.2"] = (parseInt(0).toFixed == null) && (BO["safari"] && (window.XMLHttpRequest != null)); 
    BO["safari2.0"] = (parseInt(0).toFixed != null) && BO["safari"] && !BO["safari1.2"]; 
    BO["safari1.1"] = BO["safari"] && !BO["safari1.2"] && !BO["safari2.0"]; 
    return BO; 
} 
 
	var BO = new detectBrowser(); 
	
	
	
//Reiter ausblenden############################################################################/

function getElementsByClassName(class_name){
   var all_obj,ret_obj=new Array(),j=0,teststr;
  if(document.all)all_obj=document.all;
  else if(document.getElementsByTagName && !document.all)
  all_obj=document.getElementsByTagName("*");
    for(i=0;i<all_obj.length;i++)
    {
     if(all_obj[i].className.indexOf(class_name)!=-1)
     {
        teststr=","+all_obj[i].className.split(" ").join(",")+",";
        if(teststr.indexOf(","+class_name+",")!=-1)
        {
           ret_obj[j]=all_obj[i];
              j++;
         }
      }
    }
    return ret_obj;
}
   

function reiterSichtbar(classname){
	var container = getElementsByClassName(classname);
	for (var i = 0; i < container .length; i++) {
		container[i].style.visibility="visible";
  	}
}



//Zufallsbild############################################################################/
today=new Date();
jran=today.getTime();
var anzahl = 3;     // Anzahl der Bilder
var random_number="";
var image="";
var links ="";
var tabnr = 0;

ia=9301;
ic=49297;
im=233280;
jran = (jran*ia+ic) % im;

random_number = Math.ceil( (jran/(im*1.0)) * anzahl);

// läd ein Image abhängig von der Zufallszahl



if (random_number==1) {
	image="featured_images/featured_100-CO_opt.jpg";
	text="Highly specified CCD-Lenses";
	links="CompactObjective.html";
	tabnr=0;
}




if (random_number==2) {
	image="featured_images/IMG_2480_opt.jpg";
	text="Macro Zoom Lens 18-108 with close-up lens";
	links="MacroLenses.html";
	tabnr=1;
}


if (random_number==3) {
	image="featured_images/featured_Zoom_opt.jpg";
	text="OEM 7:1 Zoom Objectives";
	links="OEMZoomMicroscope.html";
	tabnr=0;
}









function zufallsbild() {
	links= links+"?tabnr="+tabnr;
	document.write("<a href='" + links +"'><img src='" + image + "' border='0' alt='" + text + "'></a><br />")
	document.write("<a href='" + links +"'>" + text + "</a>")
	return;
}


function MyGetParam(param) {
	var url = String(window.location);
	//alert(url);
	if(window.location.search != "") {
		// Es gibt Parameter
		var undef = url.split("?");
		var args = undef[1].split("&");
		for(i = 0; i < args.length; i++) {
			var a = args[i].split("=");
			if(a[0] == param) {
			return a[1];
			}
		}
	}
}



//#########Tooltip############################//
// position of the tooltip relative to the mouse in pixel //
var offsetx = 4;
var offsety =  8;

function newelement(newid)
{ 
    if(document.createElement)
    { 
        var el = document.createElement('div'); 
        el.id = newid;     
        with(el.style)
        { 
            display = 'none';
            position = 'absolute';
        } 
        el.innerHTML = '&nbsp;'; 
        document.body.appendChild(el); 
    } 
} 
var ie5 = (document.getElementById && document.all); 
var ns6 = (document.getElementById && !document.all); 
var ua = navigator.userAgent.toLowerCase();
var isapple = (ua.indexOf('applewebkit') != -1 ? 1 : 0);
function getmouseposition(e)
{
    if(document.getElementById)
    {
        var iebody=(document.compatMode && 
        	document.compatMode != 'BackCompat') ? 
        		document.documentElement : document.body;
        pagex = (isapple == 1 ? 0:(ie5)?iebody.scrollLeft:window.pageXOffset);
        pagey = (isapple == 1 ? 0:(ie5)?iebody.scrollTop:window.pageYOffset);
        mousex = (ie5)?event.x:(ns6)?clientX = e.clientX:false;
        mousey = (ie5)?event.y:(ns6)?clientY = e.clientY:false;

        var lixlpixel_tooltip = document.getElementById('tooltip');
        lixlpixel_tooltip.style.left = (mousex+pagex+offsetx) + 'px';
        lixlpixel_tooltip.style.top = (mousey+pagey+offsety) + 'px';
    }
}
function tooltip(tip)
{
    if(!document.getElementById('tooltip')) newelement('tooltip');
    var lixlpixel_tooltip = document.getElementById('tooltip');
    lixlpixel_tooltip.innerHTML = tip;
    lixlpixel_tooltip.style.display = 'block';
    document.onmousemove = getmouseposition;
}
function exit()
{
    document.getElementById('tooltip').style.display = 'none';
}



function Go (select) {
  var wert = select.options[select.options.selectedIndex].value;
  window.location.href = wert;

}


//onload############################################################################/
//window.onload = function() {
	
	//if(!BO["ie55"] || !BO["ie5"]){
	//	reiterSichtbar("TabbedPanelsTabGroup");
	//}
	//if(BO["opera"]){
	//	reiterSichtbar("TabbedPanelsTabGroup");
	//}
//}
