// ---------------------------------------------------------
// KIDS IN CRISIS Page_Nav.js 
// ---------------------------------------------------------
var gstPageName = ""; 
var gstHomeDir = ""; 
var gstSecDir  = ""; 
var gIsLive = false;
var stTestLive=window.location.href.split("file://")[1];
if (stTestLive==null){
	gIsLive=true;	
}

//if (gIsLive){
//	gstHomeDir = "http://www.kidsincrisis.org/"; 
//	gstSecDir = "https://protected.fatcow.com/kidsin/"; 
//}

if (gIsLive){
	gstHomeDir = "http://198.170.83.173/"; 
	gstSecDir = "http://198.170.83.173/"; 
}

function GetParameter(stParamString, stParam)
{	
	stValue="";
	if (stParamString.indexOf(stParam)>-1) {
		stValue = stParamString.substr(stParamString.indexOf(stParam)+stParam.length+1,3);
	} 
	return stValue;	
}				
// ----------------------------------------------------------
// FUNCTION: Get_Date()
// ----------------------------------------------------------
function Get_Date() {
	var days = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
	var months = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
	var now = new Date();
	var result = months[now.getMonth()] + ". ";
	result += now.getDate() + ", ";
	result += now.getYear();
	return (result);
}
					
// ----------------------------------------------------------
// FUNCTION: MM_findObj(n, d)
// ----------------------------------------------------------
function MM_findObj(n, d) { //v3.0
  	var p,i,x;  
  	if(!d) {
		d=document; 
	}
  	if((p=n.indexOf("?"))>0&&parent.frames.length) {
    	d=parent.frames[n.substring(p+1)].document; 
		n=n.substring(0,p);
	}
  	if(!(x=d[n])&&d.all) {
		x=d.all[n]; 
	}
	for (i=0;!x&&i<d.forms.length;i++) {
		x=d.forms[i][n];
	}
  	for(i=0;!x&&d.layers&&i<d.layers.length;i++) {
		x=MM_findObj(n,d.layers[i].document); 
	}
	return x;
}

// ----------------------------------------------------------
// FUNCTION: MM_swapImage()
// ----------------------------------------------------------
function MM_swapImage() { //v3.0
  var i,j=0,x;
  var a=MM_swapImage.arguments; 
  document.MM_sr=new Array; 
  for(i=0;i<(a.length-2);i+=3){
   	if ((x=MM_findObj(a[i]))!=null){
   	  document.MM_sr[j++]=x; 
	  if(!x.oSrc){
	    x.oSrc=x.src; 
	  }
	  x.src=a[i+2];
    }
  }	
}
// ----------------------------------------------------------
// FUNCTION: MM_swapImgRestore()
// ----------------------------------------------------------
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

// ----------------------------------------------------------
// FUNCTION: GetParam()
// ----------------------------------------------------------
function GetParam() {
	gstParam=window.location.href.split("#")[1];
	if (gstParam==null){
		gstParam="NONE";
	}
	return gstParam;
}  

// ----------------------------------------------------------
// FUNCTION: Write_HorzRule
// ----------------------------------------------------------
function Write_HorzRule(stColspan, stImg, stIndent)
{
	stRule = "images/horz_rule.gif"
	if (stImg == "LT"){
		stRule = "images/horz_rule_tantall.gif"
	}
	document.writeln('<tr><td colspan="'+stColspan +'">');
		document.writeln('<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">');
				
		// horz rule with spacer			
		document.write  ('<tr><td align="left" width="100%" background="'+stRule+'">');
		document.writeln('<img src="images/pic_spacer.gif" alt="" width="1" height="11" border="0"></td>');	
		if (stIndent != "NONE"){		
			document.write('<td><img src="images/pic_spacer.gif" alt="" width="10" height="11" border="0"></td>');
		}
		document.writeln('</tr></table>');	
	document.writeln('</td></tr>');	
}

