/*<!----------------------------------------------------------------------------------Created by: Duc Vo---------
 *File Name      : siteIncludes.js
 *Purpose        : includes various functionalities used in different parts of the web site.
 *
 *Company Name   : DVo!nvesCo Corp - Copyright 2003 - All Rights Reserved
 *Compnay Website: www.dvoinvesco.com 
 *Contact Info   : sales@dvoinvesco.com, support@dvoinvesco.com
 *
 *- Event functions are declared in the dynLibs.js file -
 *
--------------------------------------------------------------------------------------Created on: 8/03--------->*/
<!---------------------//Hide from Old Broswer
//Include in HTML file: <SCRIPT LANGUAGE="JAVASCRIPT" SRC="share/js/siteIncludes.js"></SCRIPT>


/****************************************************************************************************
//		HEADER -- FOOTER
*****************************************************************************************************/
//Global Varaibles
   var topMenu    = new Array();    //Holds a list of top menu content
   var mCount     = 0;              //count the number top menu there are.
   var sideMenu   = new Array();
   var footer     = new Array();

function initData(curMenu, level, cgiFlag)
{
    //For cases where we are CGI files living inside the cgi-bin folder
    //For any section that have sub level, we must add in our menuTitle (in lower case)
    //so that sublevel links on the side menu work right
    /*
    if(cgiFlag){
        cgiFlag = true;
        subLevelBaseLink = curMenu.toLowerCase() + "/";
        //alert(aspFlag +":"+ subLevelBaseLink);
    }
    */
    
    
    for(i = 0; i < level; i++) baseDir += '../';
    selMenu = curMenu; //Defined in the dynLib.js file
    
    collectMenuData();
    //writeTopMenu();
}

function collectMenuData(){
   //For the header
   topMenu.name              = "topMenu";
   topMenu.css               = " class=topMenuLink ";
   topMenu[topMenu.length]   = new mItem(topMenu,  "Home",            "index.html");
   topMenu[topMenu.length]   = new mItem(topMenu,  "Products",        "products/index.html");
   
   //For the sidemenu
   sideMenu.name             = "sideMenu";
   sideMenu.css              = " class=lfSideMenuLink ";
   sideMenu[sideMenu.length] = new mItem(sideMenu, "Home",            "index.html",           "home");
   sideMenu[sideMenu.length] = new mItem(sideMenu, "Our Mission",     "ourmision.html",       "mission");
   sideMenu[sideMenu.length] = new mItem(sideMenu, "Who We Are",      "whoweare.html",        "aboutus");
   sideMenu[sideMenu.length] = new mItem(sideMenu, "How We Can Help", "howwecanhelp.html",    "ourhelp");
   sideMenu[sideMenu.length] = new mItem(sideMenu, "Your Benefits",   "sellerbenefits.html",  "sellerbenefits");
   sideMenu[sideMenu.length] = new mItem(sideMenu, "Our Solutions",   "oursolutions.html",    "solutions");
   sideMenu[sideMenu.length] = new mItem(sideMenu, "Stop Foreclosure",   "stopforeclosure.html",    "stopfc");
   sideMenu[sideMenu.length] = new mItem(sideMenu, "Sell Your House", "sellyourhouse.html",   "yourhouse"); 
   sideMenu[sideMenu.length] = new mItem(sideMenu, "Cash Rewards",    "cashrewards.html",     "rewards");
   sideMenu[sideMenu.length] = new mItem(sideMenu, "Contact Us",      "contactUs.html",       "contactus");
   sideMenu[sideMenu.length] = new mItem(sideMenu, "FAQs",            "faq.html",             "faq");
   sideMenu[sideMenu.length] = new mItem(sideMenu, "Free Special Report", "share/docs/DVo_SubjecttoReport.pdf", "specialreport");
      
   //For the footer
   footer.name               = "footer";
   footer.css                = " class=footerLink ";
   footer[footer.length]     = new mItem(footer,   "Home",            "index.html");
   footer[footer.length]     = new mItem(footer,   "Contact Us",      "contactUs.html");
   footer[footer.length]     = new mItem(footer,   "Cash Rewards",    "cashrewards.html");
   footer[footer.length]     = new mItem(footer,   "Sell Your House", "sellyourhouse.html");
   footer[footer.length]     = new mItem(footer,   "FAQs",            "faq.html");
   footer[footer.length]     = new mItem(footer,   "Free Special Report", "share/docs/DVo_SubjecttoReport.pdf");
   
}
   
//A menu item has these unique attributes
function mItem(curObj, mName, link, imgName){
   this.menuName      = mName;
   this.url           = baseDir + link;

   var label          = ' <span' + curObj.css + '>' + mName + '</span>';
   
   //The imgName currently applies to the side menu only
   if(imgName){
	   var eHandler   = 'onMouseOver=' + curObj.name + '["' + curObj.length + '"].over(' + imgName + ') onMouseOut=' + curObj.name + '["' + curObj.length + '"].out(' + imgName + ')';
	   var link       = getImgStr('misc/space.gif',0,11,11,imgName,imgName) + ' <a href="' + this.url  + '"' + curObj.css +  eHandler + '>' + mName + '</a>'
	       label      = getImgStr('mo/diamond_cur.gif',0,11,11) + label;
	   
	   this.overImg   = new Image();
	   this.outImg    = new Image();
	   this.overImg.src   = baseDir + 'share/img/mo/diamond_hover.gif';
	   this.outImg.src    = baseDir + 'share/img/misc/space.gif';
	   
	   this.over = function mouseOver(imgName) {
						 if (document.images && imgName != 'null'){
						      //alert(document[imgName.name].src + "=="+ this.overImg.src);
							  document[imgName.name].src = this.overImg.src;
						 }
					 }
	   this.out  = function mouseOut(imgName) {
						if (document.images && imgName != 'null'){
							 document[imgName.name].src = this.outImg.src;
					    }
					 }
   }
   else{
   	   var link           = ' <a href="' + this.url + '"' + curObj.css + '>' + mName + '</a>'
   }
   
   this.linkOrLabel   = (selMenu == mName ? label : link ); //Link or Label
   
}


