//var site_root = "http://localhost/orlandodesign/site/";
var site_root = "http://www.orlandodesign.ca/";

var HiddenLinksDiv = "NavCreativeLinks";
var NavLinksDiv = "NavLinks";
var BeginPx = 99;
var CurrentPx = BeginPx;
var EndPx = 333;
var TimerID = null;
var TransitionStarted = false;
var TransitionComplete = false;


function GetContent( FilePath_1, FilePath_2, ImageDir, ImageName, ImageFile )
{
	var FullUrl_1 = site_root + FilePath_1;
	var http = new HttpObject( FullUrl_1, "DetailsContent" );
	http.Get();
	
	var FullUrl_2 = site_root + FilePath_2;
	var http2 = new HttpObject2( FullUrl_2, "ThumbsContent" );
	http2.Get();
	
	RollOn( ImageDir, ImageName, ImageFile ); 
	return false;
	
} // GetContent

function ChangeContent( FilePath, DivName )
{
	var FullUrl = site_root + FilePath;
	
	var http = new HttpObject( FullUrl, DivName );
	http.Get();
	
	return false;
	
} // ChangeContent


function ShiftNavLinks()
{	
	if ( !TransitionStarted || TransitionComplete )
	{
		if ( IsVisible( HiddenLinksDiv ) )
		{
			TransitionStarted = true;
			TransitionComplete = false;
			TimerID = setInterval( 'BackwardLinks()', 10 );
		}
		else
		{
			TransitionStarted = true;
			TransitionComplete = false;
			TimerID = setInterval( 'ForwardLinks()', 10 );
			showHideLayer( HiddenLinksDiv );

		} // visible or not?
	} // only move links if they are not already moving
	
	return false;
} // ShiftNavLinks


function ExposeCreativeLinks()
{
	MoveLayer( NavLinksDiv, EndPx, 0 );
	showHideLayer( HiddenLinksDiv );
	TransitionComplete = true;

} // ExposeCreativeLinks


function ForwardLinks()
{

	if ( CurrentPx <= EndPx )
	{
		MoveLayer( NavLinksDiv, CurrentPx, 0 );
		CurrentPx += 3;
	}
	else
	{
		MoveLayer( NavLinksDiv, EndPx, 0 );
		clearInterval( TimerID );
		TransitionComplete = true;
	}

} // ForwardLinks


function BackwardLinks()
{

	if ( CurrentPx >= BeginPx )
	{
		MoveLayer( NavLinksDiv, CurrentPx, 0 );
		CurrentPx -= 7;
	}
	else
	{
		MoveLayer( NavLinksDiv, BeginPx, 0 );
		clearInterval( TimerID );
		showHideLayer( HiddenLinksDiv );
		TransitionComplete = true;
	}

} // ForwardLinks


function MoveLayer( strLayerName, xCoord, yCoord )
{
   if ( document.all ) 
   {
      // We have IE4+
      var theLayer = eval( "document.all." + strLayerName + ".style" );     
      theLayer.pixelLeft = xCoord;
      theLayer.pixelTop = yCoord;

   } 
   else if ( document.layers ) 
   {
      // We have Netscape 4.x
      var theLayer = eval( "document." + strLayerName );
      theLayer.left = xCoord;
      theLayer.top = yCoord;   
   } 
   else if ( !document.all && document.getElementById ) 
   {
      // We have Mozilla or Netscape 6.x
      var theLayer = document.getElementById( strLayerName ).style;    
      theLayer.left = xCoord + "px";
      theLayer.top = yCoord + "px";    
   }     
}

function IsVisible( strLayerName )
{
   var LayerVisible = false;
   
   if ( document.all ) 
   {
      // We have IE4+
      var theLayer = eval( "document.all." + strLayerName + ".style" );     
      LayerVisible = ( theLayer.visibility == "visible" ) ? true : false;     
      
   } 
   else if ( document.layers ) 
   {
      // We have Netscape 4.x
      var theLayer = eval( "document." + strLayerName );
      LayerVisible = ( theLayer.visibility == "show" ) ? true : false;     
   
   } 
   else if ( !document.all && document.getElementById ) 
   {
      // We have Mozilla or Netscape 6.x
      var theLayer = document.getElementById( strLayerName ).style;    
      LayerVisible = ( theLayer.visibility == "visible" ) ? true : false;     
   }  
   
   return LayerVisible;
}

function showHideLayer( strLayerName )
{
   var strAction = "";

   if ( document.all ) 
   {
      // We have IE4+
      var theLayer = eval( "document.all." + strLayerName + ".style" );     
      strAction = ( theLayer.visibility == "hidden" || theLayer.visibility == "" ) ? "visible" : "hidden";    
      theLayer.visibility = strAction;
      
   } 
   else if ( document.layers ) 
   {
      // We have Netscape 4.x
      var theLayer = eval( "document." + strLayerName );
      strAction = ( theLayer.visibility == "hide" || theLayer.visibility == "" ) ? "show" : "hide";
      theLayer.visibility = strAction;
   
   } 
   else if ( !document.all && document.getElementById ) 
   {
      // We have Mozilla or Netscape 6.x
      var theLayer = document.getElementById( strLayerName ).style;    
      strAction = ( theLayer.visibility == "hidden" || theLayer.visibility == "" ) ? "visible" : "hidden";
      
      theLayer.visibility = strAction;
   }
   
} // showHideLayer


function RollOn( ImageDir, ImageName, Pic )
{
	if ( document.images )
	{
		document.images[ImageName].src = ImageDir + Pic;
	} // knows about images

} // RollOn


