// tables.js


/*******************************************
//  To add a slide show.

	1. Create an array of images (see aImages)
	
	2. Add a new unique variable: see var SlideShowA = null ;
		example: var UniqueName = null ;
	
	3. Instantiate the variable in the window.onload() function.  Paramaters are:
		SlideShowObject("uniqueSlideShowName", arrayOfImages, widthOfIMage, heightOfImages, timerInMilliseconds, webPageDivId) ;
		See SlideShowA for example.

	4. Also in "onload()" function, add "setTimout(LauchSlides(UniqueName), 10) ;


	5.	Add a "case" statement to the "doDisplaySlide()" and "doLoadSlide()" functions. 
			a) Case must match "uniqueSlideShowName" in step 3.
			b) Variabel calling "doDisplay()" must match variable name created in step 2.
			example:
				case 'uniqueSlideShowName' :
					UniqueName.doDisplay() ;
					return;
					

*/

var SlideShowA = null ;
var SlideShowB = null ;


var aImages = new Array("/images/userdir/Logos/HospSlide1a.jpg",
                        "/images/userdir/Logos/HospSlide1.jpg",
                        "/images/userdir/Logos/HospSlide2.jpg",
                        "/images/userdir/Logos/HospSlide3.jpg",
                        "/images/userdir/Logos/HospSlide4.jpg",
                        "/images/userdir/Logos/HospSlide5.jpg",
                        "/images/userdir/Logos/HospSlide6.jpg")


var bImages = new Array("/images/userdir/Logos/Welcome1.png",
                        "/images/userdir/Logos/Welcome2.png",
                        "/images/userdir/Logos/Welcome3.png",
			"/images/userdir/Logos/Welcome4.png",
                        "/images/userdir/Logos/Welcome5.png")


window.onload=function()
{
	SlideShowA = new SlideShowObject ("slideShowA", aImages, 405, 75, 10000, "SlideShowLocation") ;
	SlideShowB = new SlideShowObject ("slideShowB", bImages, 571, 66, 10000, "SlideShowLocationB") ;

	
	setTimeout("LaunchSlides(SlideShowA)", 10) ;
  	setTimeout("LaunchSlides(SlideShowB)", 10) ;
}

function doDisplaySlide(n)
{
	switch(n)
	{
		case 'slideShowA' :
			SlideShowA.doDisplay() ;
			return ;
			
		case 'slideShowB' :
			SlideShowB.doDisplay() ;
			return ;
			
	}
}

function doLoadSlide(n)
{
	switch(n)
	{
		case 'slideShowA' :
			SlideShowA.doLoad() ;
			return ;

		case 'slideShowB' :
			SlideShowB.doLoad() ;
			return ;
	}
}

/*****************************************************************/

function SlideShowObject(Name, ImageArray, Width, Height, time, location)
{
	this.aImages = ImageArray ;
	this.aSize 	 = new Array(Width, Height) ;
	this.iDisplay = time ;
	this.oTimer = null ;
	this.iCurrent = 0 ;
	this.sSource = "" ;
	this.aName = Name ;
	this.aLocation = location ;
	this.doErrorDisplay = doErrorDisplay ;

}

function LaunchSlides(SlideShow)
{
 	var str = "<img name=" + SlideShow.aName + " src=\"" + SlideShow.aImages[SlideShow.iCurrent] + "\" onerror=\"doLoadSlide('" + SlideShow.aName + "')\" onload=\"doLoadSlide('" + SlideShow.aName + "')\" width=\"" + SlideShow.aSize[0] + "\" height=\"" + SlideShow.aSize[1] + "\" style=\"filter: revealTrans(TRANSITION=23)\">" ;

	document.getElementById(SlideShow.aLocation).innerHTML = str ;
			
}




function doDisplay()
{
	
    clearTimeout(this.oTimer)
    if (this.sSource != "")
    {
		var d = document.getElementsByName(this.aName) ;
		if (d[0])
		{
			if (d[0].filters)
			{
				d[0].filters[0].Stop() ;
				d[0].filters[0].Apply() ;
				d[0].filters.revealTrans.transition = 12 ;
			}
	
			d[0].src = this.sSource ;
	
			if (d[0].filters)
				d[0].filters[0].Play() ;
		}
	}
}

function doReadyImage()
{
   this.slider.sSource = this.src ;
   if (this.slider.oTimer==null)
       doDisplay(this.slider.aName) ;
}

