﻿
	
		var doInitialize = false;
	
	//-------------------------------------------------------------------------
	//-------------------------------------------------------------------------
	
		var SWFAddressExists = true;
		
	
		
	//-------------------------------------------------------------------------
		
		function navigate( address, isSWFAddress )
		{
			//alert("navigate()");
			if( isSWFAddress != null )
			{
				SWFAddressExists = isSWFAddress;
			}
			else
			{
			}
			
			var url = "/?file=" + address + "index.xml";

			var loc =  document.location.href;

			if( loc.substr(  loc.length - url.length, url.length ) != url )
			{
				document.location = url;
				doInitialize = true;
			}
		}
	
	//-------------------------------------------------------------------------
	
		var prevURL = "test";
		document.prevURL = prevURL;
	
		function navigateTo( alt1, isSWFAddress)
		{
			/*
			SWFAddressExists = isSWFAddress;
			if( !alt1 )
				return;
				
			if( alt1 != "test" )
			{
				return;
			}
			
			
			alt1 = alt1.replace("index.xml", "" ).replace("index.xml", "" );
			
			alt1 = alt1.replace( "//", "/" );
			
						
			setCnsPageKey( alt1 + "index.xml" );
			
			var xmlHttp = GetXmlHttpObject();
			if( ( xmlHttp == null ) || !isSWFAddress )
			{
				alt1 = alt1.replace("index.xml", "" ).replace("index.xml", "" );
				
				var url = "/?file=" + alt1 + "index.xml";

				var loc =  document.location.href;

				if( loc.substr(  loc.length - url.length, url.length ) != url )
				{
					//var url = "/?file=" + alt1;
					navigate( alt1 + "index.xml" );
					location.href =  url;
				}
				
				return;
			} 
			SWFAddressExists = true;
			var plus = alt1;
			
			xmlHttp.onreadystatechange=function()
			{
				if(xmlHttp.readyState==4)
				{
					var content = document.getElementById( "content" );
					content.innerHTML = xmlHttp.responseText;
				
					//	document.location.href = document.location.href;
					doInitialize = true;
						initializeFrame();
//						}
				}
			}
			
			alt1 = alt1.replace("index.xml", "" );
			
			if( alt1 == "sitemap/" )
			{
				var url = "inc/getPage.php?page=" + alt1 + "";
			}
			else
			{
				var url = "inc/getPage.php?page=" + alt1 + "index.xml";
			}
			var content = document.getElementById( "content" );
			
			prevURL = alt1;
			

			xmlHttp.open( "GET", url, true );
			xmlHttp.send( null );
			*/
		}
		
	/*
		function navigateTo( path )
		{
			setCnsPageKey( path );
			var content = document.getElementById( "content" );
			
			if( content.src != path )
				content.src = path;
		}
		*/
	
	
	//-------------------------------------------------------------------------
		function setSWFSize( id, width, height )
		{
		/*
			var swf123 = document.getElementById( id );
	//alert("swf = " + swf);
		
			if( swf123 )
			{
				swf123.style.width = swf123.width = width;
				swf123.style.height = swf123.height = height;
			}
			*/
		}
	
	
	//-------------------------------------------------------------------------
		function decode( string )
		{
			var result;
			var parts;
			
			parts = string.split( "%" );
			result = parts[ 0 ];
			
			for( var i = 1; i < parts.length; i++ )
			{
				var part_i = parts[ i ];
			
				var charCodeString = part_i.substr( 0, 2 );
				var charCode = parseInt( charCodeString, 16 );
				var char = String.fromCharCode( charCode );
				var rest = part_i.substr( 2, part_i.length );
				result += char + rest;
			}
			
			parts = result.split( "+" );
			result = parts[ 0 ];
			
			for( var i = 1; i < parts.length; i++ )
			{
				result += " " + parts[ i ];
			}
			
			return result;
		}
		/*
	//-------------------------------------------------------------------------
		function writeHeader( destination, text )
		{
			if( destination.style.display == "block" )
			{
				destination.style.display = "block";
				return;
			}
			
			destination.style.display = "block";
			var now = new Date();
			var id = now.getTime() + "" + Math.round(Math.random()*3000) + destination.id;
			//alert( "id = " + id + ", text = " + text);
			//var swfObject = new SWFObject( "/Sifer.swf", id, "20px", "20px", "7", "#000000" );
			
			var color = "0x000000";
			var fontSize = "12";
			
			if( destination.tagName == "H2" )
				fontSize = "30";
			
			if( destination.style.color )
			{
				var colorstring = destination.style.color;
				
				var colors;
				
				
				if( colorstring.lastIndexOf( "rgb" ) != -1 )
				{
				
					colorstring = colorstring.replace( "rgb(", "" );
					colorstring = colorstring.replace( ")", "" );
					
					colors = colorstring.split( ", " );
					
					var r = colors[ 0 ];
					var g = colors[ 1 ];
					var b = colors[ 2 ];
					color = (r<<16) + (g<<8) + ((b<<8)>>8);
				}
				else
				{
					color = colorstring.replace( "#", "0x" );
					
				}
				
			//	alert( "color = "+color);
	//			color += b;
				
			}
			
			
			if( destination.style.fontSize )
			{
				fontSize = destination.style.fontSize;
				fontSize = fontSize.replace( "px", "" );
//				alert( "fontSize = \""+fontSize+"\"");
			}
			
			destination.style.display = "block";
			
			destination.style.paddingTop = "0px";
			destination.id = id;
			
			var flashvars = "Id="+id+"&Sifer="+decode(text)+"&color="+color+"&fontSize="+fontSize;
			
			Sifr( destination, id, flashvars );
			
			
//			alert( "\"" + flashvars + "\"" );
		
		}
		
		
	//-------------------------------------------------------------------------
		
		var arr;
		var arr2;
		
		arr = new Array();
		
		var arrt = document.getElementsByTagName("h1");
		arr2 = document.getElementsByTagName("h2");
		
		var time = (new Date()).getTime();
		var timer_id;
	//-------------------------------------------------------------------------
		function fixHeaders( i, len )
		{		
			clearInterval( timer_id );
			var tag = arr[ i ];
			if( tag && tag.innerHTML )
			{
				var txt = tag.innerHTML;
				tag.id = time + "" + i;
				writeHeader( tag, txt );
			}
			i++;
			if( i < len )
			{
				timer_id = setInterval( 'fixHeaders( ' + i + ', ' + len + ' )', 1 );	
			}
			else
			{
				//resizeIframe('content');
			}
		}
		
		*/
	//-------------------------------------------------------------------------
		function doesAjaxExist()
		{
			var xmlHttp = GetXmlHttpObject();
			if (xmlHttp==null)
			{	
				return false;
			} 
			return true;
		}
		
	//-------------------------------------------------------------------------
		function initializeFrame()
		{
			/*
			if( doInitialize != true )
				return
			
			doInitialize = false;
		//	var content = document.getElementById( 'content' );
			while( arr.length > 0 )
			{
				arr.pop();
			}
		
			arrt = document.getElementsByTagName("h1");
			for( var i = 0; i < arrt.length; i++ )
			{
				arr.push ( arrt[ i ] );
				arrt[ i ].style.display = "none";
			}
			arr2 = document.getElementsByTagName("h2");
			
			//alert( "arr2 = " + arr2 );
			
			for( var i = 0; i < arr2.length; i++ )
			{	
				arr.push ( arr2[ i ] );
				arr2[ i ].style.display = "none";
			}
			
			
			timer_id = setInterval( 'fixHeaders(0, ' + arr.length + ' )', 1 );	
			
			if( arr.length <= 0 )
			{
				
				// resizeIframe('content');
			}
			*/
			
			
			/*
			while( arr.length > 0 )
			{
				arr.pop();
			}
		
			arr = document.getElementsByTagName("object");
			
			
			for( var i = 0; i < arr.length; i++ )
			{
				arr[ i ].outerHTML = arr[ i ].outerHTML;
			}
			
			for (var i = 0; i < document.images.length; i++) 
			{
				if (!IsImageOk(document.images[i])) 
				{
					var img = document.images[i];
					
					setTimeout( "fixImagestrsdf("+i+")", 30*(i+1) );
					var src = img.src;
					img.src = "";
					img.src = src;
				}
			}
			*/
		}