var sDefaultPage = "HomeTemplate.aspx";

function showDetail(id) 
{
	/* Call the current page in detail view mode */
	
	var sPath = window.location.href;
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	sPage = sPage.substring(0,sPage.indexOf('.aspx') + 5);

	window.location.href = sDefaultPage + "?view=detail&id=" + id;
}

function showTemplate(id) 
{
	/* Call the current page in template view mode */
	
	var sPath = window.location.href;
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	sPage = sPage.substring(0,sPage.indexOf('.aspx') + 5);

	window.location.href = sDefaultPage + "?view=template&id=" + escape(id);
}

function addBookmark() 
{

if ( navigator.appName != "Microsoft Internet Explorer" )
{ window.sidebar.addPanel(document.title,window.location.href,""); }
else { window.external.AddFavorite(window.location.href, document.title); }

	/* Add a bookmark to the page (IE only) */
/*if(navigator.appName != "Microsoft Internet Explorer")
 alert("Only available for Microsoft Internet Explorer");
else
{
	try {
		window.external.AddFavorite(window.location.href, document.title);
	}
	catch(ex) {
		alert('This feature is not supported by your browser')
	}
	}*/
}

function openStatPrint(id) 
{
	var url = "StatPrint.aspx?id=" + id;
	window.open (url, "eBird","toolbar=1, location=0,status=0,scrollbars=1, width=670,height=470,resizable=yes");
}

function openStatDownload(id) 
{
	var url = "StatDownload.aspx?id=" + id;
	window.open (url, "eBird","location=0,status=0,scrollbars=0, width=670,height=470");
}

function openStatDownloadExcel2000(id) 
{
	var url = "StatDownload.aspx?id=" + id + "&htmlformat=true";
	window.open (url, "eBird","location=0,status=0,scrollbars=0, width=670,height=470");
}

function showMetaCell(id,address)
{
	var w = screen.width-370;
	var h = screen.height-130;
		
	var win = window.open("../pages/PageInfo.aspx?view=cell&id=" + id + "&address=" + address, "users", "toolbar=no,menubar=no,status=no,scrollbars=1,width=370, height=130,left=" + (w/2) + ",top=" + (h/2));
	win.focus();
}
function showMetaRange(id,address)
{
	var w = screen.width-370;
	var h = screen.height-130;
		
	var win = window.open("../pages/PageInfo.aspx?view=range&id=" + id + "&address=" + address, "users", "toolbar=no,menubar=no,status=no,scrollbars=1,width=370, height=130,left=" + (w/2) + ",top=" + (h/2));
	win.focus();
}
function tellAFriend() 
{
	var w = screen.width-640;
	var h = screen.height-480;
	var url = location.href;
	var win = window.open("../pages/TellAFriend.aspx?url=" + escape(url),
	"tellafriend","toolbar=no,menubar=no,status=no,width=640, height=480,left=" + (w/2) + ",top=" + (h/2));
	win.focus();
}

function tellAFriend1(url) 
{
	var w = screen.width-640;
	var h = screen.height-480;
	var win = window.open("../pages/TellAFriend.aspx?url=" + escape(url),
	"tellafriend","toolbar=no,menubar=no,status=no,width=640, height=480,left=" + (w/2) + ",top=" + (h/2));
	win.focus();
}



function openOrderForm(id)
{
	var w = screen.width-370;
	var h = screen.height-130;
		
	var win = window.open("../pages/Commander.aspx?id=" + id ,"commander","toolbar=no,menubar=no,status=no,width=640, height=480,left=" + (w/2) + ",top=" + (h/2));
	win.focus();
}
function openMetaDataTable(id)
{
	var w = screen.width-640;
	var h = screen.height-600;
		
	var win = window.open("../pages/StatMetadata.aspx?id=" + id ,"","toolbar=no,menubar=no,status=no,width=640, height=600,left=" + (w/2) + ",top=" + (h/2));
	win.focus();
}

