//General Functions


function popupwindow(page) {
	var newWindow = window.open(page,'HPA','width=750,height=700,toolbar=no,directories=no,status=no,resizable=yes,scrollbars=yes,menubar=no');
	//newWindow.opener = window.parent.content; 
	//newWindow.opener.name = "opener";
}

function popuptext(page) {
	var newWindow = window.open(page,'HPA','width=600,height=500,toolbar=no,directories=no,status=no,resizable=yes,scrollbars=yes,menubar=no');
	//newWindow.opener = window.parent.content; 
	//newWindow.opener.name = "opener";
}

function popupNew(page) {
	var newPopWindow = window.open(page,'Cendant');

}


function bigwindow(page) {
	var newBigWindow = window.open(page,'HPA','width=600,height=400,toolbar=no,directories=no,status=no,scrollbars=yes,resize=yes,menubar=no');
}

function bignewwindow(page) {
	var newBigWindow = window.open(page,'newwindow');
}

function mainwindow(page) {
	window.opener.location.href = page;
	window.close(self);
}

function changePageSearch(form) {
    var url, selectedOption;
	selectedOption = form.arrowselection.selectedIndex;
	url = form.arrowselection.options[selectedOption].value;
	var newWindow = window.open(url,'Cendant','width=500,height=500,toolbar=no,directories=no,status=no,scrollbars=yes,resize=yes,menubar=no');
	newWindow.opener = window.top;			
}

function changePageQuickLinks(form) {
    var choice, selectedOption;
	selectedOption = form.quicklinks.selectedIndex;
	choice = form.quicklinks.options[selectedOption].value;
	
	if (choice == "1") {
		//Emergency Procedures
		parent.content.location.href = "http://intranet.mortgagesvcs.com/html/admin/emerprocs/emerprocs.html";
	
	}
	if (choice == "2") {
		//Stay Connected
		//parent.content.location.href = "e1.stayconnected.content.html";
		//parent.nav.location.href = "e1.stayconnected.nav.html";
		parent.content.location.href = "e1.stayconnected.content.html";
	}
	if (choice == "3") {
		//Sexual Harassment (TPH)
		popupwindow('e1.handbook.policy705.html');
	}
	if (choice == "4") {
		//eMail Etiquette (TPH)
		popupwindow('e1.handbook.policy517.html');
	}
	if (choice == "5") {
		//Sales Manual
		parent.content.location.href = "file://mbs-csrvr-vs5/UserDeptsX/MBS/sales_manual/hlmproject-bonds/bonds/frames/cl_frame.htm";
		
	}
	if (choice == "6") {
		//Market Commentary
		parent.content.location.href = "http://intranet.mortgagesvcs.com/html/secondary/secondaryweb/index.htm";	
	}	
		if (choice == "7") {
			//SwitchBoard
			parent.content.location.href = "http://intranet.mortgagesvcs.com/html/411.html";	
			//popupwindowNew('http://intranet.mortgagesvcs.com/html/411.html');
	}
		if (choice == "8") {
			//News
			parent.content.location.href = "http://intranet.mortgagesvcs.com/html/mktg/news.html";	
			
	}
	
	
	
	
	
	
	
	
	
}

function theTime() {
    var now = new Date();
    var time = now.getTime();
    var hour = now.getHours();
    var minutes = now.getMinutes(); 
    var thetime = hour + ":" + minutes;
    return (thetime);
 }

//Nav Link Functions

TriDown = new Image();
TriUp = new Image();

TriDown.src = "images/triDown.gif";
TriUp.src = "images/triUp.gif";

function NavigationOutline(navitem,arrowname) {

	var itemParentName = navitem + "Parent";
	var itemChildName = navitem + "Child";
	
	if (document[arrowname].src == eval("TriUp.src")) {
		//item is expanded, so contract
		document[arrowname].src = eval("TriDown.src");
		toggleVisibility(itemChildName,'hidden','hidden','hidden');
		toggleDisplay(itemChildName,'none','none','none');
	}
	else {
		//item is not expanded, so expand
		document[arrowname].src = eval("TriUp.src");
		toggleVisibility(itemChildName,'show','visible','visible');
		toggleDisplay(itemChildName,'block','block','block');
	}
	
}


function NavigationOutline1(navitem,arrowname) {

	var itemParentName = navitem + "Parent";
	var itemChildName = navitem + "Child";
	
	if (document[arrowname].src == eval("TriUp.src")) {
		//item is expanded, so contract
		document[arrowname].src = eval("TriDown.src");
		toggleVisibility(itemChildName,'hidden','hidden','hidden');
		toggleDisplay(itemChildName,'none','none','none');
	}
	else {
		//item is not expanded, so expand
		document[arrowname].src = eval("TriUp.src");
		toggleVisibility(itemChildName,'show','visible','visible');
		toggleDisplay(itemChildName,'block','block','block');
	}
	parent.content.location.href = navitem + ".content.html";

	//parent.nav.location.href = "e1.nav.html";
	//parent.location.href = "e1.html";
	//parent.location.href = navitem + ".html";
}

function NavigationOutline1OLD(navitem,arrowname) {

	var itemParentName = navitem + "Parent";
	var itemChildName = navitem + "Child";
	
	if (document[arrowname].src == eval("TriUp.src")) {
		//item is expanded, so contract
		document[arrowname].src = eval("TriDown.src");
		toggleVisibility(itemChildName,'hidden','hidden','hidden');
		toggleDisplay(itemChildName,'none','none','none');
	}
	else {
		//item is not expanded, so expand
		document[arrowname].src = eval("TriUp.src");
		toggleVisibility(itemChildName,'show','visible','visible');
		toggleDisplay(itemChildName,'block','block','block');
	}
	parent.content.location.href = navitem + ".html";
	//parent.nav.location.href = "e1.nav.html";
	//parent.location.href = "e1.html";
	//parent.location.href = navitem + ".html";
}


