function WinOpen(whatwin) 
{
    win=open(whatwin,"popup","resize=no,status=0,scrollbars=no,toolbar=no,directories=no,menubar=no,width=550,height=500");
    win.focus();
}

/**************************************************************************************************************************/
/*
Author: Ahmad Zadli
Description: All the functions below deal with the Special Sections repeater panel.
Tom wants the following things:

1. The title of the article to appear as a hot link, just like the 'More' link.
2. The state of the browser that focuses on the main article that was clicked
   using anchor links. 
*/

// Will be called when the user clicks the title link or the 'More' link in the Special Sections panel.
function SS_ExpandLink(cntrlLink)
{
	__doPostBack(cntrlLink.name + '$ddpanel$_ctl1$lnkExpand','');
	// store in cookie so that we can get later.
	document.cookie = 'anchorname=anchor_' + cntrlLink.name; 
}

// Will be called by the body onload event. Only relevant for the Special Section area.
// It uses the anchor link so that when the user clicks on the expand link, it will jump to
// that article.
function SS_DetermineAnchorLink()
{
	// Only do it if the user is browsing the Special Section panel
	if (getQueryVariable('area') == 'ssindex')
	{
		// First get the cookie if it is there
		var cookieAnchor = get_cookie("anchorname") 
		
		if (cookieAnchor != '')
			window.location.href = '#' + cookieAnchor;
	}
	else // else we remove the old cookies for clean-up purposes.
	{
		document.cookie = '';
	}
}

// Function to retrieve the cookie value
function get_cookie(Name) {
	var search = Name + "="
	var returnvalue = "";
	if (document.cookie.length > 0) {
		offset = document.cookie.indexOf(search)
		// if cookie exists
		if (offset != -1) 
		{ 
			offset += search.length
			// set index of beginning of value
			end = document.cookie.indexOf(";", offset);
			// set index of end of cookie value
			if (end == -1) end = document.cookie.length;
			returnvalue=unescape(document.cookie.substring(offset, end))
		}
	}
	return returnvalue;
}

// Function to get the value of a certain query string.
function getQueryVariable(variable) 
{
	// Retrieve the url
	var query = window.location.search.substring(1);
	// Split the query strings based on the & character
	var vars = query.split("&");
	for (var i=0;i<vars.length;i++) 
	{
		var pair = vars[i].split("=");
		if (pair[0] == variable) // Found that query string!
		{
			return pair[1];
		}
	} 
	return null; // Nothing is found
}