<!--

//The following function is used to redirect to a new page from a dropdown list
//It was written specifically for the dropdown navigation on the home page but could be used from any dropdown list.

function redirectPage(select) {

  for(var index=0; index<select.options.length; index++){
	var newwindow = select.options[index].newwindow;
	if(select.options[index].selected)
      {

		if(newwindow == null || newwindow == "" || newwindow == "false" || newwindow == "F") {
         	 	window.location.href=select.options[index].value;
				break;
         	} else {
         		newWin = window.open(select.options[index].value);
	    		window.newWin.focus();
				break;
         	}

      }
  }
}

//The following function is used to redirect to the appropriate retail site from a dropdown list

function redirectRetailPage() {
 
  for(var index=0; index<document.retailLocation.options.length; index++)
    if(document.retailLocation.options[index].selected)
      {
        if(document.retailLocation.options[index].value!="")
          window.location.href=document.retailLocation.options[index].value;
        break;
      }
}

//The following function is used to open a link in a new smaller window
//It was written specifically for the toric calculator but can be used for any type of page.

function newWindow(linkUrl,width,height){
        // Create and set window option variables.
        var windowBars = 'directories=no,location=no,menubar=no,status=no,toobar=no';
        var windowOptions = 'scrollbars=yes,resizable=yes';
        windowOptions = windowOptions + ',width=' + width + ',height=' + height;
        var windowFeatures = windowBars + ',' + windowOptions;
        var childWindow = linkUrl;

        // Open the child window
    	newWin = window.open(childWindow, 'NewWindow', windowFeatures);
	    window.newWin.focus();
}

//The following function is used to redirect to a new page from a radio button list
//It was written specifically for the radio navigation on the lensfinder but it could be used from any radio group.

function radioRedirectPage(radioObj) {
	var radioLength = radioObj.length;
	if(radioLength == undefined){
		if(radioObj.checked) {
			if(radioObj.value!="")
				window.location.href=radioObj.value;
		}
	}else {
		for(var i = 0; i < radioLength; i++) {
			if(radioObj[i].checked) {
				if(radioObj[i].value!="")
					Window.location.href=radioObj[i].value;
				break;
			}
		}
	}
}

//-->
