<!--

function popunder(popurl)
{
	winpops=window.open(popurl,"popunder","width=385,height=515,top=1,left=1,scrollbars=no");
	this.focus();
}

function CheckReqFields(oForm) {

	// Form for ERIS Customer Message Centre administration
	if (oForm.Title.value == '') {
		alert('"Title" is a required field.');
		return false;
	}
	if (oForm.text.value == '') {
		alert('"Text" is a required field.');
		return false;
	}
	
	return true	
}
// -->


function SetLang(lang) {
	if (lang == 'FR')
		document.write('<%=Session("VER") = "FR" %>');
	else
		document.write('<%=Session("VER") = "EN" %>');
}

function AdjustFrameHeight(container, content) {
    window.parent.scroll(0,0);
	container.style.height = '3050px';
/*
    if (content.location.href.indexOf('OrderFormStep1.asp') > -1)
        container.style.height = content.document.body.scrollHeight + 200;
    else
        container.style.height = content.document.body.scrollHeight;
*/
}


function AdjustFrameHeightNonIE(frameName) {
	document.getElementById(frameName).height = '3050px';
//    if (navigator.userAgent.indexOf('MSIE') == -1) {
//        document.getElementById(frameName).height = document.documentElement.scrollHeight;
//    }
}

function popImage(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=yes,location=0,statusbar=0,menubar=0,resizable=0,width=740,height=420');");
}


function ReadCookie(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for (var i = 0; i < ca.length; i++) {
        var c = ca[i];
        while (c.charAt(0) == ' ') c = c.substring(1, c.length);
        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
    }
    return null;
}


function FilterNumericOnly(field, e) {
  if (window.event != null)
  {
    // IE
    e  = event;
    var c = String.fromCharCode(e.keyCode);
    var field = e.srcElement;
  }
  else
  {
    var c = String.fromCharCode(e.which);
    var field = e.target;
  }
  
  if (e.type == "blur")
  {
    var regularExpression  = /^[+-]?\d*\.?\d*$/;
    if (field.value.search(regularExpression) == -1)
    {
        eval('spn' + field.name + 'IncorrectFmt').style.display = 'block';
        field.focus();
    }
    else 
    {
        eval('spn' + field.name + 'TypingError').style.display = 'none';
        eval('spn' + field.name + 'IncorrectFmt').style.display = 'none';
    }
  }
  else
  {  
      if ("0123456789.+-".indexOf(c) == -1 || (c == '.' && field.value.indexOf(".") != -1)) {
        
        /* unknown key pressed; ignore it */
        if (window.event != null) e.returnValue = false;
        else 
            if (e.which != 0 && e.which != 8 && !e.ctrlKey) e.preventDefault(true);
        
        if ("OW".indexOf(c.toUpperCase()) != -1)
        {
            if (field.value.length == 0 || "+-".indexOf(field.value.substring(0,1)) == -1) field.value = "+" + field.value;
            eval('spn' + field.name + 'TypingError').style.display = 'block';
        }
        else if ("E".indexOf(c.toUpperCase()) != -1)
        {
            if (field.value.length == 0 || "+-".indexOf(field.value.substring(0,1)) == -1) field.value = "-" + field.value;
            eval('spn' + field.name + 'TypingError').style.display = 'block';
        }
      }
      else 
      {
        eval('spn' + field.name + 'TypingError').style.display = 'none';
        eval('spn' + field.name + 'IncorrectFmt').style.display = 'none';
      }
  }  
}


function GetEvent(e)
{
    alert(e.target);
}
//function ClearFrameURLCookie() {
//    document.cookie = "frameURL=/reports/welcome.aspx; path=/";
//    alert();
//}