function deleteInfoRow(num)  {
    for (var i = 0; i < num; i++)  {
        document.getElementById('myTable2').deleteRow(0);
    }
    try  {
        for (var i = 0; i < 3; i++)  {
            document.getElementById('myTable3').deleteRow(0);
        }
    } catch (e)  {}
    numberRows  = 0;
}
//end function deleteInfoRow
function buildTable(mylist, mylist2, mytable)  {
    for (var i = mylist.length - 1; i >= 0; i--)  {
        if (mytable  == "reg")  {
            var x  = document.getElementById('myTable2').insertRow(0);
        } else  {
            var x  = document.getElementById('myTable3').insertRow(0)
        }
        var y  = x.insertCell(0);
        var z  = x.insertCell(1);
        pubLabel  = document.createElement("span");
        textField  = document.createElement("input");
        pubLabel.tabIndex  = "-1";
        pubLabel.innerHTML  = "<a href='#'>"  + mylist[i]  + "</a>";
        pubLabel.style.border  = '0px';
        pubLabel.className  = 'mybackground';
        pubLabel.style.fontSize  = '11px';
        pubLabel.size  = "13";
        textField.type  = "text";
        textField.id  = mylist2[i];
        pubLabel.innerHTML  = "";
        tipstart  = "<a class='info' tabindex='-1' onclick='return false;' href='#' >";
        tipstartwide  = "<a class='info wide' tabindex='-1' onclick='return false;' href='#' >";
        tipstartnarrow  = "<a class='info narrow' tabindex='-1' onclick='return false;' href='#' >";
        switch (textField.id)  {
            case "ATitle":if (type  == "Book")  {
                pubLabel.innerHTML  = tipstart  + mylist[i]  + "<span>ONLY Fill in if citing a chapter. Capitalization as for title of book.</span></a>";
            } else  {
                if (style  != "APA")  {
                    pubLabel.innerHTML  = tipstartwide  + mylist[i]  + "<span>Each word in a title is capitalized, except for articles (a, an, the), prepositions (against, between, in, of, to), conjunctions (and, but, for, nor, or, so, yet), and the infinitive to. Always capitalize the first word, the first word after a colon or a dash.</span></a>";
                } else  {
                    pubLabel.innerHTML  = tipstart  + mylist[i]  + "<span>Capitalize only the first word, the first word after a colon or a dash, and proper nouns.</span></a>";
                }
            }
            break;
            case "MedTitle":switch (type)  {
                case "Newspaper":pubLabel.innerHTML  = tipstart  + mylist[i]  + "<span>If name of newspaper begins with 'The', this word is omitted. </span></a>";
                ;
                break;
                default:if (style  == "APA"  && type  == "Book")  {
                    pubLabel.innerHTML  = tipstart  + mylist[i]  + "<span>Capitalize only the first word, the first word after a colon or a dash, and proper nouns.</span></a>";
                } else  {
                    pubLabel.innerHTML  = tipstartwide  + mylist[i]  + "<span>Each word in a title is capitalized, except for articles (a, an, the), prepositions (against, between, in, of, to), conjunctions (and, but, for, nor, or, so, yet), and the infinitive to. Always capitalize the first word, the first word after a colon or a dash.</span></a>";
                }
                break;
            }
            break;
            case "Edition":pubLabel.innerHTML  = tipstart  + mylist[i]  + "<span>Only if other than first (digits only).</span></a>";
            break;
            case "State":if (style  == "MLA")  {
                xtra  = "Add when the publisher's city is not well known or could be confused with another city. "
            } else  {
                xtra  = "";
            }
            pubLabel.innerHTML  = tipstart  + mylist[i]  + "<span>"  + xtra  + "Include two-letter state code (if U.S.A) or name of country (if not U.S.A.).</span></a>";
            break;
            case "Publisher":if (style  == "MLA")  {
                pubLabel.innerHTML  = tipstartwide  + mylist[i]  + "<span>If no publisher N.p. will automatically display. Publisher names: 'Co.', 'Inc.' and related abbreviations should not be included in citations (ex. 'Ivan R. Dee, Inc.' should be given as 'Ivan R. Dee'.</span></a>";
            } else {
                pubLabel.innerHTML  = tipstartwide  + mylist[i]  + "<span>Publisher names: 'Co.', 'Inc.' and related abbreviations should not be included in citations (ex. 'Ivan R. Dee, Inc.' should be given as 'Ivan R. Dee'.</span></a>";
            }
            break;
            case "City":if (type  == "Newspaper")pubLabel.innerHTML  = tipstart  + mylist[i]  + "<span>Include if city name is not in title and newspaper is a less well-known publication.</span>";
            else pubLabel.innerHTML  = mylist[i];
            break;
            case "myDate":if (style  != "f") pubLabel.innerHTML  = tipstart  + mylist[i]  + "<span>If blank (n.d.) will be automatically added to your citation.</span></a>";
            else pubLabel.innerHTML  = mylist[i];
            break;
            case "Year":if (style  != "Chicago") pubLabel.innerHTML  = tipstart  + mylist[i]  + "<span>If blank (n.d.) will be automatically added to your citation.</span></a>";
            else pubLabel.innerHTML  = mylist[i];
            break;
            case "Volume":pubLabel.innerHTML  = tipstartnarrow  + mylist[i]  + "<span>Digits only</span></a>";
            break;
            case "Dbase":pubLabel.innerHTML  = tipstart  + mylist[i]  + "<span>Provide database name if retrieved from library database.</span></a>";
			break;
            case "DOI":pubLabel.style.paddingRight = "60px";
            pubLabel.innerHTML  = tipstartwide  + mylist[i]  + "<span>Digital Object Identifer - a unique alphanumeric string assigned to identify content and provide a persistent link to its location on the internet. The DOI is typically located on the first page of the electronic journal article near the copyright notice. When a DOI is used in your citation, no other retrieval information is needed. Leave blank if cannot be found.</span></a>";
            break;
            case "URL":switch (style)  {
                case "MLA":if (type  == "Website")  {
                    pubLabel.innerHTML  = tipstartwide  + mylist[i]  + "<span>URLs are no longer required. Only include URL if reader will be unlikely to find article otherwise.</span></a>"
                } else  {
                    pubLabel.innerHTML  = tipstartwide  + mylist[i]  + "<span> Only include URL if there is no database name and the reader will be unlikely to find the article otherwise.</span></a>"
                }
                break;
                case "APA":if (type  != "Website") tempJournal  = "Only use if no DOI. ";
                else tempJournal  = "";
                pubLabel.innerHTML  = tipstartwide  + mylist[i]  + "<span>"  + tempJournal  + "Try to only use home page URL of the publication or a URL which will not change. Use exact URL if page is not easy to find from homepage.</span></a>";
                break;
                case "Chicago":switch (type)  {
                    case "Journal":pubLabel.innerHTML  = tipstart  + mylist[i]  + "<span>Only use if no DOI.</span></a>";
                    break;
                    default:pubLabel.innerHTML  = mylist[i];
                    break;
                }
                break;
            }
            //
             break;
            case "myDate2":switch (style)  {
                case "APA":pubLabel.innerHTML  = tipstart  + mylist[i]  + "<span>Include retrieval date ONLY when content is likely to change. (e.g., wikis) or for time-sensitive details.</span></a>";
                break;
                case "Chicago":if (type  != "Website")  {
                    pubLabel.innerHTML  = tipstart  + mylist[i]  + "<span>Include an access date ONLY if publisher or discipline requires it.</span></a>";
                } else {
                    pubLabel.innerHTML  = tipstart  + mylist[i]  + "<span>Include access date if content is subject to change. (e.g., wikis) </span></a>";
                }
                break;
                default:pubLabel.innerHTML  = mylist[i];
                break;
            }
            break;
            case "Page":pubLabel.id  = "PageLabel";
            if (type  == "Newspaper")  {
                if (style == "Chicago") pubLabel.innerHTML  = tipstart  + mylist[i]  + "<span>Page numbers may be omitted. A section letter is sufficient if available.</span></a>";
                else pubLabel.innerHTML  = tipstart  + mylist[i]  + "<span>For multiple pages: B2, B4 or C1, C3-C4.</span></a>";
            } else if (style  == "MLA")  {
                pubLabel.innerHTML  = tipstart  + mylist[i]  + "<span>Inclusive: xx-xx. (If blank - n.pag. will automatically appear)</span></a>";
            } else  {
                pubLabel.innerHTML  = tipstart  + mylist[i]  + "<span>Inclusive: xx-xx</span></a>";
            }
            if (type  == "Book") pubLabel.innerHTML  = tipstart  + mylist[i]  + "<span>List pages of chapter or essay in book</span></a>";
            break;
            default:pubLabel.innerHTML  = mylist[i];
            break;
        }
        textField.onkeyup  = function ()  {
            sendToBottom();
        };
        if (textField.id  == "City"  && type  == "Newspaper")  {
            textField.value  = "Only include if city not in the title and is local";
            textField.style.color  = '#767474';
            textField.defaultValue  = "Only include if city not in the title and is local";
            textField.onfocus  = function ()  {
                clearDefault(this);
            };
            textField.onblur  = function ()  {
                replaceDefault(this)
            }
        }
        if (textField.id  == "Edition")  {
            textField.onkeyup  = function ()  {
                onlyNumbers(this);
            }
        };
        textField.size  = "46";
        if (textField.id  === "Issue"  || textField.id  === "Volume"  || textField.id  === "Edition")  {
            textField.size  = "2";
        }
        if (textField.id  === "Year")  {
            textField.size  = "4";
            textField.maxLength  = "4";
        }
        if (textField.id  == "Page")  {
            textField.size  = "8";
        }
        if (textField.id  == "URL")  {
            textField.value  = "http://";
            /*y.width = "120";*/if (type  != "Website")  {
                x.id  = "online";
            }
        }
        y.appendChild(pubLabel);
        z.appendChild(textField);
        //w.appendChild(temp);
         /*** VOLUME ISSUE BOX */if (mylist2[i]  === "Volume")  {
            textField2  = document.createElement("INPUT");
            textField3  = document.createElement("INPUT");
            textField2.type  = "text";
            textField3.type  = "text";
            textField.style.marginRight  = '5px';
            textField2.style.marginRight  = '5px';
            textField.size  = "2";
            textField2.size  = "10";
            textField3.size  = "2";
            textField.id  = "Volume";
            textField2.value  = "Issue";
            textField2.style.backgroundColor  = "#FFF";
            textField2.readOnly  = true;
            textField2.style.border  = '0px';
            textField2.tabIndex  =  - 1;
            textField3.id  = "Issue";
            textField2.className  = 'mybackground';
            textField2.size  = "4";
            textField2.readonly  = true;
            textField2.onkeyup  = function ()  {
                sendToBottom();
            };
        }
        if (mylist2[i]  === "myDate"  || mylist2[i]  === "myDate2")  {
            textField2  = document.createElement("select");
            textField3  = document.createElement("input");
            if (mylist2[i]  == "myDate2"  || type  == "Website"  || type  == "Newspaper")  {
                var until  = 13;
            } else  {
                until  = 29;
            }
            for (x = 0; x < until; x++)  {
                if (style  === "MLA")  {
                    myarray  = ["", "Jan.", "Feb.", "Mar.", "Apr.", "May", "June", "July", "Aug.", "Sept.", "Oct.", "Nov.", "Dec.", "Jan.-Feb.", "Feb.-Mar.", "Mar.-Apr.", "Apr.-May", "May-June", "June-July", "July-Aug.", "Aug.-Sept.", "Sept.-Oct.", "Oct.-Nov.", "Nov.-Dec.", "Dec.-Jan.", "Spring", "Summer", "Fall", "Winter"];
                } else  {
                    myarray  = ["", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", "January/February", "February/March", "March/April", "April/May", "May/June", "June/July", "July/August", "August/September", "September/October", "October/November", "November/December", "December/January", "Spring", "Summer", "Fall", "Winter"];
                }
                textField32  = document.createElement("option");
                textField32.appendChild(document.createTextNode(myarray[x]));
                textField32.setAttribute("value", myarray[x]);
                textField2.appendChild(textField32);
                j  = 1;
                textField.maxLength  = "2";
                textField3.maxLength  = "4";
            }
            textField3.type  = "text";
            textField.style.marginRight  = '5px';
            textField2.style.marginRight  = '5px';
            textField.size  = "2";
            textField3.size  = "4";
            switch (mylist2[i])  {
                case "Volume":textField.id  = "Volume";
                textField2.value  = "Issue";
                textField2.style.border  = '0px';
                textField2.tabIndex  =  - 1;
                textField3.id  = "Issue";
                textField2.className  = 'mybackground';
                textField2.size  = "4";
                textField2.readonly  = true;
                break;
                case "myDate":textField.id  = "Day";
                textField2.id  = "Month";
                textField3.id  = "Year";
                break;
                case "myDate2":textField.id  = "Day2";
                textField2.id  = "Month2";
                textField3.id  = "Year2";
                break;
            }
            if (mylist2[i]  == "myDate2"  || mylist2[i]  == "myDate")  {
                textField.value  = "dd";
                textField.style.color  = '#767474';
                textField.defaultValue  = "dd";
                textField.onfocus  = function ()  {
                    clearDefault(this);
                };
                textField3.value  = "yyyy";
                textField3.style.color  = '#767474';
                textField3.defaultValue  = "yyyy";
                textField3.onfocus  = function ()  {
                    clearDefault(this);
                };
            }
            textField2.onchange  = function ()  {
                sendToBottom();
            };
        }
        if (mylist2[i]  == "myDate"  || mylist2[i]  == "myDate2"  || mylist2[i]  == "Volume")  {
            textField.onkeyup  = function ()  {
                sendToBottom();
            };
            textField3.onkeyup  = function ()  {
                sendToBottom();
            };
            z.appendChild(textField2);
            z.appendChild(textField3);
        }
        if (textField.id  == "Volume"  || textField.id  == "Day"  || textField.id  == "Day2"  || textField.id  == "Year")  {
            textField.onkeyup  = function ()  {
                onlyNumbers(this);
            }
        };
        if (style  === "MLA")  {
            document.getElementById('mymonth').className  = "shortMonth";
        } else  {
            document.getElementById('mymonth').className  = "longerMonth";
        }
    }
}
//end build table function
function gettype(mymedium)  {
    medium  = mymedium;
	for (var i = 0; i < 3; i++)  {
        if (document.getElementById('DOI')  !== null) document.getElementById('DOI').value  = "";
        if (document.getElementById('URL')  !== null) document.getElementById('URL').value  = "http://";
        if (document.getElementById('Dbase')  !== null) document.getElementById('Dbase').value  = "";
        if (document.getElementById('Day2')  !== null) {
            document.getElementById('Day2').value  = "dd";
            document.getElementById('Day2').style.color  = "#767474";
        }
        if (document.getElementById('Month2')  !== null)document.getElementById('Month2').value  = "";
        if (document.getElementById('Year2')  !== null) {
            document.getElementById('Year2').value  = "yyyy";
            document.getElementById('Day2').style.color  = "#767474";
        }
    }
    try  {
        if (medium  == 'Print')  {
            document.getElementById('myTable3').className  = "hide";
            document.getElementById("Page").className  = "show";
            document.getElementById("PageLabel").className  = "show";
        } else  {
            document.getElementById('myTable3').className  = "show";
           /* if (type  == "Newspaper"  && style == "APA" )  {
                document.getElementById("Page").className  = "hide";
                document.getElementById("Page").value  = "";
                document.getElementById("PageLabel").className  = "hide";
            }*/
        }
        sendToBottom();
        workingMedium  = medium;
    } catch (e)  {}
}
//end gettype function
function clicked() {
    if (editting  !== "")  {
        myclicked  = true;
    }
}
function showInfo(text)  { 
    //builds page with textboxes
     if (editting  !== ""  && myrefresh  === false  && editmade === true) {
        refresh();  // for change type after editted - in refresh resets textboxes 
		        
    } else  { // for change type after in edit mode but no editting was done
        if( editting  !== ""  && myclicked  == true  && editmade  === false) {
		    document.getElementById('authorFirst1').style.backgroundColor  = '#F8EBC0';
            document.getElementById('MI1').style.backgroundColor  = '#F8EBC0';
            document.getElementById('authorLast1').style.backgroundColor  = '#F8EBC0';
            document.getElementById('step3legend').innerHTML  = 'Step 3: Fill in all known information';
            document.getElementById('ae'  + editting).style.backgroundColor  = '#FFF';
            document.getElementById("newarea").innerHTML  = newAreaTxt;
            document.getElementById("newarea").className  = "newarea";
            editting  = "";
            myeditting  = false;
            myclicked  = false;
			total = "";
        }
    }
    popupIntextWindow('arrow2', false);
    popupIntextWindow('square', false);
    popupIntextWindow('arrow4', false);
    if (arrow3  === false) popupIntextWindow('arrow3', true);
    arrow3  = true;
    //type  = text;
    myimage  = text;
    //type  = text;
     hasChangedAuthor  = false;
    if (style  !== ""  && total  !== "" )  {//skips first time
       
        	
         if (myrefresh !== true && myalert  === 0  && tmptotal  !== ""  && editmade  == true  && myeditting === false )  {
            $.alerts.okButton  = ' Save and continue';
            $.alerts.cancelButton  = ' Continue without saving ';
			var oldtype = type;
            jConfirm('Do you want to save your citation? \n(If you do not save it will be overwritten by the next citation.)', 'Message from CiteFast', function (r)  {
                if (r)  { 
                    type=oldtype;
					inShowInfo = true; //stops  a circular functions
					refresh();
					inShowInfo = false;
                    type  = text;
                    myproceed()
                }
                //saves citation
                 else  { //continues withoutsaving
                    type  = text;
					total  = "";
                    intext  = "";
                    pre1  = "";
                    pre  = "";
                    myproceed();
                     updateBox();
                }
            });
        }else  {  //if editting
             if (text  !== "")  { 
                //updateBox();
				myproceed();
                 //removed updateBox possible problems
            }
       }
    } else  {  //first time in page
        type  = text;  //skipped confirm box when loading page
		myproceed();
    }
    //first time hits page
    type  = text;
	workingType = type;
}
//}
function myproceed()  { 
    // creates form with fields
     
	 document.getElementById(type).checked  = true;
    mytext  = "a "  + type;
    //if (workingMedium !== undefined) medium = workingMedium;
     if (medium  == "Web") document.getElementById('Web').checked  = true;
    else document.getElementById('Print').checked  = true;
    document.getElementById('mycitation').className  = "show";
    document.getElementById('mycitation').style.width = "420px";
    document.getElementById('mycitation').innerHTML  = "<img class='floatLeft' src='images/"  + myimage  + ".gif' />&nbsp; <strong> "  + style  + " Citation for "  + mytext  + " </strong><div style='float:right;width:130px'><input name='button' type='button' id='myButton' onClick='refresh(); return false;' class='input-rounded-button' value='Save Citation' style='width:125px'/></div></form>";
    //document.getElementById("myButton").disabled  = "disabled";
    document.getElementById('Step4').className  = "mybackground";
    document.getElementById('publabel').className  = "show";
    if (type  == "Website")  {
        document.getElementById('medium').className  = "hide";
    } else  {
        document.getElementById('medium').className  = "show";
    }
    if (typeof numberRows  !== "undefined")  {
        deleteInfoRow(numberRows);
    }
    var mylist;
    switch (type)  {
        case "Magazine":if (style  == "Chicago")  {
            mylist  = ["Article&nbsp;title", "Magazine&nbsp;title", "Date&nbsp;published"];
            mylist2  = ["ATitle", "MedTitle", "myDate"];
        } else  {
            if (style  == "MLA")  {
                mylist  = ["Article&nbsp;title", "Magazine&nbsp;title", "Page(s)", "Date&nbsp;published"];
                mylist2  = ["ATitle", "MedTitle", "Page", "myDate"];
            } else  {
                mylist  = ["Date&nbsp;published", "Article&nbsp;title", "Magazine&nbsp;title", "Volume", "Page(s)"];
                mylist2  = ["myDate", "ATitle", "MedTitle", "Volume", "Page" ];
            }
        }
        break;
        case "Book":switch (style)  {
            case "APA":mylist  = ["Year","Title", "Edition", "Publishing&nbsp;city", "State/Country", "Publisher", "Chapter&nbsp;title", "Page(s)"];
            mylist2  = [ "Year", "MedTitle","Edition", "City", "State", "Publisher", "ATitle", "Page"];
            break;
            case "MLA":mylist  = ["Title", "Edition", "Publishing&nbsp;city", "State/Country", "Publisher", "Year","Chapter&nbsp;title", "Page(s)"];
            mylist2  = ["MedTitle", "Edition", "City", "State", "Publisher", "Year", "ATitle", "Page"];
            break;
            case "Chicago":mylist  = ["Title", "Edition", "Publishing&nbsp;city", "Publisher", "Year", "Chapter&nbsp;title", "Page(s)"];
            mylist2  = ["MedTitle", "Edition", "City", "Publisher", "Year", "ATitle", "Page"];
            break;
        }
        break;
        case "Journal":if (style  == "APA")  {
            mylist  = [ "Year&nbsp;published", "Article&nbsp;title", "Journal&nbsp;title","Volume", "Page(s)"];
            mylist2  = ["Year","ATitle", "MedTitle", "Volume", "Page"];
        } else  {
            mylist  = ["Article&nbsp;title", "Journal&nbsp;title", "Year&nbsp;published", "Volume", "Page(s)"];
            mylist2  = ["ATitle", "MedTitle", "Year", "Volume", "Page"];
        }
        break;
        case "Newspaper":if (style  == "APA")  {
            mylist  = ["Date&nbsp;published","Article&nbsp;title", "Newspaper&nbsp;title", "City&nbsp;(optional)","Page(s)" ];
            mylist2  = ["myDate","ATitle", "MedTitle", "City","Page" ];
        } else  {
            mylist  = ["Article title", "Newspaper&nbsp;title", "City&nbsp;(optional)", "Date&nbsp;published","Page(s)"];
            mylist2  = ["ATitle", "MedTitle", "City", "myDate" ,"Page"];
        }
        break;
        case "Website":if (style  == "MLA")  {
            mylist  = ["Article&nbsp;title", "Website&nbsp;title", "Publisher", "Date&nbsp;published"];
            mylist2  = ["ATitle", "MedTitle", "Publisher", "myDate"];
            break;
        } else mylist  = ["Article&nbsp;title", "Website&nbsp;title", "Date&nbsp;published"];
        mylist2  = ["ATitle", "MedTitle", "myDate"];
        break;
    }
    numberRows  = mylist.length;
    j  = 0;
    onlinelist  = ["URL", "Date&nbsp;accessed"];
    onlinelist2  = ["URL", "myDate2"];
    switch (style)  {
        case "MLA":onlinelist  = ["Database", "Date&nbsp;accessed", "URL&nbsp;(optional)"];
        onlinelist2  = ["Dbase", "myDate2", "URL"];
        if (type  == "Website")  {
            onlinelist  = ["Date&nbsp;accessed", "URL&nbsp;(optional)"];
            onlinelist2  = ["myDate2", "URL"];
        }
        break;
        case "APA":if (type  == "Website")  {
            onlinelist  = ["URL", "Retrieval&nbsp;date"];
            onlinelist2  = ["URL", "myDate2"];
        } else {
            onlinelist  = ["DOI", "URL<br /><img src='images/spacer.gif' height='30px' width='0'>"];
            onlinelist2  = ["DOI", "URL"];
        }
        break;
        case "Chicago":if (type  == "Journal")  {
            onlinelist  = ["Date&nbsp;accessed", "DOI", "URL"];
            onlinelist2  = ["myDate2", "DOI", "URL"];
        } else {
            onlinelist  = ["Date&nbsp;accessed", "URL", ];
            onlinelist2  = ["myDate2", "URL"]
        }
        break;
    }
    aCount  = 0;
    editorCount  = 0;
    $('#TextBoxesGroup').html('');
	ellipsis  = false;
    etal  = "";
    authorbox();
    buildTable(onlinelist, onlinelist2, "online");
    buildTable(mylist, mylist2, "reg");
	try  {
        if (type  == "Website"  || medium  == "Web")  {
            document.getElementById('myTable3').className  = "show";
        } else  {
            document.getElementById('myTable3').className  = "hide";
        }
    } catch (e)  {}
    //focus('textarea1'); 
    		 if (document.getElementById('Month')  !== null )document.getElementById('Month').style.backgroundColor  = '#F8EBC0';
    if (document.getElementById('Month2')  !== null )document.getElementById('Month2').style.backgroundColor  = '#F8EBC0';
}
//end function myproceed
function changeStyle(txt)  {
	var zz=true;
    if (style  == "") popupIntextWindow('arrow2', true);
    popupIntextWindow('arrow4', false);
    popupIntextWindow('arrow1', false);
    if (activeTab  == "#tab2") {
        restoredefaulttab();
    }
    document.getElementById("sourceform").style.backgroundColor  = "#FFF";
    for (var i  = 0;i  < document.getElementById("sourceform").elements.length;i++)  {
        document.getElementById("sourceform").elements[i].disabled  = false;
    }
    if (readCookie('yourCookieNum')  !== null  || total  !== "")  {
        zz  = confirm("Are you sure you want to change styles? All citations and information entered will be permanently deleted.");
        if (zz  === true)  {  // changing styles
            style  = txt;
            document.getElementById("citationsaved").innerHTML  = "";
            eraseCookie();
        } else  {
            if (style  == "APA")  {  //keeping old style
                document.getElementById('style2').checked  = true;
            }
            if (style  == "MLA")  {
                document.getElementById('style1').checked  = true;
            }
            if (style  == "Chicago")  {
                document.getElementById('style3').checked  = true;
            }
        }
    }
   
     if (zz  === true)  {  //continues with changing style
        style  = txt;
        if (style  == "APA")  {
            document.getElementById('menu-guide').innerHTML  = "<a  href=\"JavaScript:newPopup('guide.php?style=APA');\">APA Style Guide</a>";
			document.getElementById('style2').checked  = true;
            headbib  = "References"
        }
        if (style  == "MLA")  {
			document.getElementById('menu-guide').innerHTML  = "<a  href=\"JavaScript:newPopup('guide.php?style=MLA');\">MLA Style Guide</a>";
            document.getElementById('style1').checked  = true;
            headbib  = "Work cited"
        }
        if (style  == "Chicago")  {
			document.getElementById('menu-guide').innerHTML  = "<a  href=\"JavaScript:newPopup('guide.php?style=Chicago');\">Chicago Style Guide</a>";
            document.getElementById('style3').checked  = true;
            headbib  = "Bibliography"
        }
        document.getElementById("headbib").innerHTML  = headbib;
		updateBox();
        document.getElementById("intexttitle").innerHTML  = style  + " In-text citation w/ Guide";
        deleteInfoRow(numberRows);
        hasChangedAuthor  = false;
        if (type  != ""  && style  !== "")  {
            //makes 3 and 4 bold
             //document.getElementById("myButton").style.disabled  = false;
            showInfo(type);
        }
    }
   
}
function setStyle(txt)  {
    styleTitle  = txt;
    document.getElementById('mytitle').value  = "";
    document.getElementById('mytitle2').value  = "";
    document.getElementById('myname').value  = "";
    document.getElementById('instructor').value  = "";
    document.getElementById('institution').value  = "";
    var myd  = new Date();
     document.getElementById('mydate').value  = getMonthName(myd.getMonth())  + " "  + myd.getDate()  + ", "  + myd.getFullYear();
    document.getElementById('runninghead').value  = "";
    document.getElementById('myfirstname').value  = "";
    document.getElementById('myMI').value  = "";
    document.getElementById('course').value  = "";
    document.getElementById('authornotetxt').value  = "";
    switch (styleTitle)  {
        case "APA":
		document.getElementById('menu-guide').innerHTML  = "<a  href=\"JavaScript:newPopup('guide.php?style=APA');\">APA Style Guide</a>";
		document.getElementById("APArun").className  = "info";
        document.getElementById("APAauthornote").className  = "info";
        document.getElementById("mlafirstpage").className  = "hide";
        document.getElementById("runhead").className  = "show";
        document.getElementById("authornote").className  = "show";
        document.getElementById("institutionrow").className  = "show";
        document.getElementById("titlepagetitle").className  = "show";
        document.getElementById("coursetable").className  = "hide";
        break;
        case "MLA":
		document.getElementById('menu-guide').innerHTML  = "<a  href=\"JavaScript:newPopup('guide.php?style=MLA');\">MLA Style Guide</a>";
		document.getElementById("runhead").className  = "hide";
        document.getElementById("authornote").className  = "hide";
        document.getElementById("mlafirstpage").className  = "show";
        document.getElementById("institutionrow").className  = "hide";
        document.getElementById("titlepagetitle").className  = "hide";
        document.getElementById("coursetable").className  = "show";
        break;
        case "Chicago":
		document.getElementById('menu-guide').innerHTML  = "<a  href=\"JavaScript:newPopup('guide.php?style=Chicago');\">Chicago Style Guide</a>";
		document.getElementById("runhead").className  = "hide";
        document.getElementById("authornote").className  = "hide";
        document.getElementById("mlafirstpage").className  = "hide";
        document.getElementById("institutionrow").className  = "hide";
        document.getElementById("titlepagetitle").className  = "show";
        document.getElementById("coursetable").className  = "show";
        break;
    }
    total2  = "";
}

