function ddlSelectIndexByID(obj, id)
{
				var i = 0;
				while(i < obj.length)
				{
					if(obj.options[i].value == id)
					{
						obj.options.selectedIndex = i;
					}
					i++;
				}
}

function ddlSelectIndexByValue(obj, value)
{
				var i = 0;
				while(i < obj.length)
				{
					if(obj.options[i].text == id)
					{
						obj.options.selectedIndex = i;
					}
					i++;
				}
}

function getURLVirtual()
{
			var str = document.URL;
			str = str.replace("http://", "");
			str = str.substring(str.indexOf("/") + 1, str.length);
			str = str.substring(0, str.indexOf("/"));
			
			return str;
}


var testwin, RedURL;

function	checkPopUpBlocker(RedirectURL)
{
			//check to see if popup blocker is installed
			testwin = window.open("about:blank","IM_Win", "height=1, width=1, top=0, left=0, menubar=0, scrollbars=0,location=0, resizable=0, status=0");
			RedURL = RedirectURL;

			setTimeout('PopUpBlocker()',500);
}

function PopUpBlocker()
{
	var winExists=0;
	try
	{
		if (testwin.location.href != "") winExists=1;
	}
	catch(e){}
	
	if (winExists==1)
	{
		testwin.close();
		checkAppWindow(RedURL);	
	}
	else
	{
		alert("You have a pop-up blocker installed.\n\nThis application will not run unless you either\n\t1.) Uninstall the pop-up blocker.\n\t2.) Add this site to the list of safe sites.");
	}

}

function checkAppWindow(RedirectURL)
{
		// Do not close the window if it is the Application
		if (window.name != getURLVirtual())
		{
			window.open(RedirectURL ,getURLVirtual(), "height=600, width=800, top=0, left=0, menubar=0, scrollbars=1,location=0, resizable=1, status=1");

			// Destroy this Window
			var oMe = window.self;
			oMe.opener = window.self;
			oMe.close();
		}
		else
		{
		self.moveTo(0,0)
		self.resizeTo(800,600)
		}
}