function doErrorDisplay()
{
//alert(this.slider) ;	
   clearTimeout(this.slider.oTimer) ;
   
   doLoad(this.slider.aName) ;
}


function doLoad()
{
   clearTimeout(this.oTimer) ;

   var img = new Image() ;
   img.onload = this.doReadyImage ;
   img.onerror = this.doErrorDisplay ;
   img.slider = this ;
   this.sSource = "" ;
   this.iCurrent++ ;
   if (this.iCurrent == this.aImages.length)
        this.iCurrent = 0 ;

   this.oTimer = setTimeout("this.oTimer=null;doDisplaySlide('"+this.aName+"')",this.iDisplay) ;
   img.src = this.aImages[this.iCurrent] ;

}

function quickNextLoad()
{
   clearTimeout(this.oTimer) ;
   this.oTimer = null ;
   var img = new Image() ;
   img.onload = this.doReadyImage ;
   img.onerror = this.doErrorDisplay ;
   img.src = this.aImages[this.iCurrent] ;
}

function quickPrevLoad()
{
   clearTimeout(this.oTimer) ;
   this.oTimer = null ;
   var img = new Image() ;
   img.onload = this.doReadyImage ;
   img.onerror = this.doErrorDisplay ;
   this.iCurrent -= 1 ;
   if (this.iCurrent < 0)
       this.iCurrent = this.aImages.length-1 ;
   this.iCurrent -= 1 ;

   if (this.iCurrent < 0)
       this.iCurrent = this.aImages.length-1 ;

   img.src = this.aImages[this.iCurrent] ;
}

SlideShowObject.prototype.doDisplay 	= doDisplay ;
SlideShowObject.prototype.doReadyImage 	= doReadyImage ;
SlideShowObject.prototypedoErrorDisplay = doErrorDisplay ;
SlideShowObject.prototype.doLoad 		= doLoad ;
SlideShowObject.prototype.quickNextLoad = quickNextLoad ;
SlideShowObject.prototype.quickPrevLoad = quickPrevLoad ;

