function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}

function FS_DivSwapRestore(evt) {
	evt = (evt) ? evt : event;
	target = (evt.target) ? evt.target : evt.srcElement;
	if (target.nodeType == 3) target = target.parentNode;
	if (target) {
		if (evt.type == "mouseover") {
			var elm = MM_findObj('teaserview');
			elm.FSoHTML = elm.innerHTML;
			var r = target.getElementsByTagName('div');
			elm.innerHTML = r[0].innerHTML;
		} else if (evt.type == "mouseout") {
			var elm = MM_findObj('teaserview');
			elm.innerHTML = elm.FSoHTML;
		} else 	return true;
	} else return true;
}

function addEvent(obj, sType, fn){
    if (obj.addEventListener){
        obj.addEventListener(sType, fn, false);
    } else if (obj.attachEvent) {
        var r = obj.attachEvent("on"+sType, fn);
    } else {
        alert("Handler could not be attached");
    }
}

function initDivSwapRestore() 
{
 var divt = document.getElementsByTagName('div');
 if (divt != null) {
	 for( var i = 0; i < divt.length; i++ )
	 {
	  if( divt[i].className == "teaser" ) {
		addEvent(divt[i],'mouseover',FS_DivSwapRestore);
		addEvent(divt[i],'mouseout',FS_DivSwapRestore);
	  }
	 }
 }
}
// Flips the display of an object
function flipDisplay(layerID)
{ 
  var visStr, obj;
  if ((obj = MM_findObj(layerID)) != null)
  {
    if (obj.style)
    {
      obj = obj.style;
      obj.display = (obj.display == 'none' || obj.display == '') ? 'block' : 'none';
	  return obj.display;
	}
  }
}

// Flips the display of an object and swaps an image at the same time
function flipExpand(LayerID,ImageID,ImgVisSrc, ImgHidSrc)
{
	var argc=arguments.length;
	ImgVisSrc=(argc>2) ? arguments[2] : '../images/tri-down.gif';
	ImgHidSrc=(argc>3) ? arguments[3] : '../images/tri-right.gif';
	if (flipDisplay(LayerID) == 'none') {
		switchImage(ImageID,ImgHidSrc);
	} else {
		switchImage(ImageID,ImgVisSrc);
	}
	return false;
}

function switchImage(imgName, imgSrc) 
{
  if (document.images)
  {
    if (imgSrc != "none")
    {
      document.images[imgName].src = imgSrc;
    }
  }
}
var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}
var subPopUp=0;
function subscribePop(URLStr)
{
  var width=450;
  var height=290;
  if(subPopUp)
  {
    if(!SubPopUp.closed) SubPopUp.close();
  }
  SubPopUp = open(URLStr, 'SubPopUp', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+'');
}

function MM_jumpWindow(targ,selObj,restore){ //v1.0
  window.open(selObj.options[selObj.selectedIndex].value);
  if (restore) selObj.selectedIndex=0;
}