// ----------------------------------------------------------
// FUNCTION: Load_Pics()
// ----------------------------------------------------------
function Load_Pics(){
	
	if (document.images) {
  		home_f2 = new Image(150 ,23); home_f2.src = "images/link_home_f2.gif";
  		home_f1 = new Image(150 ,23); home_f1.src = "images/link_home.gif";		
 		needhelp_f2 = new Image(150 ,23); needhelp_f2.src = "images/link_needhelp_f2.gif";
  		needhelp_f1 = new Image(150 ,23); needhelp_f1.src = "images/link_needhelp.gif";
		spanish_f2 = new Image(150 ,23); spanish_f2.src = "images/link_spanish_f2.gif";
  		spanish_f1 = new Image(150 ,23); spanish_f1.src = "images/link_spanish.gif";
		news_f2 = new Image(150 ,23); news_f2.src = "images/link_news_f2.gif";
  		news_f1 = new Image(150 ,23); news_f1.src = "images/link_news.gif";		
		
		aboutkic_f2 = new Image(150 ,23); aboutkic_f2.src = "images/link_aboutkic_f2.gif";
  		aboutkic_f1 = new Image(150 ,23); aboutkic_f1.src = "images/link_aboutkic.gif";
		programs_f2 = new Image(150 ,23); programs_f2.src = "images/link_programs_f2.gif";
  		programs_f1 = new Image(150 ,23); programs_f1.src = "images/link_programs.gif";
		ourkids_f2 = new Image(150 ,23); ourkids_f2.src = "images/link_ourkids_f2.gif";
  		ourkids_f1 = new Image(150 ,23); ourkids_f1.src = "images/link_ourkids.gif";
		emaillist_f2 = new Image(150 ,23); emaillist_f2.src = "images/link_emaillist_f2.gif";
  		emaillist_f1 = new Image(150 ,23); emaillist_f1.src = "images/link_emaillist.gif";

		donations_f2 = new Image(150 ,23); donations_f2.src = "images/link_donations_f2.gif";
  		donations_f1 = new Image(150 ,23); donations_f1.src = "images/link_donations.gif";
		volunteers_f2 = new Image(150 ,23); volunteers_f2.src = "images/link_volunteers_f2.gif";
  		volunteers_f1 = new Image(150 ,23); volunteers_f1.src = "images/link_volunteers.gif";
		youthcorps_f2 = new Image(150 ,23); youthcorps_f2.src = "images/link_youthcorps_f2.gif";
  		youthcorps_f1 = new Image(150 ,23); youthcorps_f1.src = "images/link_youthcorps.gif";
		gratitude_f2 = new Image(150 ,23); gratitude_f2.src = "images/link_gratitude_f2.gif";
  		gratitude_f1 = new Image(150 ,23); gratitude_f1.src = "images/link_gratitude.gif";
		
	
		orgprofile_f2 = new Image(150 ,23); orgprofile_f2.src = "images/link_orgprofile_f2.gif";
  		orgprofile_f1 = new Image(150 ,23); orgprofile_f1.src = "images/link_orgprofile.gif";
		professionals_f2 = new Image(150 ,23); professionals_f2.src = "images/link_professionals_f2.gif";
  		professionals_f1 = new Image(150 ,23); professionals_f1.src = "images/link_professionals.gif";
		corporations_f2 = new Image(150 ,23); corporations_f2.src = "images/link_corporations_f2.gif";
  		corporations_f1 = new Image(150 ,23); corporations_f1.src = "images/link_corporations.gif";
		
		employment_f2 = new Image(150 ,23); employment_f2.src = "images/link_employment_f2.gif";
  		employment_f1 = new Image(150 ,23); employment_f1.src = "images/link_employment.gif";

		
		safeteen_f2 = new Image(150 ,23); safeteen_f2.src = "images/link_safeteen_f2.gif";
  		safeteen_f1 = new Image(150 ,23); safeteen_f1.src = "images/link_safeteen.gif";

		links_f2 = new Image(150 ,23); links_f2.src = "images/link_links_f2.gif";
  		links_f1 = new Image(150 ,23); links_f1.src = "images/link_links.gif";

		// special navigation buttons
		top_f1 = new Image(75, 25); top_f1.src = "images/btn_top.gif";
		top_f2 = new Image(75, 25); top_f2.src = "images/btn_top_f2.gif";	

	 	list_f1 = new Image(50, 25); list_f1.src = "images/btn_list.gif";
		list_f2 = new Image(50, 25); list_f2.src = "images/btn_list_f2.gif";	
	 	next_f1 = new Image(50, 25); next_f1.src = "images/btn_next.gif";
		next_f2 = new Image(50, 25); next_f2.src = "images/btn_next_f2.gif";
	 	prev_f1 = new Image(50, 25); prev_f1.src = "images/btn_prev.gif";
		prev_f2 = new Image(50, 25); prev_f2.src = "images/btn_prev_f2.gif";
	}	
}

