function addToFavorite(favTitle){
	
				 var hostname="http://" + location.host;
  			 if (window.sidebar) { // Mozilla Firefox Bookmark	
  			 		window.sidebar.addPanel(unescape(favTitle), hostname,"");	
  			 } else if( window.external ) {  	// IE Favorite		
  			 	window.external.AddFavorite( hostname, unescape(favTitle)); 
  			 }	else if(window.opera && window.print) { // Opera Hotlist	
  			 		return true;  
  			 }
}

function custom_print() {
    if (document.all) {
        if (navigator.appVersion.indexOf("5.0") == -1) {
            var OLECMDID_PRINT = 6;
            var OLECMDEXECOPT_DONTPROMPTUSER = 2;
            var OLECMDEXECOPT_PROMPTUSER = 1;
            var WebBrowser = "<OBJECT ID=\"WebBrowser1\" WIDTH=0 HEIGHT=0 CLASSID=\"CLSID:8856F961-340A-11D0-A96B-00C04FD705A2\"></OBJECT>";
            document.body.insertAdjacentHTML("beforeEnd", WebBrowser);
            WebBrowser1.ExecWB(6, 2);
            WebBrowser1.outerHTML = "";
        } else {
            self.print();
        }
    } else {
        self.print();
    }
}

var month=new Array(L_January,L_February,L_March,L_April,L_May,L_June,L_July,L_August,L_September,L_October,L_November,L_December)
var today=new Date()
var thisDate=today.getDate()
var thisMonth=month[today.getMonth()]
var year=today.getYear()
if (year < 1000) {year += 1900};
var TheDate = thisDate + " " + thisMonth + " " + year


function isDate(strValue){
  var objRegExp = /^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/

  //check to see if in correct format
  if(!objRegExp.test(strValue))
    return false; //doesn't match pattern, bad date
  else{
    var arrayDate = strValue.split('/'); 
    //split date into month, day, year
    //create a lookup for months not equal to Feb.
    var arrayLookup = { '01' : 31,'03' : 31, '04' : 30,'05' : 31,'06' : 30,'07' : 31,
                        '08' : 31,'09' : 30,'10' : 31,'11' : 30,'12' : 31}
		
		if (arrayDate[0].charAt(0)=='0') arrayDate[0]=arrayDate[0].charAt(1);
    var intDay = parseInt(arrayDate[0]);
		if (arrayDate[1].length==1) arrayDate[1] ='0'+arrayDate[1].toString();
		var intMonth = parseInt(arrayDate[1]);
		 
    //check if month value and day value agree
    if(arrayLookup[arrayDate[1]] != null) {
      if(intDay <= arrayLookup[arrayDate[1]] && intDay != 0)
        return true; //found in lookup table, good date
    }

   
    if (intMonth == 2) { 
       var intYear = parseInt(arrayDate[2]);
       if( ((intYear % 4 == 0 && intDay <= 29) || (intYear % 4 != 0 && intDay <=28)) && intDay !=0)
          return true; //Feb. had valid number of days
    } 
  }
  return false; //any other values, bad date
}

function getClientHeight(id){
		var el=document.getElementById(id);
		return  el.contentWindow.innerHeight || el.contentWindow.document.documentElement.clientHeight || el.contentWindow.document.body.offsetHeight || 0; 
		}

function calcHeight(id)
{
	var w;
	var el = document.getElementById(id);		
	if (el) {
		//find the height of the internal page
		//change the height of the iframe
		//alert(getClientHeight(id));

	    //setTimeout(function(){el.height=getClientHeight(id);}, 100); //wait a sec
	    try {
	        if (el.contentWindow.document.body.scrollHeight == 0) {
				    switch (id){
					    case 'fraNewsletters'	: w=103; break;
					    case 'fraPolls'				: w=228; break;
					    default:  w=200;
				    }
			    } else {			
				    w=el.contentWindow.document.body.scrollHeight;
		    }
		    el.height = w + 10;
		} catch(e) { /* ignore */ }	
    }
}

function isEmail(email) {
 /*
    if (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
        return true;
    else
        return false;
   */
     /*
        var expr = /^[a-z0-9]([a-z0-9_\-\.]*)@([a-z0-9_\-\.]*)(\.[a-z]{2,3}(\.[a-z]{2}){0,2})$/i;
        //check for valid email
        return expr.test(expr);
        */
        
        var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/  
        return email.match(re)  

 
}

// LTrim(string) : Returns a copy of a string without leading spaces.
function ltrim(str) {
    var whitespace = new String(" \t\n\r");
    var s = new String(str);
    if (whitespace.indexOf(s.charAt(0)) != -1) {
        var j = 0, i = s.length;
        while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
            j++;
        s = s.substring(j, i);
    }
    return s;
}

//RTrim(string) : Returns a copy of a string without trailing spaces.
function rtrim(str) {
    var whitespace = new String(" \t\n\r");
    var s = new String(str);
    if (whitespace.indexOf(s.charAt(s.length - 1)) != -1) {
        var i = s.length - 1;       // Get length of string
        while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
            i--;
        s = s.substring(0, i + 1);
    }
    return s;
}

// Trim(string) : Returns a copy of a string without leading or trailing spaces
function trim(str) {
    return rtrim(ltrim(str));
}

function openWin(winName, urlLoc, w, h, showStatus, isViewer, maximized, scrollbar, resize) {
    l = (screen.availWidth - w) / 2;
    t = (screen.availHeight - h) / 2;

    // if (window.showModalDialog) {
    //	win= window.showModalDialog(urlLoc, window, 'resizable: no; help: no; status: no; scroll: no; dialogHeight:' + (h) + 'px; dialogWidth:'+(w) +'px; center:yes');
    // } else {

    features = "toolbar=no";      // yes|no
    features += ",location=no";    // yes|no
    features += ",directories=no"; // yes|no
    features += ",status=" + (showStatus ? "yes" : "no");  // yes|no
    features += ",menubar=no";     // yes|no
    if (typeof scrollbar != 'undefined')
        features += ",scrollbars=yes";   // auto|yes|no
    else
        features += ",scrollbars=no";   // auto|yes|no

    if (typeof resize != 'undefined')
        features += ",resizable=yes";
    else
        features += ",resizable=no";

    features += ",dependent";      // close the parent, close the popup, omit if you want otherwise
    if (maximized) {
        features += ",maximize=1";
        features += ",height=" + h;
        features += ",width=" + w;
    } else {

        features += ",height=" + h;
        features += ",width=" + w;
    }
    features += ",left=" + l;
    features += ",top=" + t;

    winName = winName.replace(/[^a-z]/gi, "_");
    return window.open(urlLoc, winName, features);
    // }
}



//APPLICATION / E-PAYMENTS FUNCTIONS






