if(typeof(window.this_section_id)=='undefined'){this_section_id="";}
if(typeof(window.this_group_id)=='undefined'){this_group_id="";}
if(typeof(window.this_member_id)=='undefined'){this_member_id="";}

// current page path
var this_page_path="";
if((this_section_id=="stories")&&(this_group_id!="")&&(this_member_id!="")) this_page_path="../";
if((this_section_id=="blog")) this_page_path="../";
if((this_section_id=="mail")) this_page_path="../";


// menu_items[]=new Array("section_id", "group_id", "member_id", "Title", "link", "new_window");
var menu_items=new Array();

pushin(menu_items, new Array("company", "", "", "company", this_page_path+"company.html", ""));
pushin(menu_items, new Array("services", "", "", "services", this_page_path+"services.html", ""));
pushin(menu_items, new Array("stories", "",  "", "success stories", this_page_path+"stories.html", ""));
pushin(menu_items, new Array("testimonials", "",  "", "testimonials", this_page_path+"testimony1.html", ""));
pushin(menu_items, new Array("resources", "",  "", "resources", this_page_path+"resources.html", ""));
pushin(menu_items, new Array("news", "",  "", "news", this_page_path+"news.html", ""));
pushin(menu_items, new Array("contact", "",  "", "contact", this_page_path+"contact.html", ""));
pushin(menu_items, new Array("home", "", "", "home", this_page_path+"index.html", ""));




// display_page_header()
function display_page_header(){

		document.write ("<div class='page_header'>");
			document.write ("<link rel='icon' href='"+this_page_path+"images/favicon.ico' type='image/x-icon' /><link rel='shortcut icon' href='"+this_page_path+"images/favicon.ico' type='image/x-icon' />");
			document.write ("<a href='"+this_page_path+"index.html' style='float:left; margin-top:18px;'><img src='"+this_page_path+"images/nextphase.gif' width='150' height='50' border='0' /></a>");
			document.write ("<div style='float:right; margin-top:8px;'>");
			
			for(i=0; i<menu_items.length; i++){
				if(this_section_id==menu_items[i][0]){
					document.write ("<a href='"+menu_items[i][4]+"' class='menu_section_in'>"+menu_items[i][3]+"</a>");
				}else{
					document.write ("<a href='"+menu_items[i][4]+"' class='menu_section'>"+menu_items[i][3]+"</a>");
				}
				
				if(i<(menu_items.length-1)){
					document.write ("<span style='font-size:12px; color:#ccc;'>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;</span>");
				}
				
			}
			
			document.write ("</div>");
			document.write ("&nbsp;<div style='clear:both;'></div>");
		document.write ("</div>");
	
}


var Story_Thumbnail_Count_Per_Line=7;