// ----------------------------------------------------------
// FUNCTION: Write_NavItem
// ----------------------------------------------------------
function Write_NavItem(stName, stLink, stTip)
{
	if (gstPageName.toUpperCase() == stTip.toUpperCase() ){
	    document.write('<TR><TD>');
		document.writeln('<IMG height="23" src="images/link_'+stName+'_f3.gif" width="150" border=0" '); 
		document.writeln('name="'+stName+'" alt="'+stTip+'"></TD></TR>');
	}
	else {				
	    document.write('<TR><TD><A onmouseover="MM_swapImage(');
		document.write("'"+stName+"','','images/link_"+stName+"_f2.gif', 1); ");
		document.writeln('" onmouseout="MM_swapImgRestore();" href="'+stLink+'"> ');
		document.writeln('<IMG height="23" src="images/link_'+stName+'.gif" width="150" border=0" '); 
		document.writeln('name="'+stName+'" alt="'+stTip+'"></A></TD></TR>');
	}
}	

// ----------------------------------------------------------
// FUNCTION: Begin_PageNav
// ----------------------------------------------------------
function Begin_PageNav(stPageName)
{
	gstPageName = GetParent(stPageName);
	
	Load_Pics();
	
	stWidth="100%";
	
	stAlign_L = "center";
	stAlign_C = "center";
	stAlign_R = "right";
	stWidth_L = "33%";
	stWidth_C = "34%";
	stWidth_R = "33%";
	
	document.writeln('<BODY vLink="#cc3333" aLink="#cc3333" link="#cc3333" bgColor="#ffffff" '); 
	document.writeln('   leftMargin="0" topMargin="0" onload="" marginwidth="0" marginheight="0">');
	
	// header 
	document.writeln('<a name="top"><table ID="kic" width="'+stWidth+'" border="0" cellspacing="0" cellpadding="0"><TBODY> ');
	
	// nWidth = document.getElementById("kic").offsetWidth;
	nWidth = screen.width;
	// alert(nWidth);
   	if (nWidth < 1100) {
		stAlign_R = "center"
		stWidth_L = "1%";
		stWidth_C = "50%";
		stWidth_R = "50%";
	}

	document.write  ('<TR><TD width="175"><A href="'+gstHomeDir+'content/publish/default.shtml"><IMG height="130" width="175" ');
    document.writeln('  alt="Home" src="images/img_kicbanner_left.gif" border="0"></A></TD>');
	
	document.write  ('<TD align="center" width="100%" background="images/img_kicbanner_bgnd.gif">');
    document.writeln('<table width="100%" border="0" cellspacing="0" cellpadding="0"><TBODY><TR>');
	
	document.write  ('<TD align="'+stAlign_L+'" width="'+stWidth_L+'" ');
	document.write  ('><IMG height="130" width="'+stWidth_L+'" ');
    document.writeln('  alt="" src="images/img_shim.gif" border="0"></TD>');	
	
    document.write  ('<TD align="'+stAlign_C+'" width="'+stWidth_C+'" ');
	document.write  ('><A href="'+gstHomeDir+'content/publish/needhelp.shtml"><IMG height="130" width="270" ');
    document.writeln('  alt="Get Help" src="images/img_kicbanner_ctr.gif" border="0"></A></TD>');
	
	document.write  ('<TD width="20"><IMG height="130" width="20" ');
    document.writeln('  alt="" src="images/img_shim.gif" border="0"></TD>');	

    document.write('<TD align="'+stAlign_R+'" width="'+stWidth_R+'" ');
	document.write  ('><A href="'+gstHomeDir+'content/publish/needhelp.shtml"><IMG height="130" width="270" ');
    document.writeln('  alt="Get Help" src="images/img_kicbanner_right.gif" border="0"></A></TD>');
	
	document.write  ('<TD width="15"><IMG height="130" width="15" ');
    document.writeln('  alt="" src="images/img_shim.gif" border="0"></TD>');	
		
	document.writeln(' </TR><TBODY></TABLE></TD></TR>');
	
	// spacer row
	document.write  ('<TR><TD colspan="2" width="100%"><IMG height="5" width="1" ');
    document.writeln('  alt="" src="images/img_shim.gif" border="0"></TD>');
	document.writeln(' </TR>');
    document.writeln('</TBODY></TABLE>');
	
	// Create Date String
	var days = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
	var months = new Array("Jan.","Feb.","Mar.","Apr.","May","Jun.","Jul.","Aug.","Sep.","Oct.","Nov.","Dec.");
	var now = new Date();
	var stDate = "&nbsp;&nbsp;&nbsp;"
	var stYear = "111";
	if (now.getDate() < 10) {
	stDate += "&nbsp;";
	}
	stDate += "Today:&nbsp;";
	stDate += months[now.getMonth()] + " ";
	stDate += now.getDate() + ", ";
	stDate += now.getFullYear(); 

	// begin Left NAVIGATION pane
  	document.writeln('<TABLE cellSpacing="0" cellPadding=0" width="'+stWidth+'" border="0"><TBODY><TR>');
  	document.writeln('<TD vAlign="top" align="center" background="images/img_sidebar_bgnd.gif"><IMG height="11"');
	document.writeln('  width="160" hspace="0" src="images/img_sidebar_top.gif" border="0" ><BR>');
    document.writeln('<TABLE cellspacing="0" cellPadding="0" width="160" border="0" ><TBODY>');

	document.writeln('<TR><TD><IMG SRC="images/img_shim.gif" WIDTH="1" HEIGHT="7" BORDER=0></TD></TR>');
	document.writeln('<TR><TD class="Date">'+stDate+'</TD></TR>');
	document.writeln('<TR><TD><IMG height="15" width="150" hspace="0" src="images/img_sidebar_line.gif"');
	document.writeln(' border="0"></TD></TR>');
    
	// top level navigation
	Write_NavItem("home", gstHomeDir+"content/publish/default.shtml", "Welcome");
	Write_NavItem("needhelp", gstHomeDir+"content/publish/needhelp.shtml", "Do You Need Help?");
	Write_NavItem("spanish", gstHomeDir+"content/publish/spanish.shtml", "Ayuda Espaņol?");
	Write_NavItem("news", gstHomeDir+"content/publish/headlines.shtml", "News and Events");	
	
	document.writeln('<TR><TD><IMG height="23" width="150" hspace="0" src="images/img_sidebar_line.gif"');
	document.writeln(' border="0" ></TD></TR>');
	
	Write_NavItem("aboutkic", gstHomeDir+"content/publish/aboutkic.shtml", "About Kids in Crisis");	
	Write_NavItem("programs", gstHomeDir+"content/publish/programs.shtml", "Programs & Services");	
	Write_NavItem("safeteen", gstHomeDir+"content/publish/safe_teen.shtml", "SafeTalk & Teen Talk");	
	Write_NavItem("ourkids", gstHomeDir+"content/publish/ourkids.shtml", "Meet Our Kids");	
	Write_NavItem("emaillist", gstSecDir+"content/publish/emaillist.shtml", "Join Our Email List");		
	
	document.writeln('<TR><TD><IMG height="23" width="150" hspace="0" src="images/img_sidebar_line.gif"');
	document.writeln(' border="0" ></TD></TR>');

	
	Write_NavItem("donations", gstSecDir+"content/publish/donations.shtml", "Make A Donation");	
	Write_NavItem("volunteers", gstHomeDir+"content/publish/volunteers.shtml", "Become A Volunteer");	
	Write_NavItem("youthcorps", gstSecDir+"content/publish/youthcorps.shtml", "Youth Corps");	
	Write_NavItem("gratitude", gstHomeDir+"content/publish/gratitude_kidschallenge.shtml", "In Gratitude");		

	document.writeln('<TR><TD><IMG height="23" width="150" hspace="0" src="images/img_sidebar_line.gif"');
	document.writeln(' border="0" ></TD></TR>');

	// Write_NavItem("orgprofile", "staff.html", "Organization Profile");	
	Write_NavItem("professionals", gstHomeDir+"content/publish/professionals.shtml", "For Professionals");	
	Write_NavItem("corporations", gstHomeDir+"content/publish/corporations.shtml", "Corporate Giving");	
	Write_NavItem("employment", gstHomeDir+"content/publish/employment.shtml", "Employment");		
	Write_NavItem("links", gstHomeDir+"content/publish/links.shtml", "Other Links");	
			
	// padding of blank lines
	for (n=1; n<4; n++) {
	  document.writeln('<TR><TD><IMG height="23" width="150" hspace="0" src="images/img_sidebar_line.gif"');
	  document.writeln(' border="0" ></TD></TR>');
	}
	
    document.writeln('<TR><TD>&nbsp;</TD></TR>');
	document.writeln('</TBODY></TABLE></TD>');
		
	document.writeln('<TD align="center" valign="top" width="100%">');
	// Calling HTML writes a TABLE with the Right pane	
	
}

