/*function SetElementWidth(dd, width)
{
	var elem = document.getElementById(dd);
	elem.style.width = width;
	elem.expand;
}*/

//Not used
function FixTopMenu()
{
	var menu = document.getElementById('topmenu');
			
	if(menu)
	{
		var menuitems = menu.getElementsByTagName('li');
		if(menuitems)
		{
			var count = menuitems.length;
			for(i = 0; i < menuitems.length; i++)
			{
				if(menuitems[i].className && menuitems[i].className == 'menusep')
					count--;
			}
			if(count < 5)
			{
				menu.className = 'RightMarginFixlt5';
			}
			else if(count == 5)
			{
				menu.className = 'RightMarginFix5';
			}
			else if(count == 6)
			{
				menu.className = 'RightMarginFix6';
			}
			else if(count == 8)
			{
				menu.className = 'RightMarginFix8';
			}			
			
		}
	}
}


// opens a calendar window from a page and writes the selected date to a chosen writable control
function openCalendar(control_name) {
    calendar_window=window.open('/Templates/Popups/CalendarPopup.aspx?formname='+control_name,'calendar_window','width=190,height=210,');
    calendar_window.focus();
}

function openPopup(url, title, width, height) {
    window.open(url, title, 'status=no,toolbar=no,scrollbars=no,resizable=no,menubar=no,location=no,directories=no,width='+width+',height='+height);
}

String.prototype.endsWith = function(s){
	var reg = new RegExp(s + "$");
	return reg.test(this);
}

function ResetProfileSearchDropdownsByTagName()
{
	var elems = document.getElementsByTagName('select');
	
	for(i = 0; i < elems.length; i++)
	{
		if(elems[i].id.endsWith('OfficeDropDown') || elems[i].id.endsWith('IndustryGroupsDropDown'))
		{
			if(elems[i].selectedIndex) {
				elems[i].selectedIndex = 0;
				elems[i].blur();
		    }
		}
		
		else if(elems[i].id.endsWith('IndustryDropDown') || elems[i].id.endsWith('BranchDropDown'))
		{
			if(elems[i].selectedIndex) {
				elems[i].selectedIndex = 0;
				elems[i].blur();
		    }
		}		
		
	}
	
	
}

function ResizeWindow()
{	
	window.resizeTo(990,730);
}

function CloseWindow()
{
	window.open('','_parent','');
	window.close();
}

