function getValue(varname)
{
  // First, we load the URL into a variable
  var url = window.location.href;

  // Next, split the url by the ?
  var qparts = url.split("?");

  // Check that there is a querystring, return "" if not
  if (qparts.length == 0)
  {
    return "";
  }

  // Then find the querystring, everything after the ?
  var query = qparts[1];

  // Split the query string into variables (separates by &s)
  var vars = query.split("&");

  // Initialize the value with "" as default
  var value = "";

  // Iterate through vars, checking each one for varname
  for (i=0;i<vars.length;i++)
  {
    // Split the variable by =, which splits name and value
    var parts = vars[i].split("=");
    
    // Check if the correct variable
    if (parts[0] == varname)
    {
      // Load value into variable
      value = parts[1];

      // End the loop
      break;
    }
  }
  
  // Convert escape code
  value = unescape(value);

  // Convert "+"s to " "s
  value.replace(/\+/g," ");

  // Return the value
  return value;
}


function open_window(url)  
{
	mywin = window.open(url,"win",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1, width=480,height=420, top=25, left=25, screenX=0, screenY=0');
}
function open_window2(url)  
{
	mywin = window.open(url,"win",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0, width=340,height=80, top=200, left=200, screenX=0, screenY=0');
}
function calc_open_window(url)  
{
	mywin = window.open(url,"win",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1, width=680,height=420, top=25, left=25, screenX=0, screenY=0');
}
function rate_window(url)  
{
	nurl = "printer_ready_cd_rates.asp?rates=Yes";
	mywin = window.open(nurl,"window",'titlebarno,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1, width=740, height=480, top=25, left=25, screenX=0, screenY=0');
}

function news_window(url)  
{
	nurl = "printer_ready_pr.asp?article=" + url;
	mywin = window.open(nurl,"window",'titlebarno,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1, width=740, height=480, top=25, left=25, screenX=0, screenY=0');
}
function print_window(url)  
{
	nurl = "printer_ready.asp?article=" + url;
	mywin = window.open(nurl,"window",'titlebarno,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1, width=740, height=480, top=25, left=25, screenX=0, screenY=0');
}
function print_window_trust(url)  
{
	nurl = "printer_ready_trust.asp?article=" + url;
	mywin = window.open(nurl,"window",'titlebarno,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1, width=740, height=480, top=25, left=25, screenX=0, screenY=0');
}

function faq_window(url)  
{
	mywin = window.open(url,"window",'titlebarno,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1, width=630, height=480, top=25, left=25, screenX=0, screenY=0');
}
function spawn_window(url)  
{
	mywin = window.open(url,"window",'titlebarno,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1, width=520, height=480, top=25, left=25, screenX=0, screenY=0');
}
function link_alert(NewPage)
{
	input_box=confirm("NOTICE: You are now leaving Southern Michigan Bank and Trust web site. The external site you have selected is not owned or controlled by us, and we express no responsibility or endorsement for the information, accuracy, presentation or hyperlinks on it. By exiting our web site, you will no longer be protected by our privacy policy or security practices.");

	if (input_box==true)

	{ 
		// Output when OK is clicked

 		 window.open(NewPage);
	}

}

