<!--

/* ----------------------------------------------------------- */
// Browser Sniff
/* ----------------------------------------------------------- */

var InstantASP_UserAgent = navigator.userAgent.toLowerCase();
var InstantASP_BrowserVer = navigator.appVersion
var InstantASP_Opera = (InstantASP_UserAgent.indexOf('opera')!=-1); 
var InstantASP_Opera8 = ((InstantASP_UserAgent.indexOf('opera 8')!=-1||InstantASP_UserAgent.indexOf('opera/8')!=-1)?1:0); 
var InstantASP_NS4 = (document.layers)?true:false; 
var InstantASP_IE4 = (document.all && !document.getElementById)?true:false;
var InstantASP_IE5 = (document.all && document.getElementById)?true:false;
var InstantASP_NS6 = (!document.all && document.getElementById)?true:false;
var InstantASP_FireFox = (InstantASP_UserAgent.indexOf("firefox/")!=-1);
var InstantASP_Transitions = (InstantASP_IE5||InstantASP_IE4)?true:false
var InstantASP_Transition;
 
/* ----------------------------------------------------------- */
// Get a reference to an object on the client                   
/* ----------------------------------------------------------- */

function InstantASP_FindControl(strControlName) {
	var objReturn = '';
		if (InstantASP_IE5 || InstantASP_NS6 || InstantASP_Opera || InstantASP_Opera8)
		{objReturn = document.getElementById(strControlName);}
		else if (InstantASP_IE4) {objReturn = document.all[strControlName];}
		else if (InstantASP_NS4) {objReturn = document.layers[strControlName];}
	return objReturn;
}

/* ----------------------------------------------------------- */
// XmlHttpRequest    
/* ----------------------------------------------------------- */

function InstantASP_XmlHttpRequest()    {
  var XmlHttp, bComplete = false;
  try { XmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); }
  catch (e) { try { XmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); }
  catch (e) { try { XmlHttp = new XMLHttpRequest(); }
  catch (e) { XmlHttp = false; }}}
  if (!XmlHttp) return null;

  this.Connect = function(sURL, sMethod, sVars, oEvent) { 
    if (!XmlHttp) return false;
    bComplete = false;
    sMethod = sMethod.toUpperCase();

    try {
      if (sMethod == "GET") { 
	    XmlHttp.open(sMethod, sURL+"?"+sVars, true);
        sVars = "";
      } else {
        XmlHttp.open(sMethod, sURL, true);
        XmlHttp.setRequestHeader("Method", "POST "+sURL+" HTTP/1.1");
        XmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
      }
      XmlHttp.onreadystatechange = function() {
        if (XmlHttp.readyState == 4 && XmlHttp.status == 200 && !bComplete) {
          bComplete = true; oEvent(XmlHttp);
        }
	  };
      XmlHttp.send(sVars);
    } catch(e) {return false;}
    return true;
  };
  return this;
}

// Retrieve text of an XML document element, including elements using namespaces

function InstantASP_GetElementTextNS(prefix, local, parentElem, index) {
    var result = "";
    if (prefix && InstantASP_IE4||InstantASP_IE5) {
        result = parentElem.getElementsByTagName(prefix + ":" + local)[index];
    } else {
        result = parentElem.getElementsByTagName(local)[index];
    }

    if (result) {
        if (result.childNodes.length > 1) {
            return result.childNodes[1].nodeValue;
        } else {
            return result.firstChild.nodeValue;    		
        }
    } else {
        return "";
    }
}

// encode a string for including within a URL      