function LoadPopups()
{
    // ShowTable vars(tableToDisplay, IdOfDisplayDiv, IdOfTable, ClassOfTable, IdOfMouseOver, ColorLeftCol(true)

    ShowTable(TableIndiaHealth,     'LocIndiaHealth1', '', 'TCFix') ;
        ShowTable(TableCostaRicaHealth, 'LocCRHealth1', '', 'TCPopup') ;
    ShowTable(TableCostaRicaHealthLinks, 'LocCRHealthLinks', '', 'TCFix') ;
        ShowTable(TableNGH, 'LocNGH1', '', 'TCPopup') ;
    ShowTable(TableJCI, 'LocJCI1', 'IDTEST', 'TCPopup','',false) ;

    ShowTable(TableISQua, 'LocISQua1', 'IDTEST', 'TCPopup','',false) ;
    ShowTable(TableCRBeautyB, 'LocCRBeautyB1', '', 'TCPopup') ;
    ShowTable(TableIndiaVsCostaRica, 'LocIndiaVsCR', '', 'TCFix') ;
    ShowTable(TableIndiaBariatric, 'LocIndiaBariatric', '', 'TCFix') ;
    ShowTable(TableCRBariatric, 'LocCRBariatric', '', 'TCFix') ;
    ShowTable(TableIndiaHeart, 'LocIndiaHeartLinks', '', 'TCFix') ;
    ShowTable(TableIndiaOrtho, 'LocIndiaOrthoLinks', '', 'TCFix') ;
    ShowTable(TableCROrtho, 'LocCROrthoLinks', '', 'TCFix') ;
    ShowTable(TableCRBeautyLinks, 'LocCRBeautyLinks', '', 'TCFix') ;
    ShowTable(TableMexicoDentalCosmetic, 'LocDentPartMex', '', 'TCPopup') ;

/*      ShowTable(TableIndiaHealthNoLinks, 'LocIndiaHealthNoLinks1', '', 'TCFix') ;
    ShowTable(TableIndiaHealthNoLinks, 'LocIndiaHealthNoLinks2', '', 'TCFix') ;
        ShowTable(TableCRHealthNoLinks, 'LocCRHealthNoLinks1', '', 'TCFix') ;
    ShowTable(TableCRBeautyB, 'LocCRBeautyB2', '', 'TCPopup') ;
    ShowTable(TableJCI, 'LocJCI2', '', 'TCPopup') ;
    ShowTable(TableIndiaHealth,     'LocIndiaHealth2', '', 'TCFix') ;
    ShowTable(TableNGH, 'LocNGH2', '', 'TCPopup') ;
    ShowTable(TableCostaRicaBeauty, 'LocCRBeauty1', '', 'TCPopup') ;

-------------
Completede Table and Locations:
Web Page        Table Name      Table type
Homepage        LocJCI1         Pop
Homepage        LocISQua1       Pop
homepage        LocNGH1         Pop
Health Procedures   LocIndiaHealth1     Fix
health procedures   LocCRHealthLinks    Fix
Hosp-ClinicaBiblica LocCRHealth1        Pop
hosp-clinicabiblica LocCRBeautyB1       Pop
Procedures Area     LocIndiaVsCR        Fix
Health-Bariatric    LocIndiaBariatric   Fix
health-Bariatric    LocCRBariatric      Fix
Health-Coronary     LocIndiaHeartLinks  Fix
Health-Ortho        LocIndiaOrthoLinks  Fix
Health-Ortho        LocCOrthoLinks      Fix
Beauty          LocCRBeautyLinks    Fix
Dental-Partner-Mex  LocDentPartMex      POP
-------------


*/

//  Mean Comments out this line
/*  Means Comment Out
*/

/*
    ShowTable(TableCostaRicaBeauty, 'location5', '', 'tableclass2', '', false) ;
    ShowTable(TableCostaRicaHealth, 'location6', '', 'tableclass2') ;

    ShowTable(TableIndiaHealth,     'location7', '', 'tableclass3') ;
    ShowTable(TableCostaRicaBeauty, 'location8', '', 'tableclass3', '', false) ;
    ShowTable(TableCostaRicaHealth, 'location9', '', 'tableclass3') ;
*/



}
function TableMexicoDentalCosmetic()
{
    var ar = new Array(3) ;

    ar[0] = new Array("Procedure","ADA Code","Est. Mexico","U.S. Est. Low","U.S. Est. High","Savings Low","Savings High");
    ar[1] = new Array("Porcelain Veneer","D2962","$410","$800","$2,500","$390","$2,090");
    ar[2] = new Array("Porcelain Crown","D2750","$510","$1,000","$3,500","$490","$2,990");


    return ar ;
}

function TableIndiaHealth()
{
    var ar = new Array(9) ;

    ar[0] = new Array("Procedure","U.S. Price Estimate","Package Estimate India","Savings in US$","Savings as a Percentage");
    ar[1] = new Array("<a href=\"http://www.navigateglobalhealth.com/Hip-Replacement.aspx\">Hip Replacement</a>","$41,000","$8,600","$32,400","79%");
    ar[2] = new Array("Hip Resurfacing","No Data","$8,000","ND","ND");
ar[3] = new Array("<a href=\"http://www.navigateglobalhealth.com/Knee-Replacement.aspx\">Knee Replacement</a>","$36,000","$7,600","$28,400","79%");
    ar[4] = new Array("Valve Replacement","$124,000","$12,000","$112,000","90%");
    ar[5] = new Array("<a href=\"http://www.navigateglobalhealth.com/Coronary-Artery-Bypass-Graft.aspx\">CABG</a>","$90,000","$8,500","$81,500","91%");
    ar[6] = new Array("<a href=\"http://www.navigateglobalhealth.com/Balloon-Angioplasty-PTCA.aspx\">PCTA</a>","$44,000","$9,500","$34,500","78%");
    ar[7] = new Array("Gastric Bypass","$29,500","$10,400","$19,100","65%");
    ar[8] = new Array("Gastric Banding","$25,800","$8,700","$17,100","66%");

    return ar ;
}

function TableCostaRicaBeauty()
{
    var ar = new Array(6) ;

    ar[0] = new Array("Procedure","U.S. Price Estimate","Package Est. Costa Rica","Savings in US$","Savings as a Percentage");
    ar[1] = new Array("Breast Augmentation","$10,000","$4,600","$5,400","54%");
    ar[2] = new Array("Breast Reduction","$7,000","$5,800","$1,200","17%");
    ar[3] = new Array("Face Lift","$15,000","$6,900","$8,100","54%");
    ar[4] = new Array("Tummy Tuck","$8,500","$6,400","$2,100","25%");
    ar[5] = new Array("Eyelid Surgery","$5,000","$4,200","$800","16%");

    return ar ;
}

