function lookup_medium(url) {
  var AppName    = navigator.appName;
  var AppVersion = navigator.appVersion;
  var UserAgent  = navigator.userAgent;
  var iBrowser6  = AppVersion.indexOf('MSIE 6.0');
  var iBrowser   = AppVersion.indexOf('MSIE 7.0');
  var iBrowser8  = AppVersion.indexOf('MSIE 8.0');
  var BrowserName;
  var strFeatures;
  if(AppName == "Microsoft Internet Explorer") // Browser is Internet Explorer, but need to identify the version of it.
    if (iBrowser8 == -1) // It's not IE8
      if (iBrowser == -1) // It's not IE7, so can be IE6 or IE5. Let's call IE6 style sheet since it's compatible with older verions like IE 5.5 etc.
        strFeatures = "dialogWidth:910px;dialogHeight:490px;maximize:no;minimize:no;status:yes;scrollbars:auto";
      else // It's IE7 so let's call the IE7 style sheet
        strFeatures = "dialogWidth:900px;dialogHeight:440px;maximize:no;minimize:no;status:yes;scrollbars:auto";
    else // IE8 so let's call the IE8 style sheet
      strFeatures = "dialogWidth:900px;dialogHeight:440px;maximize:no;minimize:no;status:yes;scrollbars:auto";
  else
    strFeatures = "dialogWidth:900px;dialogHeight:440px;maximize:no;minimize:no;status:yes;scrollbars:auto";
  window.showModalDialog(url, window, strFeatures);
  return false;
}

function lookup_help(url)
{
  var AppName    = navigator.appName;
  var AppVersion = navigator.appVersion;
  var UserAgent  = navigator.userAgent;
  var iBrowser6  = AppVersion.indexOf('MSIE 6.0');
  var iBrowser   = AppVersion.indexOf('MSIE 7.0');
  var iBrowser8  = AppVersion.indexOf('MSIE 8.0');
  
  var strFeatures;
  if(AppName == "Microsoft Internet Explorer") // Browser is Internet Explorer, but need to identify the version of it.
    if (iBrowser8 == -1) // It's not IE8
      if (iBrowser == -1) // It's not IE7, so can be IE6 or IE5. Let's call IE6 style sheet since it's compatible with older verions like IE 5.5 etc.
      	strFeatures = "dialogWidth:740px;dialogHeight:555px;maximize:no;minimize:no;status:yes;scrollbars:no;";
      else // It's IE7 so let's call the IE7 style sheet
      	strFeatures = "dialogWidth:735px;dialogHeight:490px;maximize:no;minimize:no;status:yes;scrollbars:no;";
    else // IE8 so let's call the IE8 style sheet
      strFeatures = "dialogWidth:735px;dialogHeight:490px;maximize:no;minimize:no;status:yes;scrollbars:no;";
  else
      strFeatures = "dialogWidth:750px;dialogHeight:500px;maximize:no;minimize:no;status:yes;scrollbars:no;";	if (BrowserName == "IPad")
  	ecommLookups = window.open(url,"ecommLookups",status=false,resizable=false,top=500,left=230,height=500,width=750,dependent=true,toolbar=false,alwaysRaised=true);
  else	
    var cReturnVal = window.showModalDialog(url, window, strFeatures);
}

function lookup_video(url)
{
  var AppName    = navigator.appName;
  var AppVersion = navigator.appVersion;
  var UserAgent  = navigator.userAgent;
  var iBrowser6  = AppVersion.indexOf('MSIE 6.0');
  var iBrowser   = AppVersion.indexOf('MSIE 7.0');
  var iBrowser8  = AppVersion.indexOf('MSIE 8.0');
  
  var strFeatures;
  if(AppName == "Microsoft Internet Explorer") // Browser is Internet Explorer, but need to identify the version of it.
    if (iBrowser8 == -1) // It's not IE8
      if (iBrowser == -1) // It's not IE7, so can be IE6 or IE5. Let's call IE6 style sheet since it's compatible with older verions like IE 5.5 etc.
        strFeatures = "dialogWidth:500px;dialogHeight:490px;maximize:no;minimize:no;status:yes;scrollbars:no;";
      else // It's IE7 so let's call the IE7 style sheet
        strFeatures = "dialogWidth:500px;dialogHeight:400px;maximize:no;minimize:no;status:yes;scrollbars:no;";
    else // IE8 so let's call the IE8 style sheet
      strFeatures = "dialogWidth:500px;dialogHeight:400px;maximize:no;minimize:no;status:yes;scrollbars:no;";
  else
    strFeatures = "dialogWidth:500px;dialogHeight:400px;maximize:no;minimize:no;status:yes;scrollbars:no;";
  var cReturnVal = window.showModalDialog(url, window, strFeatures);
}


var currentFocusID = null; // the variable that stores the ID of the last/current input that had focus
function setFocus(currentID) {

	// remove old highlight
	if (currentFocusID) {
		var oldItem = document.getElementById(currentFocusID);
		oldItem.style.backgroundColor="";
	}	

	// set new item
	currentFocusID = currentID;
	
	if(currentID != null){
		// hightlight new item
		var newItem = document.getElementById(currentFocusID);
		newItem.style.backgroundColor="#FFFFCC";
	}
}

function highlight (currentID) {
	// hightlight new item
	var newItem = document.getElementById(currentFocusID);
	newItem.style.backgroundColor="#FFFFCC";
}



/** 
*	Changes the value of the current item in focus to the new values
*	after a lookup.  The lookup windows is responsible for calling this function.
*/
function returnFromLookup(newValue) {
	var pairs = newValue.split("|&|");
	for(var i=0; i<pairs.length; i++){
		var pair = pairs[i].split("|=|");
		var elm = document.getElementById(pair[0]);
 		if(elm && elm.value != null){
			elm.value = pair[1];
			
		}
	}

	setFocus(currentFocusID);
}

/**
*	Handle change of value and call the method to change value on
*	the window that opened the dialog. 
*/
function handleLookup(newValue) {
  
	var str = "";
	//var attr = document.getElementById(newValue).attributes.item("proteus-values");
	var attr = document.getElementById(newValue).getAttribute("proteus-values");
  
	if(attr){
		//str = unescape(attr.value);	
  	str = unescape(attr);	
	}
  
	window.dialogArguments.returnFromLookup(str);
	window.close();
}

var lastSelected;
					
function setSelected(obj) {

	if (lastSelected != null
			&& lastSelected.id != null) {
			
			var lastId = lastSelected.id;
			
			if (lastId != null 
				&& lastId.indexOf("_") > 0) {
				
				var num = lastId.substring(lastId.indexOf("_")+1);
				
				if (num%2==1) {
					// odd
					lastSelected.className = 'odd';
				} 
				else {
					lastSelected.className = 'even';
				}
			}	
		
	}
	lastSelectedClass = obj.className;
	lastSelected = obj;
	obj.className='selected';
}

function highlight (obj, className) {
	if (obj.className != 'selected') {
		obj.className = 'hover';
	}
}

function restore(obj, theClass) {
	if (obj.className != 'selected') {
		obj.className = theClass;
	}	
}

