
function delineateLoc(str,subStr)
{
  lenAdd = subStr.length;
  if ( str.indexOf(subStr) > 0 ) {
	 theleft = str.indexOf(subStr) + lenAdd;
	 //theright = str.lastIndexOf("&") - 1;
	 theright = str.lastIndexOf("&");
	 if ( theleft > 0 && theright < 0 ) {
		return(str.substring(theleft,str.length));
	 } else {
		return(str.substring(theleft, theright));
	 }
  } else {
	 return "";
  }
}

if (document.getElementById("PV") != null) {

	try {
		var locate = parent.window.location
		document.PV.VID.value = locate
		var text = document.PV.VID.value
		document.PV.VID.value = delineateLoc(text,"VID=")

		if (document.PV.VID.value != "" ) {
			if (document.location != "http://www.oidview.com/mibs/0/md-0-1.html" && document.PV.VID.value != "0" ) {
				document.location = "http://www.oidview.com/mibs/" + document.PV.VID.value + "/md-" + document.PV.VID.value + "-1.html";
			} else {
				document.location = "http://www.oidview.com/mibs/0/md-0-1.html";
			}
		}
	} catch (err) {
		// do nothing, probably couldn't get access to the location
	}

}

function setCurrPage()
{
	document.PV.currpage.value = "http://www.oidview.com/mibs/" + document.PV.vendor.value + '/md-' + document.PV.vendor.value + '-1.html'
	selectNewPage();
}
function selectNewPage()
{
	document.location = document.PV.currpage.value;
}
function setVendorByName()
{
	document.PV.vendor.value = document.selectObjects.selectName.options[document.selectObjects.selectName.selectedIndex].value
	setCurrPage();
}
function setVendorByVID()
{
	document.PV.vendor.value = document.selectObjects.selectVID.options[document.selectObjects.selectVID.selectedIndex].value
	setCurrPage();
}

function openPopupMibs(id,vid,top){

    var url = "/cgi-bin/mibs_getPasscode.cgi?id=" + id + "&vid=" + vid;
    
    document.getElementById("popUpContent").innerHTML = "<html><body><IFRAME valign='top' src='" + url + "' scrolling='no' frameborder=0 border=0 width='235' height='190'></IFRAME></body></html>";
    
    var nPopupLeft = ((f_clientWidth() / 2) - 127 );

    showhideLayer('popUpMibs','visible');
    
    document.getElementById("popUpMibs").className="downloadPopUpMibs";
    document.getElementById("popUpMibs").style.visibility = "visible";
    document.getElementById("popUpMibs").style.left = nPopupLeft;
    document.getElementById("popUpMibs").style.top = top;
    
    document.getElementById("vendor_nav_bar").style.visibility = "hidden";
    document.getElementById("popUpAds").style.visibility = "visible";
      
}

function closePopupMibs(){
	
    document.getElementById("vendor_nav_bar").style.visibility = "visible";
    document.getElementById("popUpMibs").style.visibility = "hidden";
    document.getElementById("popUpMibs").style.left = -700 ;
    document.getElementById("popUpMibs").style.top = 0;

    showhideLayer('popUpMibs','hidden');

}

function openPopup(id,vid,top){

    var url = "/cgi-bin/mibs_getPasscode.cgi?id=" + id + "&vid=" + vid;
    
    document.getElementById("popUpContent").innerHTML = "<html><body><IFRAME valign='top' src='" + url + "' scrolling='no' frameborder=0 border=0 width='225' height='190'></IFRAME></body></html>";
    
    var nPopupLeft = ((f_clientWidth() / 2) - 127 );
    
    document.getElementById("popUp").className="downloadPopUp";
    document.getElementById("popUp").style.visibility = "visible";
    document.getElementById("popUp").style.left = nPopupLeft;
    document.getElementById("popUp").style.top = top;
}

function closePopup(){
    document.getElementById("popUp").style.visibility = "hidden";
    document.getElementById("popUp").style.left = -700 ;
    document.getElementById("popUp").style.top = 0;
}

function roll_over(img_name, img_src){
    document.getElementById(img_name).src = img_src;
}

// cross browser functions
function f_clientWidth() {
	return f_filterResults (
		window.innerWidth ? window.innerWidth : 0,
		document.documentElement ? document.documentElement.clientWidth : 0,
		document.body ? document.body.clientWidth : 0
	);
}
function f_clientHeight() {
	return f_filterResults (
		window.innerHeight ? window.innerHeight : 0,
		document.documentElement ? document.documentElement.clientHeight : 0,
		document.body ? document.body.clientHeight : 0
	);
}
function f_scrollLeft() {
	return f_filterResults (
		window.pageXOffset ? window.pageXOffset : 0,
		document.documentElement ? document.documentElement.scrollLeft : 0,
		document.body ? document.body.scrollLeft : 0
	);
}

function f_scrollTop() {
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}

function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}

