// amount is amount of content
// lstype is long or short layout
// theplace is either open in a blank or self window
// header is 1 or 0 to place header


var home_files=12;
var pik_files = Math.ceil(Math.random()*home_files);


var the_file="homecontent"+pik_files+".js";
document.write('<script src="http://www.dreamsalivemagazine.com/freecontent/'+the_file+'"><\/script>');


function homecontent(amount,lstype,theplace,header){

var piks=6; // the number of choices in this category
var prestart = Math.ceil(Math.random()*piks);


if((lstype == "long") && (amount > 2)){
amount=2;
}


if(amount > piks){
amount=piks;
}

var headertext="In Your Home";

var space=prestart+(amount-1);

if (space > piks){

var start=piks-(amount-1);
}
else{
start= prestart;
}

var group=amount;
var curl;
var cicon;
var caption;
var author;
var longdesc;

document.write('<TABLE CELLPADDING=2 CELLSPACING=0>');


if(header == 1){

makeheader(lstype,amount,headertext);

} // end if header


if(lstype=="long"){
document.write('<TR>');
}




var allcontent = new Array("bogus",hcontent1,hcontent2,hcontent3,hcontent4,hcontent5,hcontent6);

var countit=1;

while(countit <= amount){

	curl=allcontent[start][0];
	cicon=allcontent[start][1];
	caption=allcontent[start][2];
	author=allcontent[start][3];
	longdesc=allcontent[start][4];


	if(lstype == "short"){
	insert(curl,cicon,caption,longdesc,author,theplace);

	group=group-1;

		if(group > 0){
		document.write('<TR><TD STYLE="font-size:8pt\;">&nbsp\;</TD></TR>');
		}

	}
	else{
	var cbg=selectcolor();
	
	var cfg = cbg.replace("AA","EE");
	cfg = cfg.replace("BB","EE");
	cfg = cfg.replace("BB","EE");
	cfg = cfg.replace("BB","EE");
	cfg = cfg.replace("DD","F7");
	cfg = cfg.replace("DD","F7");
	cfg = cfg.replace("DD","F7");


	fullinsert(curl,cicon,caption,longdesc,author,cbg,cfg,theplace);

	group=group-1;


		if(group == 1){
		document.write('<TD WIDTH=20>&nbsp\;</TD>');
		}
		else{
		document.write('</TR>');

		}
	}
countit++;
start++;

}


document.write('</TABLE>');

} // end freecontent