function TableCostaRicaHealth()
{
    var ar = new Array(5) ;

    ar[0] = new Array("Procedure","U.S. Price Estimate","Package Est. CR","Savings in US$","Savings as a Percentage");
    ar[1] = new Array("Hip Replacement","$41,000","$13,700","$27,300","67%");
    ar[2] = new Array("Knee Replacement","$36,000","$12,700","$23,300","65%");
    ar[3] = new Array("Gastric Bypass","$29,500","$13,700","$15,800","54%");
    ar[4] = new Array("Gastric Banding","$25,800","$10,950","$14,850","58%");

    return ar ;
}

function TableCostaRicaHealthLinks()
{
    var ar = new Array(5) ;

    ar[0] = new Array("Procedure","U.S. Price Estimate","Package Est. CR","Savings in US$","Savings as a Percentage");
    ar[1] = new Array("<a href=\"http://www.navigateglobalhealth.com/Hip-Replacement.aspx\">Hip Replacement</a>","$41,000","$11,680","$29,320","72%");
    ar[2] = new Array("<a href=\"http://www.navigateglobalhealth.com/Knee-Replacement.aspx\">Knee Replacement</a>","$36,000","$11,180","$24,820","69%");
    ar[3] = new Array("Gastric Bypass","$32,000","$12,180","$19,820","62%");
    ar[4] = new Array("Gastric Banding","$26,000","$8,865","$17,135","66%");

    return ar ;
}

function TableNGH()
{
    var ar = new Array(8) ;

    ar[0] = new Array("Procedure","U.S. Price Estimate","Estimate Costa Rica","Estimate India","Estimate Turkey");
        ar[1] = new Array("Hip Replacement","$41,000","$13,700","$8,600","$9,600");
        ar[2] = new Array("Knee Replacment","$36,000","$12,700","$7,600","$9,200");
        ar[3] = new Array("Inguinal Hernia","$19,400","$7,500","$6,300","$5,300");
        ar[4] = new Array("CABG","$90,000","$26,500","$8,500","$10,300");
        ar[5] = new Array("PTCA","$44,000","$14,500","$9,500","$5,400");
        ar[6] = new Array("Gastric Bypass","$29,500","$13,700","$10,400","call");
        ar[7] = new Array("Gastric Banding","$25,800","$10,950","$8,700","call");

    return ar ;
}

function TableJCI()
{
    var ar = new Array(2) ;

    ar[0] = new Array("Joint Commision International");
        ar[1] = new Array("JCI is the international arm of The Joint Commission on the Accreditation of Healthcare Organizations (JCAHO).  JCAHO sets standards for healthcare organizations in the US and US Territories. JCI is the international arm of The Joint Commission on the Accreditation of Healthcare Organizations (JCAHO).  JCAHO sets standards for healthcare organizations in the US and US Territories.");


    return ar ;
}
function TableISQua()
{
    var ar = new Array(2) ;

    ar[0] = new Array("International Society for Quality in Health Care");
        ar[1] = new Array("The Dublin based International Society for Quality in Health Care or ISQua is the umbrella organization of accrediting institutions.  ISQua does not accredit individual hospitals.  Simply put the ISQua accredits the accreditors.");


    return ar ;
}


function TableIndiaVsCostaRica()
{
 var ar = new Array(4) ;

    ar[0] = new Array("Estimates","CABG","PTCA","Knee Replacement","Hip Replacement","Gastric Procedure");
    ar[1] = new Array("India","$8,500","$9,500","$7,600","$8,600","$10,400");
    ar[2] = new Array("Costa Rica","$26,500","$14,500","$12,700","$13,700","$13,700");
    ar[3] = new Array("Turkey","$10,300","$5,400","$9,200","$9,600","call");

return ar ;
}