// ----------------------------------------------------------
// FUNCTION: End_Page
// ----------------------------------------------------------
function End_PageNav(showSiteMap)
{
		//---- bottom page navigation items ------------------
		
	document.writeln('</TD></TR>');
	
	document.writeln('<TR><td width="160" height="11" align="center" valign="middle" ');
	document.writeln('  background="images/img_sidebar_bgnd.gif">&nbsp;</td>');
  	document.writeln('<TD align="center" valign="middle"> ');
	
	// horzrule image 
	document.writeln('<table border="0" cellspacing="0" cellpadding="0" width="100%">');
	document.writeln('<tr><td><img src="images/img_shim.gif" width="1" height="11"');
	document.writeln('	border="0" align="left"></td></tr><tr>');
	document.writeln('<td background="images/bgnd_horzrule_dark.gif"><img ');
	document.writeln(' src="images/img_shim.gif" width="1" height="11"  ');
	document.writeln('	border="0" align="left"></td></tr></table> ');
	
	document.writeln('</TD></TR>');
	
  	document.writeln('<TR><td width="160" height="40" align="center" valign="middle" background="images/img_sidebar_bot.gif">');
	document.writeln('<A href="http://www.humanitects.com"><IMG src="images/ht_advert.gif" valign="middle" border="0"></a>&nbsp;</td>');
  	document.writeln('<TD align="center" valign="middle"><FONT ');
	document.writeln('face="Verdana, Arial, Helvetica, sans-serif" color=#000000 size=-2>Kids in ');
	document.writeln('Crisis<IMG src="images/img_bullet_black.gif">One Salem ');
	document.writeln('Street<IMG src="images/img_bullet_black.gif">Cos Cob, ');
	document.writeln('CT 06807<IMG src="images/img_bullet_black.gif">(203) 327-KIDS<BR>');
	
		
		if (showSiteMap !="TRUE")
		{
			document.write('&nbsp;');
		 	End_Page();
		}
}		
// ----------------------------------------------------------
// FUNCTION: End_Page
// ----------------------------------------------------------
function End_Page()
{
	document.writeln('</FONT></TD></TR></TBODY></TABLE></BODY></HTML>');
}