// display_page_footer()
function display_page_footer(){

		document.write ("<div class='page_footer'>");

		document.write ("<a href='"+this_page_path+"company.html' onMouseOut='MM_swapImgRestore()' onMouseOver=\"MM_swapImage('menu_01','','"+this_page_path+"images/nav/company2a.gif',1)\" style='float:left; display:block;'><img src=");
		if(this_section_id=="company"){document.write ("'"+this_page_path+"images/nav/company2a.gif'");}else{document.write ("'"+this_page_path+"images/nav/company1.gif'");}
		document.write (" alt='Company' name='menu_01' id='menu_01' width='62' height='30' border='0' /></a>");

		document.write ("<a href='"+this_page_path+"1.html' onMouseOut='MM_swapImgRestore()' onMouseOver=\"MM_swapImage('menu_01_a','','"+this_page_path+"images/nav/services2a.gif',1)\" style='float:left; display:block;'><img src=");
		if(this_section_id=="services"){document.write ("'"+this_page_path+"images/nav/services2a.gif'");}else{document.write ("'"+this_page_path+"images/nav/services1.gif'");}
		document.write (" alt='Services' name='menu_01_a' id='menu_01_a' width='70' height='30' border='0' /></a>");

		document.write ("<a href='"+this_page_path+"stories.html' onMouseOut='MM_swapImgRestore()' onMouseOver=\"MM_swapImage('menu_02','','"+this_page_path+"images/nav/success2a.gif',1)\" style='float:left; display:block;'><img src=");
		if(this_section_id=="stories"){document.write ("'"+this_page_path+"images/nav/success2a.gif'");}else{document.write ("'"+this_page_path+"images/nav/success1.gif'");}
		document.write (" alt='Success Stories' name='menu_02' id='menu_02' width='100' height='29' border='0' /></a>");



		document.write ("<a href='"+this_page_path+"testimony1.html' onMouseOut='MM_swapImgRestore()' onMouseOver=\"MM_swapImage('menu_02_a','','"+this_page_path+"images/nav/testimonials2a.gif',1)\" style='float:left; display:block;'><img src=");
		if(this_section_id=="testimonials"){document.write ("'"+this_page_path+"images/nav/testimonials2a.gif'");}else{document.write ("'"+this_page_path+"images/nav/testimonials1.gif'");}
		document.write (" alt='Testimonials' name='menu_02_a' id='menu_02_a' width='90' height='30' border='0' /></a>");




		document.write ("<a href='"+this_page_path+"resources.html' onMouseOut='MM_swapImgRestore()' onMouseOver=\"MM_swapImage('menu_03','','"+this_page_path+"images/nav/resources2a.gif',1)\" style='float:left; display:block;'><img src=");
		if(this_section_id=="resources"){document.write ("'"+this_page_path+"images/nav/resources2a.gif'");}else{document.write ("'"+this_page_path+"images/nav/resources1.gif'");}
		document.write (" alt='Resources' name='menu_03' id='menu_03' width='70' height='29' border='0' /></a>");

		document.write ("<a href='"+this_page_path+"news.html' onMouseOut='MM_swapImgRestore()' onMouseOver=\"MM_swapImage('menu_04','','"+this_page_path+"images/nav/news2a.gif',1)\" style='float:left; display:block;'><img src=");
		if(this_section_id=="news"){document.write ("'"+this_page_path+"images/nav/news2a.gif'");}else{document.write ("'"+this_page_path+"images/nav/news1.gif'");}
		document.write (" alt='News' name='menu_04' id='menu_04' width='45' height='29' border='0' /></a>");


		document.write ("<a href='"+this_page_path+"contact.html' onMouseOut='MM_swapImgRestore()' onMouseOver=\"MM_swapImage('menu_05','','"+this_page_path+"images/nav/contact2a.gif',1)\" style='float:left; display:block;'><img src=");
		if(this_section_id=="contact"){document.write ("'"+this_page_path+"images/nav/contact2a.gif'");}else{document.write ("'"+this_page_path+"images/nav/contact1.gif'");}
		document.write (" alt='Contact' name='menu_05' id='menu_05' width='60' height='29' border='0' /></a>");

		document.write ("<a href='"+this_page_path+"legal.html' onMouseOut='MM_swapImgRestore()' onMouseOver=\"MM_swapImage('menu_05_a','','"+this_page_path+"images/nav/legalB2a.gif',1)\" style='float:left; display:block;'><img src=");
		if(this_section_id=="legal"){document.write ("'"+this_page_path+"images/nav/legalB2a.gif'");}else{document.write ("'"+this_page_path+"images/nav/legalB1.gif'");}
		document.write (" alt='Legal' name='menu_05_a' id='menu_05_a' width='50' height='30' border='0' /></a>");


		
		
		if(this_section_id!="home"){
			document.write ("<a href='"+this_page_path+"index.html' onMouseOut='MM_swapImgRestore()' onMouseOver=\"MM_swapImage('menu_07','','"+this_page_path+"images/nav/home2.gif',1)\" style='float:left; display:block;'><img src='"+this_page_path+"images/nav/home1.gif' alt='Home'  name='menu_07' id='menu_07' width='49' height='29' border='0' /></a>");
		}

		document.write ("<div style='clear:both;'></div>");
						
		document.write ("</div>");
		
		MM_preloadImages(this_page_path+"images/nav/company2a.gif");
		MM_preloadImages(this_page_path+"images/nav/services2a.gif");
		MM_preloadImages(this_page_path+"images/nav/success2a.gif");
		MM_preloadImages(this_page_path+"images/nav/testimonials2a.gif");
		MM_preloadImages(this_page_path+"images/nav/resources2a.gif");
		MM_preloadImages(this_page_path+"images/nav/contact2a.gif");
		MM_preloadImages(this_page_path+"images/nav/legal2a.gif");
		MM_preloadImages(this_page_path+"images/nav/legalB2a.gif");
		MM_preloadImages(this_page_path+"images/nav/news2a.gif");
		MM_preloadImages(this_page_path+"images/nav/home2.gif");
		
		
	
}