function NavigationOutline1NoLink(navitem,arrowname) {

	var itemParentName = navitem + "Parent";
	var itemChildName = navitem + "Child";
	
	if (document[arrowname].src == eval("TriUp.src")) {
		//item is expanded, so contract
		document[arrowname].src = eval("TriDown.src");
		toggleVisibility(itemChildName,'hidden','hidden','hidden');
		toggleDisplay(itemChildName,'none','none','none');
	}
	else {
		//item is not expanded, so expand
		document[arrowname].src = eval("TriUp.src");
		toggleVisibility(itemChildName,'show','visible','visible');
		toggleDisplay(itemChildName,'block','block','block');
	}

}
//Nav Search Functions

function setFormAction(objForm){
	
    strURL = "http://intranet.mortgagesvcs.com/scripts/samples/NewPhoneBook.exe?Action=Profile";
    strURL = strURL + "&LastName=" + objForm.LastName.value;
    strURL = strURL + "&FirstName=" + objForm.FirstName.value;
    strURL = strURL + "&Department=" + objForm.Department.value;
    window.open(strURL,'Cendant','width=550,height=500,toolbar=no,directories=no,status=no,scrollbars=yes,resize=yes,menubar=no');

}



function clearall(objForm){
	
     objForm.LastName.value = "";
     objForm.FirstName.value = "";
     objForm.Department.value = "ALL";

}


function setFormJobSearch(objForm){
	
    strURL = "http://intranet.mortgagesvcs.com/scripts/samples/WantAds.exe?Action=QueryJob";
    strURL = strURL + "&Department=" + objForm.Department.value;
    strURL = strURL + "&Title=" + objForm.Title.value;
    window.open(strURL,'Cendant','width=650,height=500,toolbar=yes,directories=no,status=no,scrollbars=yes,resize=yes,menubar=no');
    objForm.Title.value = ""
    objForm.Department.value = "ALL"
}



radiobuttonon = new Image();
radiobuttonoff = new Image();

radiobuttonon.src = "images/radiobuttonon.gif";
radiobuttonoff.src = "images/radiobuttonoff.gif";

function phonedirectory() {
	document["search1"].src = eval("radiobuttonon.src");
	document["search2"].src = eval("radiobuttonoff.src");
	toggleVisibility('e8Child','show','visible','visible');
	toggleVisibility('e9Child','hidden','hidden','hidden');
	toggleVisibility('e10Child','show','visible','visible');
	toggleVisibility('e11Child','hidden','hidden','hidden');
	toggleDisplay('e8Child','block','block','block');
	toggleDisplay('e9Child','none','none','none');
	toggleDisplay('e10Child','block','block','block');
	toggleDisplay('e11Child','none','none','none');
}

function searchintranet() {
	document["search1"].src = eval("radiobuttonoff.src");
	document["search2"].src = eval("radiobuttonon.src");
	toggleVisibility('e8Child','hidden','hidden','hidden')
	toggleVisibility('e9Child','show','visible','visible');
	toggleVisibility('e10Child','hidden','hidden','hidden')
	toggleVisibility('e11Child','show','visible','visible');
	toggleDisplay('e8Child','none','none','none');
	toggleDisplay('e9Child','block','block','block');
	toggleDisplay('e10Child','none','none','none');
	toggleDisplay('e11Child','block','block','block');
}

//DIV Style Functions

function toggleDisplay(id, NNtype, IEtype, WC3type) {
    if (document.getElementById) {
        eval("document.getElementById(id).style.display = \"" + WC3type + "\"");
    } else {
        if (document.layers) {
            document.layers[id].display = NNtype;
        } else {
            if (document.all) {
                eval("document.all." + id + ".style.display = \"" + IEtype + "\"");
            }
        }
    }
}

function toggleVisibility(id, NNtype, IEtype, WC3type) {
    if (document.getElementById) {
        eval("document.getElementById(id).style.visibility = \"" + WC3type + "\"");
    } else {
        if (document.layers) {
            document.layers[id].visibility = NNtype;
        } else {
            if (document.all) {
                eval("document.all." + id + ".style.visibility = \"" + IEtype + "\"");
            }
        }
    }
}

// Rollover Functions

function activate(image_name) {
if (document.images) {
document[image_name].src = eval(image_name + "On.src");
	}
}

function deactivate(image_name) {
if (document.images) {
document[image_name].src = eval(image_name + "Off.src");
	}
}

// Link Bold Function
var blastid = "null";
var bnewid = "null";

function clearBold()
{
blastid.className="c2"
}

function bolder1(bnew){
if (blastid=="null") {
 bnew.className="c1";
}
else{
 bnew.className="c1";
 blastid.className="c2";
}
 blastid=bnew
}

function bolderRst(){
if (blastid!="null") {
 blastid.className="c2";
}
}

//Phone Book Validation

function checkData() {
                        var Dept = myForm.Department.value;
                        var First = myForm.FirstName.value;
                        var FirstLength = First.length;
                        var Last = myForm.LastName.value;
                        var LastLength = Last.length;
                        if(Dept == "ALL"){
                                if(FirstLength<1){
                                        if(LastLength<1){
                                                alert("Please enter more Search Criteria ------> Enter First Name, Last Name or select specific Department Name to search against.");
                                                return false;
                                        		}
                                                  else {
					      setFormAction(document.forms[0])
                           				}
                                		}
                                           else {
				      setFormAction(document.forms[0])
                           			}
                        		}
                   
                     		   else {
                        setFormAction(document.forms[0])
                           		}
                }
