var newwin;

function launchwin(winurl,winname,winfeatures) {
	newwin = window.open([winurl],[winname],[winfeatures]);
	if (newwin.focus) {
		setTimeout('newwin.focus();',250);
	}
}

function go_home (src) {
	if (window.parent.frames) {		window.parent.frames[1].location.href = '/home/home.asp?src=' + src;
		return;	
	}
}

function goto_url (strURL,src) {
	if (window.parent.frames) {
		if (!(strURL == '' )) {
			window.parent.frames[1].location.href = strURL + '?src=' + src;
			return;	
		}
	}
}

function loadURL (strWhere) {
	if (!(strWhere == '')) {
		window.parent.frames[1].location.href = strWhere;
		return;	
	}
	alert('supposed to go somewhere !');
}

function pop_window(strWhich,strSrc) {
	var strUrl
	strUrl = '/register/'

	if ((document.cookie.search('MIDGUID') < 0)) {
		strUrl = strUrl + 'default.asp?cmd=login&svc=' + strWhich + '&src=' + strSrc;
		launchwin(strUrl,'register_window','toolbar=no,height=500,width=500,scrollbars=yes,screeny=130,screenx=165,left=130,top=10');
		return;
	}

	if ((strWhich == 'all')) {
		strUrl = strUrl + 'default.asp?svc=all&src=' + strSrc;
		launchwin(strUrl,'register_window','toolbar=no,height=380,width=500,scrollbars=yes,screeny=130,screenx=165,left=130,top=165');
		return;
	}
	
	
	if ((strWhich == 'clndr')) {
		loadURL('/calendar/default.asp' + '?src=' + strSrc);
		return;
	}

	if ((strWhich == 'ptabms')) {
		loadURL('/photoalbums/default.asp' + '?src='  + strSrc);
		return;
	}

	if ((strWhich == 'grtcrds')) {
		loadURL('/ecards/default.asp' + '?src=' + strSrc);
		return;
	}

	if ((strWhich == 'qml')) {
	launchwin('/mail/mailoptions.asp?src=' + strSrc , 'mail' , 'height=380,width=500,scrollbars=yes,screeny=130,screenx=165,left=130,top=165');
		return;
	}


	return;
	}


function mail(src) {
	pop_window('qml',src);
}

function chat(src) {
	launchwin('/chat/default.asp?src=' + src, 'chat' , 'height=380,width=595,screeny=165,screenx=130,left=130,top=165,scrollbars=yes');
}

function search(src) {
	if (screen.width) {w = screen.width - 10};
	if (window.outerWidth) {w = window.outerWidth};
	if (w > 800) {w=800};
	launchwin('/search/search.asp?src=' + src, 'search' , 'height=140,width='+w+',screeny=0,screenx=0,left=0,top=0,scrollbars=yes');
}

function help(id,src) {
	launchwin('/help/default.asp?HelpId=' + id + '&src=' +src ,'help' , 'height=380,width=620,screeny=130,screenx=165,left=130,top=165');
}