// display_stories_sector_list()
function display_stories_sector_list(){

		// display list in 2 columns
		var line_number=Math.ceil(stories_sectors.length/2);
		
		document.write ("<table width='' border='0' cellspacing='0' cellpadding='0'><tr>");

		// first column
		document.write ("<td width='150' valign='top'>");
		for(i=0; i<line_number; i++){
			if(this_group_id==stories_sectors[i][0]){
				if(stories_sectors[i][3]=="new"){
					document.write ("<a href='"+stories_sectors[i][2]+"' target='_blank' class='secondary_link_in'>"+stories_sectors[i][1]+"</a>");
				}else{
					document.write ("<a href='"+stories_sectors[i][2]+"' class='secondary_link_in'>"+stories_sectors[i][1]+"</a>");
				}
			}else{
				if(stories_sectors[i][3]=="new"){
					document.write ("<a href='"+stories_sectors[i][2]+"' target='_blank' class='secondary_link'>"+stories_sectors[i][1]+"</a>");
				}else{
					document.write ("<a href='"+stories_sectors[i][2]+"' class='secondary_link'>"+stories_sectors[i][1]+"</a>");
				}
			}
		}
		document.write ("</td>");

		// second column
		document.write ("<td width='160' valign='top'>");
		for(i=line_number; i<stories_sectors.length; i++){
			if(this_group_id==stories_sectors[i][0]){
				if(stories_sectors[i][3]=="new"){
					document.write ("<a href='"+stories_sectors[i][2]+"' class='secondary_link_in' target='_blank'>"+stories_sectors[i][1]+"</a>");
				}else{
					document.write ("<a href='"+stories_sectors[i][2]+"' class='secondary_link_in'>"+stories_sectors[i][1]+"</a>");
				}
			}else{
				if(stories_sectors[i][3]=="new"){
					document.write ("<a href='"+stories_sectors[i][2]+"' class='secondary_link' target='_blank'>"+stories_sectors[i][1]+"</a>");
				}else{
					document.write ("<a href='"+stories_sectors[i][2]+"' class='secondary_link'>"+stories_sectors[i][1]+"</a>");
				}
			}
		}
		document.write ("</td>");

		// third column - only "Client Testimonials"
		document.write ("<td width='110' valign='top'>");
			document.write ("<a href='"+this_page_path+"testimony1.html' class='secondary_link'>Client Testimonials</a>");
		document.write ("</td>");


		document.write ("</tr></table>");

}

// display_stories_sector_list_inline()
function display_stories_sector_list_inline(){

		document.write ("<ul class='list_dot_red'>");
		for(i=0; i<stories_sectors.length; i++){
			if(stories_sectors[i][3]=="new"){
				document.write ("<li><a href='"+stories_sectors[i][2]+"' target='_blank' class=''>"+stories_sectors[i][1]+"</a></li>");
			}else{

				document.write ("<li><a href='"+stories_sectors[i][2]+"' class=''>"+stories_sectors[i][1]+"</a></li>");
			}
		}

		document.write ("</ul>");

}

