<!--
// This file contains mixed scripts required by the site modules
// David Mitchell 2005-6-13



// open a link in a new window with no scrollbars
function openwindowlink(url, name) {

	url = getEnvironment(url);
   	newwin = window.open(url, name, "height=452, width=488, left=330, top=100, scrollbars=no, noresize=no");
   	newwin.focus();

}


// open a link in a new window with scrollbars
function openscrollingwindowlink(url, name) {

	url = getEnvironment(url);
   	newwin = window.open(url, name, "height=460, width=504, left=330, top=100, scrollbars=yes, noresize=no");
	newwin.focus();

}


// open a link in a new window with scrollbars
function openScrollingWindow(site, url, name) {

	url = getSiteEnvironment(site, url);
   	newwin = window.open(url, name, "height=500, width=504, left=330, top=100, scrollbars=yes, noresize=no");
	newwin.focus();

}


// create the proper url based on the environment we're on.
function getEnvironment(appendurl) {

	url=document.location.toString();

	// by testing > 0 and < 8, we ensure that these characters appear right after http://
	if(url.indexOf("dev") > 0 && url.indexOf("dev") <= 8) {
		url = "http://dev-referral.3web.com/" + appendurl;
	}
	else if (url.indexOf("pre") > 0 && url.indexOf("pre") <= 8) {
		url = "http://pre-referral.3web.com/" + appendurl;
	}
	else {
		url = "http://referral.3web.com/" + appendurl;
	}

	return(url);
}


// open a link in a new window with scrollbars
function getSiteEnvironment(site, appendurl) {

	var url = document.location.toString();
	var newurl = "";

    if (url.indexOf("8080/") >= 0) {
	    newurl = url.substring(0, url.lastIndexOf("8080/")+5);
	}
	else if (url.indexOf("localhost/") >=0) {
	    newurl = url.substring(0, url.lastIndexOf("localhost/")+10);
	}
	else {
	    newurl = url.substring(0, url.lastIndexOf(".com/")+5);
	}

    newurl = newurl + appendurl;

	return(newurl);
}



// Open the personal links picker window (used by personallinks module).
// Takes the url of the window to be opened as a parameter
function openWindow(link)
{

    myclWindow = window.open(link,"customize_links2","width=620,height=350,toolbar=0,resizable=yes,location=0,directories=0,status=0,menubar=0,scrollbars=0,copyhistory=0");
	if (myclWindow.opener == null)
  	myclWindow.opener = self;
}


// submit a form via javascript (used by weather module).
function submit_form(form) {
  form.submit();
}

//-->