// ----------------------------------------------------------
// FUNCTION: Write_NavBtns
// ----------------------------------------------------------
function Write_NavBtns(stList, stPrev, stNext, stNum)
{	
	// List Button
	if (stList == ""){
		document.writeln('<img src="images/btn_list_d.gif" alt="" ');
		document.write('width="50" height="25" border="0" >');
	}
	else {
		stName="list"; stLink=stList; stTip="list";
		document.writeln('<a onmouseover="MM_swapImage(');
		document.write  ("'"+stName+stNum+"','','images/btn_"+stName+"_f2.gif', 1); ");
		document.write  ('" onmouseout="MM_swapImgRestore();" href="'+stLink+'">');
		document.write  ('<img height="25" src="images/btn_'+stName+'.gif" width="50" border=0" '); 
		document.write  ('name="'+stName+stNum+'" alt="'+stTip+'"></a>');				
	}
	// Prev Button
	if (stPrev == ""){
		document.writeln('<img src="images/btn_prev_d.gif" alt="" ');
		document.write('width="50" height="25" border="0" >');
	}
	else {		
		stName="prev"; stLink=stPrev; stTip="previous";
		document.writeln('<a onmouseover="MM_swapImage(');
		document.write  ("'"+stName+stNum+"','','images/btn_"+stName+"_f2.gif', 1); ");
		document.write  ('" onmouseout="MM_swapImgRestore();" href="'+stLink+'">');
		document.write  ('<img height="25" src="images/btn_'+stName+'.gif" width="50" border=0" '); 
		document.write  ('name="'+stName+stNum+'" alt="'+stTip+'"></a>');				
	}
	
	// Next Button
	if (stNext == ""){
		document.writeln('<img src="images/btn_next_d.gif" alt="" ');
		document.write('width="50" height="25" border="0" >');
	}
	else {		
		stName="next"; stLink=stNext; stTip="next";
		document.writeln('<a onmouseover="MM_swapImage(');
		document.write  ("'"+stName+stNum+"','','images/btn_"+stName+"_f2.gif', 1); ");
		document.write  ('" onmouseout="MM_swapImgRestore();" href="'+stLink+'">');
		document.write  ('<img height="25" src="images/btn_'+stName+'.gif" width="50" border=0" '); 
		document.write  ('name="'+stName+stNum+'" alt="'+stTip+'"></a>');						
	}
}


// ----------------------------------------------------------------------
// Write_Confidential
// ----------------------------------------------------------------------
function Write_Confidential(stModifier, bShort, bSpanish)
{
	bShort=true;
    // Confidentiality Statement 
	document.writeln('<tr><td class="Note" '+stModifier+'><em>');
	if (!bSpanish) {
		if (!bShort){
		   document.writeln(' All services are confidential. ');
		}
		document.writeln(' To preserve anonymity, photos of children on this website are representations only.</em></td></tr>');
	}
	else {
		if (!bShort){
		   document.writeln(' Todos los servicios son confidenciales. ');
		}
		document.writeln(' Para preservar el anonimato, las fotos de los niņos ');
		document.writeln('en esta pagina del internet son solamente representaciones.</em></td></tr>');
	}
	
	document.writeln('<tr><td><img src="images/img_shim.gif" width="1" height="2" border="0"></td></tr>');

}