// display_stories_names()
function display_stories_names(){

		var this_stories_names=new Array();
		for(i=0; i<stories_names.length; i++) if(stories_names[i][0]==this_group_id) pushin(this_stories_names, stories_names[i]);

		// display list in 2 columns
		var line_number=Math.ceil(this_stories_names.length/2);
		
		document.write ("<table width='' border='0' cellspacing='0' cellpadding='0'><tr>");

		// first column
		document.write ("<td width='170' valign='top'>");
		for(i=0; i<line_number; i++){
			if(this_member_id==this_stories_names[i][1]){
				document.write ("<div class='secondary_link_in'>"+this_stories_names[i][2]+"</div>");
			}else{
				if(this_stories_names[i][4]=="new"){
					document.write ("<a href='"+this_stories_names[i][3]+"' class='secondary_link' target='_blank'>"+this_stories_names[i][2]+"</a>");
				}else{
					document.write ("<a href='"+this_stories_names[i][3]+"' class='secondary_link'>"+this_stories_names[i][2]+"</a>");
				}
			}
		}
		document.write ("</td>");

		// second column
		document.write ("<td width='250' valign='top'>");
		for(i=line_number; i<this_stories_names.length; i++){
			if(this_member_id==this_stories_names[i][1]){
				document.write ("<div class='secondary_link_in'>"+this_stories_names[i][2]+"</div>");
			}else{
				if(this_stories_names[i][4]=="new"){
					document.write ("<a href='"+this_stories_names[i][3]+"' class='secondary_link' target='_blank'>"+this_stories_names[i][2]+"</a>");
				}else{
					document.write ("<a href='"+this_stories_names[i][3]+"' class='secondary_link'>"+this_stories_names[i][2]+"</a>");
				}
			}
		}
		document.write ("</td>");

		document.write ("</tr></table>");

	
}


// display_story_images()
function display_story_images(){
	
		document.write ("<div class='big_image_area'>");
			document.write ("<img src='"+this_page_path+story_images_path+story_images[0][0]+"' name='mainpic' id='mainpic' width='289' height='289' alt='Branding by NextPhase Strategy' />");
		document.write ("</div>");
		
		document.write ("<div class='thumbnail_area'>");
		var i, ii=0;
  		for(i=0; i<story_images.length; i++){
			
			if(story_images[i][1]=="") story_images[i][1]=story_images[i][0].split(".",2)[0]+"T."+story_images[i][0].split(".",2)[1];
			
			document.write ("<a href='' onMouseOver=\"image_rotator_status='paused';display_one_image("+i+")\" onMouseOut=\"image_rotator_status='playing';\" onClick='return false;' class='thumbnail' id='thumbnail_"+i+"'><img src='"+this_page_path+story_images_path+story_images[i][1]+"' width='30' height='30' border='0' alt='Branding by NextPhase Strategy' /></a>");
			ii++;
			if(ii==Story_Thumbnail_Count_Per_Line){
				ii=0;
				document.write ("<div style='clear:both;'></div>");
				document.write ("</div>");
				document.write ("<div class='thumbnail_area'>");
			}
			
			MM_preloadImages(this_page_path+story_images_path+story_images[i][0]);
		}
		document.write ("</div>");
		
		start_image_rotate();
		
}

var image_rotator_status="playing";
var image_rotator_timeout;
var image_rotator_interval=8000;
var image_rotator_num=0;

// display_one_image()
function display_one_image(this_num){
	getobjbyId("mainpic").src=this_page_path+story_images_path+story_images[this_num][0];
	for(var i=0; i<story_images.length; i++) getobjbyId("thumbnail_"+i).className='thumbnail';
	getobjbyId("thumbnail_"+this_num).className='thumbnail_in';
	image_rotator_num=this_num+1;
}

function start_image_rotate(){
	if(image_rotator_status=="playing"){
		if(image_rotator_num>=story_images.length) image_rotator_num=0;
		display_one_image(image_rotator_num);
	}
	// uncomment below starts rotating
	setTimeout(start_image_rotate, image_rotator_interval);
};


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 MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  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);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,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];}
}



// ========================================================================================================================
//v1.0
//Copyright 2006 Adobe Systems, Inc. All rights reserved.
function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
  var str = '<object ';
  for (var i in objAttrs)
    str += i + '="' + objAttrs[i] + '" ';
  str += '>';
  for (var i in params)
    str += '<param name="' + i + '" value="' + params[i] + '" /> ';
  str += '<embed ';
  for (var i in embedAttrs)
    str += i + '="' + embedAttrs[i] + '" ';
  str += ' ></embed></object>';

  document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "id":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}


function pushin(the_array, the_data){var len_array=the_array.length;the_array[len_array]=the_data;return the_array.length;}
function getobjbyId(id){var ns4 = (document.layers)?true:false;var ns6 = (document.getElementById)?true:false;var ie4 = (document.all)?true:false;if (ns4){return document.layers[id];}else if(ie4){return document.all[id];}else{return document.getElementById(id);}}


function openwindow(theURL,winName,features){  
  window.open(theURL,winName,features);
}