//-------------------------------   writeTopMenu   -------------------------------------------
//Write the top menu to the top of the page...
//
function writeTopMenu(){
   var moURL  = baseDir + 'share/img/';
   var ioStr  = '';
   
   ioStr += '<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100% HEIGHT=112>' +
            
            
            '</TR></TABLE>';

   doc.writeln(ioStr);
   
}
   
//-------------------------------   writeLfSideMenu   -------------------------------------------
//Write the side menu to the left column of the page...
//
function writeLfSideMenu(){
   var ioStr  = '';
   
   ioStr += '<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=141 HEIGHT=100%><TR><TD VALIGN=TOP>' +getImgStr('header/yh4c_logo.gif') +
            
	            '<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100% style="padding-right:4px">' +
	            '<TR><TD valign=top height=1>' + '' + '</TD></TR>';
	            for(i = 0; i < sideMenu.length; i++){
	               ioStr += '<TR><TD align=right height=30>' + sideMenu[i].linkOrLabel + '</TD></TR>';
	            }
	   ioStr += '<TR><TD>' + '</TD></TR>' +
	            '</TABLE>' +
            '</TD><TD rowspan= ' + (sideMenu.length+1) + '>' + getImgStr('header/divider_line_tb.gif',0,7,'100%') + '</TD></TR></TABLE>';
            
   doc.writeln(ioStr);
}
 
//-------------------------------   writeFooter   ----------------------------------------------
//Write the footer content to browser...
//
function writeFooter(){
   var ioStr = '\n';
   var c     = "<sup>Copyright (c) 2003 - YourHouse4Cash.com - All rights reserved</sup>";
   
   ioStr += '<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100% HEIGHT=67 class=footerBar>' +
            '<TR><TD width=141 align=right>' + getImgStr('footer/style_dot.gif','0',12,15) + '</TD><TD>&nbsp;' + getImgStr("footer/divider_line_lr.gif", '0', '100%', 15, 'footerLine', 'footerLine') + '</TD></TR>' +
            '<TR><TD></TD><TD align=center valign="top">';
            
            for(i = 0; i < footer.length-1; i++){
               ioStr += footer[i].linkOrLabel + '<span class="linkseparator"> | </span>';
            }
            
   ioStr += footer[footer.length-1].linkOrLabel +
            '</TD></TR>' +
            '<TR><TD></TD><TD align=center valign=middle height=10>' + c + '</TD></TR>' +
            '</TABLE>' +
            '\n';
   doc.write(ioStr);
}



/****************************************************************************************************
//		LEFT COLUMN -- RIGHT COLUMN
*****************************************************************************************************/

function writeLfSide()
{
   writeLfSideMenu();
}

function writeRtSide()
{

}



/****************************************************************************************************
//		HELPER & MISC... METHODS
*****************************************************************************************************/
function writePageTitle()
{

}


//=============================================     FAQs START   ===================================
var faqs    = new Array();

function collectQADivs(vis){
   if(!is4) return; // Not a compatible browser so do not do the work or else user will get annoying JS alert error messages.
   
   var qObj = doc.all['Q'];
   var aObj = doc.all['A'];
   
   for(i = 0; i < qObj.length; i++){
      faqs[i] = new initDIVs(qObj[i], aObj[i], vis); 
      faqs[i].click();  
   }
   
   if(IE4){
      var control1 = doc.all['control1'];
      var contro2 = doc.all['control22'];
      control1.innerHTML = '<p><SPAN class="faqControl" onclick="faqs.expandAll()">Expand All</SPAN> |$| <SPAN class="faqControl" onclick="faqs.collapseAll()">Collapse All</SPAN>';
      control2.innerHTML = control1.innerHTML; 
      
      faqs.expandAll  = function expand(){ 
         for(i = 0; i < faqs.length; i++){
            displayObj(faqs[i].aObj, "block");
            faqs[i].vis = false;
         }
      }
      faqs.collapseAll  = function collapse(){
         for(i = 0; i < faqs.length; i++){
            displayObj(faqs[i].aObj, "none");
            faqs[i].vis = true;
         }
      }
      //alert(control.innerHTML)
      
   }
}

function initDIVs(q, a, v){
   this.qObj  = q;
   this.aObj  = a;
   this.vis   = (v != "show" ? false:true); //Default visibility is hidden.
   
   this.click  = function mouseclick() {
      displayObj(this.aObj, (this.vis ? "block" : "none")); //a function define in dynLibs.js
      this.vis = !this.vis;
   }
   
}

//=============================================     FAQs END     ===================================

//End hiding script
//------------------->


