function populateLoginForm()
{
	var email = getCookie("EMAIL");
	if(email != "" && email != "null" && email != null)
	{
		document.loginForm.EMAIL.value = email;
		document.loginForm.PASSWORD.value = "";
		//document.loginForm.PASSWORD.focus();
	}
}


function setCookie(name,value,days) 
{
	try
	{
		//alert("setCookie(" + name + "," + value + "," + days + ")");
		if (days) 
		{
			var date = new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000));
			var expires = "; expires="+date.toGMTString();
		}
		else var expires = "";
		document.cookie = name+"="+value+expires+"; path=/";			
	}
	catch (e)
	{

	}

}

function getCookie(name) 
{
	try
	{
		//alert("getCookie(" + name + ")");
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) 
		{
			var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(nameEQ) == 0)
			{
				var result = c.substring(nameEQ.length,c.length);
				//alert("getCookie(" + name + "):" + result);
				return result;
			}
		}
		return null;
	}
	catch (e)
	{

	}
}	

function googleAnalytics(URL)
{
	//window.status = "TRACKING: pageTracker._trackPageview('" + URL + "');"
	eval("pageTracker._trackPageview('" + URL + "');");
	//alert("pageTracker._trackPageview('" + URL + "');");
}



function popUp(URL) 
{
	//alert("javascript: popUp(" + URL + ")");
	
	
	day = new Date();
	id = day.getTime();
	var height = 550;
		
	if(getAvailableHeight() >= 800)
	{
		height = 850;
	}

	eval("page" + id + " = window.open('" + URL + "', '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=750,height=" + height + ", left=400,top=50');");
	
}

function openWindow(URL) 
{
	//alert("javascript: popUp(" + URL + ")");
	eval("page = window.open('" + URL + "', 'NewWindow', 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=800,height=600');");
}

function cropperPopUp(URL) 
{
	//alert("javascript: cropperPopUp(" + URL + ")");
	day = new Date();
	id = day.getTime();
	var height = 550;
	//alert("getAvailableHeight()=" + getAvailableHeight());
	
	if(getAvailableHeight() >= 800)
	{
		height = 800;
	}
	
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=750,height=" + height + ",left=400,top=50');");
}

function getAvailableHeight()
{
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' )
	{
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} 
	
	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) 
	{
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} 
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) 
	{
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	//window.alert( 'Width = ' + myWidth );
	//window.alert( 'Height = ' + myHeight );
	
	return myHeight;
}

function thisMovie(movieName) 
{
	 if (navigator.appName.indexOf("Microsoft") != -1) 
	 {
		 return window[movieName];
	 } 
	 else 
	 {
		 return document[movieName];
	 }
}

function call_refreshTeamData()
{
	thisMovie("flashDiv").call_refreshTeamData();
}
function call_refreshImage()
{
	thisMovie("flashDiv").call_refreshImage();
}