function PrintNavigation()
{

	document.write( "<div id=\"NavLogo\"><a href=\"" + site_root + "index.php\"><img src=\"" + site_root + "images/navO.gif\" width=\"18\" height=\"20\" border=\"0\" alt=\"\" /></a></div>" );

	document.write( "<div id=\"NavCreative\"><a href=\"#\" onclick=\"return ShiftNavLinks();\" class=\"nav_cool\" style=\"padding-right: 0px;\" id=\"creative\">creative</a></div>" );

	document.write( "<div id=\"NavCreativeLinks\">:<a href=\"" + site_root + "display/display.html\" class=\"nav_warm\" style=\"padding-left: 3px;\" id=\"display_link\">display</a>  <a href=\"" + site_root + "identity/identity.html\" class=\"nav_warm\" id=\"identity\">identity</a>  <a href=\"" + site_root + "illustration/index.html\" class=\"nav_warm\" id=\"illustration\">illustration</a>  <a href=\"" + site_root + "print/print.html\" class=\"nav_warm\" id=\"print\">print</a>  <a href=\"" + site_root + "screen/screen.html\" class=\"nav_warm\" style=\"padding-right: 3px;\" id=\"screen\">screen</a>:</div>" );

	document.write( "<div id=\"NavLinks\"><a href=\"" + site_root + "about/about.html\" class=\"nav_cool\" id=\"about\">about</a>  <a href=\"" + site_root + "reveal/reveal.html\" class=\"nav_cool\" id=\"reveal\">reveal</a>  <a href=\"" + site_root + "play/play.html\" class=\"nav_cool\" id=\"play\">play</a>  <a href=\"" + site_root + "everyone/index.html\" class=\"nav_cool\" id=\"everyone\">everyone</a></div>" );

	ModifyNavLinks();
} // PrintNavigation


function ModifyNavLinks()
{

	var link;
	var linkID = "";
	var doc = location.href;
	
	if ( doc.indexOf( "creative" ) != -1 )
	{
		linkID = "creative";
	}
	else if ( doc.indexOf( "illustration" ) != -1 )
	{
		linkID = "illustration";
		ExposeCreativeLinks();
	}
	else if ( doc.indexOf( "identity" ) != -1 )
	{
		linkID = "identity";
		ExposeCreativeLinks();
	}
	else if ( doc.indexOf( "print" ) != -1 )
	{
		linkID = "print";
		ExposeCreativeLinks();
	}
	else if ( doc.indexOf( "display" ) != -1 )
	{
		linkID = "display_link";
		ExposeCreativeLinks();
	}	
	else if ( doc.indexOf( "screen" ) != -1 )
	{
		linkID = "screen";
		ExposeCreativeLinks();
	}
	else if ( doc.indexOf( "about" ) != -1 )
	{
		linkID = "about";
	}	
	else if ( doc.indexOf( "reveal" ) != -1 )
	{
		linkID = "reveal";
	}	
	else if ( doc.indexOf( "play" ) != -1 )
	{
		linkID = "play";
	}
	else if ( doc.indexOf( "everyone" ) != -1 )
	{
		linkID = "everyone";
	
	} // determine which link is hilighted		

	if ( linkID != "" )
	{
		if ( document.all ) 
		{
			link = eval("document.all." + linkID + ".style");
			link.color = "#990000";

		} 
		else if ( !document.all && document.getElementById ) 
		{
			link = document.getElementById(linkID).style;
			link.color = "#990000";
		}
	} // have link ID

} // ModifyNavLinks







var NUM_IMAGES = 8;

function getImage( pageType )
{
   var image_arr = new Array( NUM_IMAGES );

   if ( pageType == "home" )
   {
      image_arr[0] = "index_cycle/Navpic1.jpg";
      image_arr[1] = "index_cycle/Navpic1a.jpg";
      image_arr[2] = "index_cycle/Navpic1b.jpg";
      image_arr[3] = "index_cycle/Navpic1c.jpg";
      image_arr[4] = "index_cycle/Navpic1d.jpg";
	  image_arr[5] = "index_cycle/Navpic1e.jpg";
	  image_arr[6] = "index_cycle/Navpic1f.jpg";
	  image_arr[7] = "index_cycle/Navpic1g.jpg";	  
   }
   else if ( pageType == "sub" )
   {
      image_arr[0] = "index_cycle/sample_03.jpg";
      image_arr[1] = "index_cycle/sample_03a.jpg";
      image_arr[2] = "index_cycle/sample_03b.jpg";
      image_arr[3] = "index_cycle/sample_03c.jpg";
      image_arr[4] = "index_cycle/sample_03d.jpg";   
	  image_arr[5] = "index_cycle/sample_03e.jpg";   
	  image_arr[6] = "index_cycle/sample_03f.jpg"; 
	  image_arr[7] = "index_cycle/sample_03g.jpg"; 
	}
   
   var index = Math.floor( Math.random() * NUM_IMAGES );
   index = index % NUM_IMAGES;

   return image_arr[index];
}

function printRandImage( pageType, width, height )
{
   document.write( "<img src=\"" + getImage( pageType ) + "\" width=\"" + width + "\" " );
   document.write( "height=\"" + height + "\" border=\"0\" alt=\"creative for everyone\"" );
   document.write( "/>" );
}


// Changes the image reference of the image being moused over
// Accepts the name of the image (specified in the image tag)
// as it's only parameter.
// Use in conjunction with rollOff function to create a rollover effect