var loc = document.location.toString(); 
var index1 = loc.lastIndexOf("mysales");
var index2 = loc.lastIndexOf("loginxx");
var index3 = loc.lastIndexOf("registration");
var index4 = loc.lastIndexOf("myclients");
var index5 = loc.lastIndexOf("Administration");
var indexSep = loc.indexOf(":"); 
var url = loc.substring(indexSep,loc.length); 

if ((index1 != -1 || index2 != -1 || index3 != -1 || index4 != -1 || index5 != -1) && indexSep == "4") 
{	
	var secureUrl = "https" + url; 
	location.replace(secureUrl); // get rid of current page in history location.href = secureUrl; 
}
else if ((index1 == -1 && index2 == -1 && index3 == -1 && index4 == -1 && index5 == -1) && indexSep == "5")
{
	var nonsecureUrl = "http" + url; 
	location.replace(nonsecureUrl); // get rid of current page in history location.href = nonsecureUrl; 
}


function interceptEnterKey(buttonToClick)
{
	if (event.keyCode == 13)
	{
		event.cancelBubble = true;
		event.returnValue = false;

		//if(document.getElementById('AWBLogin1_txtUserName') != null)
		//{
			//if ((document.getElementById('AWBLogin1_txtUserName').value != '') && (document.getElementById('AWBLogin1_txtPassword').value != ''))
			//{
			//	document.getElementById('AWBLogin1_btnLogin').click();
			//}		
			//else if (document.getElementById('Header1_txtSearch').value != '')
			//{
				document.getElementById('Header1_searchLink').click();
			//}
		//}
		if(document.getElementById('SearchUserCtrl1_btnSearch') != null)
		{
			document.getElementById('SearchUserCtrl1_btnSearch').click();
		}
		else
		{
			if (document.getElementById('Header1_txtSearch').value != '')
			{
				document.getElementById('Header1_searchLink').click();
			}
		}
	}
}

function setFocusToUserName()
{
	//if(document.getElementById('AWBLogin1_txtUserName') != null)
	//{
	//	document.getElementById('AWBLogin1_txtUserName').focus();
	//}
}

function toggleMetaData()
{
	var metaDiv = document.getElementById('metainner');
	
	if(metaDiv.style.display == 'none')
	{
		metaDiv.style.display = 'block';
	}
	else
	{
		metaDiv.style.display = 'none';
	}
}