function TableIndiaHealthNoLinks()
{
     var ar = new Array(7) ;

    ar[0] = new Array("Procedure","U.S. Price Estimate","Package Est. India","Savings in US$","Savings as a Percentage");
    ar[1] = new Array("Hip Replacement","$41,000","$7,750","$33,250","81%");
    ar[2] = new Array("Hip Resurfacing","$No Data","$8,500","N/D","N/D");
    ar[3] = new Array("Knee Replacment","$36,000","$7,750","$28,250","78%");
    ar[4] = new Array("Spinal Fusion","$59,000","$12,000","47,000","80%");
    ar[5] = new Array("CABG","$90,000","$8,500","$81,500","91%");
    ar[6] = new Array("PTCA","$44,000","$9,750","$34,250","78%");

    return ar ;
}

function TableCRHealthNoLinks()
{
 var ar = new Array(5) ;

    ar[0] = new Array("Procedure","U.S. Price Estimate","Package Est. Costa Rica","Savings in US$","Premium paid for US care");
    ar[1] = new Array("Hip Replacement","$41,000","$11,680","$29,250","71%");
    ar[2] = new Array("Knee Replacement","$36,000","$11,180","$24,650","68%");
    ar[3] = new Array("Gastric Bypass","$32,000","$12,180","$19,820","62%");
    ar[4] = new Array("Gastric Banding","$26,000","$8,865","$8,865","66%");

 return ar ;
}

function TableIndiaBariatric()
{
 var ar = new Array(3) ;

    ar[0] = new Array("Procedure","U.S. Price Estimate","Package Est. India","Savings in US$","Savings as a Percentage");
    ar[1] = new Array("Gastric Bypass","$29,500","$10,400","$19,100","65%");
    ar[2] = new Array("Gastric Banding","$25,800","$8,700","$17,100","66%");

return ar ;
}

function TableCRBariatric()
{
 var ar = new Array(3) ;

    ar[0] = new Array("Procedure","U.S. Price Estimate","Package Est. Costa Rica","Savings in US$","Savings as a Percentage");
    ar[1] = new Array("Gastric Bypass","$29,500","$13,700","$15,800","54%");
    ar[2] = new Array("Gastric Banding","$25,800","$10,950","$14,850","58%");

return ar ;
}

function TableIndiaHeart()
{
 var ar = new Array(4) ;

    ar[0] = new Array("Health Procedure","U.S. Price Estimate","Package Est. India","Savings in US$","Savings as a Percentage");
    ar[1] = new Array("<a href=\"http://www.navigateglobalhealth.com/Coronary-Artery-Bypass-Graft.aspx\">CABG</a>","$90,000","$8,500","$81,500","91%");
    ar[2] = new Array("<a href=\"http://www.navigateglobalhealth.com/Balloon-Angioplasty-PTCA.aspx\">PTCA</a>","$44,000","$9,500","$34,500","78%");
    ar[3] = new Array("<a href=\"http://www.navigateglobalhealth.com/Heart-Valve-Replacement.aspx\">Valve Replacement</a>","$124,000","$12,000","$112,000","90%");


return ar ;
}

function TableIndiaOrtho()
{
 var ar = new Array(4) ;

    ar[0] = new Array("Health Package India","U.S. Price Estimate","Package Est. India","Savings in US$","Savings as a Percentage");
    ar[1] = new Array("<a href=\"http://www.navigateglobalhealth.com/Hip-Replacement.aspx\">Hip Replacement</a>","$41,000","$8,600","$32,400","79%");
    ar[2] = new Array("Hip Resurfacing","No Data","$8,000","Call","Call");
    ar[3] = new Array("<a href=\"http://www.navigateglobalhealth.com/Knee-Replacement.aspx\">Knee Replacement</a>","$36,000","$7,600","$28,400","79%");

return ar ;
}

function TableCROrtho()
{
 var ar = new Array(4) ;

    ar[0] = new Array("Health Packages Costa Rica","U.S. Price Estimate","Package Est. CR","Savings in US$","Savings as a Percentage");
    ar[1] = new Array("<a href=\"http://www.navigateglobalhealth.com/Hip-Replacement.aspx\">Hip Replacement</a>","$41,000","$13,700","$27,300","67%");
    ar[2] = new Array("Hip Resurfacing","No Data","$13,700","Call","Call");
    ar[3] = new Array("<a href=\"http://www.navigateglobalhealth.com/Knee-Replacement.aspx\">Knee Replacement</a>","$36,000","$12,700","$23,300","65%");

return ar ;
}

