// The following two functions are used to add a call to a script function that
// from the body onload.  Reddot has its own onload functions, and will therefore not display
// the menu if you do not use this method to add a function to teh onload.  This method will
// basically append your function call to the onload that reddot creates and therefore will
// fire all the appropriate method and functions.
    var onloadArray = new Array();
    var bodyOnload = false;
    function add_onload(functionName){
        if (bodyOnload!=true){
            // define the body element and create the onload handler
            if (document.getElementsByTagName("body")[0]!= null){
                var doc_body = document.getElementsByTagName("body")[0];
                if (typeof(doc_body.onload)=="function"&&doc_body.onload.toString().indexOf('executeFunctions')==-1) onloadArray[onloadArray.length]=doc_body.onload;
                    bodyOnload=true;
            }
        }
        // add onload functions to the array
        onloadArray[onloadArray.length] = functionName;
        window.onload=executeFunctions;
    }
    // execute functions that are specified as onload functions for the page.
    function executeFunctions() {
        for (i in onloadArray) {
            if (typeof(onloadArray[i])=="function") onloadArray[i].apply();
            else eval(onloadArray[i]);
        }
    }
 
//this is used for the email a friend link
function OpenEmailWindow(link) {
    winwidth = 400;
    winheight = 340;
    if(screen.width) {
        var winl = (screen.width-winwidth)/2;
        var wint = (screen.height-winheight)/2;
    } else {
        winl = 50;
        wint = 50;
    }
    if (winl < 0) winl = 0;
    if (wint < 0) wint = 0;
    
    window.open(''+link+'','emailwindow','left='+winl+',top='+wint+',width='+winwidth+',height='+winheight+',toolbar=0,resizable=0,scrollbars=0,location=0,status=0,menubar=0');
}
//this script grabs the querystring for the email a friend widget
 var qs2 = location.search; 
var qs3 = ""
    if (qs2 !== "") {
       qs2 = qs2.substring(1);
       qs3 = "&"+qs2                                 
    }
 //this is used to remove the yellow from google autofill
  if(window.attachEvent)
    window.attachEvent("onload",setListeners);
  function setListeners(){
    inputList = document.getElementsByTagName("INPUT");
    for(i=0;i<inputList.length;i++){
      inputList[i].attachEvent("onpropertychange",restoreStyles);
      inputList[i].style.backgroundColor = "";
    }
    selectList = document.getElementsByTagName("SELECT");
    for(i=0;i<selectList.length;i++){
      selectList[i].attachEvent("onpropertychange",restoreStyles);
      selectList[i].style.backgroundColor = "";
    }
  }
  function restoreStyles(){
    if(event.srcElement.style.backgroundColor != "")
      event.srcElement.style.backgroundColor = "";
  }

//this is used for the email a friend link
function OpenRSVPWindow(link) {
    winwidth = 600;
    winheight = 600;
    if(screen.width) {
        var winl = (screen.width-winwidth)/2;
        var wint = (screen.height-winheight)/2;
    } else {
        winl = 50;
        wint = 50;
    }
    if (winl < 0) winl = 0;
    if (wint < 0) wint = 0;
    
    window.open(''+link+'','emailwindow','left='+winl+',top='+wint+',width='+winwidth+',height='+winheight+',toolbar=0,resizable=0,scrollbars=0,location=0,status=0,menubar=0');
}