function InstantASP_EncodeString(strInput) {
	if (!strInput) {return '';}
	strInput = strInput.replace(/^\s*/, ' ');
	strInput = strInput.replace(/\s+/, ' ');
	strInput = strInput.replace(/\+/g, '%2B');
	strInput = strInput.replace(/\"/g,'%22')
	strInput = strInput.replace(/\'/g, '\'')	
	return escape(strInput);
}

/* ----------------------------------------------------------- */
// PanelBar Control
/* ----------------------------------------------------------- */

// expand / collapse a single panel bar

function InstantASP_PanelBarToggle(strTrId, strImgId, strTrFooterId, strSkin, strCkiePrefix, strCkieName, bolState, strExImg, strColImg, strGroupName) {

	objContent = InstantASP_FindControl(strTrId);
	objImage = InstantASP_FindControl(strImgId);
	objFooter = InstantASP_FindControl(strTrFooterId);
	
	if (objContent.style.display == "none") { // expand
		// should we collpase the rest of the group
		if (strGroupName != "") {InstantASP_PanelBarGroupToggle(strGroupName, strCkiePrefix, strCkieName, 0, strSkin);}
		// display controls
		if (objImage != null) {objImage.src = strSkin + strColImg;}		
		if (objContent != null) {objContent.style.display = "block";}		
		if (objFooter != null) {objFooter.style.display = "block";}
		
		// update cookie
		if (bolState) {InstantASP_UpdateCookie(strTrId, false, strCkiePrefix + strCkieName);} 
		else {InstantASP_UpdateCookie(strTrId, true, strCkiePrefix + strCkieName);}
	} else { // collapse
		// hide controls
		if (objImage != null) {objImage.src = strSkin + strExImg;}		
		if (objContent != null) {objContent.style.display = "none";}		
		if (objFooter != null) {objFooter.style.display = "none";}
		
		// update cookie
		if (bolState) {InstantASP_UpdateCookie(strTrId, true, strCkiePrefix + strCkieName);}
		else {InstantASP_UpdateCookie(strTrId, false, strCkiePrefix + strCkieName);}
	}
}

// expand / collapse a group of panel bars

function InstantASP_PanelBarGroupToggle(strGroupName, strCkiePrefix, strCkieName, bolState, strSkin, strExImg, strColImg) {

	if (InstantASP_IE4 || InstantASP_IE5 || InstantASP_Opera || InstantASP_NS6)	{
		// toggle all divs matching object name
		tr = document.getElementsByTagName("DIV");
		for (var i = 0; i < tr.length; i++) { 
			if (tr[i].id.indexOf(strGroupName) >= 0) {
				if (bolState) 
					{tr[i].style.display = "block";
					 InstantASP_UpdateCookie(tr[i].id, true, strCkiePrefix + strCkieName);}
					else
					{tr[i].style.display = "none";
					 InstantASP_UpdateCookie(tr[i].id, false, strCkiePrefix + strCkieName);}
			}
		}
	
		// change all images matching object name
		input = document.getElementsByTagName("img");
		for (var i = 0; i < input.length; i++) { 
			if (input[i].id.indexOf(strGroupName) >= 0) {
				if (bolState) 
					{input[i].src = strSkin + "Images/Misc_Collapse.gif";}
					else
					{input[i].src = strSkin + "Images/Misc_Expand.gif";}
			}
		}
	}
}

/* ----------------------------------------------------------- */
// Simple Menu Control
/* ----------------------------------------------------------- */

var InstantASP_MenusActive = false; // determines if a menu is active
var InstantASP_MenuItems = new Array(); // holds a collection of current active menus
var InstantASP_MenuLeft = 0;
var InstantASP_MenuRight = 0;
var InstantASP_MenuTop = 0;
var InstantASP_MenuBottom = 0;

// Set-up event handlers					   
if (InstantASP_IE4 || InstantASP_IE5 || InstantASP_Opera) {
	document.onclick = InstantASP_HideAllMenusOnClick;
	document.onscroll = InstantASP_HideAllMenusOnClick;
	window.onload = InstantASP_TrackResize; // manually track windows.resize to accomodate for IE bug
}    
else if (InstantASP_NS6) { 
	document.addEventListener("mousedown", InstantASP_HideAllMenusOnClick, true);
	window.addEventListener("resize", InstantASP_HideAllMenus, false);
} 
else if (InstantASP_NS4) {
	document.onmousedown = InstantASP_HideAllMenusOnClick;
	window.captureEvents(Event.MOUSEMOVE);
}

// code to resolve resize event fire bug when using .appendChild within IE
// why? Because the <body> element was resized to accomodate the newly added <div> (menu) tag, and 
// IE fails to make any distinction between the window (or viewport) and the <body> element resizing
function InstantASP_Resized()   {
    var currentSize = InstantASP_GetViewPortSize();
    if (currentSize[0] != g_prevSize[0] || currentSize[1] != g_prevSize[1]) {
         g_prevSize = currentSize;
         InstantASP_HideAllMenus();
    }
}

// track page resizing
function InstantASP_TrackResize()
{  
    window.g_prevSize = InstantASP_GetViewPortSize();
    setInterval(InstantASP_Resized, 25);
}

// Open Menu on MouseOver Event
function iasp_OpnMnuMouseOver(Caller, DivLayer, InnerHTML, Width, height) {
	if (InstantASP_MenusActive) {iasp_OpnMnu(Caller, DivLayer, InnerHTML, Width, height);}	
}

// Open Menu on MouseClick Event
function iasp_OpnMnu(Caller, DivLayer, InnerHTML, Width, Height) {

	// create unique identity for generated div layer
	DivLayer = DivLayer + "_" + Caller
	
	// create iframe to hold menu, this ensures we render over dropdownlists
	var Iframe = DivLayer + "_Iframe"
	
	// determine if we can create elements dynamically
	if (!document.createElement) {return false;}
	
	// check to see if item is already within active menu array if so just quit and return false
	for (count = 0; count < InstantASP_MenuItems.length; count++)	{
		if (InstantASP_MenuItems[count] == DivLayer) {
			return false;
		}
	}
	
	// hide any menus that maybe open
	InstantASP_HideAllMenus();
	
	// add active menu to array and set active state to true
	InstantASP_MenuItems[InstantASP_MenuItems.length] = DivLayer;
	InstantASP_MenusActive = true;
	
	// create the div layer container for this menu
	InstantASP_CreateLayer(InnerHTML, DivLayer, Iframe, Width, Height);
    
    // get object references to div layer and div_layer that called this function
	var div_layer = InstantASP_FindControl(DivLayer);
    var div_layer_caller = InstantASP_FindControl(Caller);
     	
        // set default offset for div layer from the caller div
    var offsetTopDefault = div_layer_caller.offsetHeight + 4;
    	             	
	// position div layer relative to the opening link  
	var intTop = InstantASP_GetOffsetTop(div_layer_caller) + offsetTopDefault;
	var intLeft = InstantASP_GetOffsetLeft(div_layer_caller); 

  	// set position of controls
    div_layer.style.top = intTop + "px";
    div_layer.style.left = intLeft + "px";
     	   
    //  calculate left and top positions of current div layer
    if (InstantASP_IE4 || InstantASP_IE5 || InstantASP_Opera) { 
 		InstantASP_MenuLeft = div_layer.style.posLeft;
		InstantASP_MenuTop = div_layer.style.posTop - offsetTopDefault; 
	} else if (InstantASP_NS6) {
		InstantASP_MenuLeft = InstantASP_StyleWidthToInt(div_layer.style.left);
		InstantASP_MenuTop = InstantASP_StyleWidthToInt(div_layer.style.top);
	}
	
	// calculate right and bottom positions of current div layer
	InstantASP_MenuRight = parseInt(InstantASP_MenuLeft) + parseInt(mnu_extent.x);			
	InstantASP_MenuBottom = parseInt(InstantASP_MenuTop) + parseInt(mnu_extent.y);
	
	// ensure width is tidy
	Width = InstantASP_StyleWidthToInt(Width)
	
	// attempt to keep menu on screen			
	if (InstantASP_IE4 || InstantASP_IE5 || InstantASP_Opera || InstantASP_NS6) { 
 		win_width = document.body.clientWidth;
		if (InstantASP_MenuRight > win_width) {
			div_layer.style.left = win_width - Width - 10 + "px";
		}
	}
			
	// finally display the menu		
		
	if (InstantASP_Transition ==null) {
	    InstantASP_Transition =  new InstantASPTransition('SimpleMenuTransitions');
	        InstantASP_Transition.ExpandTransition = 0;
	    
	 }
	  InstantASP_Transition.ExpandDiv(div_layer);	
		
}

// Create div to hold menu
function InstantASP_CreateLayer(InnerHTML, DivLayer, Iframe, mnu_width, mnu_height) {     

	// create div layer container to holder table
    var elemDiv = document.createElement('span');     	
    elemDiv.id = DivLayer;
    elemDiv.style.position = 'absolute';
    elemDiv.style.top = '-1000px'; /* tweak for opera */
    elemDiv.style.left = '-1000px'; /* tweak for opera */       
    elemDiv.style.overflow = 'hidden';    
    elemDiv.style.zindex = 10;
	elemDiv.style.width = mnu_width;
	elemDiv.innerHTML = InnerHTML;
	
	if (InstantASP_IE5) {
        elemDiv.style.filter = 'progid:DXImageTransform.Microsoft.Shadow(color="#888888", Direction=120, Strength=3) alpha(Opacity=100)';
    }
	
	// add elements to document
	document.body.appendChild(elemDiv); 
	
	// get height now content has been added
	var height;	
	if ((InstantASP_IE4 || InstantASP_IE5) || InstantASP_NS6)
		{height = elemDiv.offsetHeight;}
	else if (InstantASP_NS4)	
		{height = elemDiv.clip.height;}
			
    // contents exceed height setup overflow
	if (mnu_height != "") {
	    mnu_height =  InstantASP_StyleWidthToInt(mnu_height)
	    if (height > mnu_height) {
	        elemDiv.style.height = mnu_height + "px";
	        elemDiv.style.overflowX = 'hidden';
	        elemDiv.style.overflowY = 'scroll';
	        height = mnu_height
	    }
	 }
	
	mnu_extent = {
		x : mnu_width,
		y : height
	};
		
}

// Hide all menus on click event of document
function InstantASP_HideAllMenusOnClick(event) {

    // hide any possible tooltip
    iasp_hideToolTip();
    // are menus active
	if (InstantASP_MenusActive) {
		// find the element that was clicked
		if (InstantASP_IE4 || InstantASP_IE5 || InstantASP_Opera) {
			el = window.event.srcElement;
		}
		else {
			el = (event.target.tagName ? event.target : event.target.parentNode);
		}
		
		// did we find a parent div layer		
		var container = InstantASP_GetContainer(el, "SPAN")		
		if (container != null) {	
			if (container.id.indexOf("_SimpleMenuDivLayer") == -1) {
				    // hide all menus
				InstantASP_HideAllMenus();
			}	
		} else {
			// hide all menus
			InstantASP_HideAllMenus();
		}
	}
}

// Hide all active menus 

function InstantASP_HideAllMenus() {
    // hide any possible simply meny control
	if (InstantASP_MenusActive) {	
		for (count = 0; count < InstantASP_MenuItems.length; count++)	{
			var div_layer = InstantASP_FindControl(InstantASP_MenuItems[count]);
			if (div_layer != null)	{
				div_layer.style.display = 'none';
				InstantASP_MenuItems[count] = '';
				InstantASP_MenusActive = false;
			}
		}			
	}
}

/* ----------------------------------------------------------- */
// LinkBar Control
/* ----------------------------------------------------------- */

// toggle link bar tab

function InstantASP_LinkBarToggle(nodeID, clientID,  csstd, csstdsel, csstdchild, csstabline, csstabhl, csstablinesel) {

	// unique node id
	var uniqueid = nodeID + clientID;
	
	// get menu objects
	var lbtdchild = InstantASP_FindControl("lbtdchild_" + clientID);
	var lbchildmenulayer = InstantASP_FindControl("lbchildmenulayer_" + uniqueid);
	
	// reset styles
	InstantASP_LinkBarReset(clientID, csstd, csstdchild, csstabline, csstabhl);
	
	// update styles
	InstantASP_SwitchClass("lbtd_" + uniqueid, csstdsel);
	InstantASP_SwitchClass("lbtdchild_" + clientID, csstdchild);
	InstantASP_SwitchClass("lbtd1_" + uniqueid, csstabline);
	InstantASP_SwitchClass("lbtd2_" + uniqueid, csstabhl);
	InstantASP_SwitchClass("lbtd3_" + uniqueid, csstablinesel);	
	InstantASP_SwitchClass("lbhtd1_" + uniqueid, csstabhl);
	InstantASP_SwitchClass("lbhtd2_" + uniqueid, csstabhl);
	InstantASP_SwitchClass("lbhtd3_" + uniqueid, csstablinesel);	
	
	// populate host with menu
	if (lbchildmenulayer != null) {
	    lbtdchild.innerHTML = lbchildmenulayer.innerHTML;
	}
		
}

// reset link bar tabs

function InstantASP_LinkBarReset(clientID, csstd, csstdchild, csstabline, csstabhl) {
	for (i = 1; i <= 10; i++)	{
		var uniqueid = i + clientID
		InstantASP_SwitchClass("lbtd_" + uniqueid, csstd);
		InstantASP_SwitchClass("lbtdchild_" + clientID, csstdchild);	
		InstantASP_SwitchClass("lbtd1_" + uniqueid, csstabline);
		InstantASP_SwitchClass("lbtd2_" + uniqueid, csstabline);	
		InstantASP_SwitchClass("lbtd3_" + uniqueid, csstabline);
		InstantASP_SwitchClass("lbhtd1_" + uniqueid, csstabhl);
		InstantASP_SwitchClass("lbhtd2_" + uniqueid, csstabhl);	
		InstantASP_SwitchClass("lbhtd3_" + uniqueid, csstabhl);
	}
}

/* ----------------------------------------------------------- */
// Helpers
/* ----------------------------------------------------------- */

// Open a new window

function InstantASP_OpenWindow(Url, Width, Height, Scroll, ToolBar, Location, Status, MenuBar, Resizeable, Unique) {	
	var String;
	var winName = Width.toString() + Height.toString()
   	String =  "toolbar=" + ToolBar + ",location=" + Location 
   	String += ", directories=0,status=" + Status + ",menubar=" + MenuBar + ","
	String += "scrollbars=" + Scroll + ",resizable=" + Resizeable + ",copyhistory=0,";
   	String += ",width=";
   	String += Width;
   	String += ",height=";
   	String += Height;
   	
   	// should we center popup window
   	if (InstantASP_IE4 || InstantASP_IE5 || InstantASP_Opera || InstantASP_NS6)	{
	WndTop  = (screen.height - Height) / 2;
	WndLeft = (screen.width  - Width)  / 2;
	String += ",top=";
   	String += WndTop;
   	String += ",left=";
   	String += WndLeft;}
   	
   	// should we display single popup or allow multiple
   	try {
   		if (Unique == true) {WinPic = window.open(Url,WinNum++,String);}
   		else {WinPic = window.open(Url,winName,String);WinPic.focus();}}
   	catch (e) {};
}

// Hrrm cookies

function InstantASP_UpdateCookie(objName, bolSave, strCookieName) { 
	var ckColl = InstantASP_GetCookie(strCookieName);
	var arrLocTemp = new Array();
	if (ckColl != null) { 
		arrColl = ckColl.split(",");
		for (i in arrColl) { 
			if (arrColl[i] != objName && arrColl[i] != "") {arrLocTemp[arrLocTemp.length] = arrColl[i];}
		}
	}
	if (bolSave) {arrLocTemp[arrLocTemp.length] = objName;}
	InstantASP_SetCookie(strCookieName, arrLocTemp.join(","));
}

function InstantASP_SetCookie(name, value) { 
	expire = "expires=Wed, 1 Jan 2020 00:00:00 GMT;";
	document.cookie = name + "=" + value + "; path=/;" + expire;
}

function InstantASP_GetCookie(name) { 
	ckName = name + "=";ckPos  = document.cookie.indexOf(ckName);
	if (ckPos != -1) {
		ckStart = ckPos + ckName.length;
		ckEnd = document.cookie.indexOf(";", ckStart);
		if (ckEnd == -1) {ckEnd = document.cookie.length;}
		return unescape(document.cookie.substring(ckStart, ckEnd));
	} 
	return null;
}

// Misc

function InstantASP_SwitchClass(objectname, classname)
{
	var obj = InstantASP_FindControl(objectname);
	if (obj) {obj.className = classname;}
}


// Get top offset for object

function InstantASP_GetOffsetTop(objControl) {

	var top = objControl.offsetTop;
	var parent = objControl.offsetParent;
	while (parent != document.form) {
	top += parent.offsetTop;
	parent = parent.offsetParent;}
	return top;
	
}

// Get left offset for object

function InstantASP_GetOffsetLeft(objControl) {

	var left = objControl.offsetLeft;
	var parent = objControl.offsetParent;
	while (parent != document.form) {
	left += parent.offsetLeft;
	parent = parent.offsetParent;}
	return left;
	
}

// Get the height of an object.

function InstantASP_GetObjHeight(obj) {
	var height = 0; 
	if (InstantASP_NS4) {var height = obj.clip.height;}
	else {var height = obj.offsetHeight;}
	return height;  
}

// Starting with the given node, find the nearest contained element             

function InstantASP_GetContainer(node, tagName) {

  while (node != null) {
    if (node.tagName != null && node.tagName == tagName)
      return node; node = node.parentNode;
  }
  return node;
}

// Removes px and percentage markers from css style properties and returns an integer      

function InstantASP_StyleWidthToInt(strInput)	{

	var strOutput = 0;
	if (strInput.toLowerCase().indexOf("px") >= 0) {
		strOutput = strInput.substr(0, strInput.toLowerCase().indexOf("px"));
	} else if (strInput.indexOf("%") >= 0) {
		strOutput = strInput.substr(0, strInput.indexOf("%"));
	}
	return parseInt(strOutput);	
}

// This funtion removes any trialing anchor points within a string

function InstantASP_RemoveBookMark(strInput) {
	var uri = new String(strInput)
	var strOutput; var intPos = uri.indexOf('#');
	if (intPos > 0) {strOutput = uri.substring(0, intPos);}
	else {strOutput = uri;} return strOutput;
}

// This funtion removes any querystring from a string

function InstantASP_RemoveQueryString(strInput) {
	var uri = new String(strInput)
	var strOutput; var intPos = uri.indexOf('?');
	if (intPos > 0) {strOutput = uri.substring(0, intPos);}
	else {strOutput = uri;} return strOutput;
}

function InstantASP_GetViewPortSize()  {

    var size = [0, 0];
    if (typeof window.innerWidth != 'undefined')
    {
     size = [ window.innerWidth, window.innerHeight ];
    }
    else if (typeof document.documentElement != 'undefined' &&
             typeof document.documentElement.clientWidth != 'undefined' &&
             document.documentElement.clientWidth != 0)
    {
     size = [ document.documentElement.clientWidth, document.documentElement.clientHeight ];
    }
    else
    {
     size = [ document.getElementsByTagName('body')[0].clientWidth,
              document.getElementsByTagName('body')[0].clientHeight ];
    }
    
    return size;    
  
}

function InstantASP_ToggleVisibility(strControlName) {
    var obj = InstantASP_FindControl(strControlName);

    if (obj != null) {
        if (obj.style.display == "none") {
            obj.style.display = "inline";
        } else {
            obj.style.display = "none";
        }
    }
}

function InstantASP_HideControl(strControlName) {
    var obj = InstantASP_FindControl(strControlName);
    if (obj != null) {
        obj.style.display = "none";
    }    
}

 function InstantASP_ShowControl(strControlName) {
    var obj = InstantASP_FindControl(strControlName);
    if (obj != null) {
        obj.style.display = "inline";        
    }    
}


function iasp_CreateTD(strClass, strWidth, strAlign, objControl) {

    var td = document.createElement("TD");
    if (strClass != null) {td.className =  strClass;}
    if (strWidth != null) {td.style.width = strWidth;}
    if (strAlign != null) {td.align =  strAlign;}
    td.appendChild(objControl);
    return td;
}

//-->

/* ----------------------------------------------------------- */
// Dual Drop Down List Client Side JavaScript
// InstantASP.Common.UI.WebControls.DualDropDowns
/* ----------------------------------------------------------- */

function hasOptions(obj) {
	if (obj!=null && obj.options!=null) { return true; }
	return false;
	}

function addTextBoxOption(from,to,inputhidden) {
    var value = from.value;
    	var options = new Object();
	if (hasOptions(to)) {
		for (var i=0; i<to.options.length; i++) {
			options[to.options[i].value] = to.options[i].text;
			}
		}
	if (value == "") {return; }
    if (value == null || value == "undefined" || options[value]!=value) {
        if (!hasOptions(to)) { var index = 0; } else { var index=to.options.length; }
        to.options[index] = new Option( value, value, false, false);
    }
    populateValueField(to,inputhidden);
	from.value = "";
	to.selectedIndex = -1;
}

function addSelectedOptions(from,to,inputhidden) {
	var options = new Object();
	if (hasOptions(to)) {
		for (var i=0; i<to.options.length; i++) {
			options[to.options[i].value] = to.options[i].text;
			}
		}
	if (!hasOptions(from)) { return; }
	for (var i=0; i<from.options.length; i++) {
		var o = from.options[i];
		if (o.selected) {
			if (options[o.value] == null || options[o.value] == "undefined" || options[o.value]!=o.text) {
				if (!hasOptions(to)) { var index = 0; } else { var index=to.options.length; }
				to.options[index] = new Option( o.text, o.value, false, false);
				}
			}
		}
		
	populateValueField(to,inputhidden);
	from.selectedIndex = -1;
	to.selectedIndex = -1;
	
	}

function removeSelectedOptions(from,inputhidden) { 
	if (!hasOptions(from)) { return; }
	if (from.type=="select-one") {
		from.options[from.selectedIndex] = null;
		}
	else {
		for (var i=(from.options.length-1); i>=0; i--) { 
			var o=from.options[i]; 
			if (o.selected) { 
				from.options[i] = null; 
				} 
			}
		}
	populateValueField(from,inputhidden);
	from.selectedIndex = -1; 
	} 

function moveOptionUp(obj,inputhidden) {
	if (!hasOptions(obj)) { return; }
	for (i=0; i<obj.options.length; i++) {
		if (obj.options[i].selected) {
			if (i != 0 && !obj.options[i-1].selected) {
				swapOptions(obj,i,i-1);
				obj.options[i-1].selected = true;
				}
			}
		}
	populateValueField(obj,inputhidden);
	}

function moveOptionDown(obj,inputhidden) {
	if (!hasOptions(obj)) { return; }
	for (i=obj.options.length-1; i>=0; i--) {
		if (obj.options[i].selected) {
			if (i != (obj.options.length-1) && ! obj.options[i+1].selected) {
				swapOptions(obj,i,i+1);
				obj.options[i+1].selected = true;
				}
			}
		}
	populateValueField(obj,inputhidden);
	}

function swapOptions(obj,i,j) {
	var o = obj.options;
	var i_selected = o[i].selected;
	var j_selected = o[j].selected;
	var temp = new Option(o[i].text, o[i].value, o[i].defaultSelected, o[i].selected);
	var temp2= new Option(o[j].text, o[j].value, o[j].defaultSelected, o[j].selected);
	o[i] = temp2;
	o[j] = temp;
	o[i].selected = j_selected;
	o[j].selected = i_selected;
	}
	
function populateValueField(obj,inputhidden) {

	if (!hasOptions(obj)) { return; }
	var strValues = "";
	for (i=0; i<obj.options.length; i++) {
		strValues = strValues + obj.options[i].value + ",";
		}
	inputhidden.value = strValues;
	
	}
	
	
/* ----------------------------------------------------------- */
// Bookmark URL method
/* ----------------------------------------------------------- */
	
function InstantASP_Bookmark(bmurl, bmtitle){

     if(window.sidebar) { 
       window.sidebar.addPanel(bmtitle, bmurl,""); 
     }else if( document.all ) {
      window.external.AddFavorite( bmurl, bmtitle);
     }else if( window.opera && window.print ) {
      return true;
      
     }
   }
	
/* ----------------------------------------------------------- */
// ToolTip Control
/* ----------------------------------------------------------- */
	
var iasptooltip_offsetxpoint = 10;
var iasptooltip_offsetypoint = 10;
var iasptooltip_obj = null;
var iasptooltip_allowMove = true;
var iasptooltip_allowHide = true;
var iasptooltip_timeoutID;

/* get ibhect nidel */
function iasp_ieTrueBody() {
    return (document.compatMode && document.compatMode != "BackCompat") ? document.documentElement : document.body;
}

/* enable tooltip */
function iasp_EnableTip(thetext, intWidth, intShowFor) {

    // init vars
    iasptooltip_allowMove = true; 
    iasptooltip_allowHide = true;

    // clear timeout
    if (iasptooltip_timeoutID != null) {clearTimeout(iasptooltip_timeoutID);}
    
    // get tooltip layer
    iasptooltip_obj = InstantASP_FindControl('iasp_ToolTip');
    if (!iasptooltip_obj) {return false;}
    
    iasptooltip_obj.style.left = '-1000px'
    iasptooltip_obj.style.top = '-1000px'
    
    if (InstantASP_NS6 || InstantASP_IE5) {
        if (typeof intWidth != "undefined") {
            iasptooltip_obj.style.width = intWidth + "px";
        }
        if (InstantASP_IE5) {
            iasptooltip_obj.style.filter = 'progid:DXImageTransform.Microsoft.Shadow(color="#888888", Direction=120, Strength=3) alpha(Opacity=100)';
        }
        
        // populate text
        iasp_populateToolTip(thetext);
      
        // show tooltip
        iasptooltip_obj.style.display = "block";
        
        // depends on InstantASPTransitions.js
        doFade(iasptooltip_obj, 25);	  
        
        // position tooltip
        document.onmousemove = iasp_PositionTip;
        
        // hide after x secs
        if (intShowFor > 0) {
            iasp_DisableTip(intShowFor)
        }        

    }
}

/* populate tooltip text */
function iasp_populateToolTip(strText) {
      iasptooltip_obj.innerHTML = strText; 
}

/* position tooltip */
function iasp_PositionTip(e) {

    if (iasptooltip_allowMove && iasptooltip_obj.style.display != "none") {
    
        var iasptooltip_curX = (InstantASP_NS6) ? e.pageX : event.x + iasp_ieTrueBody().scrollLeft;
        var iasptooltip_curY = (InstantASP_NS6) ? e.pageY : event.y + iasp_ieTrueBody().scrollTop;      
        var iasptooltip_bottomedge = InstantASP_IE5 && !InstantASP_Opera ? iasp_ieTrueBody().clientHeight - event.clientY - iasptooltip_offsetypoint : window.innerHeight - e.clientY - iasptooltip_offsetypoint;
        var iasptooltip_rightedge = InstantASP_IE5 && !InstantASP_Opera ? iasp_ieTrueBody().clientWidth - event.clientX - iasptooltip_offsetxpoint : (window.innerWidth - e.clientX - iasptooltip_offsetxpoint);       

        // set left
        if (iasptooltip_rightedge < iasptooltip_obj.offsetWidth ) {
             iasptooltip_obj.style.left = InstantASP_IE5 ? iasp_ieTrueBody().scrollLeft + event.clientX - iasptooltip_obj.offsetWidth - 15 + "px" : window.pageXOffset + (e.clientX - iasptooltip_obj.offsetWidth - 15) + "px";
            } 
        else {
            iasptooltip_obj.style.left = iasptooltip_curX + (iasptooltip_offsetxpoint) + "px";
        }        

        // set top
        iasptooltip_obj.style.top = InstantASP_IE5? iasp_ieTrueBody().scrollTop + event.clientY + iasptooltip_offsetypoint + "px" : window.pageYOffset + e.clientY + iasptooltip_offsetypoint + "px";
        
        // don't move again
        iasptooltip_allowMove = false;
          
    }  
}

function iasp_DisableTip(intDelay) {
        if (intDelay == null) {intDelay = 0;}       
        if (iasptooltip_allowHide) {
            iasptooltip_timeoutID = setTimeout(iasp_hideToolTip,intDelay * 1000)
        }
}

function iasp_clearToolTipTimeout() {
    // clear timeout
    if (iasptooltip_timeoutID != null) {clearTimeout(iasptooltip_timeoutID);}
    iasp_showToolTip();
    iasptooltip_allowHide = false;
}

function iasp_showToolTip() {
    if (InstantASP_NS6 || InstantASP_IE5) {
        if (iasptooltip_obj != null) {
            iasptooltip_obj.style.display = "inline-block";
            iasptooltip_allowMove = false;
        }
    }
}

function iasp_hideToolTip() {
    if (InstantASP_NS6 || InstantASP_IE5) {
        if (iasptooltip_obj != null) {
             iasptooltip_obj.style.display = "none";
             iasptooltip_allowMove = true;
         }
    }
}


/* ----------------------------------------------------------- */
// Ajax Loader
/* ----------------------------------------------------------- */

var iasp_bolLoadStarted = false;
var iasp_bolLoadEnded = false;
var iasp_LoaderDivId = 'iasp_LoaderDiv';

function iasp_AjaxExtensionsInitializeRequest(postBackElement) {

    // ensure method is only ran once
    if (!iasp_bolLoadStarted) {
            
        // get body
        var body = document.getElementsByTagName("body");
        
        // tweak opacity
        if (InstantASP_IE4 || InstantASP_IE5 || InstantASP_Opera || InstantASP_NS6)	{
	       body[0].style.filter = "alpha(opacity=25); -moz-opacity: .25;";
        }
        
        // set pointer to hourglass
        if (document.body != null) {document.body.style.cursor = 'wait';}
        
        // show loader
        iasp_AddLoader();
        
        // update flags
        iasp_bolLoadStarted = true;
        iasp_bolLoadEnded = false;
    }
}

function iasp_AjaxExtensionsEndRequest(postBackElement) {

    // ensure method is only ran once
    if (!iasp_bolLoadEnded) {
    
        // get body
        var body = document.getElementsByTagName("body");
    
         // tweak opacity
        if (InstantASP_IE4 || InstantASP_IE5 || InstantASP_Opera || InstantASP_NS6)	{
            body[0].style.filter = "";
        }
        
        // set pointer to default
        if (document.body != null) {document.body.style.cursor = 'default';}
        
        // hide loader
        iasp_RemoveLoader();
        
        // update flags
        iasp_bolLoadEnded = true;
        iasp_bolLoadStarted = false;
        
    }
}

var iasp_LoaderDiv;
function iasp_AddLoader() {

    // calculate position
    var top = Math.round((document.documentElement.clientHeight/2)+document.documentElement.scrollTop) + "px";
    var left = Math.round((document.documentElement.clientWidth/2))-100 + "px";
    
	// build loader
   if (!iasp_LoaderDiv) {iasp_LoaderDiv = document.createElement('div');}
    iasp_LoaderDiv.id = iasp_LoaderDivId;   
    iasp_LoaderDiv.style.position = 'absolute';
    iasp_LoaderDiv.style.top = top;
    iasp_LoaderDiv.style.left = left;
    iasp_LoaderDiv.style.zindex = 999999;
	iasp_LoaderDiv.innerHTML = iasp_AjaxLoadingText;
	
	// add to document
	document.body.appendChild(iasp_LoaderDiv);    
}

function iasp_RemoveLoader() {
    // hide loader
    var iasp_LoaderDiv = InstantASP_FindControl(iasp_LoaderDivId);
    if (iasp_LoaderDiv != null)  {
        iasp_LoaderDiv.style.display = "";
        document.body.removeChild(iasp_LoaderDiv);  
    }   
}


//-->