function TableCRBeautyB()
{
 var ar = new Array(6) ;

    ar[0] = new Array("Procedure","U.S. Price Estimate","Package Estimate C R","Savings in US$","Saving as a Percentage");
    ar[1] = new Array("Breast Augmentation","$7,300","$4,600","$2,700","37%");
    ar[2] = new Array("Eyelid Surgery","$7,000","$4,200","$2,800","40%");
    ar[3] = new Array("Tummy Tuck","$9,000","$6,400","$2,600","29%");
    ar[4] = new Array("Breast Reduction","$9,000","$5,800","$3,200","36%");
    ar[5] = new Array("Face Lift","$15,000","$6,900","$8,100","54%");

return ar ;
}

function TableCRBeautyLinks()
{
 var ar = new Array(6) ;

    ar[0] = new Array("Procedure By Popularity","U.S. Price Estimate","Package Estimate C R","Savings in US$","Savings as a Percentage");
    ar[1] = new Array("<a href=\"http://www.navigateglobalhealth.com/Breast-Augmentation-Mammaplasty.aspx\">Breast Augmentation</a>","$7,300","$4,600","$2,700","37%");
    ar[2] = new Array("<a href=\"http://www.navigateglobalhealth.com/Eyelid-Surgery-Blepharoplasty.aspx\">Eyelid Surgery</a>","$7,000","$4,200","$2,800","40%");
    ar[3] = new Array("<a href=\"http://www.navigateglobalhealth.com/Tummy-Tuck-Abdominal-Wall-Tighten-Abdominoplasty.aspx\">Tummy Tuck","$9,000","$6,400","$2,600","29%");
    ar[4] = new Array("<a href=\"http://www.navigateglobalhealth.com/Breast-Reduction-Reduction-Mammoplasty.aspx\">Breast Reduction","$9,000","$5,800","$3,200","36%");
    ar[5] = new Array("<a href=\"http://www.navigateglobalhealth.com/Facelift-Rhytidectomy.aspx\">Face Lift","$15,000","$6,900","$8,100","54%");


return ar ;
}


function ClearTable(id)
{
    document.getElementById(id).innerHTML = "" ;
}
/*
function ShowTable() can take the following parameters in the exact order

1. function for tableToDisplay  - required
2. id IdOfDisplayDiv            - required
3. IdOfTable                    - for formatting only
4. ClassOfTable                 - for formatting only
5. IdOfMouseOver                - id of div to mouseover to get popup
6. ColorLeftCol(true)           - formatting option for table left column

*/

function ShowTable(TableFunc, id)
{

    var tar = TableFunc() ;

    var me = "" ;
    var cl = "" ;

    if (arguments.length < 2)
        return ;

    var d = document.getElementById(id) ;
    if (d == null)
    {
        return ;
    }

    var str = "<table" ;

    if (arguments.length > 2)
    {
        me = " id='" + arguments[2] + "'" ;
        str = str.concat(me) ;
    }

    if (arguments.length > 3)
    {
        cl = " class='" + arguments[3] + "'" ;
        str = str.concat(cl) ;
    }

    var leftheader = true ;

    if (arguments.length > 4)
    {
        if (arguments[4] != "")
        {
            var i = arguments[4] ;
            var o = document.getElementById(arguments[4]) ;
            o.onmouseover = function(e)
            {
                var evtobj = window.event ? window.event : e ;
                DisplayTable(i, id, evtobj) ;
            }

            o.onmouseout = function(e)
            {
                var evtobj = window.event ? window.event : e ;
                HideTable(id, evtobj) ;
            }
        }
    }

    var leftheader = true ;
    if (arguments.length > 5)
    {
        if (arguments[5] == false)
            leftheader = false ;
    }


    str = str.concat(">") ; // table end bracket

    var len = tar.length ;
    var len2 = tar[0].length ;
    var temp ;
    var type ;
    var rec = "";
    for (var x = 0 ; x < len ; x++)
    {
        rec = rec.concat("<tr>") ;
        temp = "" ;

        for (var y = 0 ; y < len2 ; y++)
        {
            if (x == 0 || (y == 0 && leftheader == true))
                type = "th" ;
            else
                type = "td" ;

            temp = temp.concat("<" + type + ">" + tar[x][y] + "</" + type + ">") ;
        }
        rec = rec.concat(temp + "</tr>\n") ;
    }

    str = str.concat(rec) ;
    str = str.concat("<table>") ;

    var obj = document.getElementById(id) ;
    obj.innerHTML = str ;
}

