// array of child windows
var children = new Array();

// object of an new window
var childWindow = null;

// get member id from url
var palId = getArgs().palId;
var alias = getArgs().alias;

// swf file id 
//var swfID="contactlist";

// player parameters
var playerWidth = '100%';
var playerHeight = '100%';
var playerVersion = '8';

function CheckToClose()
{
	if (window.opener)
  {
		try
		{
			if (window.opener.closed)
			{
				window.close();
			}
		}
		catch (err)
		{
			window.close();
		}
	}
	else
	{
		window.close();
	}
}

function getArgs ()
{
	var args = new Object();
	var query = location.search.substring(1);
	var pairs = query.split("&");
	for(var i = 0; i < pairs.length; i++)
	{
		var pos = pairs[i].indexOf('=');
		if (pos == -1) continue;
		var argname = pairs[i].substring(0, pos);
		var value = pairs[i].substring(pos + 1);
		args[argname] = unescape(value);
	}
	
	return args;
}

function CloseChilds ()
{
	for (var i = 0; i < children.length; i++)
	{
		children[i].close();
	}
}

function OpenRemovePalConfirmation( palId )
{

	var url = "/instant_messenger/RemovePalConfirmation.aspx?palId=" + palId;
	var windowName = "confirm" + palId;
	childWindow = window.open(url,windowName,"width=430,height=190,location=no,menubar=no,resizable=yes,scrollbars=no,status=no,titlebar=no,toolbar=no");
	children[children.length] = childWindow;
}

function OpenRemoveGroupConfirmation( groupId )
{
	var url = "/instant_messenger/DeleteGroupConfirmation.aspx?GroupId=" + groupId;
	var windowName = "remgroup" + groupId;
	childWindow = window.open(url,windowName,"width=430,height=190,location=no,menubar=no,resizable=yes,scrollbars=no,status=no,titlebar=no,toolbar=no");
	children[children.length] = childWindow;
}

function ShowAddGroup() 
{
   childWindow = window.open("/instant_messenger/AddGroup.aspx", "add_group", "width=420,height=250,location=no,menubar=no,resizable=yes,scrollbars=no,status=no,titlebar=no,toolbar=no");
   children[children.length] = childWindow;
}
function ShowAddPal() 
{

    childWindow = window.open("/instant_messenger/AddPal.aspx", "add_pal", "width=440,height=370,location=no,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,toolbar=no");
    children[children.length] = childWindow;
}
function ShowBlockList() 
{

    childWindow = window.open("/instant_messenger/BlockList.aspx", "block_list", "width=530,height=400,location=no,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,toolbar=no");
    children[children.length] = childWindow;

}
function DeleteGroup() 
{


   childWindow = window.open("/instant_messenger/DeleteGroup.aspx", "del_group", "width=420,height=260,location=no,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,toolbar=no");
   children[children.length] = childWindow;
}

function ShowEditGroup() 
{

   childWindow = window.open("/instant_messenger/EditGroup.aspx", "ed_group", "width=420,height=260,location=no,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,toolbar=no");
   children[children.length] = childWindow;
}
function ShowPrivacy() 
{
   childWindow = window.open("PrivacySettings.aspx", "ps_pal", "width=430,height=540,location=no,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,toolbar=no");
   children[children.length] = childWindow;
}
function ShowRenameGroup() 
{
   childWindow = window.open("RenameGroup.aspx", "ren_gr", "width=430,height=340,location=no,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,toolbar=no");
   children[children.length] = childWindow;
}
function RemovePal() 
{
   childWindow = window.open("RemovePal.aspx", "rem_pal", "width=420,height=370,location=no,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,toolbar=no");
   children[children.length] = childWindow;
}
	

function ShowUserInfo(palId) 
{
   var url = "/instant_messenger/UserInfo.aspx?palId=" + palId;
   childWindow = window.open(url, "uInfo", "width=420,height=280,location=no,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,toolbar=no");
   children[children.length] = childWindow;
  
}
function ShowProviderInfo(providerId) 
{
	var url = "/reviews/show.asp?id="+providerId;
	childWindow = window.open(url, "prividerInfo","top=100, left=100, height=600, width=760, location=no, resizable=yes, scrollbars=no, toolbar=no, status=no");
	children[children.length] = childWindow;
}
function ShowHelp() 
{

   childWindow = window.open("Help.aspx", "uHelp", "width=420,height=350,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,titlebar=no,toolbar=no");
   children[children.length] = childWindow;
}
function ShowAbout() 
{

   childWindow = window.open("About.aspx", "uAbout", "width=420,height=350,location=no,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,toolbar=no");
   children[children.length] = childWindow;
}
function ShowFAQ() 
{

   childWindow = window.open("FAQ.aspx", "uFaq", "width=420,height=350,location=no,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,toolbar=no");
   children[children.length] = childWindow;
}
function OpenRefWindow( url )
{
    if (opener)	
     opener.open(url, '_blank');	
   //window.open( url );
}
function RemovePalClick(palId) //used by flash
{
	params = '?PalId=' + palId;			
	OpenChild('RemovePalConfirmation', params, 'width=430,height=190,location=no,menubar=no,resizable=yes,scrollbars=no,status=no,titlebar=no,toolbar=no');
}